richlagetest
Advanced tools
Comparing version 0.0.0-6b25a0cea70025c54da987b98fd875b7437dd662 to 0.0.0-78671d73a2fed1cdad482b0f9e0934f36a513cd5
@@ -1,2 +0,2 @@ | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var _extends=require("@babel/runtime/helpers/extends"),_objectWithoutPropertiesLoose=require("@babel/runtime/helpers/objectWithoutPropertiesLoose"),React=require("react"),lodash=require("lodash"),_inheritsLoose=require("@babel/runtime/helpers/inheritsLoose"),wixRichContentCommon=require("wix-rich-content-common"),ReactDOM=require("react-dom"),Measure=require("react-measure"),wixRichContentViewer=require("wix-rich-content-viewer");function _interopDefaultLegacy(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var _extends__default=_interopDefaultLegacy(_extends),_objectWithoutPropertiesLoose__default=_interopDefaultLegacy(_objectWithoutPropertiesLoose),React__default=_interopDefaultLegacy(React),_inheritsLoose__default=_interopDefaultLegacy(_inheritsLoose),ReactDOM__default=_interopDefaultLegacy(ReactDOM),Measure__default=_interopDefaultLegacy(Measure),METHOD_BLOCK_MAP=Object.freeze({h1:"header-one",h2:"header-two",h3:"header-three",h4:"header-four",h5:"header-five",h6:"header-six",quote:"blockquote"}),METHOD_GROUPED_BLOCK_MAP=Object.freeze({plain:"unstyled",code:"code-block",ol:"ordered-list-item",ul:"unordered-list-item"}),METHOD_PLUGIN_DATA_MAP=Object.freeze({image:{type:"wix-draft-plugin-image",mutability:"IMMUTABLE",data:{config:{alignment:"center",size:"content",showTitle:!1,showDescription:!1}}},video:{type:"wix-draft-plugin-video",mutability:"IMMUTABLE",data:{config:{size:"content",alignment:"center"}}},gallery:{type:"wix-draft-plugin-gallery",mutability:"IMMUTABLE",data:{config:{alignment:"center",size:"content",layout:"small",spacing:0},styles:{galleryLayout:2,gallerySizeType:"px",gallerySizePx:300,galleryMargin:0,oneRow:!1,cubeRatio:1,galleryThumbnailsAlignment:"bottom",isVertical:!0,numberOfImagesPerRow:3,imageMargin:20,thumbnailSpacings:0,cubeType:"fill",enableInfiniteScroll:!0,titlePlacement:"SHOW_ON_HOVER",allowHover:!1,itemClick:"link",fullscreen:!1,showArrows:!1,gridStyle:1,loveButton:!1,allowSocial:!1,allowDownload:!1,mobileSwipeAnimation:"NO_EFFECT",thumbnailSize:120,gotStyleParams:!0,cubeImages:!0,groupSize:1,groupTypes:"1",hasThumbnails:!1,enableScroll:!0,isGrid:!0,isSlider:!1,isColumns:!1,isSlideshow:!1,cropOnlyFill:!1,smartCrop:!1,imageResize:!1,galleryImageRatio:2,galleryType:"Columns",minItemSize:50,videoPlay:"auto"}}},soundCloud:{type:"wix-draft-plugin-sound-cloud",mutability:"IMMUTABLE",data:{config:{size:"content",alignment:"center"}}},giphy:{type:"wix-draft-plugin-giphy",mutability:"IMMUTABLE",data:{config:{size:"content",alignment:"center"}}},map:{type:"wix-draft-plugin-map",mutability:"IMMUTABLE",data:{config:{size:"content",alignment:"center",width:400,height:400}}},file:{type:"wix-draft-plugin-file-upload",mutability:"IMMUTABLE",data:{config:{alignment:"left",size:"small"}}},divider:{type:"wix-draft-plugin-divider",mutability:"IMMUTABLE",data:{type:"single",config:{size:"large",alignment:"center",textWrap:"nowrap"}}},link:{type:"LINK",mutability:"IMMUTABLE",data:{config:{}}},linkPreview:{type:"wix-draft-plugin-link-preview",mutability:"IMMUTABLE",data:{config:{size:"content",alignment:"center"}}}}),INTERACTIONS=Object.freeze({READ_MORE:"READ_MORE",IMAGE_COUNTER:"IMAGE_COUNTER",SEE_FULL_CONTENT:"SEE_FULL_CONTENT"}),getPoster=function(item){var _item$url$thumbnail,_item$thumbnail,_item$url$thumbnail2,_item$thumbnail2,_item$url$thumbnail3,_item$thumbnail3;return{url:(null===(_item$url$thumbnail=item.url.thumbnail)||void 0===_item$url$thumbnail?void 0:_item$url$thumbnail.pathname)||(null===(_item$thumbnail=item.thumbnail)||void 0===_item$thumbnail?void 0:_item$thumbnail.pathname)||item.thumbnail_url||item.thumbnail,width:(null===(_item$url$thumbnail2=item.url.thumbnail)||void 0===_item$url$thumbnail2?void 0:_item$url$thumbnail2.width)||(null===(_item$thumbnail2=item.thumbnail)||void 0===_item$thumbnail2?void 0:_item$thumbnail2.width)||item.thumbnail_width||item.width,height:(null===(_item$url$thumbnail3=item.url.thumbnail)||void 0===_item$url$thumbnail3?void 0:_item$url$thumbnail3.height)||(null===(_item$thumbnail3=item.thumbnail)||void 0===_item$thumbnail3?void 0:_item$thumbnail3.height)||item.thumbnail_height||item.height}},galleryTypeConverters={giphy:function(item){var _item$width=item.width,width=void 0===_item$width?600:_item$width,_item$height=item.height,height=void 0===_item$height?480:_item$height;return{mediaUrl:item.mp4,metadata:{type:"video",videoUrl:item.mp4,videoId:item.url,poster:{url:item.url,width:width,height:height},source:"giphy",width:width,height:height}}},video:function(item){var _item$url,isCustom=item.isCustom,_ref=isCustom?item.url:item,_ref$width=_ref.width,width=void 0===_ref$width?600:_ref$width,_ref$height=_ref.height,height=void 0===_ref$height?480:_ref$height,url=isCustom?null===(_item$url=item.url)||void 0===_item$url?void 0:_item$url.pathname:item.url;return{url:url,mediaUrl:url,metadata:{type:"video",poster:getPoster(item),videoId:url,width:width,height:height}}},image:function(item){return{itemId:item.id||item.url,metadata:{width:item.width,height:item.height}}}},toGalleryItems=function(items){return items.map((function(item,index){return _extends__default.default({itemId:item.id||"item-"+index,url:item.url},galleryTypeConverters[item.type](item))}))},defaultMerger=function(mediaInfo,entity){return _extends__default.default({},entity,{data:_extends__default.default({},entity.data,mediaInfo)})},videoMerger=function(_ref2,entity){var url=_ref2.url,isCustom=_ref2.isCustom;return _extends__default.default({},entity,{data:_extends__default.default({},entity.data,{src:url,isCustomVideo:!!isCustom})})},mergers={"wix-draft-plugin-image":function(_ref,entity){var url=_ref.url,width=_ref.width,height=_ref.height,_ref$alt=_ref.alt,alt=void 0===_ref$alt?"":_ref$alt,_ref$caption=_ref.caption,caption=void 0===_ref$caption?"":_ref$caption,link=_ref.link,_ref$source=_ref.source,source=void 0===_ref$source?null:_ref$source;return _extends__default.default({},entity,{data:_extends__default.default({},entity.data,{config:_extends__default.default({},entity.data.config,link?{link:link}:{}),metadata:{alt:alt,caption:caption},src:_extends__default.default({width:width,height:height},"static"===source?{url:url,source:source}:{file_name:url})})})},"wix-draft-plugin-gallery":function(items,entity){return _extends__default.default({},entity,{data:_extends__default.default({},entity.data,{items:toGalleryItems(items)})})},"wix-draft-plugin-giphy":function(_ref3,entity){var width=_ref3.width,height=_ref3.height,url=_ref3.url,thumbnail=_ref3.thumbnail;return _extends__default.default({},entity,{data:_extends__default.default({},entity.data,{gif:{width:width,height:height,originalUrl:url,stillUrl:thumbnail}})})},"wix-draft-plugin-video":videoMerger,"wix-draft-plugin-sound-cloud":videoMerger,"wix-draft-plugin-file-upload":function(_ref4,entity){var fileType=_ref4.fileType,name=_ref4.name,url=_ref4.url;return _extends__default.default({},entity,{data:_extends__default.default({},entity.data,{type:fileType,name:name,url:url})})},"wix-draft-plugin-map":function(mapSettings,entity){return _extends__default.default({},entity,{data:_extends__default.default({},entity.data,{mapSettings:mapSettings})})},"wix-draft-plugin-divider":defaultMerger,mention:defaultMerger,LINK:defaultMerger,"wix-draft-plugin-link-preview":function(_ref5,entity){var url=_ref5.url;return _extends__default.default({},entity,{data:_extends__default.default({},entity.data,{config:_extends__default.default({},entity.data.config,{link:_extends__default.default({},entity.data.config.link,{url:url})})})})},"wix-draft-plugin-headers-markdown":defaultMerger,"wix-draft-plugin-link-button":defaultMerger,"wix-draft-plugin-action-button":defaultMerger,"wix-draft-plugin-poll":defaultMerger,"wix-draft-plugin-html":defaultMerger},DEFAULT_BLOCK_CONFIG={data:{},inlineStyleRanges:[],entityRanges:[],depth:0},createBlock=function(type,text,config){return _extends__default.default({key:Math.random().toString(36).substr(2,5),type:type,text:text},_extends__default.default({},DEFAULT_BLOCK_CONFIG,config||{}))},addPlugin=function(_ref3){var contentState=_ref3.contentState,data=_ref3.data,config=_ref3.config;return function(_ref2){var _extends2,mediaInfo,entity,contentState=_ref2.contentState,data=_ref2.data,config=_ref2.config,mergedEntity=(mediaInfo=data,mergers[(entity=config).type](mediaInfo,entity));return _extends__default.default({},contentState,{entityMap:_extends__default.default({},contentState.entityMap,(_extends2={},_extends2[Object.keys(contentState.entityMap).length]=mergedEntity,_extends2))})}({contentState:function(_ref){var contentState=_ref.contentState,text=_ref.text,type=_ref.type,config=_ref.config;return _extends__default.default({},contentState,{blocks:[].concat(contentState.blocks,[createBlock(type,text,config)])})}({contentState:contentState,text:" ",type:"atomic",config:{entityRanges:[{offset:0,length:1,key:Object.keys(contentState.entityMap).length}]}}),data:data,config:config})},interactionDataMerger=function(_ref){var contentState=_ref.contentState,_ref$settings=_ref.settings,settings=void 0===_ref$settings?{}:_ref$settings,_ref$blockFilter=_ref.blockFilter,blockFilter=void 0===_ref$blockFilter?function(){}:_ref$blockFilter,type=_ref.type,_ref$schema=_ref.schema,schema=void 0===_ref$schema?[]:_ref$schema;if(!contentState.blocks||0===contentState.blocks.length)return contentState;var lastBlock=contentState.blocks.slice(-1)[0];if(blockFilter(lastBlock))return contentState;var invalidSettings=Object.keys(settings).filter((function(key){return!schema.includes(key)}));if(invalidSettings.length>0&&console.error("Warning: invalid "+type+" interaction settings found",invalidSettings),"atomic"!==lastBlock.type){var _lastBlock$data,modifiedBlock=_extends__default.default({},lastBlock,{data:_extends__default.default({},lastBlock.data,{interactions:[].concat((null==lastBlock||null===(_lastBlock$data=lastBlock.data)||void 0===_lastBlock$data?void 0:_lastBlock$data.interactions)||[],[{type:type,settings:settings}])})});return _extends__default.default({},contentState,{blocks:[].concat(contentState.blocks.slice(0,contentState.blocks.length-1),[modifiedBlock])})}var lastBlockEntityKey=lastBlock.entityRanges.length>0&&lastBlock.entityRanges[0].key;if(!1!==lastBlockEntityKey){var _extends2,lastBlockEntity=contentState.entityMap[lastBlockEntityKey],modifiedEntity=_extends__default.default({},lastBlockEntity,{data:_extends__default.default({},lastBlockEntity&&lastBlockEntity.data,{interactions:[].concat(lastBlockEntity&&lastBlockEntity.data.interactions||[],[{type:type,settings:settings}])})});return _extends__default.default({},contentState,{entityMap:_extends__default.default({},contentState.entityMap,(_extends2={},_extends2[lastBlockEntityKey]=modifiedEntity,_extends2))})}return contentState},DEFAULT_STATE={blocks:[],entityMap:{},VERSION:"8.63.6"},ContentStateBuilder=function(){function ContentStateBuilder(initialState){this.contentState=_extends__default.default({},DEFAULT_STATE,initialState||{})}return ContentStateBuilder.prototype.get=function(){return this.contentState},ContentStateBuilder}();Object.keys(_extends__default.default({},METHOD_BLOCK_MAP,METHOD_GROUPED_BLOCK_MAP)).forEach((function(method){ContentStateBuilder.prototype[method]=function(textBlocksWithEntities){var content,textContentArray=lodash.isArray(content=textBlocksWithEntities)?content:[content];return this.contentState=textContentArray.reduce((function(state,_ref){return _ref4={contentState:state,block:_ref.block,entities:_ref.entities},contentState=_ref4.contentState,block=_ref4.block,entities=_ref4.entities,_extends__default.default({},contentState,{blocks:[].concat(contentState.blocks,[block]),entityMap:_extends__default.default({},contentState.entityMap,entities)});var _ref4,contentState,block,entities}),this.contentState),this}})),Object.entries(METHOD_PLUGIN_DATA_MAP).forEach((function(_ref2){var method=_ref2[0],defaultEntityData=_ref2[1];ContentStateBuilder.prototype[method]=function(_ref3){var mediaInfo=_ref3.mediaInfo,_ref3$config=_ref3.config,config=void 0===_ref3$config?{}:_ref3$config,_ref3$overrides=_ref3.overrides,overrides=void 0===_ref3$overrides?{}:_ref3$overrides;return this.contentState=addPlugin({contentState:this.contentState,data:mediaInfo,config:_extends__default.default({},defaultEntityData,{data:_extends__default.default({},defaultEntityData.data,{config:_extends__default.default({},defaultEntityData.data.config,config)},overrides)})}),this}})),Object.entries({readMore:function(builder,settings){return void 0===settings&&(settings={}),builder.contentState=interactionDataMerger({contentState:builder.contentState,settings:settings,blockFilter:function(block){return"atomic"===block.type},type:INTERACTIONS.READ_MORE,schema:["label","onClick","expandMode","lines","text","showToggle"]}),builder},seeFullPost:function(builder,settings){return void 0===settings&&(settings={}),builder.contentState=interactionDataMerger({contentState:builder.contentState,settings:settings,blockFilter:function(){return!1},type:INTERACTIONS.SEE_FULL_CONTENT,schema:["label","labelStyles","overlayStyles","onClick"]}),builder},imageCounter:function(builder,settings){return void 0===settings&&(settings={}),builder.contentState=interactionDataMerger({contentState:builder.contentState,settings:settings,blockFilter:function(block){return"atomic"!==block.type},type:INTERACTIONS.IMAGE_COUNTER,schema:["counter","formatLabel","onClick","style"]}),builder}}).forEach((function(_ref4){var key=_ref4[0],method=_ref4[1];ContentStateBuilder.prototype[key]=function(settings){return method(this,settings)}}));var defaultEntityConverter=function(){return[]},videoConverter=function(_ref3){var _src$thumbnail,_ref3$data=_ref3.data,_ref3$data$src=_ref3$data.src,src=void 0===_ref3$data$src?{}:_ref3$data$src,isCustomVideo=_ref3$data.isCustomVideo,_ref3$data$metadata=_ref3$data.metadata,metadata=void 0===_ref3$data$metadata?{}:_ref3$data$metadata;return[{type:"video",url:lodash.isString(src)?src:src.pathname,isCustom:isCustomVideo,thumbnail:lodash.has(src,"thumbnail")?null===(_src$thumbnail=src.thumbnail)||void 0===_src$thumbnail?void 0:_src$thumbnail.pathname:metadata.thumbnail_url||"",caption:metadata.title||""}]},linkConverter=function(entity){return[{type:"link",url:entity.data.url}]},converters={"wix-draft-plugin-image":function(entity){var _entity$data$src,_entity$data$src2,_entity$data$src3,_entity$data$metadata,_entity$data$metadata2,_entity$data$config;return[{width:null===(_entity$data$src=entity.data.src)||void 0===_entity$data$src?void 0:_entity$data$src.width,height:null===(_entity$data$src2=entity.data.src)||void 0===_entity$data$src2?void 0:_entity$data$src2.height,url:null===(_entity$data$src3=entity.data.src)||void 0===_entity$data$src3?void 0:_entity$data$src3.file_name,type:"image",alt:(null===(_entity$data$metadata=entity.data.metadata)||void 0===_entity$data$metadata?void 0:_entity$data$metadata.alt)||"",caption:(null===(_entity$data$metadata2=entity.data.metadata)||void 0===_entity$data$metadata2?void 0:_entity$data$metadata2.caption)||"",link:null===(_entity$data$config=entity.data.config)||void 0===_entity$data$config?void 0:_entity$data$config.link}]},"wix-draft-plugin-gallery":function(entity){return entity.data.items.filter((function(_ref){var metadata=_ref.metadata;return!(null!=metadata&&metadata.type)||"image"===(null==metadata?void 0:metadata.type)||"video"===(null==metadata?void 0:metadata.type)})).map((function(_ref2){var _metadata$poster,metadata=_ref2.metadata,url=_ref2.url,itemId=_ref2.itemId;return"video"===(null==metadata?void 0:metadata.type)?{type:"video",url:url,thumbnail:(null==metadata||null===(_metadata$poster=metadata.poster)||void 0===_metadata$poster?void 0:_metadata$poster.url)||"",caption:(null==metadata?void 0:metadata.title)||"",isGalleryItem:!0}:{url:url,height:null==metadata?void 0:metadata.height,width:null==metadata?void 0:metadata.width,id:itemId,type:"image",alt:(null==metadata?void 0:metadata.altText)||"",caption:(null==metadata?void 0:metadata.title)||"",isGalleryItem:!0}}))},"wix-draft-plugin-divider":defaultEntityConverter,"wix-draft-plugin-video":videoConverter,"wix-draft-plugin-sound-cloud":videoConverter,"wix-draft-plugin-giphy":function(entity){var _entity$data$gif,_entity$data$gif2,_entity$data$gif3,_entity$data$gif4,_entity$data$gif5;return[{type:"giphy",url:null===(_entity$data$gif=entity.data.gif)||void 0===_entity$data$gif?void 0:_entity$data$gif.originalUrl,mp4:null===(_entity$data$gif2=entity.data.gif)||void 0===_entity$data$gif2?void 0:_entity$data$gif2.downsizedSmallMp4,thumbnail:null===(_entity$data$gif3=entity.data.gif)||void 0===_entity$data$gif3?void 0:_entity$data$gif3.stillUrl,width:null===(_entity$data$gif4=entity.data.gif)||void 0===_entity$data$gif4?void 0:_entity$data$gif4.width,height:null===(_entity$data$gif5=entity.data.gif)||void 0===_entity$data$gif5?void 0:_entity$data$gif5.height,source:"static"}]},"wix-draft-plugin-file-upload":function(entity){return[{name:entity.data.name,type:"file",fileType:entity.data.type,url:entity.data.url}]},"wix-draft-plugin-map":function(entity){return[{type:"map",mapSettings:entity.data.mapSettings}]},mention:defaultEntityConverter,"wix-draft-plugin-headers-markdown":defaultEntityConverter,"wix-draft-plugin-link-button":defaultEntityConverter,"wix-draft-plugin-action-button":defaultEntityConverter,"wix-draft-plugin-poll":defaultEntityConverter,LINK:linkConverter,LINK_PREVIEW:linkConverter,"wix-draft-plugin-html":defaultEntityConverter},extractTextBlocksWithEntities=function(_ref,blockFilter){var blocks=_ref.blocks,entityMap=_ref.entityMap;return blocks.filter(blockFilter).reduce((function(texts,block){var entities=block.entityRanges.reduce((function(map,range){return map["_"+range.key]=entityMap[range.key],map}),{}),_block=_extends__default.default({},block,{entityRanges:block.entityRanges.map((function(range){return _extends__default.default({},range,{key:"_"+range.key})}))});return[].concat(texts,[{block:_block,entities:entities}])}),[])},extractTextBlockArray=function(raw,blockTypeFilter){return extractTextBlocksWithEntities(raw,(function(_ref2){var type=_ref2.type,text=_ref2.text;return blockTypeFilter(type)&&text.length>0}))},createTextFragments=function(raw){return(_ref3=raw,blockTypeFilter=function(type){return"atomic"!==type},blocks=_ref3.blocks,entityMap=_ref3.entityMap,current=0,next=0,batches=lodash.groupBy(blocks,(function(block){var isValid=blockTypeFilter(block.type);return isValid?current===next&&next++:current<next&¤t++,isValid&¤t})),Object.entries(batches).filter((function(value){return"false"!==value[0]})).map((function(batch){return extractTextBlocksWithEntities({blocks:batch[1],entityMap:entityMap},(function(_ref4){var type=_ref4.type,text=_ref4.text;return blockTypeFilter(type)&&text.length>0}))})).filter((function(batch){return batch.length>0}))).filter((function(batch){return batch.length})).map((function(batch){var textCombined=batch.map((function(entry){return entry.block.text})).join("\n"),copyBlocks=lodash.cloneDeep(batch),offset=0;copyBlocks.forEach((function(entry){entry.block.inlineStyleRanges.map((function(style){return style.offset+=offset})),entry.block.entityRanges.map((function(entity){return entity.offset+=offset})),offset+=entry.block.text.length+"\n".length}));var inlineStyleRanges=copyBlocks.flatMap((function(entry){return entry.block.inlineStyleRanges})),entityRanges=copyBlocks.flatMap((function(entry){return entry.block.entityRanges})),entities=copyBlocks.map((function(block){return block.entities})).reduce((function(acc,curr){return _extends__default.default({},acc,curr)}));return lodash.merge(lodash.cloneDeep(batch[0]),{block:{text:textCombined,inlineStyleRanges:inlineStyleRanges,entityRanges:entityRanges},entities:entities})}));var _ref3,blockTypeFilter,blocks,entityMap,current,next,batches},getContentStateMetadata=function(raw){var entityMap,mediaEntities=function(_ref6){var entityMap=_ref6.entityMap;return Object.values(entityMap).filter((function(entity){var _ref7$config=(entity.data||{}).config,config=void 0===_ref7$config?{}:_ref7$config;return!("spoiler"in config)||!config.spoiler.enabled})).reduce((function(media,entity){return[].concat(media,function(entity){return converters[entity.type]?converters[entity.type](entity):[]}(entity))}),[])}(raw),galleryItems=mediaEntities.filter((function(_ref9){return _ref9.isGalleryItem})),singleMediaItems=mediaEntities.filter((function(_ref10){var type=_ref10.type,isGalleryItem=_ref10.isGalleryItem;return function(type){return type&&["image","video","giphy"].includes(type)}(type)&&!isGalleryItem})),media={singleMediaItems:singleMediaItems,galleryItems:galleryItems,totalCount:galleryItems.length+singleMediaItems.length},blocks=Object.entries(METHOD_BLOCK_MAP).reduce((function(prev,_ref11){var _extends2,func=_ref11[0],blockType=_ref11[1];return _extends__default.default({},prev,((_extends2={})[func]=extractTextBlockArray(raw,(function(type){return type===blockType})),_extends2))}),{}),groupedBlocks=Object.entries(METHOD_GROUPED_BLOCK_MAP).reduce((function(prev,_ref12){var _extends3,func=_ref12[0],blockType=_ref12[1];return _extends__default.default({},prev,((_extends3={})[func]=function(_ref5,blockType){return _ref5.blocks.reduce((function(result,block,idx){if(block.type===blockType){var list=-1===result.lastItemIndex?[].concat(result.list,[[]]):result.list;return list[list.length-1]=[].concat(list[list.length-1],[block]),{list:list,lastItemIndex:idx}}return{list:result.list,lastItemIndex:-1}}),{list:[],lastItemIndex:-1}).list.filter((function(arr){return arr.length>0}))}(raw,blockType).map((function(blocks){return extractTextBlockArray({blocks:blocks,entityMap:raw.entityMap},(function(type){return type===blockType}))})).filter((function(arr){return arr.length>0})),_extends3))}),{}),nonMediaPluginsCount=(entityMap=raw.entityMap,Object.values(entityMap).length-media.totalCount),nonSeparatorPlugins=mediaEntities.filter((function(_ref13){var type=_ref13.type;return["link","hashtag","mention"].includes(type)}));return _extends__default.default({allText:extractTextBlockArray(raw,(function(type){return"atomic"!==type})),textFragments:createTextFragments(raw),media:media,images:mediaEntities.filter((function(_ref14){return"image"===_ref14.type})),videos:mediaEntities.filter((function(_ref15){return"video"===_ref15.type})),files:mediaEntities.filter((function(_ref16){return"file"===_ref16.type})),maps:mediaEntities.filter((function(_ref17){return"map"===_ref17.type})),links:mediaEntities.filter((function(_ref18){return"link"===_ref18.type})),nonMediaPluginsCount:nonMediaPluginsCount,collapsablePluginsCount:nonMediaPluginsCount-nonSeparatorPlugins.length},blocks,groupedBlocks)},ContentStateTransformation=function(){function ContentStateTransformation(_ref){var _if=_ref._if,_then=_ref._then,initialPreviewState=_ref.initialPreviewState;this.rules=[],this.rule({_if:_if,_then:_then}),this.previewState=initialPreviewState}var _proto=ContentStateTransformation.prototype;return _proto.rule=function(_ref2){var _if=_ref2._if,_then=_ref2._then;if(!lodash.isFunction(_if)||!lodash.isFunction(_then))throw new TypeError("invalid rule added: `_if` and `_then` should be functions ");return this.rules.push({_if:_if,_then:_then}),this},_proto.apply=function(contentState){var previewStateBuilder=new ContentStateBuilder(this.previewState),metadata=getContentStateMetadata(contentState);return this.rules.reduce((function(builder,rule){return rule._if(metadata)?rule._then(metadata,builder):builder}),previewStateBuilder).get()},_proto.toObject=function(){return this.rules.map((function(rule){return{_if:rule._if.toString(),_then:rule._then.toString()}}))},ContentStateTransformation}(),styles$3={readMore:"_12Azt",readMore_label:"wzP_E",readMore_wrapper:"_3N2Zu",readMore_calculationWrapper:"QJo1L"},ReadMore=function(_PureComponent){function ReadMore(props){var _this;return(_this=_PureComponent.call(this,props)||this).onClick=function(e){var _this$props$onPreview,_this$props;e.preventDefault(),null===(_this$props$onPreview=(_this$props=_this.props).onPreviewExpand)||void 0===_this$props$onPreview||_this$props$onPreview.call(_this$props)},_this.onReflow=function(_ref){var clamped=_ref.clamped;_this.setState({clamped:clamped})},_this.state={clamped:!1},_this.rmContainer=React__default.default.createRef(),_this.rmMocker=React__default.default.createRef(),_this}_inheritsLoose__default.default(ReadMore,_PureComponent);var _proto=ReadMore.prototype;return _proto.componentDidMount=function(){var _this$rmContainer,_this$rmContainer$cur,_this$rmMocker,_this$rmMocker$curren,height=null===(_this$rmContainer=this.rmContainer)||void 0===_this$rmContainer||null===(_this$rmContainer$cur=_this$rmContainer.current)||void 0===_this$rmContainer$cur?void 0:_this$rmContainer$cur.clientHeight,originalHeight=null===(_this$rmMocker=this.rmMocker)||void 0===_this$rmMocker||null===(_this$rmMocker$curren=_this$rmMocker.current)||void 0===_this$rmMocker$curren?void 0:_this$rmMocker$curren.clientHeight;height&&originalHeight&&this.setState({clamped:originalHeight>height})},_proto.render=function(){var clamped=this.state.clamped,_this$props$showToggl=this.props.showToggle,showToggle=void 0===_this$props$showToggl||_this$props$showToggl,_this$props2=this.props,_this$props2$lines=_this$props2.lines,lines=void 0===_this$props2$lines?3:_this$props2$lines,_this$props2$label=_this$props2.label,label=void 0===_this$props2$label?this.props.t("Preview_ReadMore_Label"):_this$props2$label,children=_this$props2.children;return this.styles=this.styles||wixRichContentCommon.mergeStyles({styles:styles$3,theme:this.props.theme}),React__default.default.createElement(React.Fragment,null,React__default.default.createElement("div",{className:styles$3.readMore_wrapper,ref:this.rmContainer,style:{WebkitLineClamp:lines}},children),React__default.default.createElement("div",{ref:this.rmMocker,className:styles$3.readMore_calculationWrapper},children),clamped&&showToggle&&React__default.default.createElement("a",{href:"",role:"button",onClick:this.onClick,className:this.styles.readMore_label},label))},ReadMore}(React.PureComponent),styles$2={readMore:"_1ApJW",readMore_label:"eTqNQ",seeFullPost_label:"tAZX-",readMore_wrapper:"_2hV2v",readMore_calculationWrapper:"_1_cK8",seeFullPost_container:"_DSpL",seeFullPost_overlay:"_1KhhV"},SeeFullPost=function(_PureComponent){function SeeFullPost(){var _this;return(_this=_PureComponent.apply(this,arguments)||this).onClick=function(e){var _this$props=_this.props,onClick=_this$props.onClick,onPreviewExpand=_this$props.onPreviewExpand;e.preventDefault(),null==onClick||onClick(e),null==onPreviewExpand||onPreviewExpand()},_this}return _inheritsLoose__default.default(SeeFullPost,_PureComponent),SeeFullPost.prototype.render=function(){this.styles=this.styles||wixRichContentCommon.mergeStyles({styles:styles$2,theme:this.props.theme});var _this$props2=this.props,_this$props2$label=_this$props2.label,label=void 0===_this$props2$label?this.props.t("Preview_ReadMore_Label"):_this$props2$label,children=_this$props2.children,overlayStyles=_this$props2.overlayStyles,labelStyles=_this$props2.labelStyles;return React__default.default.createElement("div",{className:this.styles.seeFullPost_container},children,React__default.default.createElement("div",{className:this.styles.seeFullPost_overlay,style:overlayStyles,onClick:this.onClick},React__default.default.createElement("span",{className:this.styles.seeFullPost_label,style:labelStyles},label)))},SeeFullPost}(React.PureComponent),styles$1={imageCounter_overlay:"_2Jbbp",imageCounter_container:"_3qaU_",imageCounter_label:"_1H6T8",imageCounter_measure:"_1SWX6"},ImageCounter=function(_PureComponent){function ImageCounter(){var _this;return(_this=_PureComponent.apply(this,arguments)||this).onClick=function(e){var _this$props=_this.props,onClick=_this$props.onClick,onPreviewExpand=_this$props.onPreviewExpand;e.preventDefault(),onClick(),null==onPreviewExpand||onPreviewExpand()},_this.renderDecoration=function(element){var _this$props2=_this.props,formatLabel=_this$props2.formatLabel,counter=_this$props2.counter,rect=element.getBoundingClientRect(),parentRect=_this.container.getBoundingClientRect(),style={width:rect.width,height:rect.height,top:rect.top-parentRect.top,left:rect.left-parentRect.left};return React__default.default.createElement("div",{className:_this.styles.imageCounter_container,style:style},React__default.default.createElement("span",{className:_this.styles.imageCounter_label},formatLabel(counter)))},_this.decorateImages=function(){if(_this.wrapper){var images=_this.wrapper.querySelectorAll("[role=link]"),imagesToDecorate=_this.props.imageSelector(images),decorations=[];imagesToDecorate.forEach((function(image){return decorations.push(_this.renderDecoration(image))})),ReactDOM__default.default.render(decorations,_this.container)}},_this.onResize=lodash.debounce(_this.decorateImages,200),_this.handleWrapper=function(el){return _this.wrapper=el},_this.handleContainer=function(el){return _this.container=el},_this}_inheritsLoose__default.default(ImageCounter,_PureComponent);var _proto=ImageCounter.prototype;return _proto.componentDidMount=function(){this.decorateImages()},_proto.render=function(){var _this2=this;return this.styles=this.styles||wixRichContentCommon.mergeStyles({styles:styles$1,theme:this.props.theme}),React__default.default.createElement(Measure__default.default,{onResize:this.onResize},(function(_ref){var measureRef=_ref.measureRef;return React__default.default.createElement("div",{ref:measureRef,className:_this2.styles.imageCounter_measure},React__default.default.createElement("div",{ref:_this2.handleWrapper,onClick:_this2.onClick},React__default.default.createElement("div",{ref:_this2.handleContainer,className:_this2.styles.imageCounter_overlay}),_this2.props.children))}))},ImageCounter}(React.PureComponent);ImageCounter.defaultProps={formatLabel:function(counter){return"+ "+counter},onClick:function(){},imageSelector:function(images){return images&&images.length>0?[images[images.length-1]]:[]}};var _excluded$1=["children"],interactionMap=function(onPreviewExpand){var _Object$entries;return Object.entries((_Object$entries={},_Object$entries[INTERACTIONS.READ_MORE]=ReadMore,_Object$entries[INTERACTIONS.SEE_FULL_CONTENT]=SeeFullPost,_Object$entries[INTERACTIONS.IMAGE_COUNTER]=ImageCounter,_Object$entries)).reduce((function(map,_ref){var _extends2,key=_ref[0],Component=_ref[1];return _extends__default.default({},map,((_extends2={})[key]=function(_ref2){var children=_ref2.children,props=_objectWithoutPropertiesLoose__default.default(_ref2,_excluded$1);return React__default.default.createElement(Component,Object.assign({},_extends__default.default({onPreviewExpand:onPreviewExpand},props)),children)},_extends2))}),{})},galleryStyle={galleryLayout:2,gallerySizeType:"px",gallerySizePx:300,galleryMargin:0,oneRow:!1,cubeRatio:1,galleryThumbnailsAlignment:"bottom",isVertical:!1,imageMargin:20,thumbnailSpacings:0,cubeType:"fill",enableInfiniteScroll:!0,titlePlacement:"SHOW_ON_HOVER",allowHover:!1,itemClick:"link",fullscreen:!1,showArrows:!1,gridStyle:1,loveButton:!1,allowSocial:!1,allowDownload:!1,mobileSwipeAnimation:"NO_EFFECT",thumbnailSize:120,gotStyleParams:!0,showVideoPlayButton:!1,videoPlay:"auto",numberOfImagesPerRow:2},showReadMore=function(_ref){return _ref.media.singleMediaItems.length<2},showFullPost=function(_ref2){var singleMediaItems=_ref2.media.singleMediaItems,textFragments=_ref2.textFragments,nonMediaPluginsCount=_ref2.nonMediaPluginsCount,collapsablePluginsCount=_ref2.collapsablePluginsCount;return textFragments.length>1&&0===singleMediaItems.length||nonMediaPluginsCount>0&&collapsablePluginsCount>0},defaultTransformation=new ContentStateTransformation({_if:function(metadata){return metadata.allText.length>0},_then:function(metadata,preview){var textFragments=metadata.textFragments,nonMediaPluginsCount=metadata.nonMediaPluginsCount,collapsablePluginsCount=metadata.collapsablePluginsCount,_metadata$media=metadata.media,singleMediaItems=_metadata$media.singleMediaItems,galleryItems=_metadata$media.galleryItems,showToggle=showReadMore(metadata)&&!showFullPost(metadata)&&0===collapsablePluginsCount&&1===textFragments.length,previewToDisplay=preview.plain(textFragments[0]).readMore({lines:3,showToggle:showToggle});return showReadMore(metadata)&&showFullPost(metadata)&&!(singleMediaItems.length>0&&nonMediaPluginsCount>0)||0===singleMediaItems.length&&galleryItems.length>0?previewToDisplay.seeFullPost():previewToDisplay}}).rule({_if:function(metadata){return 1===metadata.media.singleMediaItems.length},_then:function(metadata,preview){var _metadata$media2=metadata.media,galleryItems=_metadata$media2.galleryItems,mediaInfo=_metadata$media2.singleMediaItems[0],previewToDisplay=preview[mediaInfo.type]({mediaInfo:mediaInfo});return showFullPost(metadata)||metadata.textFragments.length>1||galleryItems.length>0?previewToDisplay.seeFullPost():previewToDisplay}}).rule({_if:function(metadata){return metadata.media.singleMediaItems.length>1&&metadata.media.singleMediaItems.length<=4},_then:function(_ref3,preview){var _ref3$media=_ref3.media,galleryItems=_ref3$media.galleryItems,singleMediaItems=_ref3$media.singleMediaItems,totalCount=_ref3$media.totalCount,numberOfImagesPerRow=singleMediaItems.length%2==0?2:3,gallery=preview.gallery({mediaInfo:singleMediaItems.slice(0,4),config:{size:"small"},overrides:{styles:_extends__default.default({},galleryStyle,{numberOfImagesPerRow:numberOfImagesPerRow})}}).seeFullPost();return galleryItems.length>0?gallery.imageCounter({counter:totalCount-singleMediaItems.length}):gallery}}).rule({_if:function(metadata){return metadata.media.singleMediaItems.length>4},_then:function(_ref4,preview){var _ref4$media=_ref4.media,singleMediaItems=_ref4$media.singleMediaItems,totalCount=_ref4$media.totalCount;return preview.gallery({mediaInfo:singleMediaItems.slice(0,4),config:{size:"small"},overrides:{styles:galleryStyle}}).imageCounter({counter:totalCount-4}).seeFullPost()}}),styles={},_excluded=["transformation","initialState","config"],RichContentPreview=function(_Component){function RichContentPreview(props){var _this;return(_this=_Component.call(this,props)||this).onPreviewExpand=function(){var _this$props$config,_this$props$config$PR,_this$props$config$PR2;_this.setState({isPreviewExpanded:!0}),null===(_this$props$config=_this.props.config)||void 0===_this$props$config||null===(_this$props$config$PR=_this$props$config.PREVIEW)||void 0===_this$props$config$PR||null===(_this$props$config$PR2=_this$props$config$PR.onPreviewExpand)||void 0===_this$props$config$PR2||_this$props$config$PR2.call(_this$props$config$PR)},_this.styles=wixRichContentCommon.mergeStyles({styles:styles,theme:props.theme}),_this.state={isPreviewExpanded:!1},_this}return _inheritsLoose__default.default(RichContentPreview,_Component),RichContentPreview.prototype.render=function(){var _this2=this,_this$props=this.props,transformation=_this$props.transformation,initialState=_this$props.initialState,config=_this$props.config,rest=_objectWithoutPropertiesLoose__default.default(_this$props,_excluded),previewState=this.state.isPreviewExpanded?initialState:transformation.apply(initialState),previewConfig=_extends__default.default({},config,{PREVIEW:_extends__default.default({contentInteractionMappers:[interactionMap]},config.PREVIEW,{onPreviewExpand:this.onPreviewExpand})}),isPreviewAddition={helpers:{isPreview:function(){return!_this2.state.isPreviewExpanded}}};return React__default.default.createElement("div",{className:styles.preview_container},React__default.default.createElement(wixRichContentViewer.RichContentViewer,Object.assign({initialState:previewState,config:previewConfig},lodash.merge(rest,isPreviewAddition))))},RichContentPreview}(React.Component);RichContentPreview.defaultProps={transformation:defaultTransformation};var defaultConfig={transformation:defaultTransformation,contentInteractionMappers:[interactionMap]};exports.RichContentPreview=RichContentPreview,exports.createPreview=function(config){return void 0===config&&(config={}),_extends__default.default({},defaultConfig,config)},exports.interactionMap=interactionMap; | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var _extends=require("@babel/runtime/helpers/extends"),_objectWithoutPropertiesLoose=require("@babel/runtime/helpers/objectWithoutPropertiesLoose"),wixRichContentPluginCommons=require("wix-rich-content-plugin-commons"),wixRichContentEditorCommon=require("wix-rich-content-editor-common"),_inheritsLoose=require("@babel/runtime/helpers/inheritsLoose"),React=require("react"),classNames=require("classnames"),wixRichContentCommon=require("wix-rich-content-common"),wixRichContentUiComponents=require("wix-rich-content-ui-components"),reactBeautifulDnd=require("react-beautiful-dnd");function _interopDefaultLegacy(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var _ModalsMap,_extends__default=_interopDefaultLegacy(_extends),_objectWithoutPropertiesLoose__default=_interopDefaultLegacy(_objectWithoutPropertiesLoose),_inheritsLoose__default=_interopDefaultLegacy(_inheritsLoose),React__default=_interopDefaultLegacy(React),classNames__default=_interopDefaultLegacy(classNames),COLLAPSIBLE_LIST_TYPE="wix-rich-content-plugin-collapsible-list",directions_LTR="ltr",directions_RTL="rtl",DEFAULTS=Object.freeze({config:{expandState:"first_expanded",expandOnlyOne:!1},pairs:[{key:wixRichContentCommon.generateKey()}]}),EMPTY_PAIR_VALUE={title:wixRichContentEditorCommon.EditorState.createEmpty(),content:wixRichContentEditorCommon.EditorState.createEmpty()},CollapsibleList=function(store,componentData){var _this=this;this.getData=function(){return _this.componentData},this.getConfig=function(){return _this.getData().config},this.getPairs=function(){return _this.getData().pairs},this.getPair=function(idx){return _this.getPairs()[idx]},this.getTitle=function(idx){return _this.getPair(idx).title||wixRichContentEditorCommon.EditorState.createEmpty()},this.getContent=function(idx){return _this.getPair(idx).content||wixRichContentEditorCommon.EditorState.createEmpty()},this.getDirection=function(){return _this.getConfig().direction},this.changeDirection=function(){var direction=_this.getDirection()===directions_LTR?directions_RTL:directions_LTR,updatedData={config:_extends__default.default({},_this.getConfig(),{direction:direction})};_this.updateData(updatedData)},this.getExpandState=function(){return _this.getConfig().expandState},this.setExpandState=function(expandState){var updatedData={config:_extends__default.default({},_this.getConfig(),{expandState:expandState})};"expanded"===expandState&&(updatedData.config.expandOnlyOne=void 0),_this.updateData(updatedData)},this.getExpandOnlyOne=function(){return _this.getConfig().expandOnlyOne},this.toggleExpandOnlyOne=function(){var updatedData={config:_extends__default.default({},_this.getConfig(),{expandOnlyOne:!_this.getExpandOnlyOne()})};_this.updateData(updatedData)},this.setData=function(data){_this.store.set("componentData",data)},this.updateData=function(data){var componentData=_this.getData();_this.setData(_extends__default.default({},componentData,data))},this.setTitle=function(idx,editorState){var pair={title:editorState};_this.setPair(idx,pair)},this.setContent=function(idx,editorState){var pair={content:editorState};_this.setPair(idx,pair)},this.setPair=function(idx,updatedPair){var pairs=[].concat(_this.getPairs()),currentPair=_this.getPair(idx),newPair=_extends__default.default({},currentPair.title&¤tPair.content?{}:EMPTY_PAIR_VALUE,currentPair,updatedPair);pairs.splice(idx,1,newPair),_this.updateData({pairs:pairs})},this.createNewPair=function(){return{key:wixRichContentCommon.generateKey(),title:wixRichContentEditorCommon.EditorState.createEmpty(),content:wixRichContentEditorCommon.EditorState.createEmpty()}},this.insertNewPair=function(){var pairs=_this.getPairs();_this.updateData({pairs:[].concat(pairs,[_this.createNewPair()])})},this.reorderPairs=function(startIdx,endIdx){var pairs=_this.getPairs(),pairToMove=pairs.splice(startIdx,1)[0];pairs.splice(endIdx,0,pairToMove),_this.updateData({pairs:pairs})},this.deletePair=function(pairIndex){var pairs=_this.getPairs();pairs.splice(pairIndex,1),_this.updateData({pairs:pairs})},this.store=store,this.componentData=componentData},styles$5={title:"_3hUj0",settingsContainer:"_62k0D",separator:"_20bm0",direction_selector:"_1jUkB",direction_selector_option:"_1w4ED"},CollapsibleListSettings=function(_Component){function CollapsibleListSettings(props){var _this;(_this=_Component.call(this,props)||this).renderOption=function(_ref){var item=_ref.item;return React__default.default.createElement(React__default.default.Fragment,null,React__default.default.createElement(item.icon,null),React__default.default.createElement("p",null,item.label))},_this.renderExpandOptions=function(){var _this$props=_this.props,getDataManager=_this$props.getDataManager,t=_this$props.t,theme=_this$props.theme,isMobile=_this$props.isMobile;return React__default.default.createElement(React__default.default.Fragment,null,React__default.default.createElement(wixRichContentUiComponents.RadioGroupVertical,{label:t("CollapsibleList_CollapsibleListSettings_Tab_Settings_CollapseView_Title"),value:getDataManager().getExpandState(),dataSource:[{value:"expanded",labelText:t("CollapsibleList_CollapsibleListSettings_Tab_Settings_CollapseView_Expanded"),dataHook:"Expanded"},{value:"first_expanded",labelText:t("CollapsibleList_CollapsibleListSettings_Tab_Settings_CollapseView_FirstExpanded"),dataHook:"FirstExpanded"},{value:"collapsed",labelText:t("CollapsibleList_CollapsibleListSettings_Tab_Settings_CollapseView_Collapsed"),dataHook:"Collapsed"}],t:t,theme:theme,onChange:function(value){return getDataManager().setExpandState(value)}}),"expanded"!==getDataManager().getExpandState()&&React__default.default.createElement(wixRichContentUiComponents.LabeledToggle,{label:t("CollapsibleList_CollapsibleListSettings_Tab_Settings_CollapseView_InSections"),checked:getDataManager().getExpandOnlyOne(),onChange:getDataManager().toggleExpandOnlyOne,theme:theme,style:isMobile?{paddingTop:"28px"}:{},dataHook:"onePairExpanded"}))},_this.renderSeparator=function(){return React__default.default.createElement(wixRichContentUiComponents.Separator,{horizontal:!0,className:_this.styles.separator})},_this.renderDirectionOptions=function(){var _this$props2=_this.props,getDataManager=_this$props2.getDataManager,t=_this$props2.t;return React__default.default.createElement(React__default.default.Fragment,null,React__default.default.createElement("p",{className:_this.styles.title},t("CollapsibleList_CollapsibleListSettings_Tab_Settings_Direction_Title")," ",React__default.default.createElement(wixRichContentUiComponents.InfoIcon,{tooltipText:t("CollapsibleList_CollapsibleListSettings_Tab_Settings_Direction_Title_Tooltip")})),React__default.default.createElement(wixRichContentUiComponents.SelectionList,{theme:_this.styles,dataSource:[{value:directions_LTR,label:t("CollapsibleList_CollapsibleListSettings_Tab_Settings_Direction_LTR"),icon:wixRichContentPluginCommons.LTRIcon,dataHook:"ltrDirection"},{value:directions_RTL,label:t("CollapsibleList_CollapsibleListSettings_Tab_Settings_Direction_RTL"),icon:wixRichContentPluginCommons.RTLIcon,dataHook:"rtlDirection"}],renderItem:_this.renderOption,value:getDataManager().getDirection(),onChange:getDataManager().changeDirection,className:_this.styles.direction_selector,optionClassName:_this.styles.direction_selector_option}))};var _theme=props.theme;return _this.styles=wixRichContentCommon.mergeStyles({styles:styles$5,theme:_theme}),_this}return _inheritsLoose__default.default(CollapsibleListSettings,_Component),CollapsibleListSettings.prototype.render=function(){return React__default.default.createElement("div",{className:this.styles.settingsContainer},this.renderExpandOptions(),this.renderSeparator(),this.renderDirectionOptions())},CollapsibleListSettings}(React.Component),styles$4={collapsibleListModal:"_2gcEm",collapsibleListModalTitle:"_22bSm",collapsibleListModal_scrollContainer:"bpnq3",collapsibleListModal_mobile:"_1QgQS"},CollapsibleListModal=function(_Component){function CollapsibleListModal(props){var _this;(_this=_Component.call(this,props)||this).onComponentUpdate=function(){return _this.forceUpdate()},_this.revertComponentData=function(){var helpers=_this.props.helpers,initialComponentData=_this.state.initialComponentData;initialComponentData&&_this.getDataManager().updateData(initialComponentData),helpers.closeModal()},_this.onDoneClick=function(){_this.props.helpers.closeModal()},_this.getDataManager=function(){var pubsub=_this.props.pubsub;return new CollapsibleList(pubsub.store,pubsub.get("componentData"))},_this.renderDesktopHeader=function(){var t=_this.props.t;return React__default.default.createElement("h3",{className:_this.styles.collapsibleListModalTitle},t("CollapsibleList_CollapsibleListSettings_Common_Header"))},_this.renderMobileHeader=function(){var _this$props=_this.props,t=_this$props.t,theme=_this$props.theme;return React__default.default.createElement(wixRichContentUiComponents.SettingsMobileHeader,{t:t,theme:theme,onCancel:_this.revertComponentData,onSave:_this.onDoneClick})},_this.renderSettings=function(){var _classNames,_this$props2=_this.props,isMobile=_this$props2.isMobile,theme=_this$props2.theme,t=_this$props2.t;return React__default.default.createElement("div",{className:classNames__default.default(styles$4.collapsibleListModal_scrollContainer,(_classNames={},_classNames[styles$4.collapsibleListModal_mobile]=isMobile,_classNames))},React__default.default.createElement(CollapsibleListSettings,{getDataManager:_this.getDataManager,theme:theme,isMobile:isMobile,t:t}))},_this.renderDesktopFooterPanel=function(){var _this$props3=_this.props,theme=_this$props3.theme,t=_this$props3.t;return React__default.default.createElement(wixRichContentUiComponents.SettingsPanelFooter,{fixed:!0,theme:theme,cancel:_this.revertComponentData,save:_this.onDoneClick,t:t})},_this.state=_this.initState(props);var _theme=props.theme;return _this.styles=wixRichContentCommon.mergeStyles({styles:styles$4,theme:_theme}),_this}_inheritsLoose__default.default(CollapsibleListModal,_Component);var _proto=CollapsibleListModal.prototype;return _proto.initState=function(props){return{initialComponentData:props.pubsub.get("componentData")}},_proto.componentDidMount=function(){var pubsub=this.props.pubsub;pubsub.subscribe("componentData",this.onComponentUpdate),this.setState({initialComponentData:pubsub.get("componentData")})},_proto.componentWillUnmount=function(){this.props.pubsub.unsubscribe("componentData",this.onComponentUpdate)},_proto.render=function(){var _this$props4=this.props,isMobile=_this$props4.isMobile,languageDir=_this$props4.languageDir;return React__default.default.createElement("div",{className:this.styles.collapsibleListModal,"data-hook":"collapsibleListModal",dir:languageDir},isMobile?this.renderMobileHeader():this.renderDesktopHeader(),this.renderSettings(),!isMobile&&this.renderDesktopFooterPanel())},CollapsibleListModal}(React.Component),Modals={COLLAPSIBLE_LIST_MODAL:"collapsible-list-modal"},ModalsMap=((_ModalsMap={})[Modals.COLLAPSIBLE_LIST_MODAL]=CollapsibleListModal,_ModalsMap),modalStyles={customStyles:{overlay:{backgroundColor:"transparent"},content:{borderRadius:"2px",boxShadow:"0 4px 8px 0 rgba(0, 0, 0, 0.1)",border:"solid 1px rgba(255, 255, 255, 0.25)"}}},createInlineButtons=function(_ref){var t=_ref.t,disableKeyboardEvents=_ref.disableKeyboardEvents;return[{keyName:"settings",type:wixRichContentPluginCommons.BUTTONS.EXTERNAL_MODAL,fullHeight:!0,modalName:Modals.COLLAPSIBLE_LIST_MODAL,children:t("CollapsibleList_CollapsibleListSettings_Tab_Settings_TabName"),modalStyles:wixRichContentEditorCommon.getModalStyles(modalStyles),t:t,mobile:!0,triggerSettingsBi:!0,pluginId:COLLAPSIBLE_LIST_TYPE},{keyName:"separator",mobile:!1,type:wixRichContentPluginCommons.BUTTONS.SEPARATOR},{keyName:"delete",type:wixRichContentPluginCommons.BUTTONS.DELETE,mobile:!0,beforeOnClickDelete:function(){null==disableKeyboardEvents||disableKeyboardEvents(!1)}}]},InsertPluginIcon=function(props){return React__default.default.createElement("svg",Object.assign({width:"19px",height:"12px",viewBox:"0 0 23 12",version:"1.1",xmlns:"http://www.w3.org/2000/svg"},props),React__default.default.createElement("g",{stroke:"none",strokeWidth:"1",fill:"none",fillRule:"evenodd"},React__default.default.createElement("g",{transform:"translate(-265.000000, -379.000000)",fill:"currentColor"},React__default.default.createElement("g",{transform:"translate(265.000000, 379.000000)"},React__default.default.createElement("path",{d:"M10,0.8 L22.6,0.8 C22.7104569,0.8 22.8,0.88954305 22.8,1 L22.8,1.6 C22.8,1.71045695 22.7104569,1.8 22.6,1.8 L10,1.8 C9.88954305,1.8 9.8,1.71045695 9.8,1.6 L9.8,1 C9.8,0.88954305 9.88954305,0.8 10,0.8 Z M10,5.8 L22.6,5.8 C22.7104569,5.8 22.8,5.88954305 22.8,6 L22.8,6.6 C22.8,6.71045695 22.7104569,6.8 22.6,6.8 L10,6.8 C9.88954305,6.8 9.8,6.71045695 9.8,6.6 L9.8,6 C9.8,5.88954305 9.88954305,5.8 10,5.8 Z M10,10.8 L22.6,10.8 C22.7104569,10.8 22.8,10.8895431 22.8,11 L22.8,11.6 C22.8,11.7104569 22.7104569,11.8 22.6,11.8 L10,11.8 C9.88954305,11.8 9.8,11.7104569 9.8,11.6 L9.8,11 C9.8,10.8895431 9.88954305,10.8 10,10.8 Z",fillRule:"nonzero"}),React__default.default.createElement("path",{d:"M2.61252587,5.04452587 C2.55011987,5.10656164 2.44933186,5.10656164 2.38692587,5.04452587 L2.04692587,4.70452587 C2.01688154,4.67451494 2,4.63379134 2,4.59132587 C2,4.54886039 2.01688154,4.50813679 2.04692587,4.47812587 L4.47972587,2.04532587 L2.04772587,-0.386674135 C2.01768154,-0.416685056 2.0008,-0.457408655 2.0008,-0.499874135 C2.0008,-0.542339615 2.01768154,-0.583063214 2.04772587,-0.613074135 L2.38692587,-0.953074135 C2.41693679,-0.983118462 2.45766039,-1 2.50012587,-1 C2.54259134,-1 2.58331494,-0.983118462 2.61332587,-0.953074135 L5.49812587,1.93172587 C5.52817019,1.96173679 5.54505173,2.00246039 5.54505173,2.04492587 C5.54505173,2.08739134 5.52817019,2.12811494 5.49812587,2.15812587 L2.61252587,5.04372587 L2.61252587,5.04452587 Z",transform:"translate(3.772526, 2.045526) rotate(-270.000000) translate(-3.772526, -2.045526) "})))))},ArrowIcon=function(props){return React__default.default.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24"},props),React__default.default.createElement("g",{fillRule:"evenodd"},React__default.default.createElement("g",null,React__default.default.createElement("g",null,React__default.default.createElement("g",null,React__default.default.createElement("g",null,React__default.default.createElement("path",{d:"M11.999 9L6 14.241 6.657 15 11.999 10.334 17.343 15 18 14.241z",transform:"translate(-129 -185) translate(97 105) translate(23 71) rotate(-90 21 12) matrix(1 0 0 -1 0 24)"})))))))},PlusIcon=function(props){return React__default.default.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24"},props),React__default.default.createElement("g",{fillRule:"evenodd"},React__default.default.createElement("g",null,React__default.default.createElement("g",null,React__default.default.createElement("g",null,React__default.default.createElement("path",{d:"M12.5 6v5.5H18v1h-5.5V18h-1v-5.5H6v-1h5.5V6h1z",transform:"translate(-129 -269) translate(97 105) translate(23 155) rotate(-90 21 12)"}))))))},DndIcon=function(props){return React__default.default.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 20 20"},props),React__default.default.createElement("g",{fillRule:"evenodd"},React__default.default.createElement("g",null,React__default.default.createElement("g",null,React__default.default.createElement("g",null,React__default.default.createElement("g",null,React__default.default.createElement("path",{d:"M5.37 7.083c-.684-.025-1.22-.596-1.203-1.28.017-.685.58-1.228 1.265-1.22.684.009 1.234.566 1.235 1.25-.014.704-.594 1.263-1.297 1.25zM5.37 2.5c-.684-.026-1.22-.597-1.203-1.28.017-.685.58-1.228 1.265-1.22.684.009 1.234.566 1.235 1.25-.014.703-.594 1.263-1.297 1.25zM5.463 9.167c.684.025 1.22.596 1.203 1.28-.017.685-.58 1.228-1.265 1.22-.684-.009-1.234-.566-1.234-1.25.014-.703.594-1.262 1.296-1.25zM1.203 7.083C.52 7.058-.017 6.487 0 5.803c.017-.685.581-1.228 1.265-1.22.685.009 1.235.566 1.235 1.25-.013.704-.594 1.263-1.297 1.25zM1.203 2.5C.52 2.474-.017 1.903 0 1.22.017.534.581-.009 1.265 0 1.95.01 2.5.566 2.5 1.25c-.013.703-.594 1.263-1.297 1.25zM1.297 9.167c.683.025 1.22.596 1.203 1.28-.017.685-.581 1.228-1.265 1.22C.55 11.658 0 11.1 0 10.417c.015-.703.594-1.262 1.297-1.25z",transform:"translate(-99 -190) translate(99 176) translate(0 14) translate(6.667 4.167)"})))))))},styles$3={ltr:"E6y_Z",rtl:"_2wLEl",iconContainer:"_21s0b",icon:"_2z8L4",isExpanded:"aPvla"};function ExpandCollapseButton(props){var onClick=props.onClick,idx=props.idx,ariaLabel=props.ariaLabel;return React__default.default.createElement("div",{role:"button",tabIndex:"-1",className:styles$3.iconContainer,onClick:onClick,onKeyUp:function(e){return(" "===e.key||"Enter"===e.key)&&onClick(e)},"data-hook":"ExpandCollapseButton_"+idx},React__default.default.createElement(ArrowIcon,{role:"button",tabIndex:"0","aria-label":ariaLabel,className:classNames__default.default(styles$3.icon,props.isExpanded&&styles$3.isExpanded)}))}var styles$2={titleContainer:"_3LwlN",title:"_3CwVy",content:"_3TxVS"},CollapsibleListPair=function(_Component){function CollapsibleListPair(props){var _this;(_this=_Component.call(this,props)||this).focusTitle=function(){var _this$titleEditorRef$;return null===(_this$titleEditorRef$=_this.titleEditorRef.current)||void 0===_this$titleEditorRef$?void 0:_this$titleEditorRef$.focus()},_this.renderTitle=function(){var _this$props=_this.props,idx=_this$props.idx,renderTitle=_this$props.renderTitle;return React__default.default.createElement("div",{className:_this.styles.title},renderTitle(idx,_this.titleEditorRef))},_this.focusContent=function(){var _this$contentEditorRe;return null===(_this$contentEditorRe=_this.contentEditorRef.current)||void 0===_this$contentEditorRe?void 0:_this$contentEditorRe.focus()},_this.renderContent=function(){var _this$props2=_this.props,idx=_this$props2.idx,renderContent=_this$props2.renderContent;return _this$props2.isExpanded&&React__default.default.createElement("div",{className:_this.styles.content},renderContent(idx,_this.contentEditorRef))},_this.onClick=function(e){var _helpers$onViewerActi,_this$props3=_this.props,isExpanded=_this$props3.isExpanded,onCollapseClick=_this$props3.onCollapseClick,onExpandClick=_this$props3.onExpandClick,idx=_this$props3.idx,helpers=_this$props3.helpers,isInEditor=_this$props3.isInEditor;isExpanded?onCollapseClick(idx):onExpandClick(idx),null===(_helpers$onViewerActi=helpers.onViewerAction)||void 0===_helpers$onViewerActi||_helpers$onViewerActi.call(helpers,COLLAPSIBLE_LIST_TYPE,"Click",isExpanded?"collapse":"expand"),isInEditor||(e.preventDefault(),setTimeout((function(){return wixRichContentCommon.anchorScroll(_this.pairRef,_this.context.experiments)})))},_this.onKeyDown=function(e){"a"===e.key&&(e.ctrlKey||e.metaKey)&&e.stopPropagation()};var theme=props.theme;return _this.styles=wixRichContentCommon.mergeStyles({styles:styles$2,theme:theme}),_this.titleEditorRef=React__default.default.createRef(),_this.contentEditorRef=React__default.default.createRef(),_this.pairRef=React__default.default.createRef(),_this}return _inheritsLoose__default.default(CollapsibleListPair,_Component),CollapsibleListPair.prototype.render=function(){var _this2=this,_this$props4=this.props,isExpanded=_this$props4.isExpanded,idx=_this$props4.idx,t=_this$props4.t;return React__default.default.createElement(React__default.default.Fragment,null,React__default.default.createElement("div",{className:this.styles.titleContainer,onKeyDown:this.onKeyDown,ref:function(_ref){return _this2.pairRef=_ref}},React__default.default.createElement(ExpandCollapseButton,{isExpanded:isExpanded,onClick:this.onClick,idx:idx,ariaLabel:t(isExpanded?"CollapsibleListPlugin_ExpandButton_AriaLabel":"CollapsibleListPlugin_CollapseButton_AriaLabel")}),this.renderTitle()),this.renderContent())},CollapsibleListPair}(React.Component);CollapsibleListPair.contextType=wixRichContentCommon.GlobalContext;var getPairsAllCollpased=function(pairs){return pairs.map((function(){return!1}))},getDefaultPairsState=function(pairs,defaultPairsExpandState){var pairsState="expanded"===defaultPairsExpandState?function(pairs){return pairs.map((function(){return!0}))}(pairs):getPairsAllCollpased(pairs);return"first_expanded"===defaultPairsExpandState&&(pairsState[0]=!0),pairsState},CollapsibleListPairs=function(_Component){function CollapsibleListPairs(props){var _this;return(_this=_Component.call(this,props)||this).focusPair=function(_ref){var idx=_ref.idx,isTitle=_ref.isTitle,pair=_this.pairsRefs[idx];isTitle?null==pair||pair.focusTitle():(null==pair?void 0:pair.focusContent())||null==pair||pair.focusTitle()},_this.expandPair=function(idx){var _this$props=_this.props,pairs=_this$props.pairs,expandOnlyOne=_this$props.expandOnlyOne,pairsState=_this.state.pairsState;expandOnlyOne&&(pairsState=getPairsAllCollpased(pairs)),pairsState[idx]=!0,_this.setState({pairsState:pairsState})},_this.collapsePair=function(idx){var pairsState=[].concat(_this.state.pairsState);pairsState[idx]=!1,_this.setState({pairsState:pairsState})},_this.insertNewPair=function(){var expandOnlyOne=_this.state.expandOnlyOne,pairsState=_this.state.pairsState;expandOnlyOne&&(pairsState=getPairsAllCollpased(pairsState)),pairsState=[].concat(pairsState,[!0]),_this.setState({pairsState:pairsState})},_this.deletePair=function(idx){var pairsState=_this.state.pairsState;pairsState.splice(idx,1),_this.setState({pairsState:pairsState})},_this.reorderPairs=function(startIdx,endIdx){var pairsState=_this.state.pairsState,pairToMove=pairsState.splice(startIdx,1)[0];pairsState.splice(endIdx,0,pairToMove),_this.setState({pairsState:pairsState})},_this.pairsRefs=[],_this.state=_this.initState(props),_this}_inheritsLoose__default.default(CollapsibleListPairs,_Component);var _proto=CollapsibleListPairs.prototype;return _proto.initState=function(props){var pairs=props.pairs,expandState=props.expandState;return{defaultPairsExpandState:expandState,expandOnlyOne:props.expandOnlyOne,pairsState:getDefaultPairsState(pairs,expandState)}},CollapsibleListPairs.getDerivedStateFromProps=function(props,state){var pairs=props.pairs,expandState=props.expandState,expandOnlyOne=props.expandOnlyOne;return state.defaultPairsExpandState!==expandState||expandOnlyOne&&expandOnlyOne!==state.expandOnlyOne?{defaultPairsExpandState:expandState,expandOnlyOne:expandOnlyOne,pairsState:getDefaultPairsState(pairs,expandState)}:null},_proto.render=function(){var _this2=this,_this$props2=this.props,pairs=_this$props2.pairs,PairWrapper=_this$props2.PairWrapper,t=_this$props2.t,theme=_this$props2.theme,renderTitle=_this$props2.renderTitle,renderContent=_this$props2.renderContent,helpers=_this$props2.helpers,isInEditor=_this$props2.isInEditor,pairsState=this.state.pairsState;return pairs.map((function(pair,idx){return React__default.default.createElement(PairWrapper,{key:pair.key,id:pair.key,index:idx},React__default.default.createElement(CollapsibleListPair,{ref:function(_ref2){return _this2.pairsRefs[idx]=_ref2},t:t,key:pair.key,idx:idx,isExpanded:pairsState[idx],onCollapseClick:_this2.collapsePair,onExpandClick:_this2.expandPair,theme:theme,renderTitle:renderTitle,renderContent:renderContent,helpers:helpers,isInEditor:isInEditor}))}))},CollapsibleListPairs}(React.Component);CollapsibleListPairs.defaultProps={PairWrapper:"div"};var styles$1_new_pair_container="_1AgMx",styles$1_new_pair_button="_1Zqb4",styles$1_new_pair_label="_3iSqB";function NewPairButton(props){return React__default.default.createElement("div",{role:"button",tabIndex:"0",className:styles$1_new_pair_container,onClick:props.onClick,onKeyPress:function(e){return("Enter"===e.key||" "===e.key)&&props.onClick(e)},"data-hook":"CollapsibleListNewPair_button"},React__default.default.createElement("div",{className:styles$1_new_pair_button},React__default.default.createElement(PlusIcon,null),React__default.default.createElement("label",{className:styles$1_new_pair_label},props.label)))}var styles_dndIcon="hDgGn";function DndHandle(props){return React__default.default.createElement("div",_extends__default.default({className:styles_dndIcon},props.dragHandleProps),React__default.default.createElement(DndIcon,null))}var CollapsibleListComponent=function(_React$Component){function CollapsibleListComponent(_props){var _this,_this2=this;(_this=_React$Component.call(this,_props)||this).focusPair=function(pair){return setTimeout((function(){_this.collapsibleListRef.current.focusPair(pair)}))},_this.expandPair=function(idx){return _this.collapsibleListRef.current.expandPair(idx)},_this.focusTitle=function(idx){var pair={idx:idx,isTitle:!0};_this.focusPair(pair)},_this.focusContent=function(idx){var pair={idx:idx,isTitle:!1};_this.focusPair(pair)},_this.onTitleBackspace=function(idx){_this.getDataManager().getPairs().length>1&&(_this.getDataManager().deletePair(idx),_this.collapsibleListRef.current.deletePair(idx),0===idx?_this.focusTitle(idx):_this.focusContent(idx-1))},_this.renderTitle=function(idx,setRef){return React__default.default.createElement(_this2.renderInput,{value:_this.getDataManager().getTitle(idx),setRef:setRef,onChange:function(val){return _this.getDataManager().setTitle(idx,val)},placeholder:_this.titlePlaceholder,onBackspaceAtBeginningOfContent:function(){return _this.onTitleBackspace(idx)},handleReturn:_this.handleTitleReturn(idx),toolbarsToIgnore:["SideToolbar"]})},_this.renderContent=function(idx,setRef){return React__default.default.createElement(_this2.renderInput,{value:_this.getDataManager().getContent(idx),setRef:setRef,onChange:function(val){return _this.getDataManager().setContent(idx,val)},placeholder:_this.contentPlaceholder,onBackspaceAtBeginningOfContent:function(){return _this.focusTitle(idx)}})},_this.renderInput=function(_ref){var value=_ref.value,setRef=_ref.setRef,onChange=_ref.onChange,placeholder=_ref.placeholder,onBackspaceAtBeginningOfContent=_ref.onBackspaceAtBeginningOfContent,handleReturn=_ref.handleReturn,toolbarsToIgnore=_ref.toolbarsToIgnore,renderInnerRCE=_this.props.renderInnerRCE,direction=_this.getDataManager().getDirection();return renderInnerRCE({editorState:value,setRef:setRef,onChange:onChange,renderedIn:COLLAPSIBLE_LIST_TYPE,onBackspaceAtBeginningOfContent:onBackspaceAtBeginningOfContent,direction:direction,additionalProps:{textAlignment:"ltr"===direction?"left":"right",placeholder:placeholder,handleReturn:handleReturn},toolbarsToIgnore:toolbarsToIgnore,onFocus:function(){return _this.props.disableKeyboardEvents(!0)},onBlur:function(){return _this.props.disableKeyboardEvents(!1)}})},_this.handleTitleReturn=function(idx){return function(){return function(){return _this.expandPair(idx),_this.focusContent(idx),"handled"}}},_this.onNewPairButtonClick=function(){var newPairIdx=_this.getDataManager().getPairs().length;_this.getDataManager().insertNewPair(),_this.collapsibleListRef.current.insertNewPair(),_this.focusTitle(newPairIdx)},_this.onDragEnd=function(result){result.destination&&result.source.index!==result.destination.index&&(_this.getDataManager().reorderPairs(result.source.index,result.destination.index),_this.collapsibleListRef.current.reorderPairs(result.source.index,result.destination.index))},_this.getDataManager=function(props){var _ref2=props||_this.props,store=_ref2.store,componentData=_ref2.componentData;return new CollapsibleList(store,componentData)},_this.PairWrapper=function(_ref3){var id=_ref3.id,index=_ref3.index,children=_ref3.children,_this$props=_this.props,isMobile=_this$props.isMobile,blockProps=_this$props.blockProps,isDragDisabled=isMobile||!blockProps.isFocused;return React__default.default.createElement(reactBeautifulDnd.Draggable,{key:id,draggableId:id,index:index,isDragDisabled:isDragDisabled},(function(provided){return React__default.default.createElement("div",_extends__default.default({ref:provided.innerRef},provided.draggableProps),!isDragDisabled&&React__default.default.createElement(DndHandle,{dragHandleProps:provided.dragHandleProps}),children)}))},_this.onFocus=function(e){return e.stopPropagation()};var theme=_props.theme,t=_props.t;return _this.styles=wixRichContentCommon.mergeStyles({styles:styles$3,theme:theme}),_this.titlePlaceholder=t("CollapsibleList_ShownText_Placeholder"),_this.contentPlaceholder=t("CollapsibleList_CollapsedText_Placeholder"),_this.addNewPairLabel=t("CollapsibleList_ShownText_Add_Placeholder"),_this.collapsibleListRef=React__default.default.createRef(),_this}return _inheritsLoose__default.default(CollapsibleListComponent,_React$Component),CollapsibleListComponent.prototype.render=function(){var _this3=this,_this$props2=this.props,blockProps=_this$props2.blockProps,theme=_this$props2.theme,t=_this$props2.t,isMobile=_this$props2.isMobile,helpers=_this$props2.helpers,pairs=this.getDataManager().getPairs(),expandState=this.getDataManager().getExpandState(),expandOnlyOne=this.getDataManager().getExpandOnlyOne(),direction=this.getDataManager().getDirection();return React__default.default.createElement("div",{className:this.styles[direction],onFocus:this.onFocus,tabIndex:"0","data-hook":"collapsibleListComponent"},React__default.default.createElement(reactBeautifulDnd.DragDropContext,{onDragEnd:this.onDragEnd},React__default.default.createElement(reactBeautifulDnd.Droppable,{droppableId:"droppable"},(function(provided){return React__default.default.createElement("div",_extends__default.default({},provided.droppableProps,{ref:provided.innerRef}),React__default.default.createElement(CollapsibleListPairs,{ref:_this3.collapsibleListRef,theme:theme,t:t,isMobile:isMobile,pairs:pairs,expandState:expandState,expandOnlyOne:expandOnlyOne,renderTitle:_this3.renderTitle,renderContent:_this3.renderContent,PairWrapper:_this3.PairWrapper,helpers:helpers,isInEditor:!0}),provided.placeholder)}))),blockProps.isFocused&&React__default.default.createElement(NewPairButton,{label:this.addNewPairLabel,onClick:this.onNewPairButtonClick}))},CollapsibleListComponent}(React__default.default.Component),createInsertButtons=function(_ref){var _settings$toolbar,_settings$toolbar$ico,t=_ref.t,settings=_ref.settings,locale=_ref.locale,icon=(null==settings||null===(_settings$toolbar=settings.toolbar)||void 0===_settings$toolbar||null===(_settings$toolbar$ico=_settings$toolbar.icons)||void 0===_settings$toolbar$ico?void 0:_settings$toolbar$ico.InsertPluginButtonIcon)||InsertPluginIcon,componentData=_extends__default.default({},DEFAULTS,{config:_extends__default.default({},DEFAULTS.config,{direction:wixRichContentCommon.isRtl(locale)?directions_RTL:directions_LTR})});return[{type:wixRichContentEditorCommon.BUTTON_TYPES.BUTTON,name:wixRichContentEditorCommon.INSERT_PLUGIN_BUTTONS.COLLAPSIBLE_LIST,getLabel:function(){return t("CollapsibleList_InsertButton")},tooltip:t("CollapsibleListPlugin_InsertButton_Tooltip"),getIcon:function(){return icon},isActive:function(){return!1},isDisabled:function(){return!1},componentData:componentData,toolbars:[wixRichContentEditorCommon.TOOLBARS.INSERT_PLUGIN,wixRichContentEditorCommon.TOOLBARS.MOBILE,wixRichContentEditorCommon.TOOLBARS.FOOTER,wixRichContentEditorCommon.TOOLBARS.SIDE],section:"BlockToolbar_Section_Advanced"}]},createToolbar=function(_ref){var t=_ref.t,isMobile=_ref.isMobile,settings=_ref.settings,locale=_ref.locale,disableKeyboardEvents=_ref.disableKeyboardEvents;return{InlineButtons:createInlineButtons({t:t,disableKeyboardEvents:disableKeyboardEvents}),InsertButtons:createInsertButtons({t:t,settings:settings,isMobile:isMobile,locale:locale}),name:COLLAPSIBLE_LIST_TYPE}};function _toPropertyKey(arg){var key=function(input,hint){if("object"!=typeof input||null===input)return input;var prim=input[Symbol.toPrimitive];if(void 0!==prim){var res=prim.call(input,hint||"default");if("object"!=typeof res)return res;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===hint?String:Number)(input)}(arg,"string");return"symbol"==typeof key?key:String(key)}var createCollapsibleListPlugin=function(config){var localeContent=config.localeContent,locale=config.locale,helpers=config.helpers,t=config.t,_config$COLLAPSIBLE_L=config[COLLAPSIBLE_LIST_TYPE],settings=void 0===_config$COLLAPSIBLE_L?{}:_config$COLLAPSIBLE_L,isMobile=config.isMobile,disableKeyboardEvents=config.disableKeyboardEvents,rest=_objectWithoutPropertiesLoose__default.default(config,["localeContent","locale","helpers","t",COLLAPSIBLE_LIST_TYPE,"isMobile","disableKeyboardEvents"].map(_toPropertyKey));return wixRichContentPluginCommons.createBasePlugin(_extends__default.default({component:CollapsibleListComponent,type:COLLAPSIBLE_LIST_TYPE,toolbar:createToolbar({helpers:helpers,t:t,settings:settings,isMobile:isMobile,locale:localeContent||locale,disableKeyboardEvents:disableKeyboardEvents}),helpers:helpers,settings:settings,t:t,isMobile:isMobile,defaultPluginData:DEFAULTS,noPluginBorder:!0,noPointerEventsOnFocus:!0,locale:localeContent||locale,disableKeyboardEvents:disableKeyboardEvents},rest))};createCollapsibleListPlugin.functionName=COLLAPSIBLE_LIST_TYPE;var CollapsibleListViewer=function(_Component){function CollapsibleListViewer(props){var _this;(_this=_Component.call(this,props)||this).getPair=function(idx){return _this.props.componentData.pairs[idx]},_this.renderInnerRCV=function(contentState){var _this$props=_this.props,innerRCV=_this$props.innerRCV,componentData=_this$props.componentData;return innerRCV({contentState:contentState,textAlignment:function(componentData){return"ltr"===componentData.config.direction?"left":"right"}(componentData),direction:function(componentData){return componentData.config.direction}(componentData)})},_this.renderTitle=function(idx){var pair=_this.getPair(idx);return _this.renderInnerRCV(pair.title)},_this.renderContent=function(idx){var pair=_this.getPair(idx);return _this.renderInnerRCV(pair.content)};var theme=props.theme;return _this.styles=wixRichContentCommon.mergeStyles({styles:styles$3,theme:theme}),_this}return _inheritsLoose__default.default(CollapsibleListViewer,_Component),CollapsibleListViewer.prototype.render=function(){var _this$props2=this.props,theme=_this$props2.theme,t=_this$props2.t,componentData=_this$props2.componentData,isMobile=_this$props2.isMobile,helpers=_this$props2.helpers,config=componentData.config,pairs=componentData.pairs,direction=config.direction,expandState=config.expandState,expandOnlyOne=config.expandOnlyOne;return React__default.default.createElement("div",{className:this.styles[direction]},React__default.default.createElement(CollapsibleListPairs,{theme:theme,t:t,isMobile:isMobile,pairs:pairs,expandState:expandState,expandOnlyOne:expandOnlyOne,renderTitle:this.renderTitle,renderContent:this.renderContent,helpers:helpers}))},CollapsibleListViewer}(React.Component);exports.COLLAPSIBLE_LIST_TYPE=COLLAPSIBLE_LIST_TYPE,exports.Modals=Modals,exports.ModalsMap=ModalsMap,exports.collapsibleListViewer=CollapsibleListViewer,exports.createCollapsibleListPlugin=createCollapsibleListPlugin,exports.pluginCollapsibleList=function(config){return{config:_extends__default.default({},DEFAULTS.config,config),type:COLLAPSIBLE_LIST_TYPE,createPlugin:createCollapsibleListPlugin,ModalsMap:ModalsMap}}; | ||
//# sourceMappingURL=module.cjs.js.map |
@@ -1,2 +0,2 @@ | ||
import _extends from"@babel/runtime/helpers/extends";import _objectWithoutPropertiesLoose from"@babel/runtime/helpers/objectWithoutPropertiesLoose";import React,{Fragment,PureComponent,Component}from"react";import{isFunction,isArray,groupBy,cloneDeep,merge,isString,has,debounce}from"lodash";import _inheritsLoose from"@babel/runtime/helpers/inheritsLoose";import{mergeStyles}from"wix-rich-content-common";import ReactDOM from"react-dom";import Measure from"react-measure";import{RichContentViewer}from"wix-rich-content-viewer";var METHOD_BLOCK_MAP=Object.freeze({h1:"header-one",h2:"header-two",h3:"header-three",h4:"header-four",h5:"header-five",h6:"header-six",quote:"blockquote"}),METHOD_GROUPED_BLOCK_MAP=Object.freeze({plain:"unstyled",code:"code-block",ol:"ordered-list-item",ul:"unordered-list-item"}),METHOD_PLUGIN_DATA_MAP=Object.freeze({image:{type:"wix-draft-plugin-image",mutability:"IMMUTABLE",data:{config:{alignment:"center",size:"content",showTitle:!1,showDescription:!1}}},video:{type:"wix-draft-plugin-video",mutability:"IMMUTABLE",data:{config:{size:"content",alignment:"center"}}},gallery:{type:"wix-draft-plugin-gallery",mutability:"IMMUTABLE",data:{config:{alignment:"center",size:"content",layout:"small",spacing:0},styles:{galleryLayout:2,gallerySizeType:"px",gallerySizePx:300,galleryMargin:0,oneRow:!1,cubeRatio:1,galleryThumbnailsAlignment:"bottom",isVertical:!0,numberOfImagesPerRow:3,imageMargin:20,thumbnailSpacings:0,cubeType:"fill",enableInfiniteScroll:!0,titlePlacement:"SHOW_ON_HOVER",allowHover:!1,itemClick:"link",fullscreen:!1,showArrows:!1,gridStyle:1,loveButton:!1,allowSocial:!1,allowDownload:!1,mobileSwipeAnimation:"NO_EFFECT",thumbnailSize:120,gotStyleParams:!0,cubeImages:!0,groupSize:1,groupTypes:"1",hasThumbnails:!1,enableScroll:!0,isGrid:!0,isSlider:!1,isColumns:!1,isSlideshow:!1,cropOnlyFill:!1,smartCrop:!1,imageResize:!1,galleryImageRatio:2,galleryType:"Columns",minItemSize:50,videoPlay:"auto"}}},soundCloud:{type:"wix-draft-plugin-sound-cloud",mutability:"IMMUTABLE",data:{config:{size:"content",alignment:"center"}}},giphy:{type:"wix-draft-plugin-giphy",mutability:"IMMUTABLE",data:{config:{size:"content",alignment:"center"}}},map:{type:"wix-draft-plugin-map",mutability:"IMMUTABLE",data:{config:{size:"content",alignment:"center",width:400,height:400}}},file:{type:"wix-draft-plugin-file-upload",mutability:"IMMUTABLE",data:{config:{alignment:"left",size:"small"}}},divider:{type:"wix-draft-plugin-divider",mutability:"IMMUTABLE",data:{type:"single",config:{size:"large",alignment:"center",textWrap:"nowrap"}}},link:{type:"LINK",mutability:"IMMUTABLE",data:{config:{}}},linkPreview:{type:"wix-draft-plugin-link-preview",mutability:"IMMUTABLE",data:{config:{size:"content",alignment:"center"}}}}),INTERACTIONS=Object.freeze({READ_MORE:"READ_MORE",IMAGE_COUNTER:"IMAGE_COUNTER",SEE_FULL_CONTENT:"SEE_FULL_CONTENT"}),getPoster=function(item){var _item$url$thumbnail,_item$thumbnail,_item$url$thumbnail2,_item$thumbnail2,_item$url$thumbnail3,_item$thumbnail3;return{url:(null===(_item$url$thumbnail=item.url.thumbnail)||void 0===_item$url$thumbnail?void 0:_item$url$thumbnail.pathname)||(null===(_item$thumbnail=item.thumbnail)||void 0===_item$thumbnail?void 0:_item$thumbnail.pathname)||item.thumbnail_url||item.thumbnail,width:(null===(_item$url$thumbnail2=item.url.thumbnail)||void 0===_item$url$thumbnail2?void 0:_item$url$thumbnail2.width)||(null===(_item$thumbnail2=item.thumbnail)||void 0===_item$thumbnail2?void 0:_item$thumbnail2.width)||item.thumbnail_width||item.width,height:(null===(_item$url$thumbnail3=item.url.thumbnail)||void 0===_item$url$thumbnail3?void 0:_item$url$thumbnail3.height)||(null===(_item$thumbnail3=item.thumbnail)||void 0===_item$thumbnail3?void 0:_item$thumbnail3.height)||item.thumbnail_height||item.height}},galleryTypeConverters={giphy:function(item){var _item$width=item.width,width=void 0===_item$width?600:_item$width,_item$height=item.height,height=void 0===_item$height?480:_item$height;return{mediaUrl:item.mp4,metadata:{type:"video",videoUrl:item.mp4,videoId:item.url,poster:{url:item.url,width:width,height:height},source:"giphy",width:width,height:height}}},video:function(item){var _item$url,isCustom=item.isCustom,_ref=isCustom?item.url:item,_ref$width=_ref.width,width=void 0===_ref$width?600:_ref$width,_ref$height=_ref.height,height=void 0===_ref$height?480:_ref$height,url=isCustom?null===(_item$url=item.url)||void 0===_item$url?void 0:_item$url.pathname:item.url;return{url:url,mediaUrl:url,metadata:{type:"video",poster:getPoster(item),videoId:url,width:width,height:height}}},image:function(item){return{itemId:item.id||item.url,metadata:{width:item.width,height:item.height}}}},toGalleryItems=function(items){return items.map((function(item,index){return _extends({itemId:item.id||"item-"+index,url:item.url},galleryTypeConverters[item.type](item))}))},defaultMerger=function(mediaInfo,entity){return _extends({},entity,{data:_extends({},entity.data,mediaInfo)})},videoMerger=function(_ref2,entity){var url=_ref2.url,isCustom=_ref2.isCustom;return _extends({},entity,{data:_extends({},entity.data,{src:url,isCustomVideo:!!isCustom})})},mergers={"wix-draft-plugin-image":function(_ref,entity){var url=_ref.url,width=_ref.width,height=_ref.height,_ref$alt=_ref.alt,alt=void 0===_ref$alt?"":_ref$alt,_ref$caption=_ref.caption,caption=void 0===_ref$caption?"":_ref$caption,link=_ref.link,_ref$source=_ref.source,source=void 0===_ref$source?null:_ref$source;return _extends({},entity,{data:_extends({},entity.data,{config:_extends({},entity.data.config,link?{link:link}:{}),metadata:{alt:alt,caption:caption},src:_extends({width:width,height:height},"static"===source?{url:url,source:source}:{file_name:url})})})},"wix-draft-plugin-gallery":function(items,entity){return _extends({},entity,{data:_extends({},entity.data,{items:toGalleryItems(items)})})},"wix-draft-plugin-giphy":function(_ref3,entity){var width=_ref3.width,height=_ref3.height,url=_ref3.url,thumbnail=_ref3.thumbnail;return _extends({},entity,{data:_extends({},entity.data,{gif:{width:width,height:height,originalUrl:url,stillUrl:thumbnail}})})},"wix-draft-plugin-video":videoMerger,"wix-draft-plugin-sound-cloud":videoMerger,"wix-draft-plugin-file-upload":function(_ref4,entity){var fileType=_ref4.fileType,name=_ref4.name,url=_ref4.url;return _extends({},entity,{data:_extends({},entity.data,{type:fileType,name:name,url:url})})},"wix-draft-plugin-map":function(mapSettings,entity){return _extends({},entity,{data:_extends({},entity.data,{mapSettings:mapSettings})})},"wix-draft-plugin-divider":defaultMerger,mention:defaultMerger,LINK:defaultMerger,"wix-draft-plugin-link-preview":function(_ref5,entity){var url=_ref5.url;return _extends({},entity,{data:_extends({},entity.data,{config:_extends({},entity.data.config,{link:_extends({},entity.data.config.link,{url:url})})})})},"wix-draft-plugin-headers-markdown":defaultMerger,"wix-draft-plugin-link-button":defaultMerger,"wix-draft-plugin-action-button":defaultMerger,"wix-draft-plugin-poll":defaultMerger,"wix-draft-plugin-html":defaultMerger},DEFAULT_BLOCK_CONFIG={data:{},inlineStyleRanges:[],entityRanges:[],depth:0},createBlock=function(type,text,config){return _extends({key:Math.random().toString(36).substr(2,5),type:type,text:text},_extends({},DEFAULT_BLOCK_CONFIG,config||{}))},addPlugin=function(_ref3){var contentState=_ref3.contentState,data=_ref3.data,config=_ref3.config;return function(_ref2){var _extends2,mediaInfo,entity,contentState=_ref2.contentState,data=_ref2.data,config=_ref2.config,mergedEntity=(mediaInfo=data,mergers[(entity=config).type](mediaInfo,entity));return _extends({},contentState,{entityMap:_extends({},contentState.entityMap,(_extends2={},_extends2[Object.keys(contentState.entityMap).length]=mergedEntity,_extends2))})}({contentState:function(_ref){var contentState=_ref.contentState,text=_ref.text,type=_ref.type,config=_ref.config;return _extends({},contentState,{blocks:[].concat(contentState.blocks,[createBlock(type,text,config)])})}({contentState:contentState,text:" ",type:"atomic",config:{entityRanges:[{offset:0,length:1,key:Object.keys(contentState.entityMap).length}]}}),data:data,config:config})},interactionDataMerger=function(_ref){var contentState=_ref.contentState,_ref$settings=_ref.settings,settings=void 0===_ref$settings?{}:_ref$settings,_ref$blockFilter=_ref.blockFilter,blockFilter=void 0===_ref$blockFilter?function(){}:_ref$blockFilter,type=_ref.type,_ref$schema=_ref.schema,schema=void 0===_ref$schema?[]:_ref$schema;if(!contentState.blocks||0===contentState.blocks.length)return contentState;var lastBlock=contentState.blocks.slice(-1)[0];if(blockFilter(lastBlock))return contentState;var invalidSettings=Object.keys(settings).filter((function(key){return!schema.includes(key)}));if(invalidSettings.length>0&&console.error("Warning: invalid "+type+" interaction settings found",invalidSettings),"atomic"!==lastBlock.type){var _lastBlock$data,modifiedBlock=_extends({},lastBlock,{data:_extends({},lastBlock.data,{interactions:[].concat((null==lastBlock||null===(_lastBlock$data=lastBlock.data)||void 0===_lastBlock$data?void 0:_lastBlock$data.interactions)||[],[{type:type,settings:settings}])})});return _extends({},contentState,{blocks:[].concat(contentState.blocks.slice(0,contentState.blocks.length-1),[modifiedBlock])})}var lastBlockEntityKey=lastBlock.entityRanges.length>0&&lastBlock.entityRanges[0].key;if(!1!==lastBlockEntityKey){var _extends2,lastBlockEntity=contentState.entityMap[lastBlockEntityKey],modifiedEntity=_extends({},lastBlockEntity,{data:_extends({},lastBlockEntity&&lastBlockEntity.data,{interactions:[].concat(lastBlockEntity&&lastBlockEntity.data.interactions||[],[{type:type,settings:settings}])})});return _extends({},contentState,{entityMap:_extends({},contentState.entityMap,(_extends2={},_extends2[lastBlockEntityKey]=modifiedEntity,_extends2))})}return contentState},DEFAULT_STATE={blocks:[],entityMap:{},VERSION:"8.63.6"},ContentStateBuilder=function(){function ContentStateBuilder(initialState){this.contentState=_extends({},DEFAULT_STATE,initialState||{})}return ContentStateBuilder.prototype.get=function(){return this.contentState},ContentStateBuilder}();Object.keys(_extends({},METHOD_BLOCK_MAP,METHOD_GROUPED_BLOCK_MAP)).forEach((function(method){ContentStateBuilder.prototype[method]=function(textBlocksWithEntities){var content,textContentArray=isArray(content=textBlocksWithEntities)?content:[content];return this.contentState=textContentArray.reduce((function(state,_ref){return _ref4={contentState:state,block:_ref.block,entities:_ref.entities},block=_ref4.block,entities=_ref4.entities,_extends({},contentState=_ref4.contentState,{blocks:[].concat(contentState.blocks,[block]),entityMap:_extends({},contentState.entityMap,entities)});var _ref4,contentState,block,entities}),this.contentState),this}})),Object.entries(METHOD_PLUGIN_DATA_MAP).forEach((function(_ref2){var method=_ref2[0],defaultEntityData=_ref2[1];ContentStateBuilder.prototype[method]=function(_ref3){var mediaInfo=_ref3.mediaInfo,_ref3$config=_ref3.config,config=void 0===_ref3$config?{}:_ref3$config,_ref3$overrides=_ref3.overrides,overrides=void 0===_ref3$overrides?{}:_ref3$overrides;return this.contentState=addPlugin({contentState:this.contentState,data:mediaInfo,config:_extends({},defaultEntityData,{data:_extends({},defaultEntityData.data,{config:_extends({},defaultEntityData.data.config,config)},overrides)})}),this}})),Object.entries({readMore:function(builder,settings){return void 0===settings&&(settings={}),builder.contentState=interactionDataMerger({contentState:builder.contentState,settings:settings,blockFilter:function(block){return"atomic"===block.type},type:INTERACTIONS.READ_MORE,schema:["label","onClick","expandMode","lines","text","showToggle"]}),builder},seeFullPost:function(builder,settings){return void 0===settings&&(settings={}),builder.contentState=interactionDataMerger({contentState:builder.contentState,settings:settings,blockFilter:function(){return!1},type:INTERACTIONS.SEE_FULL_CONTENT,schema:["label","labelStyles","overlayStyles","onClick"]}),builder},imageCounter:function(builder,settings){return void 0===settings&&(settings={}),builder.contentState=interactionDataMerger({contentState:builder.contentState,settings:settings,blockFilter:function(block){return"atomic"!==block.type},type:INTERACTIONS.IMAGE_COUNTER,schema:["counter","formatLabel","onClick","style"]}),builder}}).forEach((function(_ref4){var key=_ref4[0],method=_ref4[1];ContentStateBuilder.prototype[key]=function(settings){return method(this,settings)}}));var defaultEntityConverter=function(){return[]},videoConverter=function(_ref3){var _src$thumbnail,_ref3$data=_ref3.data,_ref3$data$src=_ref3$data.src,src=void 0===_ref3$data$src?{}:_ref3$data$src,isCustomVideo=_ref3$data.isCustomVideo,_ref3$data$metadata=_ref3$data.metadata,metadata=void 0===_ref3$data$metadata?{}:_ref3$data$metadata;return[{type:"video",url:isString(src)?src:src.pathname,isCustom:isCustomVideo,thumbnail:has(src,"thumbnail")?null===(_src$thumbnail=src.thumbnail)||void 0===_src$thumbnail?void 0:_src$thumbnail.pathname:metadata.thumbnail_url||"",caption:metadata.title||""}]},linkConverter=function(entity){return[{type:"link",url:entity.data.url}]},converters={"wix-draft-plugin-image":function(entity){var _entity$data$src,_entity$data$src2,_entity$data$src3,_entity$data$metadata,_entity$data$metadata2,_entity$data$config;return[{width:null===(_entity$data$src=entity.data.src)||void 0===_entity$data$src?void 0:_entity$data$src.width,height:null===(_entity$data$src2=entity.data.src)||void 0===_entity$data$src2?void 0:_entity$data$src2.height,url:null===(_entity$data$src3=entity.data.src)||void 0===_entity$data$src3?void 0:_entity$data$src3.file_name,type:"image",alt:(null===(_entity$data$metadata=entity.data.metadata)||void 0===_entity$data$metadata?void 0:_entity$data$metadata.alt)||"",caption:(null===(_entity$data$metadata2=entity.data.metadata)||void 0===_entity$data$metadata2?void 0:_entity$data$metadata2.caption)||"",link:null===(_entity$data$config=entity.data.config)||void 0===_entity$data$config?void 0:_entity$data$config.link}]},"wix-draft-plugin-gallery":function(entity){return entity.data.items.filter((function(_ref){var metadata=_ref.metadata;return!(null!=metadata&&metadata.type)||"image"===(null==metadata?void 0:metadata.type)||"video"===(null==metadata?void 0:metadata.type)})).map((function(_ref2){var _metadata$poster,metadata=_ref2.metadata,url=_ref2.url,itemId=_ref2.itemId;return"video"===(null==metadata?void 0:metadata.type)?{type:"video",url:url,thumbnail:(null==metadata||null===(_metadata$poster=metadata.poster)||void 0===_metadata$poster?void 0:_metadata$poster.url)||"",caption:(null==metadata?void 0:metadata.title)||"",isGalleryItem:!0}:{url:url,height:null==metadata?void 0:metadata.height,width:null==metadata?void 0:metadata.width,id:itemId,type:"image",alt:(null==metadata?void 0:metadata.altText)||"",caption:(null==metadata?void 0:metadata.title)||"",isGalleryItem:!0}}))},"wix-draft-plugin-divider":defaultEntityConverter,"wix-draft-plugin-video":videoConverter,"wix-draft-plugin-sound-cloud":videoConverter,"wix-draft-plugin-giphy":function(entity){var _entity$data$gif,_entity$data$gif2,_entity$data$gif3,_entity$data$gif4,_entity$data$gif5;return[{type:"giphy",url:null===(_entity$data$gif=entity.data.gif)||void 0===_entity$data$gif?void 0:_entity$data$gif.originalUrl,mp4:null===(_entity$data$gif2=entity.data.gif)||void 0===_entity$data$gif2?void 0:_entity$data$gif2.downsizedSmallMp4,thumbnail:null===(_entity$data$gif3=entity.data.gif)||void 0===_entity$data$gif3?void 0:_entity$data$gif3.stillUrl,width:null===(_entity$data$gif4=entity.data.gif)||void 0===_entity$data$gif4?void 0:_entity$data$gif4.width,height:null===(_entity$data$gif5=entity.data.gif)||void 0===_entity$data$gif5?void 0:_entity$data$gif5.height,source:"static"}]},"wix-draft-plugin-file-upload":function(entity){return[{name:entity.data.name,type:"file",fileType:entity.data.type,url:entity.data.url}]},"wix-draft-plugin-map":function(entity){return[{type:"map",mapSettings:entity.data.mapSettings}]},mention:defaultEntityConverter,"wix-draft-plugin-headers-markdown":defaultEntityConverter,"wix-draft-plugin-link-button":defaultEntityConverter,"wix-draft-plugin-action-button":defaultEntityConverter,"wix-draft-plugin-poll":defaultEntityConverter,LINK:linkConverter,LINK_PREVIEW:linkConverter,"wix-draft-plugin-html":defaultEntityConverter},extractTextBlocksWithEntities=function(_ref,blockFilter){var blocks=_ref.blocks,entityMap=_ref.entityMap;return blocks.filter(blockFilter).reduce((function(texts,block){var entities=block.entityRanges.reduce((function(map,range){return map["_"+range.key]=entityMap[range.key],map}),{}),_block=_extends({},block,{entityRanges:block.entityRanges.map((function(range){return _extends({},range,{key:"_"+range.key})}))});return[].concat(texts,[{block:_block,entities:entities}])}),[])},extractTextBlockArray=function(raw,blockTypeFilter){return extractTextBlocksWithEntities(raw,(function(_ref2){var type=_ref2.type,text=_ref2.text;return blockTypeFilter(type)&&text.length>0}))},createTextFragments=function(raw){return(_ref3=raw,blockTypeFilter=function(type){return"atomic"!==type},blocks=_ref3.blocks,entityMap=_ref3.entityMap,current=0,next=0,batches=groupBy(blocks,(function(block){var isValid=blockTypeFilter(block.type);return isValid?current===next&&next++:current<next&¤t++,isValid&¤t})),Object.entries(batches).filter((function(value){return"false"!==value[0]})).map((function(batch){return extractTextBlocksWithEntities({blocks:batch[1],entityMap:entityMap},(function(_ref4){var type=_ref4.type,text=_ref4.text;return blockTypeFilter(type)&&text.length>0}))})).filter((function(batch){return batch.length>0}))).filter((function(batch){return batch.length})).map((function(batch){var textCombined=batch.map((function(entry){return entry.block.text})).join("\n"),copyBlocks=cloneDeep(batch),offset=0;copyBlocks.forEach((function(entry){entry.block.inlineStyleRanges.map((function(style){return style.offset+=offset})),entry.block.entityRanges.map((function(entity){return entity.offset+=offset})),offset+=entry.block.text.length+"\n".length}));var inlineStyleRanges=copyBlocks.flatMap((function(entry){return entry.block.inlineStyleRanges})),entityRanges=copyBlocks.flatMap((function(entry){return entry.block.entityRanges})),entities=copyBlocks.map((function(block){return block.entities})).reduce((function(acc,curr){return _extends({},acc,curr)}));return merge(cloneDeep(batch[0]),{block:{text:textCombined,inlineStyleRanges:inlineStyleRanges,entityRanges:entityRanges},entities:entities})}));var _ref3,blockTypeFilter,blocks,entityMap,current,next,batches},getContentStateMetadata=function(raw){var entityMap,mediaEntities=function(_ref6){var entityMap=_ref6.entityMap;return Object.values(entityMap).filter((function(entity){var _ref7$config=(entity.data||{}).config,config=void 0===_ref7$config?{}:_ref7$config;return!("spoiler"in config)||!config.spoiler.enabled})).reduce((function(media,entity){return[].concat(media,function(entity){return converters[entity.type]?converters[entity.type](entity):[]}(entity))}),[])}(raw),galleryItems=mediaEntities.filter((function(_ref9){return _ref9.isGalleryItem})),singleMediaItems=mediaEntities.filter((function(_ref10){var type=_ref10.type,isGalleryItem=_ref10.isGalleryItem;return function(type){return type&&["image","video","giphy"].includes(type)}(type)&&!isGalleryItem})),media={singleMediaItems:singleMediaItems,galleryItems:galleryItems,totalCount:galleryItems.length+singleMediaItems.length},blocks=Object.entries(METHOD_BLOCK_MAP).reduce((function(prev,_ref11){var _extends2,func=_ref11[0],blockType=_ref11[1];return _extends({},prev,((_extends2={})[func]=extractTextBlockArray(raw,(function(type){return type===blockType})),_extends2))}),{}),groupedBlocks=Object.entries(METHOD_GROUPED_BLOCK_MAP).reduce((function(prev,_ref12){var _extends3,func=_ref12[0],blockType=_ref12[1];return _extends({},prev,((_extends3={})[func]=function(_ref5,blockType){return _ref5.blocks.reduce((function(result,block,idx){if(block.type===blockType){var list=-1===result.lastItemIndex?[].concat(result.list,[[]]):result.list;return list[list.length-1]=[].concat(list[list.length-1],[block]),{list:list,lastItemIndex:idx}}return{list:result.list,lastItemIndex:-1}}),{list:[],lastItemIndex:-1}).list.filter((function(arr){return arr.length>0}))}(raw,blockType).map((function(blocks){return extractTextBlockArray({blocks:blocks,entityMap:raw.entityMap},(function(type){return type===blockType}))})).filter((function(arr){return arr.length>0})),_extends3))}),{}),nonMediaPluginsCount=(entityMap=raw.entityMap,Object.values(entityMap).length-media.totalCount),nonSeparatorPlugins=mediaEntities.filter((function(_ref13){var type=_ref13.type;return["link","hashtag","mention"].includes(type)}));return _extends({allText:extractTextBlockArray(raw,(function(type){return"atomic"!==type})),textFragments:createTextFragments(raw),media:media,images:mediaEntities.filter((function(_ref14){return"image"===_ref14.type})),videos:mediaEntities.filter((function(_ref15){return"video"===_ref15.type})),files:mediaEntities.filter((function(_ref16){return"file"===_ref16.type})),maps:mediaEntities.filter((function(_ref17){return"map"===_ref17.type})),links:mediaEntities.filter((function(_ref18){return"link"===_ref18.type})),nonMediaPluginsCount:nonMediaPluginsCount,collapsablePluginsCount:nonMediaPluginsCount-nonSeparatorPlugins.length},blocks,groupedBlocks)},ContentStateTransformation=function(){function ContentStateTransformation(_ref){var _if=_ref._if,_then=_ref._then,initialPreviewState=_ref.initialPreviewState;this.rules=[],this.rule({_if:_if,_then:_then}),this.previewState=initialPreviewState}var _proto=ContentStateTransformation.prototype;return _proto.rule=function(_ref2){var _if=_ref2._if,_then=_ref2._then;if(!isFunction(_if)||!isFunction(_then))throw new TypeError("invalid rule added: `_if` and `_then` should be functions ");return this.rules.push({_if:_if,_then:_then}),this},_proto.apply=function(contentState){var previewStateBuilder=new ContentStateBuilder(this.previewState),metadata=getContentStateMetadata(contentState);return this.rules.reduce((function(builder,rule){return rule._if(metadata)?rule._then(metadata,builder):builder}),previewStateBuilder).get()},_proto.toObject=function(){return this.rules.map((function(rule){return{_if:rule._if.toString(),_then:rule._then.toString()}}))},ContentStateTransformation}(),styles$3={readMore:"_12Azt",readMore_label:"wzP_E",readMore_wrapper:"_3N2Zu",readMore_calculationWrapper:"QJo1L"},ReadMore=function(_PureComponent){function ReadMore(props){var _this;return(_this=_PureComponent.call(this,props)||this).onClick=function(e){var _this$props$onPreview,_this$props;e.preventDefault(),null===(_this$props$onPreview=(_this$props=_this.props).onPreviewExpand)||void 0===_this$props$onPreview||_this$props$onPreview.call(_this$props)},_this.onReflow=function(_ref){var clamped=_ref.clamped;_this.setState({clamped:clamped})},_this.state={clamped:!1},_this.rmContainer=React.createRef(),_this.rmMocker=React.createRef(),_this}_inheritsLoose(ReadMore,_PureComponent);var _proto=ReadMore.prototype;return _proto.componentDidMount=function(){var _this$rmContainer,_this$rmContainer$cur,_this$rmMocker,_this$rmMocker$curren,height=null===(_this$rmContainer=this.rmContainer)||void 0===_this$rmContainer||null===(_this$rmContainer$cur=_this$rmContainer.current)||void 0===_this$rmContainer$cur?void 0:_this$rmContainer$cur.clientHeight,originalHeight=null===(_this$rmMocker=this.rmMocker)||void 0===_this$rmMocker||null===(_this$rmMocker$curren=_this$rmMocker.current)||void 0===_this$rmMocker$curren?void 0:_this$rmMocker$curren.clientHeight;height&&originalHeight&&this.setState({clamped:originalHeight>height})},_proto.render=function(){var clamped=this.state.clamped,_this$props$showToggl=this.props.showToggle,showToggle=void 0===_this$props$showToggl||_this$props$showToggl,_this$props2=this.props,_this$props2$lines=_this$props2.lines,lines=void 0===_this$props2$lines?3:_this$props2$lines,_this$props2$label=_this$props2.label,label=void 0===_this$props2$label?this.props.t("Preview_ReadMore_Label"):_this$props2$label,children=_this$props2.children;return this.styles=this.styles||mergeStyles({styles:styles$3,theme:this.props.theme}),React.createElement(Fragment,null,React.createElement("div",{className:styles$3.readMore_wrapper,ref:this.rmContainer,style:{WebkitLineClamp:lines}},children),React.createElement("div",{ref:this.rmMocker,className:styles$3.readMore_calculationWrapper},children),clamped&&showToggle&&React.createElement("a",{href:"",role:"button",onClick:this.onClick,className:this.styles.readMore_label},label))},ReadMore}(PureComponent),styles$2={readMore:"_1ApJW",readMore_label:"eTqNQ",seeFullPost_label:"tAZX-",readMore_wrapper:"_2hV2v",readMore_calculationWrapper:"_1_cK8",seeFullPost_container:"_DSpL",seeFullPost_overlay:"_1KhhV"},SeeFullPost=function(_PureComponent){function SeeFullPost(){var _this;return(_this=_PureComponent.apply(this,arguments)||this).onClick=function(e){var _this$props=_this.props,onClick=_this$props.onClick,onPreviewExpand=_this$props.onPreviewExpand;e.preventDefault(),null==onClick||onClick(e),null==onPreviewExpand||onPreviewExpand()},_this}return _inheritsLoose(SeeFullPost,_PureComponent),SeeFullPost.prototype.render=function(){this.styles=this.styles||mergeStyles({styles:styles$2,theme:this.props.theme});var _this$props2=this.props,_this$props2$label=_this$props2.label,label=void 0===_this$props2$label?this.props.t("Preview_ReadMore_Label"):_this$props2$label,children=_this$props2.children,overlayStyles=_this$props2.overlayStyles,labelStyles=_this$props2.labelStyles;return React.createElement("div",{className:this.styles.seeFullPost_container},children,React.createElement("div",{className:this.styles.seeFullPost_overlay,style:overlayStyles,onClick:this.onClick},React.createElement("span",{className:this.styles.seeFullPost_label,style:labelStyles},label)))},SeeFullPost}(PureComponent),styles$1={imageCounter_overlay:"_2Jbbp",imageCounter_container:"_3qaU_",imageCounter_label:"_1H6T8",imageCounter_measure:"_1SWX6"},ImageCounter=function(_PureComponent){function ImageCounter(){var _this;return(_this=_PureComponent.apply(this,arguments)||this).onClick=function(e){var _this$props=_this.props,onClick=_this$props.onClick,onPreviewExpand=_this$props.onPreviewExpand;e.preventDefault(),onClick(),null==onPreviewExpand||onPreviewExpand()},_this.renderDecoration=function(element){var _this$props2=_this.props,formatLabel=_this$props2.formatLabel,counter=_this$props2.counter,rect=element.getBoundingClientRect(),parentRect=_this.container.getBoundingClientRect(),style={width:rect.width,height:rect.height,top:rect.top-parentRect.top,left:rect.left-parentRect.left};return React.createElement("div",{className:_this.styles.imageCounter_container,style:style},React.createElement("span",{className:_this.styles.imageCounter_label},formatLabel(counter)))},_this.decorateImages=function(){if(_this.wrapper){var images=_this.wrapper.querySelectorAll("[role=link]"),imagesToDecorate=_this.props.imageSelector(images),decorations=[];imagesToDecorate.forEach((function(image){return decorations.push(_this.renderDecoration(image))})),ReactDOM.render(decorations,_this.container)}},_this.onResize=debounce(_this.decorateImages,200),_this.handleWrapper=function(el){return _this.wrapper=el},_this.handleContainer=function(el){return _this.container=el},_this}_inheritsLoose(ImageCounter,_PureComponent);var _proto=ImageCounter.prototype;return _proto.componentDidMount=function(){this.decorateImages()},_proto.render=function(){var _this2=this;return this.styles=this.styles||mergeStyles({styles:styles$1,theme:this.props.theme}),React.createElement(Measure,{onResize:this.onResize},(function(_ref){var measureRef=_ref.measureRef;return React.createElement("div",{ref:measureRef,className:_this2.styles.imageCounter_measure},React.createElement("div",{ref:_this2.handleWrapper,onClick:_this2.onClick},React.createElement("div",{ref:_this2.handleContainer,className:_this2.styles.imageCounter_overlay}),_this2.props.children))}))},ImageCounter}(PureComponent);ImageCounter.defaultProps={formatLabel:function(counter){return"+ "+counter},onClick:function(){},imageSelector:function(images){return images&&images.length>0?[images[images.length-1]]:[]}};var _excluded$1=["children"],interactionMap=function(onPreviewExpand){var _Object$entries;return Object.entries((_Object$entries={},_Object$entries[INTERACTIONS.READ_MORE]=ReadMore,_Object$entries[INTERACTIONS.SEE_FULL_CONTENT]=SeeFullPost,_Object$entries[INTERACTIONS.IMAGE_COUNTER]=ImageCounter,_Object$entries)).reduce((function(map,_ref){var _extends2,key=_ref[0],Component=_ref[1];return _extends({},map,((_extends2={})[key]=function(_ref2){var children=_ref2.children,props=_objectWithoutPropertiesLoose(_ref2,_excluded$1);return React.createElement(Component,Object.assign({},_extends({onPreviewExpand:onPreviewExpand},props)),children)},_extends2))}),{})},galleryStyle={galleryLayout:2,gallerySizeType:"px",gallerySizePx:300,galleryMargin:0,oneRow:!1,cubeRatio:1,galleryThumbnailsAlignment:"bottom",isVertical:!1,imageMargin:20,thumbnailSpacings:0,cubeType:"fill",enableInfiniteScroll:!0,titlePlacement:"SHOW_ON_HOVER",allowHover:!1,itemClick:"link",fullscreen:!1,showArrows:!1,gridStyle:1,loveButton:!1,allowSocial:!1,allowDownload:!1,mobileSwipeAnimation:"NO_EFFECT",thumbnailSize:120,gotStyleParams:!0,showVideoPlayButton:!1,videoPlay:"auto",numberOfImagesPerRow:2},showReadMore=function(_ref){return _ref.media.singleMediaItems.length<2},showFullPost=function(_ref2){var singleMediaItems=_ref2.media.singleMediaItems,textFragments=_ref2.textFragments,nonMediaPluginsCount=_ref2.nonMediaPluginsCount,collapsablePluginsCount=_ref2.collapsablePluginsCount;return textFragments.length>1&&0===singleMediaItems.length||nonMediaPluginsCount>0&&collapsablePluginsCount>0},defaultTransformation=new ContentStateTransformation({_if:function(metadata){return metadata.allText.length>0},_then:function(metadata,preview){var textFragments=metadata.textFragments,nonMediaPluginsCount=metadata.nonMediaPluginsCount,collapsablePluginsCount=metadata.collapsablePluginsCount,_metadata$media=metadata.media,singleMediaItems=_metadata$media.singleMediaItems,galleryItems=_metadata$media.galleryItems,showToggle=showReadMore(metadata)&&!showFullPost(metadata)&&0===collapsablePluginsCount&&1===textFragments.length,previewToDisplay=preview.plain(textFragments[0]).readMore({lines:3,showToggle:showToggle});return showReadMore(metadata)&&showFullPost(metadata)&&!(singleMediaItems.length>0&&nonMediaPluginsCount>0)||0===singleMediaItems.length&&galleryItems.length>0?previewToDisplay.seeFullPost():previewToDisplay}}).rule({_if:function(metadata){return 1===metadata.media.singleMediaItems.length},_then:function(metadata,preview){var _metadata$media2=metadata.media,galleryItems=_metadata$media2.galleryItems,mediaInfo=_metadata$media2.singleMediaItems[0],previewToDisplay=preview[mediaInfo.type]({mediaInfo:mediaInfo});return showFullPost(metadata)||metadata.textFragments.length>1||galleryItems.length>0?previewToDisplay.seeFullPost():previewToDisplay}}).rule({_if:function(metadata){return metadata.media.singleMediaItems.length>1&&metadata.media.singleMediaItems.length<=4},_then:function(_ref3,preview){var _ref3$media=_ref3.media,galleryItems=_ref3$media.galleryItems,singleMediaItems=_ref3$media.singleMediaItems,totalCount=_ref3$media.totalCount,numberOfImagesPerRow=singleMediaItems.length%2==0?2:3,gallery=preview.gallery({mediaInfo:singleMediaItems.slice(0,4),config:{size:"small"},overrides:{styles:_extends({},galleryStyle,{numberOfImagesPerRow:numberOfImagesPerRow})}}).seeFullPost();return galleryItems.length>0?gallery.imageCounter({counter:totalCount-singleMediaItems.length}):gallery}}).rule({_if:function(metadata){return metadata.media.singleMediaItems.length>4},_then:function(_ref4,preview){var _ref4$media=_ref4.media,singleMediaItems=_ref4$media.singleMediaItems,totalCount=_ref4$media.totalCount;return preview.gallery({mediaInfo:singleMediaItems.slice(0,4),config:{size:"small"},overrides:{styles:galleryStyle}}).imageCounter({counter:totalCount-4}).seeFullPost()}}),styles={},_excluded=["transformation","initialState","config"],RichContentPreview=function(_Component){function RichContentPreview(props){var _this;return(_this=_Component.call(this,props)||this).onPreviewExpand=function(){var _this$props$config,_this$props$config$PR,_this$props$config$PR2;_this.setState({isPreviewExpanded:!0}),null===(_this$props$config=_this.props.config)||void 0===_this$props$config||null===(_this$props$config$PR=_this$props$config.PREVIEW)||void 0===_this$props$config$PR||null===(_this$props$config$PR2=_this$props$config$PR.onPreviewExpand)||void 0===_this$props$config$PR2||_this$props$config$PR2.call(_this$props$config$PR)},_this.styles=mergeStyles({styles:styles,theme:props.theme}),_this.state={isPreviewExpanded:!1},_this}return _inheritsLoose(RichContentPreview,_Component),RichContentPreview.prototype.render=function(){var _this2=this,_this$props=this.props,transformation=_this$props.transformation,initialState=_this$props.initialState,config=_this$props.config,rest=_objectWithoutPropertiesLoose(_this$props,_excluded),previewState=this.state.isPreviewExpanded?initialState:transformation.apply(initialState),previewConfig=_extends({},config,{PREVIEW:_extends({contentInteractionMappers:[interactionMap]},config.PREVIEW,{onPreviewExpand:this.onPreviewExpand})}),isPreviewAddition={helpers:{isPreview:function(){return!_this2.state.isPreviewExpanded}}};return React.createElement("div",{className:styles.preview_container},React.createElement(RichContentViewer,Object.assign({initialState:previewState,config:previewConfig},merge(rest,isPreviewAddition))))},RichContentPreview}(Component);RichContentPreview.defaultProps={transformation:defaultTransformation};var defaultConfig={transformation:defaultTransformation,contentInteractionMappers:[interactionMap]},createPreview=function(config){return void 0===config&&(config={}),_extends({},defaultConfig,config)};export{RichContentPreview,createPreview,interactionMap}; | ||
import _extends from"@babel/runtime/helpers/extends";import _objectWithoutPropertiesLoose from"@babel/runtime/helpers/objectWithoutPropertiesLoose";import{LTRIcon,RTLIcon,BUTTONS,createBasePlugin}from"wix-rich-content-plugin-commons";import{EditorState,getModalStyles,BUTTON_TYPES,INSERT_PLUGIN_BUTTONS,TOOLBARS}from"wix-rich-content-editor-common";import _inheritsLoose from"@babel/runtime/helpers/inheritsLoose";import React,{Component}from"react";import classNames from"classnames";import{generateKey,mergeStyles,anchorScroll,GlobalContext,isRtl}from"wix-rich-content-common";import{RadioGroupVertical,LabeledToggle,Separator,InfoIcon,SelectionList,SettingsMobileHeader,SettingsPanelFooter}from"wix-rich-content-ui-components";import{Draggable,DragDropContext,Droppable}from"react-beautiful-dnd";var _ModalsMap,COLLAPSIBLE_LIST_TYPE="wix-rich-content-plugin-collapsible-list",directions_LTR="ltr",directions_RTL="rtl",DEFAULTS=Object.freeze({config:{expandState:"first_expanded",expandOnlyOne:!1},pairs:[{key:generateKey()}]}),EMPTY_PAIR_VALUE={title:EditorState.createEmpty(),content:EditorState.createEmpty()},CollapsibleList=function(store,componentData){var _this=this;this.getData=function(){return _this.componentData},this.getConfig=function(){return _this.getData().config},this.getPairs=function(){return _this.getData().pairs},this.getPair=function(idx){return _this.getPairs()[idx]},this.getTitle=function(idx){return _this.getPair(idx).title||EditorState.createEmpty()},this.getContent=function(idx){return _this.getPair(idx).content||EditorState.createEmpty()},this.getDirection=function(){return _this.getConfig().direction},this.changeDirection=function(){var direction=_this.getDirection()===directions_LTR?directions_RTL:directions_LTR,updatedData={config:_extends({},_this.getConfig(),{direction:direction})};_this.updateData(updatedData)},this.getExpandState=function(){return _this.getConfig().expandState},this.setExpandState=function(expandState){var updatedData={config:_extends({},_this.getConfig(),{expandState:expandState})};"expanded"===expandState&&(updatedData.config.expandOnlyOne=void 0),_this.updateData(updatedData)},this.getExpandOnlyOne=function(){return _this.getConfig().expandOnlyOne},this.toggleExpandOnlyOne=function(){var updatedData={config:_extends({},_this.getConfig(),{expandOnlyOne:!_this.getExpandOnlyOne()})};_this.updateData(updatedData)},this.setData=function(data){_this.store.set("componentData",data)},this.updateData=function(data){var componentData=_this.getData();_this.setData(_extends({},componentData,data))},this.setTitle=function(idx,editorState){var pair={title:editorState};_this.setPair(idx,pair)},this.setContent=function(idx,editorState){var pair={content:editorState};_this.setPair(idx,pair)},this.setPair=function(idx,updatedPair){var pairs=[].concat(_this.getPairs()),currentPair=_this.getPair(idx),newPair=_extends({},currentPair.title&¤tPair.content?{}:EMPTY_PAIR_VALUE,currentPair,updatedPair);pairs.splice(idx,1,newPair),_this.updateData({pairs:pairs})},this.createNewPair=function(){return{key:generateKey(),title:EditorState.createEmpty(),content:EditorState.createEmpty()}},this.insertNewPair=function(){var pairs=_this.getPairs();_this.updateData({pairs:[].concat(pairs,[_this.createNewPair()])})},this.reorderPairs=function(startIdx,endIdx){var pairs=_this.getPairs(),pairToMove=pairs.splice(startIdx,1)[0];pairs.splice(endIdx,0,pairToMove),_this.updateData({pairs:pairs})},this.deletePair=function(pairIndex){var pairs=_this.getPairs();pairs.splice(pairIndex,1),_this.updateData({pairs:pairs})},this.store=store,this.componentData=componentData},styles$5={title:"_3hUj0",settingsContainer:"_62k0D",separator:"_20bm0",direction_selector:"_1jUkB",direction_selector_option:"_1w4ED"},CollapsibleListSettings=function(_Component){function CollapsibleListSettings(props){var _this;(_this=_Component.call(this,props)||this).renderOption=function(_ref){var item=_ref.item;return React.createElement(React.Fragment,null,React.createElement(item.icon,null),React.createElement("p",null,item.label))},_this.renderExpandOptions=function(){var _this$props=_this.props,getDataManager=_this$props.getDataManager,t=_this$props.t,theme=_this$props.theme,isMobile=_this$props.isMobile;return React.createElement(React.Fragment,null,React.createElement(RadioGroupVertical,{label:t("CollapsibleList_CollapsibleListSettings_Tab_Settings_CollapseView_Title"),value:getDataManager().getExpandState(),dataSource:[{value:"expanded",labelText:t("CollapsibleList_CollapsibleListSettings_Tab_Settings_CollapseView_Expanded"),dataHook:"Expanded"},{value:"first_expanded",labelText:t("CollapsibleList_CollapsibleListSettings_Tab_Settings_CollapseView_FirstExpanded"),dataHook:"FirstExpanded"},{value:"collapsed",labelText:t("CollapsibleList_CollapsibleListSettings_Tab_Settings_CollapseView_Collapsed"),dataHook:"Collapsed"}],t:t,theme:theme,onChange:function(value){return getDataManager().setExpandState(value)}}),"expanded"!==getDataManager().getExpandState()&&React.createElement(LabeledToggle,{label:t("CollapsibleList_CollapsibleListSettings_Tab_Settings_CollapseView_InSections"),checked:getDataManager().getExpandOnlyOne(),onChange:getDataManager().toggleExpandOnlyOne,theme:theme,style:isMobile?{paddingTop:"28px"}:{},dataHook:"onePairExpanded"}))},_this.renderSeparator=function(){return React.createElement(Separator,{horizontal:!0,className:_this.styles.separator})},_this.renderDirectionOptions=function(){var _this$props2=_this.props,getDataManager=_this$props2.getDataManager,t=_this$props2.t;return React.createElement(React.Fragment,null,React.createElement("p",{className:_this.styles.title},t("CollapsibleList_CollapsibleListSettings_Tab_Settings_Direction_Title")," ",React.createElement(InfoIcon,{tooltipText:t("CollapsibleList_CollapsibleListSettings_Tab_Settings_Direction_Title_Tooltip")})),React.createElement(SelectionList,{theme:_this.styles,dataSource:[{value:directions_LTR,label:t("CollapsibleList_CollapsibleListSettings_Tab_Settings_Direction_LTR"),icon:LTRIcon,dataHook:"ltrDirection"},{value:directions_RTL,label:t("CollapsibleList_CollapsibleListSettings_Tab_Settings_Direction_RTL"),icon:RTLIcon,dataHook:"rtlDirection"}],renderItem:_this.renderOption,value:getDataManager().getDirection(),onChange:getDataManager().changeDirection,className:_this.styles.direction_selector,optionClassName:_this.styles.direction_selector_option}))};var _theme=props.theme;return _this.styles=mergeStyles({styles:styles$5,theme:_theme}),_this}return _inheritsLoose(CollapsibleListSettings,_Component),CollapsibleListSettings.prototype.render=function(){return React.createElement("div",{className:this.styles.settingsContainer},this.renderExpandOptions(),this.renderSeparator(),this.renderDirectionOptions())},CollapsibleListSettings}(Component),styles$4={collapsibleListModal:"_2gcEm",collapsibleListModalTitle:"_22bSm",collapsibleListModal_scrollContainer:"bpnq3",collapsibleListModal_mobile:"_1QgQS"},Modals={COLLAPSIBLE_LIST_MODAL:"collapsible-list-modal"},ModalsMap=((_ModalsMap={})[Modals.COLLAPSIBLE_LIST_MODAL]=function(_Component){function CollapsibleListModal(props){var _this;(_this=_Component.call(this,props)||this).onComponentUpdate=function(){return _this.forceUpdate()},_this.revertComponentData=function(){var helpers=_this.props.helpers,initialComponentData=_this.state.initialComponentData;initialComponentData&&_this.getDataManager().updateData(initialComponentData),helpers.closeModal()},_this.onDoneClick=function(){_this.props.helpers.closeModal()},_this.getDataManager=function(){var pubsub=_this.props.pubsub;return new CollapsibleList(pubsub.store,pubsub.get("componentData"))},_this.renderDesktopHeader=function(){var t=_this.props.t;return React.createElement("h3",{className:_this.styles.collapsibleListModalTitle},t("CollapsibleList_CollapsibleListSettings_Common_Header"))},_this.renderMobileHeader=function(){var _this$props=_this.props,t=_this$props.t,theme=_this$props.theme;return React.createElement(SettingsMobileHeader,{t:t,theme:theme,onCancel:_this.revertComponentData,onSave:_this.onDoneClick})},_this.renderSettings=function(){var _classNames,_this$props2=_this.props,isMobile=_this$props2.isMobile,theme=_this$props2.theme,t=_this$props2.t;return React.createElement("div",{className:classNames(styles$4.collapsibleListModal_scrollContainer,(_classNames={},_classNames[styles$4.collapsibleListModal_mobile]=isMobile,_classNames))},React.createElement(CollapsibleListSettings,{getDataManager:_this.getDataManager,theme:theme,isMobile:isMobile,t:t}))},_this.renderDesktopFooterPanel=function(){var _this$props3=_this.props,theme=_this$props3.theme,t=_this$props3.t;return React.createElement(SettingsPanelFooter,{fixed:!0,theme:theme,cancel:_this.revertComponentData,save:_this.onDoneClick,t:t})},_this.state=_this.initState(props);var _theme=props.theme;return _this.styles=mergeStyles({styles:styles$4,theme:_theme}),_this}_inheritsLoose(CollapsibleListModal,_Component);var _proto=CollapsibleListModal.prototype;return _proto.initState=function(props){return{initialComponentData:props.pubsub.get("componentData")}},_proto.componentDidMount=function(){var pubsub=this.props.pubsub;pubsub.subscribe("componentData",this.onComponentUpdate),this.setState({initialComponentData:pubsub.get("componentData")})},_proto.componentWillUnmount=function(){this.props.pubsub.unsubscribe("componentData",this.onComponentUpdate)},_proto.render=function(){var _this$props4=this.props,isMobile=_this$props4.isMobile,languageDir=_this$props4.languageDir;return React.createElement("div",{className:this.styles.collapsibleListModal,"data-hook":"collapsibleListModal",dir:languageDir},isMobile?this.renderMobileHeader():this.renderDesktopHeader(),this.renderSettings(),!isMobile&&this.renderDesktopFooterPanel())},CollapsibleListModal}(Component),_ModalsMap),modalStyles={customStyles:{overlay:{backgroundColor:"transparent"},content:{borderRadius:"2px",boxShadow:"0 4px 8px 0 rgba(0, 0, 0, 0.1)",border:"solid 1px rgba(255, 255, 255, 0.25)"}}},createInlineButtons=function(_ref){var t=_ref.t,disableKeyboardEvents=_ref.disableKeyboardEvents;return[{keyName:"settings",type:BUTTONS.EXTERNAL_MODAL,fullHeight:!0,modalName:Modals.COLLAPSIBLE_LIST_MODAL,children:t("CollapsibleList_CollapsibleListSettings_Tab_Settings_TabName"),modalStyles:getModalStyles(modalStyles),t:t,mobile:!0,triggerSettingsBi:!0,pluginId:COLLAPSIBLE_LIST_TYPE},{keyName:"separator",mobile:!1,type:BUTTONS.SEPARATOR},{keyName:"delete",type:BUTTONS.DELETE,mobile:!0,beforeOnClickDelete:function(){null==disableKeyboardEvents||disableKeyboardEvents(!1)}}]},InsertPluginIcon=function(props){return React.createElement("svg",Object.assign({width:"19px",height:"12px",viewBox:"0 0 23 12",version:"1.1",xmlns:"http://www.w3.org/2000/svg"},props),React.createElement("g",{stroke:"none",strokeWidth:"1",fill:"none",fillRule:"evenodd"},React.createElement("g",{transform:"translate(-265.000000, -379.000000)",fill:"currentColor"},React.createElement("g",{transform:"translate(265.000000, 379.000000)"},React.createElement("path",{d:"M10,0.8 L22.6,0.8 C22.7104569,0.8 22.8,0.88954305 22.8,1 L22.8,1.6 C22.8,1.71045695 22.7104569,1.8 22.6,1.8 L10,1.8 C9.88954305,1.8 9.8,1.71045695 9.8,1.6 L9.8,1 C9.8,0.88954305 9.88954305,0.8 10,0.8 Z M10,5.8 L22.6,5.8 C22.7104569,5.8 22.8,5.88954305 22.8,6 L22.8,6.6 C22.8,6.71045695 22.7104569,6.8 22.6,6.8 L10,6.8 C9.88954305,6.8 9.8,6.71045695 9.8,6.6 L9.8,6 C9.8,5.88954305 9.88954305,5.8 10,5.8 Z M10,10.8 L22.6,10.8 C22.7104569,10.8 22.8,10.8895431 22.8,11 L22.8,11.6 C22.8,11.7104569 22.7104569,11.8 22.6,11.8 L10,11.8 C9.88954305,11.8 9.8,11.7104569 9.8,11.6 L9.8,11 C9.8,10.8895431 9.88954305,10.8 10,10.8 Z",fillRule:"nonzero"}),React.createElement("path",{d:"M2.61252587,5.04452587 C2.55011987,5.10656164 2.44933186,5.10656164 2.38692587,5.04452587 L2.04692587,4.70452587 C2.01688154,4.67451494 2,4.63379134 2,4.59132587 C2,4.54886039 2.01688154,4.50813679 2.04692587,4.47812587 L4.47972587,2.04532587 L2.04772587,-0.386674135 C2.01768154,-0.416685056 2.0008,-0.457408655 2.0008,-0.499874135 C2.0008,-0.542339615 2.01768154,-0.583063214 2.04772587,-0.613074135 L2.38692587,-0.953074135 C2.41693679,-0.983118462 2.45766039,-1 2.50012587,-1 C2.54259134,-1 2.58331494,-0.983118462 2.61332587,-0.953074135 L5.49812587,1.93172587 C5.52817019,1.96173679 5.54505173,2.00246039 5.54505173,2.04492587 C5.54505173,2.08739134 5.52817019,2.12811494 5.49812587,2.15812587 L2.61252587,5.04372587 L2.61252587,5.04452587 Z",transform:"translate(3.772526, 2.045526) rotate(-270.000000) translate(-3.772526, -2.045526) "})))))},ArrowIcon=function(props){return React.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24"},props),React.createElement("g",{fillRule:"evenodd"},React.createElement("g",null,React.createElement("g",null,React.createElement("g",null,React.createElement("g",null,React.createElement("path",{d:"M11.999 9L6 14.241 6.657 15 11.999 10.334 17.343 15 18 14.241z",transform:"translate(-129 -185) translate(97 105) translate(23 71) rotate(-90 21 12) matrix(1 0 0 -1 0 24)"})))))))},PlusIcon=function(props){return React.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24"},props),React.createElement("g",{fillRule:"evenodd"},React.createElement("g",null,React.createElement("g",null,React.createElement("g",null,React.createElement("path",{d:"M12.5 6v5.5H18v1h-5.5V18h-1v-5.5H6v-1h5.5V6h1z",transform:"translate(-129 -269) translate(97 105) translate(23 155) rotate(-90 21 12)"}))))))},DndIcon=function(props){return React.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 20 20"},props),React.createElement("g",{fillRule:"evenodd"},React.createElement("g",null,React.createElement("g",null,React.createElement("g",null,React.createElement("g",null,React.createElement("path",{d:"M5.37 7.083c-.684-.025-1.22-.596-1.203-1.28.017-.685.58-1.228 1.265-1.22.684.009 1.234.566 1.235 1.25-.014.704-.594 1.263-1.297 1.25zM5.37 2.5c-.684-.026-1.22-.597-1.203-1.28.017-.685.58-1.228 1.265-1.22.684.009 1.234.566 1.235 1.25-.014.703-.594 1.263-1.297 1.25zM5.463 9.167c.684.025 1.22.596 1.203 1.28-.017.685-.58 1.228-1.265 1.22-.684-.009-1.234-.566-1.234-1.25.014-.703.594-1.262 1.296-1.25zM1.203 7.083C.52 7.058-.017 6.487 0 5.803c.017-.685.581-1.228 1.265-1.22.685.009 1.235.566 1.235 1.25-.013.704-.594 1.263-1.297 1.25zM1.203 2.5C.52 2.474-.017 1.903 0 1.22.017.534.581-.009 1.265 0 1.95.01 2.5.566 2.5 1.25c-.013.703-.594 1.263-1.297 1.25zM1.297 9.167c.683.025 1.22.596 1.203 1.28-.017.685-.581 1.228-1.265 1.22C.55 11.658 0 11.1 0 10.417c.015-.703.594-1.262 1.297-1.25z",transform:"translate(-99 -190) translate(99 176) translate(0 14) translate(6.667 4.167)"})))))))},styles$3={ltr:"E6y_Z",rtl:"_2wLEl",iconContainer:"_21s0b",icon:"_2z8L4",isExpanded:"aPvla"};function ExpandCollapseButton(props){var onClick=props.onClick,idx=props.idx,ariaLabel=props.ariaLabel;return React.createElement("div",{role:"button",tabIndex:"-1",className:styles$3.iconContainer,onClick:onClick,onKeyUp:function(e){return(" "===e.key||"Enter"===e.key)&&onClick(e)},"data-hook":"ExpandCollapseButton_"+idx},React.createElement(ArrowIcon,{role:"button",tabIndex:"0","aria-label":ariaLabel,className:classNames(styles$3.icon,props.isExpanded&&styles$3.isExpanded)}))}var styles$2={titleContainer:"_3LwlN",title:"_3CwVy",content:"_3TxVS"},CollapsibleListPair=function(_Component){function CollapsibleListPair(props){var _this;(_this=_Component.call(this,props)||this).focusTitle=function(){var _this$titleEditorRef$;return null===(_this$titleEditorRef$=_this.titleEditorRef.current)||void 0===_this$titleEditorRef$?void 0:_this$titleEditorRef$.focus()},_this.renderTitle=function(){var _this$props=_this.props,idx=_this$props.idx,renderTitle=_this$props.renderTitle;return React.createElement("div",{className:_this.styles.title},renderTitle(idx,_this.titleEditorRef))},_this.focusContent=function(){var _this$contentEditorRe;return null===(_this$contentEditorRe=_this.contentEditorRef.current)||void 0===_this$contentEditorRe?void 0:_this$contentEditorRe.focus()},_this.renderContent=function(){var _this$props2=_this.props,idx=_this$props2.idx,renderContent=_this$props2.renderContent;return _this$props2.isExpanded&&React.createElement("div",{className:_this.styles.content},renderContent(idx,_this.contentEditorRef))},_this.onClick=function(e){var _helpers$onViewerActi,_this$props3=_this.props,isExpanded=_this$props3.isExpanded,onCollapseClick=_this$props3.onCollapseClick,onExpandClick=_this$props3.onExpandClick,idx=_this$props3.idx,helpers=_this$props3.helpers,isInEditor=_this$props3.isInEditor;isExpanded?onCollapseClick(idx):onExpandClick(idx),null===(_helpers$onViewerActi=helpers.onViewerAction)||void 0===_helpers$onViewerActi||_helpers$onViewerActi.call(helpers,COLLAPSIBLE_LIST_TYPE,"Click",isExpanded?"collapse":"expand"),isInEditor||(e.preventDefault(),setTimeout((function(){return anchorScroll(_this.pairRef,_this.context.experiments)})))},_this.onKeyDown=function(e){"a"===e.key&&(e.ctrlKey||e.metaKey)&&e.stopPropagation()};var theme=props.theme;return _this.styles=mergeStyles({styles:styles$2,theme:theme}),_this.titleEditorRef=React.createRef(),_this.contentEditorRef=React.createRef(),_this.pairRef=React.createRef(),_this}return _inheritsLoose(CollapsibleListPair,_Component),CollapsibleListPair.prototype.render=function(){var _this2=this,_this$props4=this.props,isExpanded=_this$props4.isExpanded,idx=_this$props4.idx,t=_this$props4.t;return React.createElement(React.Fragment,null,React.createElement("div",{className:this.styles.titleContainer,onKeyDown:this.onKeyDown,ref:function(_ref){return _this2.pairRef=_ref}},React.createElement(ExpandCollapseButton,{isExpanded:isExpanded,onClick:this.onClick,idx:idx,ariaLabel:t(isExpanded?"CollapsibleListPlugin_ExpandButton_AriaLabel":"CollapsibleListPlugin_CollapseButton_AriaLabel")}),this.renderTitle()),this.renderContent())},CollapsibleListPair}(Component);CollapsibleListPair.contextType=GlobalContext;var getPairsAllCollpased=function(pairs){return pairs.map((function(){return!1}))},getDefaultPairsState=function(pairs,defaultPairsExpandState){var pairsState="expanded"===defaultPairsExpandState?function(pairs){return pairs.map((function(){return!0}))}(pairs):getPairsAllCollpased(pairs);return"first_expanded"===defaultPairsExpandState&&(pairsState[0]=!0),pairsState},CollapsibleListPairs=function(_Component){function CollapsibleListPairs(props){var _this;return(_this=_Component.call(this,props)||this).focusPair=function(_ref){var idx=_ref.idx,isTitle=_ref.isTitle,pair=_this.pairsRefs[idx];isTitle?null==pair||pair.focusTitle():(null==pair?void 0:pair.focusContent())||null==pair||pair.focusTitle()},_this.expandPair=function(idx){var _this$props=_this.props,pairs=_this$props.pairs,expandOnlyOne=_this$props.expandOnlyOne,pairsState=_this.state.pairsState;expandOnlyOne&&(pairsState=getPairsAllCollpased(pairs)),pairsState[idx]=!0,_this.setState({pairsState:pairsState})},_this.collapsePair=function(idx){var pairsState=[].concat(_this.state.pairsState);pairsState[idx]=!1,_this.setState({pairsState:pairsState})},_this.insertNewPair=function(){var expandOnlyOne=_this.state.expandOnlyOne,pairsState=_this.state.pairsState;expandOnlyOne&&(pairsState=getPairsAllCollpased(pairsState)),pairsState=[].concat(pairsState,[!0]),_this.setState({pairsState:pairsState})},_this.deletePair=function(idx){var pairsState=_this.state.pairsState;pairsState.splice(idx,1),_this.setState({pairsState:pairsState})},_this.reorderPairs=function(startIdx,endIdx){var pairsState=_this.state.pairsState,pairToMove=pairsState.splice(startIdx,1)[0];pairsState.splice(endIdx,0,pairToMove),_this.setState({pairsState:pairsState})},_this.pairsRefs=[],_this.state=_this.initState(props),_this}_inheritsLoose(CollapsibleListPairs,_Component);var _proto=CollapsibleListPairs.prototype;return _proto.initState=function(props){var pairs=props.pairs,expandState=props.expandState;return{defaultPairsExpandState:expandState,expandOnlyOne:props.expandOnlyOne,pairsState:getDefaultPairsState(pairs,expandState)}},CollapsibleListPairs.getDerivedStateFromProps=function(props,state){var pairs=props.pairs,expandState=props.expandState,expandOnlyOne=props.expandOnlyOne;return state.defaultPairsExpandState!==expandState||expandOnlyOne&&expandOnlyOne!==state.expandOnlyOne?{defaultPairsExpandState:expandState,expandOnlyOne:expandOnlyOne,pairsState:getDefaultPairsState(pairs,expandState)}:null},_proto.render=function(){var _this2=this,_this$props2=this.props,pairs=_this$props2.pairs,PairWrapper=_this$props2.PairWrapper,t=_this$props2.t,theme=_this$props2.theme,renderTitle=_this$props2.renderTitle,renderContent=_this$props2.renderContent,helpers=_this$props2.helpers,isInEditor=_this$props2.isInEditor,pairsState=this.state.pairsState;return pairs.map((function(pair,idx){return React.createElement(PairWrapper,{key:pair.key,id:pair.key,index:idx},React.createElement(CollapsibleListPair,{ref:function(_ref2){return _this2.pairsRefs[idx]=_ref2},t:t,key:pair.key,idx:idx,isExpanded:pairsState[idx],onCollapseClick:_this2.collapsePair,onExpandClick:_this2.expandPair,theme:theme,renderTitle:renderTitle,renderContent:renderContent,helpers:helpers,isInEditor:isInEditor}))}))},CollapsibleListPairs}(Component);CollapsibleListPairs.defaultProps={PairWrapper:"div"};var styles$1_new_pair_container="_1AgMx",styles$1_new_pair_button="_1Zqb4",styles$1_new_pair_label="_3iSqB";function NewPairButton(props){return React.createElement("div",{role:"button",tabIndex:"0",className:styles$1_new_pair_container,onClick:props.onClick,onKeyPress:function(e){return("Enter"===e.key||" "===e.key)&&props.onClick(e)},"data-hook":"CollapsibleListNewPair_button"},React.createElement("div",{className:styles$1_new_pair_button},React.createElement(PlusIcon,null),React.createElement("label",{className:styles$1_new_pair_label},props.label)))}var styles_dndIcon="hDgGn";function DndHandle(props){return React.createElement("div",_extends({className:styles_dndIcon},props.dragHandleProps),React.createElement(DndIcon,null))}var CollapsibleListComponent=function(_React$Component){function CollapsibleListComponent(_props){var _this,_this2=this;(_this=_React$Component.call(this,_props)||this).focusPair=function(pair){return setTimeout((function(){_this.collapsibleListRef.current.focusPair(pair)}))},_this.expandPair=function(idx){return _this.collapsibleListRef.current.expandPair(idx)},_this.focusTitle=function(idx){var pair={idx:idx,isTitle:!0};_this.focusPair(pair)},_this.focusContent=function(idx){var pair={idx:idx,isTitle:!1};_this.focusPair(pair)},_this.onTitleBackspace=function(idx){_this.getDataManager().getPairs().length>1&&(_this.getDataManager().deletePair(idx),_this.collapsibleListRef.current.deletePair(idx),0===idx?_this.focusTitle(idx):_this.focusContent(idx-1))},_this.renderTitle=function(idx,setRef){return React.createElement(_this2.renderInput,{value:_this.getDataManager().getTitle(idx),setRef:setRef,onChange:function(val){return _this.getDataManager().setTitle(idx,val)},placeholder:_this.titlePlaceholder,onBackspaceAtBeginningOfContent:function(){return _this.onTitleBackspace(idx)},handleReturn:_this.handleTitleReturn(idx),toolbarsToIgnore:["SideToolbar"]})},_this.renderContent=function(idx,setRef){return React.createElement(_this2.renderInput,{value:_this.getDataManager().getContent(idx),setRef:setRef,onChange:function(val){return _this.getDataManager().setContent(idx,val)},placeholder:_this.contentPlaceholder,onBackspaceAtBeginningOfContent:function(){return _this.focusTitle(idx)}})},_this.renderInput=function(_ref){var value=_ref.value,setRef=_ref.setRef,onChange=_ref.onChange,placeholder=_ref.placeholder,onBackspaceAtBeginningOfContent=_ref.onBackspaceAtBeginningOfContent,handleReturn=_ref.handleReturn,toolbarsToIgnore=_ref.toolbarsToIgnore,renderInnerRCE=_this.props.renderInnerRCE,direction=_this.getDataManager().getDirection();return renderInnerRCE({editorState:value,setRef:setRef,onChange:onChange,renderedIn:COLLAPSIBLE_LIST_TYPE,onBackspaceAtBeginningOfContent:onBackspaceAtBeginningOfContent,direction:direction,additionalProps:{textAlignment:"ltr"===direction?"left":"right",placeholder:placeholder,handleReturn:handleReturn},toolbarsToIgnore:toolbarsToIgnore,onFocus:function(){return _this.props.disableKeyboardEvents(!0)},onBlur:function(){return _this.props.disableKeyboardEvents(!1)}})},_this.handleTitleReturn=function(idx){return function(){return function(){return _this.expandPair(idx),_this.focusContent(idx),"handled"}}},_this.onNewPairButtonClick=function(){var newPairIdx=_this.getDataManager().getPairs().length;_this.getDataManager().insertNewPair(),_this.collapsibleListRef.current.insertNewPair(),_this.focusTitle(newPairIdx)},_this.onDragEnd=function(result){result.destination&&result.source.index!==result.destination.index&&(_this.getDataManager().reorderPairs(result.source.index,result.destination.index),_this.collapsibleListRef.current.reorderPairs(result.source.index,result.destination.index))},_this.getDataManager=function(props){var _ref2=props||_this.props,store=_ref2.store,componentData=_ref2.componentData;return new CollapsibleList(store,componentData)},_this.PairWrapper=function(_ref3){var id=_ref3.id,index=_ref3.index,children=_ref3.children,_this$props=_this.props,isMobile=_this$props.isMobile,blockProps=_this$props.blockProps,isDragDisabled=isMobile||!blockProps.isFocused;return React.createElement(Draggable,{key:id,draggableId:id,index:index,isDragDisabled:isDragDisabled},(function(provided){return React.createElement("div",_extends({ref:provided.innerRef},provided.draggableProps),!isDragDisabled&&React.createElement(DndHandle,{dragHandleProps:provided.dragHandleProps}),children)}))},_this.onFocus=function(e){return e.stopPropagation()};var theme=_props.theme,t=_props.t;return _this.styles=mergeStyles({styles:styles$3,theme:theme}),_this.titlePlaceholder=t("CollapsibleList_ShownText_Placeholder"),_this.contentPlaceholder=t("CollapsibleList_CollapsedText_Placeholder"),_this.addNewPairLabel=t("CollapsibleList_ShownText_Add_Placeholder"),_this.collapsibleListRef=React.createRef(),_this}return _inheritsLoose(CollapsibleListComponent,_React$Component),CollapsibleListComponent.prototype.render=function(){var _this3=this,_this$props2=this.props,blockProps=_this$props2.blockProps,theme=_this$props2.theme,t=_this$props2.t,isMobile=_this$props2.isMobile,helpers=_this$props2.helpers,pairs=this.getDataManager().getPairs(),expandState=this.getDataManager().getExpandState(),expandOnlyOne=this.getDataManager().getExpandOnlyOne(),direction=this.getDataManager().getDirection();return React.createElement("div",{className:this.styles[direction],onFocus:this.onFocus,tabIndex:"0","data-hook":"collapsibleListComponent"},React.createElement(DragDropContext,{onDragEnd:this.onDragEnd},React.createElement(Droppable,{droppableId:"droppable"},(function(provided){return React.createElement("div",_extends({},provided.droppableProps,{ref:provided.innerRef}),React.createElement(CollapsibleListPairs,{ref:_this3.collapsibleListRef,theme:theme,t:t,isMobile:isMobile,pairs:pairs,expandState:expandState,expandOnlyOne:expandOnlyOne,renderTitle:_this3.renderTitle,renderContent:_this3.renderContent,PairWrapper:_this3.PairWrapper,helpers:helpers,isInEditor:!0}),provided.placeholder)}))),blockProps.isFocused&&React.createElement(NewPairButton,{label:this.addNewPairLabel,onClick:this.onNewPairButtonClick}))},CollapsibleListComponent}(React.Component),createInsertButtons=function(_ref){var _settings$toolbar,_settings$toolbar$ico,t=_ref.t,settings=_ref.settings,locale=_ref.locale,icon=(null==settings||null===(_settings$toolbar=settings.toolbar)||void 0===_settings$toolbar||null===(_settings$toolbar$ico=_settings$toolbar.icons)||void 0===_settings$toolbar$ico?void 0:_settings$toolbar$ico.InsertPluginButtonIcon)||InsertPluginIcon,componentData=_extends({},DEFAULTS,{config:_extends({},DEFAULTS.config,{direction:isRtl(locale)?directions_RTL:directions_LTR})});return[{type:BUTTON_TYPES.BUTTON,name:INSERT_PLUGIN_BUTTONS.COLLAPSIBLE_LIST,getLabel:function(){return t("CollapsibleList_InsertButton")},tooltip:t("CollapsibleListPlugin_InsertButton_Tooltip"),getIcon:function(){return icon},isActive:function(){return!1},isDisabled:function(){return!1},componentData:componentData,toolbars:[TOOLBARS.INSERT_PLUGIN,TOOLBARS.MOBILE,TOOLBARS.FOOTER,TOOLBARS.SIDE],section:"BlockToolbar_Section_Advanced"}]},createToolbar=function(_ref){var t=_ref.t,isMobile=_ref.isMobile,settings=_ref.settings,locale=_ref.locale,disableKeyboardEvents=_ref.disableKeyboardEvents;return{InlineButtons:createInlineButtons({t:t,disableKeyboardEvents:disableKeyboardEvents}),InsertButtons:createInsertButtons({t:t,settings:settings,isMobile:isMobile,locale:locale}),name:COLLAPSIBLE_LIST_TYPE}};function _toPropertyKey(arg){var key=function(input,hint){if("object"!=typeof input||null===input)return input;var prim=input[Symbol.toPrimitive];if(void 0!==prim){var res=prim.call(input,hint||"default");if("object"!=typeof res)return res;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===hint?String:Number)(input)}(arg,"string");return"symbol"==typeof key?key:String(key)}var createCollapsibleListPlugin=function(config){var localeContent=config.localeContent,locale=config.locale,helpers=config.helpers,t=config.t,_config$COLLAPSIBLE_L=config[COLLAPSIBLE_LIST_TYPE],settings=void 0===_config$COLLAPSIBLE_L?{}:_config$COLLAPSIBLE_L,isMobile=config.isMobile,disableKeyboardEvents=config.disableKeyboardEvents,rest=_objectWithoutPropertiesLoose(config,["localeContent","locale","helpers","t",COLLAPSIBLE_LIST_TYPE,"isMobile","disableKeyboardEvents"].map(_toPropertyKey));return createBasePlugin(_extends({component:CollapsibleListComponent,type:COLLAPSIBLE_LIST_TYPE,toolbar:createToolbar({helpers:helpers,t:t,settings:settings,isMobile:isMobile,locale:localeContent||locale,disableKeyboardEvents:disableKeyboardEvents}),helpers:helpers,settings:settings,t:t,isMobile:isMobile,defaultPluginData:DEFAULTS,noPluginBorder:!0,noPointerEventsOnFocus:!0,locale:localeContent||locale,disableKeyboardEvents:disableKeyboardEvents},rest))};createCollapsibleListPlugin.functionName=COLLAPSIBLE_LIST_TYPE;var CollapsibleListViewer=function(_Component){function CollapsibleListViewer(props){var _this;(_this=_Component.call(this,props)||this).getPair=function(idx){return _this.props.componentData.pairs[idx]},_this.renderInnerRCV=function(contentState){var _this$props=_this.props,innerRCV=_this$props.innerRCV,componentData=_this$props.componentData;return innerRCV({contentState:contentState,textAlignment:function(componentData){return"ltr"===componentData.config.direction?"left":"right"}(componentData),direction:function(componentData){return componentData.config.direction}(componentData)})},_this.renderTitle=function(idx){var pair=_this.getPair(idx);return _this.renderInnerRCV(pair.title)},_this.renderContent=function(idx){var pair=_this.getPair(idx);return _this.renderInnerRCV(pair.content)};var theme=props.theme;return _this.styles=mergeStyles({styles:styles$3,theme:theme}),_this}return _inheritsLoose(CollapsibleListViewer,_Component),CollapsibleListViewer.prototype.render=function(){var _this$props2=this.props,theme=_this$props2.theme,t=_this$props2.t,componentData=_this$props2.componentData,isMobile=_this$props2.isMobile,helpers=_this$props2.helpers,config=componentData.config,pairs=componentData.pairs,direction=config.direction,expandState=config.expandState,expandOnlyOne=config.expandOnlyOne;return React.createElement("div",{className:this.styles[direction]},React.createElement(CollapsibleListPairs,{theme:theme,t:t,isMobile:isMobile,pairs:pairs,expandState:expandState,expandOnlyOne:expandOnlyOne,renderTitle:this.renderTitle,renderContent:this.renderContent,helpers:helpers}))},CollapsibleListViewer}(Component),pluginCollapsibleList=function(config){return{config:_extends({},DEFAULTS.config,config),type:COLLAPSIBLE_LIST_TYPE,createPlugin:createCollapsibleListPlugin,ModalsMap:ModalsMap}};export{COLLAPSIBLE_LIST_TYPE,Modals,ModalsMap,CollapsibleListViewer as collapsibleListViewer,createCollapsibleListPlugin,pluginCollapsibleList}; | ||
//# sourceMappingURL=module.js.map |
@@ -1,14 +0,6 @@ | ||
import { interactionMap } from './Interactions/interactionMap'; | ||
export { default as RichContentPreview } from './Components/RichContentPreview'; | ||
export { interactionMap }; | ||
export interface PreviewConfig { | ||
transformation?: unknown; | ||
contentInteractionMappers?: typeof interactionMap[]; | ||
onPreviewExpand?: () => void; | ||
} | ||
export declare const createPreview: (config?: PreviewConfig) => { | ||
transformation?: unknown; | ||
contentInteractionMappers?: ((onPreviewExpand: (() => void) | undefined) => {})[] | undefined; | ||
onPreviewExpand?: (() => void) | undefined; | ||
}; | ||
export { createCollapsibleListPlugin } from './createCollapsibleListPlugin'; | ||
export { default as collapsibleListViewer } from './collapsible-list-viewer'; | ||
export { COLLAPSIBLE_LIST_TYPE } from './types'; | ||
export { Modals, ModalsMap } from './modals'; | ||
export { pluginCollapsibleList } from './editor'; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -1,1 +0,1 @@ | ||
{"name":"richlagetest","version":"0.0.0-6b25a0cea70025c54da987b98fd875b7437dd662"} | ||
{"name":"richlagetest","version":"0.0.0-78671d73a2fed1cdad482b0f9e0934f36a513cd5"} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Uses eval
Supply chain riskPackage uses eval() which is a dangerous function. This prevents the code from running in certain environments and increases the risk that the code may contain exploits or malicious behavior.
Found 1 instance in 1 package
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 3 instances in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
449669
83
1370
7
5