richlagetest
Advanced tools
Comparing version 0.0.0-230982fa614383ea3540c69c2696628caf960803 to 0.0.0-263ccb2efb90f61645cfbda5bef16e62c32bb07c
@@ -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"),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}}; | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var _extends=require("@babel/runtime/helpers/extends"),wixRichContentPluginCommons=require("wix-rich-content-plugin-commons"),React=require("react");function _interopDefaultLegacy(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var _extends__default=_interopDefaultLegacy(_extends),React__default=_interopDefaultLegacy(React);var headersRegEx=/{\$h\d}.*?{\$h}/g,headersMarkdownStrategy=function(contentBlock,callback){!function(text,regex,callback){for(var matchArr,start;null!==(matchArr=regex.exec(text));)callback(start=matchArr.index,start+matchArr[0].length)}(contentBlock.getText(),headersRegEx,callback)},DEFAULTS={config:{},configViewer:{hideMarkdown:!0}},createHeadersMarkdownDecorator=function(config){var _config$type=config["wix-draft-plugin-headers-markdown"],settings=void 0===_config$type?{}:_config$type;return{strategy:headersMarkdownStrategy,component:function(props){return function(_ref){var children=_ref.children,hideMarkdown=_ref.hideMarkdown,sliceElementText=function(element,start,end){if("string"==typeof element)return element.slice(start,end);if(element.props&&element.props.text){var text=element.props.text.slice(start,end);return React__default.default.cloneElement(element,{text:text})}return element},Type=_ref.decoratedText.match(/h\d/)[0];if(hideMarkdown){var lastIndex=children.length-1;children[0]=sliceElementText(children[0],5),children[lastIndex]=sliceElementText(children[lastIndex],0,-4)}return React__default.default.createElement(Type,null,children)}(_extends__default.default({},props,settings))}}},createHeadersMarkdownPlugin=function(config){var _config$type=config["wix-draft-plugin-headers-markdown"],settings=void 0===_config$type?{}:_config$type,plugin={decorators:[createHeadersMarkdownDecorator(config)]};return wixRichContentPluginCommons.createBasePlugin(_extends__default.default({settings:settings,type:"wix-draft-plugin-headers-markdown",defaultPluginData:DEFAULTS},config),plugin)};createHeadersMarkdownPlugin.functionName="wix-draft-plugin-headers-markdown";exports.HEADERS_MARKDOWN_TYPE="wix-draft-plugin-headers-markdown",exports.createHeadersMarkdownDecorator=createHeadersMarkdownDecorator,exports.createHeadersMarkdownPlugin=createHeadersMarkdownPlugin,exports.pluginHeadersMarkdown=function(config){return{config:_extends__default.default({},DEFAULTS.config,config),type:"wix-draft-plugin-headers-markdown",createPlugin:createHeadersMarkdownPlugin,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{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}; | ||
import _extends from"@babel/runtime/helpers/extends";import{createBasePlugin}from"wix-rich-content-plugin-commons";import React from"react";var headersRegEx=/{\$h\d}.*?{\$h}/g,headersMarkdownStrategy=function(contentBlock,callback){!function(text,regex,callback){for(var matchArr,start;null!==(matchArr=regex.exec(text));)callback(start=matchArr.index,start+matchArr[0].length)}(contentBlock.getText(),headersRegEx,callback)},DEFAULTS={config:{},configViewer:{hideMarkdown:!0}},createHeadersMarkdownDecorator=function(config){var _config$type=config["wix-draft-plugin-headers-markdown"],settings=void 0===_config$type?{}:_config$type;return{strategy:headersMarkdownStrategy,component:function(props){return function(_ref){var children=_ref.children,hideMarkdown=_ref.hideMarkdown,sliceElementText=function(element,start,end){if("string"==typeof element)return element.slice(start,end);if(element.props&&element.props.text){var text=element.props.text.slice(start,end);return React.cloneElement(element,{text:text})}return element},Type=_ref.decoratedText.match(/h\d/)[0];if(hideMarkdown){var lastIndex=children.length-1;children[0]=sliceElementText(children[0],5),children[lastIndex]=sliceElementText(children[lastIndex],0,-4)}return React.createElement(Type,null,children)}(_extends({},props,settings))}}},createHeadersMarkdownPlugin=function(config){var _config$type=config["wix-draft-plugin-headers-markdown"],settings=void 0===_config$type?{}:_config$type,plugin={decorators:[createHeadersMarkdownDecorator(config)]};return createBasePlugin(_extends({settings:settings,type:"wix-draft-plugin-headers-markdown",defaultPluginData:DEFAULTS},config),plugin)};createHeadersMarkdownPlugin.functionName="wix-draft-plugin-headers-markdown";var pluginHeadersMarkdown=function(config){return{config:_extends({},DEFAULTS.config,config),type:"wix-draft-plugin-headers-markdown",createPlugin:createHeadersMarkdownPlugin,ModalsMap:{}}},HEADERS_MARKDOWN_TYPE="wix-draft-plugin-headers-markdown";export{HEADERS_MARKDOWN_TYPE,createHeadersMarkdownDecorator,createHeadersMarkdownPlugin,pluginHeadersMarkdown}; | ||
//# sourceMappingURL=module.js.map |
@@ -1,2 +0,2 @@ | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var _extends=require("@babel/runtime/helpers/extends"),_inheritsLoose=require("@babel/runtime/helpers/inheritsLoose"),React=require("react"),wixRichContentCommon=require("wix-rich-content-common"),classNames=require("classnames");function _interopDefaultLegacy(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var _extends__default=_interopDefaultLegacy(_extends),_inheritsLoose__default=_interopDefaultLegacy(_inheritsLoose),React__default=_interopDefaultLegacy(React),classNames__default=_interopDefaultLegacy(classNames),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)"})))))))},styles$1={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$1.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$1.icon,props.isExpanded&&styles$1.isExpanded)}))}var styles={titleContainer:"_3LwlN",title:"_3CwVy",content:"_3TxVS"},COLLAPSIBLE_LIST_TYPE="wix-rich-content-plugin-collapsible-list",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,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 DEFAULTS=Object.freeze({config:{expandState:"first_expanded",expandOnlyOne:!1},pairs:[{key:wixRichContentCommon.generateKey()}]}),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 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$1,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),typeMapper=function(){var _ref;return(_ref={})[COLLAPSIBLE_LIST_TYPE]={component:CollapsibleListViewer},_ref};exports.COLLAPSIBLE_LIST_TYPE=COLLAPSIBLE_LIST_TYPE,exports.collapsibleListTypeMapper=typeMapper,exports.pluginCollapsibleList=function(config){return{config:_extends__default.default({},DEFAULTS.config,config),type:COLLAPSIBLE_LIST_TYPE,typeMapper:typeMapper}}; | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var _extends=require("@babel/runtime/helpers/extends"),React=require("react");function _interopDefaultLegacy(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var _extends__default=_interopDefaultLegacy(_extends),React__default=_interopDefaultLegacy(React);var headersRegEx=/{\$h\d}.*?{\$h}/g,headersMarkdownStrategy=function(contentBlock,callback){!function(text,regex,callback){for(var matchArr,start;null!==(matchArr=regex.exec(text));)callback(start=matchArr.index,start+matchArr[0].length)}(contentBlock.getText(),headersRegEx,callback)},DEFAULTS_configViewer={hideMarkdown:!0},createHeadersMarkdownDecorator=function(config){var _config$type=config["wix-draft-plugin-headers-markdown"],settings=void 0===_config$type?{}:_config$type;return{strategy:headersMarkdownStrategy,component:function(props){return function(_ref){var children=_ref.children,hideMarkdown=_ref.hideMarkdown,sliceElementText=function(element,start,end){if("string"==typeof element)return element.slice(start,end);if(element.props&&element.props.text){var text=element.props.text.slice(start,end);return React__default.default.cloneElement(element,{text:text})}return element},Type=_ref.decoratedText.match(/h\d/)[0];if(hideMarkdown){var lastIndex=children.length-1;children[0]=sliceElementText(children[0],5),children[lastIndex]=sliceElementText(children[lastIndex],0,-4)}return React__default.default.createElement(Type,null,children)}(_extends__default.default({},props,settings))}}};exports.createHeadersMarkdownDecorator=createHeadersMarkdownDecorator,exports.pluginHeadersMarkdown=function(config){return{config:_extends__default.default({},DEFAULTS_configViewer,config),type:"wix-draft-plugin-headers-markdown",decorator:function(theme,config){var _createHeadersMarkdow;return createHeadersMarkdownDecorator(((_createHeadersMarkdow={})["wix-draft-plugin-headers-markdown"]=_extends__default.default({},config),_createHeadersMarkdow))}}}; | ||
//# sourceMappingURL=module.viewer.cjs.js.map |
@@ -1,2 +0,2 @@ | ||
import _extends from"@babel/runtime/helpers/extends";import _inheritsLoose from"@babel/runtime/helpers/inheritsLoose";import React,{Component}from"react";import{anchorScroll,mergeStyles,GlobalContext,generateKey}from"wix-rich-content-common";import classNames from"classnames";var 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)"})))))))},styles$1={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$1.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$1.icon,props.isExpanded&&styles$1.isExpanded)}))}var styles={titleContainer:"_3LwlN",title:"_3CwVy",content:"_3TxVS"},COLLAPSIBLE_LIST_TYPE="wix-rich-content-plugin-collapsible-list",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,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 DEFAULTS=Object.freeze({config:{expandState:"first_expanded",expandOnlyOne:!1},pairs:[{key:generateKey()}]}),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 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$1,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),typeMapper=function(){var _ref;return(_ref={})[COLLAPSIBLE_LIST_TYPE]={component:CollapsibleListViewer},_ref},pluginCollapsibleList=function(config){return{config:_extends({},DEFAULTS.config,config),type:COLLAPSIBLE_LIST_TYPE,typeMapper:typeMapper}};export{COLLAPSIBLE_LIST_TYPE,typeMapper as collapsibleListTypeMapper,pluginCollapsibleList}; | ||
import _extends from"@babel/runtime/helpers/extends";import React from"react";var headersRegEx=/{\$h\d}.*?{\$h}/g,headersMarkdownStrategy=function(contentBlock,callback){!function(text,regex,callback){for(var matchArr,start;null!==(matchArr=regex.exec(text));)callback(start=matchArr.index,start+matchArr[0].length)}(contentBlock.getText(),headersRegEx,callback)},DEFAULTS_configViewer={hideMarkdown:!0},createHeadersMarkdownDecorator=function(config){var _config$type=config["wix-draft-plugin-headers-markdown"],settings=void 0===_config$type?{}:_config$type;return{strategy:headersMarkdownStrategy,component:function(props){return function(_ref){var children=_ref.children,hideMarkdown=_ref.hideMarkdown,sliceElementText=function(element,start,end){if("string"==typeof element)return element.slice(start,end);if(element.props&&element.props.text){var text=element.props.text.slice(start,end);return React.cloneElement(element,{text:text})}return element},Type=_ref.decoratedText.match(/h\d/)[0];if(hideMarkdown){var lastIndex=children.length-1;children[0]=sliceElementText(children[0],5),children[lastIndex]=sliceElementText(children[lastIndex],0,-4)}return React.createElement(Type,null,children)}(_extends({},props,settings))}}},pluginHeadersMarkdown=function(config){return{config:_extends({},DEFAULTS_configViewer,config),type:"wix-draft-plugin-headers-markdown",decorator:function(theme,config){var _createHeadersMarkdow;return createHeadersMarkdownDecorator(((_createHeadersMarkdow={})["wix-draft-plugin-headers-markdown"]=_extends({},config),_createHeadersMarkdow))}}};export{createHeadersMarkdownDecorator,pluginHeadersMarkdown}; | ||
//# sourceMappingURL=module.viewer.js.map |
@@ -1,19 +0,7 @@ | ||
export { COLLAPSIBLE_LIST_TYPE } from './types'; | ||
export declare const COMPONENT_DATA = "componentData"; | ||
export declare const directions: { | ||
LTR: string; | ||
RTL: string; | ||
export declare const DEFAULTS: { | ||
config: {}; | ||
configViewer: { | ||
hideMarkdown: boolean; | ||
}; | ||
}; | ||
export declare const EXPANDED = "expanded"; | ||
export declare const COLLAPSED = "collapsed"; | ||
export declare const FIRST_EXPANDED = "first_expanded"; | ||
export declare const DEFAULTS: Readonly<{ | ||
config: { | ||
expandState: string; | ||
expandOnlyOne: boolean; | ||
}; | ||
pairs: { | ||
key: string; | ||
}[]; | ||
}>; | ||
//# sourceMappingURL=defaults.d.ts.map |
@@ -1,4 +0,4 @@ | ||
import { CollapsibleListPluginEditorConfig } from './types'; | ||
import { HeadersMarkdownPluginEditorConfig } from './types'; | ||
import { EditorPluginCreator } from 'wix-rich-content-common'; | ||
export declare const pluginCollapsibleList: EditorPluginCreator<CollapsibleListPluginEditorConfig>; | ||
export declare const pluginHeadersMarkdown: EditorPluginCreator<HeadersMarkdownPluginEditorConfig>; | ||
//# sourceMappingURL=editor.d.ts.map |
@@ -1,6 +0,5 @@ | ||
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'; | ||
export { createHeadersMarkdownPlugin } from './createHeadersMarkdownPlugin'; | ||
export { createHeadersMarkdownDecorator } from './viewer'; | ||
export declare const HEADERS_MARKDOWN_TYPE = "wix-draft-plugin-headers-markdown"; | ||
export { pluginHeadersMarkdown } from './editor'; | ||
//# sourceMappingURL=index.d.ts.map |
import { EditorPluginConfig, ViewerPluginConfig } from 'wix-rich-content-common'; | ||
export declare const COLLAPSIBLE_LIST_TYPE = "wix-rich-content-plugin-collapsible-list"; | ||
export interface CollapsibleListPluginEditorConfig extends EditorPluginConfig { | ||
export declare const HEADERS_MARKDOWN_TYPE = "wix-draft-plugin-headers-markdown"; | ||
export interface HeadersMarkdownPluginEditorConfig extends EditorPluginConfig { | ||
[key: string]: any; | ||
} | ||
export interface CollapsibleListPluginViewerConfig extends ViewerPluginConfig { | ||
export interface HeadersMarkdownPluginViewerConfig extends ViewerPluginConfig { | ||
[key: string]: any; | ||
} | ||
//# sourceMappingURL=types.d.ts.map |
@@ -1,6 +0,6 @@ | ||
import { typeMapper } from './typeMapper'; | ||
import { COLLAPSIBLE_LIST_TYPE, CollapsibleListPluginViewerConfig } from './types'; | ||
import { DraftDecorator } from 'draft-js'; | ||
import { HeadersMarkdownPluginViewerConfig, HeadersMarkdownPluginEditorConfig } from './types'; | ||
import { ViewerPluginCreator } from 'wix-rich-content-common'; | ||
export { COLLAPSIBLE_LIST_TYPE, typeMapper as collapsibleListTypeMapper }; | ||
export declare const pluginCollapsibleList: ViewerPluginCreator<CollapsibleListPluginViewerConfig>; | ||
export declare const createHeadersMarkdownDecorator: (config: HeadersMarkdownPluginEditorConfig) => DraftDecorator; | ||
export declare const pluginHeadersMarkdown: ViewerPluginCreator<HeadersMarkdownPluginViewerConfig>; | ||
//# sourceMappingURL=viewer.d.ts.map |
@@ -1,1 +0,1 @@ | ||
{"name":"richlagetest","version":"0.0.0-230982fa614383ea3540c69c2696628caf960803"} | ||
{"name":"richlagetest","version":"0.0.0-263ccb2efb90f61645cfbda5bef16e62c32bb07c"} |
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
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
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
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 dynamic code execution (e.g., eval()), which is a dangerous practice. This can prevent 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
4
1
35458
24
77