Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

richlagetest

Package Overview
Dependencies
Maintainers
1
Versions
150
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

richlagetest - npm Package Compare versions

Comparing version 0.0.0-0c51a1140f567e2d087a75e68f679500b8a1d7fc to 0.0.0-11457cdb98d3c734cd386b95cbcc4ec4720169eb

dist/loadable/viewer/cjs/divider-component.cjs.js

8

dist/loadable/viewer/cjs/viewer-loadable.js

@@ -1,7 +0,1 @@

"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var _extends=require("@babel/runtime/helpers/extends"),loadable=require("@loadable/component");function _interopDefaultLegacy(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var _extends__default=_interopDefaultLegacy(_extends),loadable__default=_interopDefaultLegacy(loadable),EXTERNAL_LINK_TYPE="wix-draft-plugin-external-link",LINK_TYPE="LINK",CUSTOM_LINK_TYPE="ricos-plugin-custom-link",typeMapper=function typeMapper(){var _ref;return _ref={},_ref[EXTERNAL_LINK_TYPE]={component:loadable__default.default({resolved:{},chunkName:function(){return"LinkViewer"},isReady:function(props){var key=this.resolve(props);return!0===this.resolved[key]&&("undefined"!=typeof __webpack_modules__&&!!__webpack_modules__[key])},importAsync:function(){return Promise.resolve().then((function(){return require(
/* webpackChunkName: "LinkViewer" */
"./LinkViewer.cjs.js")}))},requireAsync:function(props){var _this=this,key=this.resolve(props);return this.resolved[key]=!1,this.importAsync(props).then((function(resolved){return _this.resolved[key]=!0,resolved}))},requireSync:function requireSync(props){var id=this.resolve(props);return"undefined"!=typeof __webpack_require__?__webpack_require__(id):eval("module.require")(id)},resolve:function resolve(){return require.resolveWeak?require.resolveWeak("./LinkViewer"):eval("require.resolve")("./LinkViewer")}}),elementType:"inline"},_ref[LINK_TYPE]={component:loadable__default.default({resolved:{},chunkName:function(){return"LinkViewer"},isReady:function(props){var key=this.resolve(props);return!0===this.resolved[key]&&("undefined"!=typeof __webpack_modules__&&!!__webpack_modules__[key])},importAsync:function(){return Promise.resolve().then((function(){return require(
/* webpackChunkName: "LinkViewer" */
"./LinkViewer.cjs.js")}))},requireAsync:function(props){var _this=this,key=this.resolve(props);return this.resolved[key]=!1,this.importAsync(props).then((function(resolved){return _this.resolved[key]=!0,resolved}))},requireSync:function requireSync(props){var id=this.resolve(props);return"undefined"!=typeof __webpack_require__?__webpack_require__(id):eval("module.require")(id)},resolve:function resolve(){return require.resolveWeak?require.resolveWeak("./LinkViewer"):eval("require.resolve")("./LinkViewer")}}),elementType:"inline"},_ref[CUSTOM_LINK_TYPE]={component:loadable__default.default({resolved:{},chunkName:function(){return"LinkViewer"},isReady:function(props){var key=this.resolve(props);return!0===this.resolved[key]&&("undefined"!=typeof __webpack_modules__&&!!__webpack_modules__[key])},importAsync:function(){return Promise.resolve().then((function(){return require(
/* webpackChunkName: "LinkViewer" */
"./LinkViewer.cjs.js")}))},requireAsync:function(props){var _this=this,key=this.resolve(props);return this.resolved[key]=!1,this.importAsync(props).then((function(resolved){return _this.resolved[key]=!0,resolved}))},requireSync:function requireSync(props){var id=this.resolve(props);return"undefined"!=typeof __webpack_require__?__webpack_require__(id):eval("module.require")(id)},resolve:function resolve(){return require.resolveWeak?require.resolveWeak("./LinkViewer"):eval("require.resolve")("./LinkViewer")}}),elementType:"inline"},_ref},DEFAULTS={config:{linkTypes:{anchor:!0}}},pluginLink=function(config){return{config:_extends__default.default({},DEFAULTS.config,config),type:LINK_TYPE,typeMapper:typeMapper}};exports.LINK_TYPE=LINK_TYPE,exports.linkTypeMapper=typeMapper,exports.pluginLink=pluginLink;
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),require("@babel/runtime/helpers/extends");var viewerLoadable=require("./viewer-loadable.cjs.js");require("@loadable/component"),require("wix-rich-content-common"),exports.DIVIDER_TYPE=viewerLoadable.DIVIDER_TYPE,exports.dividerTypeMapper=viewerLoadable.typeMapper,exports.pluginDivider=viewerLoadable.pluginDivider;

@@ -1,7 +0,1 @@

import _extends from"@babel/runtime/helpers/extends";import loadable from"@loadable/component";var EXTERNAL_LINK_TYPE="wix-draft-plugin-external-link",LINK_TYPE="LINK",CUSTOM_LINK_TYPE="ricos-plugin-custom-link",typeMapper=function typeMapper(){var _ref;return _ref={},_ref[EXTERNAL_LINK_TYPE]={component:loadable({resolved:{},chunkName:function(){return"LinkViewer"},isReady:function(props){var key=this.resolve(props);return!0===this.resolved[key]&&("undefined"!=typeof __webpack_modules__&&!!__webpack_modules__[key])},importAsync:function(){return import(
/* webpackChunkName: "LinkViewer" */
"./LinkViewer.js")},requireAsync:function(props){var _this=this,key=this.resolve(props);return this.resolved[key]=!1,this.importAsync(props).then((function(resolved){return _this.resolved[key]=!0,resolved}))},requireSync:function requireSync(props){var id=this.resolve(props);return"undefined"!=typeof __webpack_require__?__webpack_require__(id):eval("module.require")(id)},resolve:function resolve(){return require.resolveWeak?require.resolveWeak("./LinkViewer"):eval("require.resolve")("./LinkViewer")}}),elementType:"inline"},_ref[LINK_TYPE]={component:loadable({resolved:{},chunkName:function(){return"LinkViewer"},isReady:function(props){var key=this.resolve(props);return!0===this.resolved[key]&&("undefined"!=typeof __webpack_modules__&&!!__webpack_modules__[key])},importAsync:function(){return import(
/* webpackChunkName: "LinkViewer" */
"./LinkViewer.js")},requireAsync:function(props){var _this=this,key=this.resolve(props);return this.resolved[key]=!1,this.importAsync(props).then((function(resolved){return _this.resolved[key]=!0,resolved}))},requireSync:function requireSync(props){var id=this.resolve(props);return"undefined"!=typeof __webpack_require__?__webpack_require__(id):eval("module.require")(id)},resolve:function resolve(){return require.resolveWeak?require.resolveWeak("./LinkViewer"):eval("require.resolve")("./LinkViewer")}}),elementType:"inline"},_ref[CUSTOM_LINK_TYPE]={component:loadable({resolved:{},chunkName:function(){return"LinkViewer"},isReady:function(props){var key=this.resolve(props);return!0===this.resolved[key]&&("undefined"!=typeof __webpack_modules__&&!!__webpack_modules__[key])},importAsync:function(){return import(
/* webpackChunkName: "LinkViewer" */
"./LinkViewer.js")},requireAsync:function(props){var _this=this,key=this.resolve(props);return this.resolved[key]=!1,this.importAsync(props).then((function(resolved){return _this.resolved[key]=!0,resolved}))},requireSync:function requireSync(props){var id=this.resolve(props);return"undefined"!=typeof __webpack_require__?__webpack_require__(id):eval("module.require")(id)},resolve:function resolve(){return require.resolveWeak?require.resolveWeak("./LinkViewer"):eval("require.resolve")("./LinkViewer")}}),elementType:"inline"},_ref},DEFAULTS={config:{linkTypes:{anchor:!0}}},pluginLink=function(config){return{config:_extends({},DEFAULTS.config,config),type:LINK_TYPE,typeMapper:typeMapper}};export{LINK_TYPE,typeMapper as linkTypeMapper,pluginLink};
import"@babel/runtime/helpers/extends";export{b as DIVIDER_TYPE,t as dividerTypeMapper,p as pluginDivider}from"./viewer-loadable2.js";import"@loadable/component";import"wix-rich-content-common";

@@ -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"),_asyncToGenerator=require("@babel/runtime/helpers/asyncToGenerator"),_regeneratorRuntime=require("@babel/runtime/regenerator"),lodash=require("lodash"),wixRichContentCommon=require("wix-rich-content-common"),React=require("react"),_inheritsLoose=require("@babel/runtime/helpers/inheritsLoose"),classNames=require("classnames"),pluginLinkSchema=require("wix-rich-content-common/dist/statics/schemas/plugin-link.schema.json"),_createClass=require("@babel/runtime/helpers/createClass"),toDraftData=require("ricos-content/libs/toDraftData");function _interopDefaultLegacy(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}require("uuid");var _ref7,_ref6,_ref3,_ref,_extends__default=_interopDefaultLegacy(_extends),_objectWithoutPropertiesLoose__default=_interopDefaultLegacy(_objectWithoutPropertiesLoose),_asyncToGenerator__default=_interopDefaultLegacy(_asyncToGenerator),_regeneratorRuntime__default=_interopDefaultLegacy(_regeneratorRuntime),React__default=_interopDefaultLegacy(React),_inheritsLoose__default=_interopDefaultLegacy(_inheritsLoose),classNames__default=_interopDefaultLegacy(classNames),pluginLinkSchema__default=_interopDefaultLegacy(pluginLinkSchema),_createClass__default=_interopDefaultLegacy(_createClass),DEFAULTS$1={config:{alignment:"center",size:"content",link:{target:"_blank",rel:""}}},LINK_PREVIEW_TYPE="wix-draft-plugin-link-preview",addLinkPreview=(_ref=_asyncToGenerator__default.default(_regeneratorRuntime__default.default.mark((function _callee(editorState,config,blockKey,linkData){var _ref2,_ref2$enableEmbed,enableEmbed,_ref2$enableLinkPrevi,enableLinkPreview,fetchData,linkPreview,title,html,fixedUrl,linkPreviewData;return _regeneratorRuntime__default.default.wrap((function(_context){for(;;)switch(_context.prev=_context.next){case 0:return _ref2=config[LINK_PREVIEW_TYPE]||{},_ref2$enableEmbed=_ref2.enableEmbed,enableEmbed=void 0===_ref2$enableEmbed||_ref2$enableEmbed,_ref2$enableLinkPrevi=_ref2.enableLinkPreview,enableLinkPreview=void 0===_ref2$enableLinkPrevi||_ref2$enableLinkPrevi,fetchData=_ref2.fetchData,_context.next=3,fetchLinkPreview(fetchData,linkData.url);case 3:if(_context.t0=_context.sent,_context.t0){_context.next=6;break}_context.t0={};case 6:if(linkPreview=_context.t0,title=linkPreview.title,html=linkPreview.html,fixedUrl=linkPreview.fixedUrl,!shouldAddEmbed(html,enableEmbed,fixedUrl)&&!shouldAddLinkPreview(title,enableLinkPreview)){_context.next=13;break}return _context.next=11,createLinkPreviewData(linkData,linkPreview,config[LINK_PREVIEW_TYPE]);case 11:linkPreviewData=_context.sent,addLinkPreviewBlock(editorState,config,blockKey,linkPreviewData);case 13:case"end":return _context.stop()}}),_callee)}))),function(_x,_x2,_x3,_x4){return _ref.apply(this,arguments)}),fetchLinkPreview=(_ref3=_asyncToGenerator__default.default(_regeneratorRuntime__default.default.mark((function _callee2(fetchData,url){var fixedUrl,_ref4,thumbnail_url,title,description,html;return _regeneratorRuntime__default.default.wrap((function(_context2){for(;;)switch(_context2.prev=_context2.next){case 0:return fixedUrl=url.split("↵").join(""),_context2.next=3,null==fetchData?void 0:fetchData(fixedUrl);case 3:if(_context2.t0=_context2.sent,_context2.t0){_context2.next=6;break}_context2.t0={};case 6:return _ref4=_context2.t0,thumbnail_url=_ref4.thumbnail_url,title=_ref4.title,description=_ref4.description,html=_ref4.html,_context2.abrupt("return",{thumbnailUrl:thumbnail_url,title:title,description:description,html:html,fixedUrl:fixedUrl});case 12:case"end":return _context2.stop()}}),_callee2)}))),function(_x5,_x6){return _ref3.apply(this,arguments)}),createLinkPreviewData=(_ref6=_asyncToGenerator__default.default(_regeneratorRuntime__default.default.mark((function _callee3(linkData,_ref5,linkPreviewConfig){var thumbnailUrl,title,description,html,fixedUrl,currentConfig,data;return _regeneratorRuntime__default.default.wrap((function(_context3){for(;;)switch(_context3.prev=_context3.next){case 0:if(thumbnailUrl=_ref5.thumbnailUrl,title=_ref5.title,description=_ref5.description,html=_ref5.html,fixedUrl=_ref5.fixedUrl,currentConfig=_extends__default.default({},DEFAULTS$1,linkPreviewConfig).config,data={config:_extends__default.default({},currentConfig,{link:_extends__default.default({},currentConfig.link,lodash.pickBy(linkData),{url:fixedUrl}),width:html&&350}),thumbnail_url:thumbnailUrl,title:title,description:description,html:html},_context3.t0=thumbnailUrl,!_context3.t0){_context3.next=8;break}return _context3.next=7,isValidImgSrc(thumbnailUrl);case 7:_context3.t0=_context3.sent;case 8:if(!_context3.t0){_context3.next=10;break}data.thumbnail_url=thumbnailUrl;case 10:return _context3.abrupt("return",data);case 11:case"end":return _context3.stop()}}),_callee3)}))),function(_x7,_x8,_x9){return _ref6.apply(this,arguments)}),addLinkPreviewBlock=(_ref7=_asyncToGenerator__default.default(_regeneratorRuntime__default.default.mark((function _callee4(editorState,config,blockKey,linkPreviewData){var setEditorState,withoutLinkBlock,_createBlock,newEditorState;return _regeneratorRuntime__default.default.wrap((function(_context4){for(;;)switch(_context4.prev=_context4.next){case 0:setEditorState=config.setEditorState,withoutLinkBlock=wixRichContentEditorCommon.deleteBlockText(editorState,blockKey),_createBlock=wixRichContentEditorCommon.createBlock(withoutLinkBlock,linkPreviewData,LINK_PREVIEW_TYPE),newEditorState=_createBlock.newEditorState,setEditorState(newEditorState);case 4:case"end":return _context4.stop()}}),_callee4)}))),function(_x10,_x11,_x12,_x13){return _ref7.apply(this,arguments)}),isValidImgSrc=function(url){return new Promise((function(resolve){var image=document.createElement("img");image.src=url,image.onload=function(){resolve(!0)},image.onerror=function(){resolve(!1)}}))},shouldAddLinkPreview=function(title,enableLinkPreview){return enableLinkPreview&&title},shouldAddEmbed=function(html,enableEmbed,url){return Array.isArray(enableEmbed)?enableEmbed.filter((function(whiteListType){return url.toLowerCase().includes(whiteListType.toLowerCase())})).length>0:html&&enableEmbed},styles={fontElementMap:"_35ss-",link:"_3Bkfb",linkInEditor:"_35evZ",linkInViewer:"_1lsz7",toolbarUrlContainer:"_10766",toolbarUrl:"_t6Zq",toolbarUrlAnchor:"_3WEE2"},LinkViewer=function(_Component){function LinkViewer(props){var _this;(_this=_Component.call(this,props)||this).handleClick=function(event){var _this$props=_this.props,componentData=_this$props.componentData,isInEditor=_this$props.isInEditor,config=_this$props.config,helpers=_this$props.helpers,customAnchorScroll=_this$props.customAnchorScroll,settings=null==config?void 0:config.LINK;if(settings){var _helpers$onViewerActi,onClick=settings.onClick,anchor=componentData.anchor,url=componentData.url;if(null==helpers||null===(_helpers$onViewerActi=helpers.onViewerAction)||void 0===_helpers$onViewerActi||_helpers$onViewerActi.call(helpers,"LINK","Click",componentData),null==onClick||onClick(event,(null==componentData?void 0:componentData.customData)||_this.getHref(url,anchor)),anchor&&(event.stopPropagation(),!isInEditor))if(event.preventDefault(),customAnchorScroll)customAnchorScroll(event,anchor);else{var anchorString="viewer-"+anchor,element=document.getElementById(anchorString);wixRichContentCommon.addAnchorTagToUrl(anchorString),wixRichContentCommon.anchorScroll(element,_this.context.experiments)}}},_this.resolveUrl=function(url){return wixRichContentCommon.isValidTelUrl(url)?url:wixRichContentCommon.normalizeUrl(url)},_this.getHref=function(url,anchor){return url?_this.resolveUrl(url):"#viewer-"+anchor},wixRichContentCommon.validate(props.componentData,pluginLinkSchema__default.default);var theme=_this.props.theme;return _this.styles=wixRichContentCommon.mergeStyles({styles:styles,theme:theme}),_this}_inheritsLoose__default.default(LinkViewer,_Component);var _proto=LinkViewer.prototype;return _proto.componentWillReceiveProps=function(nextProps){lodash.isEqual(nextProps.componentData,this.props.componentData)||wixRichContentCommon.validate(nextProps.componentData,pluginLinkSchema__default.default)},_proto.render=function(){var _classNames,_this$props2=this.props,componentData=_this$props2.componentData,anchorTarget=_this$props2.anchorTarget,children=_this$props2.children,isInEditor=_this$props2.isInEditor,url=componentData.url,anchor=componentData.anchor,_componentData$target=componentData.target,target=void 0===_componentData$target?anchorTarget:_componentData$target,rel=componentData.rel,anchorProps={href:this.getHref(url,anchor),target:anchor?"_self":target,rel:wixRichContentCommon.getRelValue(rel),className:classNames__default.default(this.styles.link,(_classNames={},_classNames[this.styles.linkInEditor]=isInEditor,_classNames[this.styles.linkInViewer]=!isInEditor,_classNames)),onClick:this.handleClick},dataHook=anchor?wixRichContentCommon.ANCHOR_VIEWER_DATA_HOOK:wixRichContentCommon.LINK_VIEWER_DATA_HOOK;return React__default.default.createElement("a",_extends__default.default({"data-hook":dataHook},anchorProps),children)},LinkViewer}(React.Component);LinkViewer.contextType=wixRichContentCommon.GlobalContext;var linkEntityStrategy=function(contentBlock,callback,contentState){contentBlock.findEntityRanges((function(character){var entityKey=character.getEntity();if(null!==entityKey){var entityType=contentState.getEntity(entityKey).getType();return"LINK"===entityType||"ricos-plugin-custom-link"===entityType}return!1}),callback)},TextLinkButton=function(_Component){function TextLinkButton(){for(var _this,_len=arguments.length,args=new Array(_len),_key=0;_key<_len;_key++)args[_key]=arguments[_key];return(_this=_Component.call.apply(_Component,[this].concat(args))||this).showLinkPanel=function(){var _this$props=_this.props,getEditorState=_this$props.getEditorState,setEditorState=_this$props.setEditorState,getEntityData=_this$props.getEntityData,insertCustomLink=_this$props.insertCustomLink,settings=_this$props.config.LINK,onLinkAdd=null==settings?void 0:settings.onLinkAdd;if(onLinkAdd){var _getEntityData;onLinkAdd(null===(_getEntityData=getEntityData(getEditorState()))||void 0===_getEntityData?void 0:_getEntityData.customData,(function(data){return setEditorState(insertCustomLink(getEditorState(),data))}))}else _this.openLinkPanel()},_this.openLinkPanel=function(){var _this$props2=_this.props,getEditorState=_this$props2.getEditorState,setEditorState=_this$props2.setEditorState,theme=_this$props2.theme,isMobile=_this$props2.isMobile,linkModal=_this$props2.linkModal,helpers=_this$props2.helpers,keyName=_this$props2.keyName,anchorTarget=_this$props2.anchorTarget,relValue=_this$props2.relValue,t=_this$props2.t,uiSettings=_this$props2.uiSettings,insertLinkFn=_this$props2.insertLinkFn,closeInlinePluginToolbar=_this$props2.closeInlinePluginToolbar,config=_this$props2.config,innerModal=_this$props2.innerModal,toolbarOffsetTop=_this$props2.toolbarOffsetTop,toolbarOffsetLeft=_this$props2.toolbarOffsetLeft,settings=config.LINK,linkTypes=null==settings?void 0:settings.linkTypes,OriginalLinkPanel=!linkTypes||lodash.isEmpty(linkTypes)||!Object.values(linkTypes).find((function(addon){return!!addon})),_ref$externalPopups=(uiSettings.linkPanel||{}).externalPopups,externalPopups=void 0!==_ref$externalPopups&&_ref$externalPopups,customStyles=isMobile||OriginalLinkPanel?{content:{position:"fixed"}}:{content:{width:512,maxWidth:512,height:390,border:"1px solid rgb(237, 237, 237)",borderRadius:"6px",boxShadow:"rgba(0, 0, 0, 0.07) 0px 4px 8px 0px",padding:20}},modalStyles=wixRichContentEditorCommon.getModalStyles({fullScreen:isMobile,isMobile:isMobile,customStyles:customStyles}),commonPanelProps={helpers:helpers,modalName:wixRichContentEditorCommon.EditorModals.TEXT_LINK_MODAL,anchorTarget:anchorTarget,relValue:relValue,theme:theme,t:t,uiSettings:uiSettings,getEditorState:getEditorState,setEditorState:setEditorState,insertLinkFn:insertLinkFn,closeInlinePluginToolbar:closeInlinePluginToolbar,linkTypes:linkTypes};if(externalPopups||isMobile||linkModal)if(helpers&&helpers.openModal){var modalProps=_extends__default.default({modalStyles:modalStyles,hidePopup:helpers.closeModal,isMobile:isMobile},commonPanelProps);helpers.openModal(modalProps)}else console.error("Open external helper function is not defined for toolbar button with keyName "+keyName);else{var _modalProps=_extends__default.default({hidePopup:innerModal.closeInnerModal,top:toolbarOffsetTop,left:toolbarOffsetLeft,modalStyles:OriginalLinkPanel?null:{maxWidth:"none",padding:20}},commonPanelProps);innerModal.openInnerModal(_modalProps)}},_this}return _inheritsLoose__default.default(TextLinkButton,_Component),TextLinkButton.prototype.render=function(){var _config$LINK,_config$LINK$toolbar,_config$LINK$toolbar$,_this$props3=this.props,theme=_this$props3.theme,helpers=_this$props3.helpers,isMobile=_this$props3.isMobile,tabIndex=_this$props3.tabIndex,config=_this$props3.config,isActive=_this$props3.isActive,icon=_this$props3.icon,tooltipText=_this$props3.tooltipText,disabled=_this$props3.disabled,buttonStyles={button:theme.inlineToolbarButton,buttonWrapper:theme.inlineToolbarButton_wrapper,icon:theme.inlineToolbarButton_icon,active:theme.inlineToolbarButton_active},insertLinkIcon=(null==config||null===(_config$LINK=config.LINK)||void 0===_config$LINK||null===(_config$LINK$toolbar=_config$LINK.toolbar)||void 0===_config$LINK$toolbar||null===(_config$LINK$toolbar$=_config$LINK$toolbar.icons)||void 0===_config$LINK$toolbar$?void 0:_config$LINK$toolbar$.InsertPluginButtonIcon)||icon;return React__default.default.createElement(wixRichContentEditorCommon.LinkButton,{onClick:this.showLinkPanel,isActive:isActive,helpers:helpers,theme:_extends__default.default({},theme,buttonStyles),isMobile:isMobile,tooltipText:tooltipText,tabIndex:tabIndex,pluginType:"LINK",icon:insertLinkIcon,disabled:disabled})},_createClass__default.default(TextLinkButton,[{key:"isActive",get:function(){return wixRichContentEditorCommon.hasLinksInSelection(this.props.getEditorState())}}]),TextLinkButton}(React.Component),RemoveLinkIcon=function(props){return React__default.default.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink",width:"19",height:"19",viewBox:"0 0 19 19"},props),React__default.default.createElement("defs",null,React__default.default.createElement("path",{id:"remove-link",d:"M7.8 6c.11 0 .2.09.2.2v.807H4.5c-1.38 0-2.5 1.12-2.5 2.5 0 1.326 1.032 2.41 2.336 2.495l.164.005H8v.793c0 .11-.09.2-.2.2H4.5C2.567 13 1 11.433 1 9.5S2.567 6 4.5 6h3.3zm5.7 0C15.433 6 17 7.567 17 9.5S15.433 13 13.5 13h-3.3c-.11 0-.2-.09-.2-.2v-.807h3.5c1.38 0 2.5-1.12 2.5-2.5 0-1.381-1.12-2.5-2.5-2.5H10V6.2c0-.11.09-.2.2-.2h3.3zm-1.7 3c.11 0 .2.09.2.2v.6c0 .11-.09.2-.2.2H6.2c-.11 0-.2-.09-.2-.2v-.6c0-.11.09-.2.2-.2h5.6z"})),React__default.default.createElement("g",{fill:"none",fillRule:"evenodd"},React__default.default.createElement("use",{fill:"currentColor",transform:"rotate(-45 9 9.5)",xlinkHref:"#remove-link"}),React__default.default.createElement("path",{stroke:"currentColor",strokeLinecap:"square",d:"M3.5 3.5l11 12"})))},RemoveLinkButton=function(_Component){function RemoveLinkButton(){for(var _this,_len=arguments.length,args=new Array(_len),_key=0;_key<_len;_key++)args[_key]=arguments[_key];return(_this=_Component.call.apply(_Component,[this].concat(args))||this).deleteLink=function(){var _this$props=_this.props,getEditorState=_this$props.getEditorState,setEditorState=_this$props.setEditorState,closeInlinePluginToolbar=_this$props.closeInlinePluginToolbar;setEditorState(wixRichContentEditorCommon.removeLinksInSelection(getEditorState(),setEditorState)),closeInlinePluginToolbar()},_this}return _inheritsLoose__default.default(RemoveLinkButton,_Component),RemoveLinkButton.prototype.render=function(){var _this$props2=this.props,theme=_this$props2.theme,helpers=_this$props2.helpers,isMobile=_this$props2.isMobile,t=_this$props2.t,tabIndex=_this$props2.tabIndex,linkButtonTooltip=t("LinkPanelContainer_RemoveButton"),buttonStyles={button:theme.inlineToolbarButton,buttonWrapper:theme.inlineToolbarButton_wrapper,icon:theme.inlineToolbarButton_icon,active:theme.inlineToolbarButton_active};return React__default.default.createElement(wixRichContentEditorCommon.InlineToolbarButton,{onClick:this.deleteLink,helpers:helpers,theme:_extends__default.default({},theme,buttonStyles),isMobile:isMobile,tooltipText:linkButtonTooltip,tabIndex:tabIndex,icon:RemoveLinkIcon,dataHook:"RemoveLinkButton",pluginType:"LINK"})},RemoveLinkButton}(React.Component),UrlLinkButton=function(_Component){function UrlLinkButton(props){var _this;(_this=_Component.call(this,props)||this).handleClick=function(event){var _this$props=_this.props,getEditorState=_this$props.getEditorState,customAnchorScroll=_this$props.customAnchorScroll,_ref$anchor=(wixRichContentEditorCommon.getLinkDataInSelection(getEditorState())||{}).anchor,anchor=void 0===_ref$anchor?"":_ref$anchor;customAnchorScroll?customAnchorScroll(event,anchor):wixRichContentEditorCommon.scrollToBlock(anchor,_this.context.experiments)},_this.preventDefault=function(event){return event.preventDefault()};var theme=_this.props.theme;return _this.styles=wixRichContentCommon.mergeStyles({styles:styles,theme:theme}),_this}return _inheritsLoose__default.default(UrlLinkButton,_Component),UrlLinkButton.prototype.render=function(){var _classNames,styles=this.styles,_this$props2=this.props,getEditorState=_this$props2.getEditorState,t=_this$props2.t,_ref2=wixRichContentEditorCommon.getLinkDataInSelection(getEditorState())||{},_ref2$url=_ref2.url,url=void 0===_ref2$url?"":_ref2$url,anchor=_ref2.anchor,target=_ref2.target,rel=_ref2.rel,href=url?wixRichContentCommon.normalizeUrl(url):void 0,anchorProps={href:href,target:target,rel:wixRichContentCommon.getRelValue(rel),className:classNames__default.default(styles.toolbarUrl,(_classNames={},_classNames[styles.toolbarUrlAnchor]=anchor,_classNames)),onMouseDown:this.preventDefault,onClick:anchor&&this.handleClick};return React__default.default.createElement("div",{className:styles.toolbarUrlContainer},React__default.default.createElement("a",anchorProps,href||t("LinkTo_Toolbar_GoTo")))},UrlLinkButton}(React.Component);UrlLinkButton.contextType=wixRichContentCommon.GlobalContext;var createInlineButtons=function(config){return[{keyName:"url",component:function(props){return React__default.default.createElement(UrlLinkButton,Object.assign({},config,props))},mobile:!0,type:wixRichContentPluginCommons.BUTTONS.CUSTOM},{keyName:"separator1",type:wixRichContentPluginCommons.BUTTONS.SEPARATOR,mobile:!0},{keyName:"edit",component:function(props){return React__default.default.createElement("div",{"data-hook":"EditLinkButton",style:{margin:"0 2px 0 -7px"}},React__default.default.createElement(TextLinkButton,Object.assign({insertLinkFn:wixRichContentEditorCommon.updateLinkAtCurrentSelection,getEntityData:wixRichContentEditorCommon.getEntityData,insertCustomLink:wixRichContentEditorCommon.insertCustomLink,icon:wixRichContentPluginCommons.EditIcon,tooltipText:config.t("LinkTo_Edit_Tooltip")},config,props)))},mobile:!0,type:wixRichContentPluginCommons.BUTTONS.CUSTOM},{keyName:"separator2",type:wixRichContentPluginCommons.BUTTONS.SEPARATOR,mobile:!0},{keyName:"remove",component:function(props){return React__default.default.createElement("div",{style:{margin:"0 -6px 0 -6px"}},React__default.default.createElement(RemoveLinkButton,Object.assign({},config,props)))},mobile:!0,type:wixRichContentPluginCommons.BUTTONS.CUSTOM}]},openLinkModal=function(_ref){var helpers=_ref.helpers,isMobile=_ref.isMobile,anchorTarget=_ref.anchorTarget,relValue=_ref.relValue,t=_ref.t,theme=_ref.theme,getEditorState=_ref.getEditorState,setEditorState=_ref.setEditorState,uiSettings=_ref.uiSettings,closeInlinePluginToolbar=_ref.closeInlinePluginToolbar,settings=_ref.settings,modalStyles=wixRichContentEditorCommon.getModalStyles({fullScreen:isMobile,isMobile:isMobile,customStyles:isMobile?{content:{position:"fixed"}}:{content:{maxWidth:"max-content",padding:20}}});if(helpers&&helpers.openModal){var modalProps={helpers:helpers,modalStyles:modalStyles,isMobile:isMobile,getEditorState:getEditorState,setEditorState:setEditorState,t:t,theme:theme,anchorTarget:anchorTarget,relValue:relValue,modalName:wixRichContentEditorCommon.EditorModals.TEXT_LINK_MODAL,hidePopup:helpers.closeModal,uiSettings:uiSettings,insertLinkFn:wixRichContentEditorCommon.insertLinkAtCurrentSelection,closeInlinePluginToolbar:closeInlinePluginToolbar,linkTypes:null==settings?void 0:settings.linkTypes};helpers.openModal(modalProps)}else console.error("Link plugin: failed to display Link modal dialog since helpers.openModal is not defined")},DEFAULTS={config:{linkTypes:{anchor:!0}}};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 createLinkPlugin=function(config){var type="LINK",theme=config.theme,anchorTarget=config.anchorTarget,relValue=config.relValue,_config$type=config[type],settings=void 0===_config$type?{}:_config$type,commonPubsub=config.commonPubsub,rest=_objectWithoutPropertiesLoose__default.default(config,["theme","anchorTarget","relValue",type,"commonPubsub"].map(_toPropertyKey)),target=anchorTarget,rel=relValue;settings.minLinkifyLength=settings.minLinkifyLength||6;var linkifyData,prevContentState,toolbar=function(config){var _config$LINK_TYPE2,_config$LINK_TYPE2$to,isDisabled=function(){return wixRichContentEditorCommon.isAtomicBlockInSelection(config.getEditorState())},getTooltip=function(){return config.t(isDisabled()?"TextLinkButton_DisableButtonForPlugins_Tooltip":"TextLinkButton_Tooltip")};return _extends__default.default({TextButtonMapper:function(){var _ref2;return(_ref2={})[wixRichContentEditorCommon.FORMATTING_BUTTONS.LINK]={component:function(props){return React__default.default.createElement(TextLinkButton,Object.assign({insertLinkFn:wixRichContentEditorCommon.insertLinkAtCurrentSelection,getEntityData:wixRichContentEditorCommon.getEntityData,insertCustomLink:wixRichContentEditorCommon.insertCustomLink,isActive:wixRichContentEditorCommon.hasLinksInSelection(config.getEditorState()),closeInlinePluginToolbar:config.closeInlinePluginToolbar,tooltipText:getTooltip(),innerModal:config.innerModal,disabled:isDisabled()},props))},keyBindings:[{keyCommand:{command:wixRichContentEditorCommon.COMMANDS.LINK,modifiers:[wixRichContentEditorCommon.MODIFIERS.COMMAND],key:"k"},commandHandler:function(editorState){if(config.onKeyboardShortcutClick({buttonName:wixRichContentEditorCommon.COMMANDS.LINK,pluginId:"LINK"}),wixRichContentEditorCommon.hasLinksInSelection(editorState))return config.closeInlinePluginToolbar(),wixRichContentEditorCommon.removeLinksInSelection(editorState);isDisabled()||openLinkModal(config)}}],externalizedButtonProps:{onClick:function(e){e.preventDefault(),openLinkModal(config)},isActive:function(){return wixRichContentEditorCommon.hasLinksInSelection(config.getEditorState())},isDisabled:isDisabled,getIcon:function(){var _config$LINK_TYPE,_config$LINK_TYPE$too,_config$LINK_TYPE$too2;return(null===(_config$LINK_TYPE=config.LINK)||void 0===_config$LINK_TYPE||null===(_config$LINK_TYPE$too=_config$LINK_TYPE.toolbar)||void 0===_config$LINK_TYPE$too||null===(_config$LINK_TYPE$too2=_config$LINK_TYPE$too.icons)||void 0===_config$LINK_TYPE$too2?void 0:_config$LINK_TYPE$too2.InsertPluginButtonIcon)||function(){var _config$experiments,_config$experiments$n;return wixRichContentEditorCommon.LinkIcon({newFormattingToolbar:null==config||null===(_config$experiments=config.experiments)||void 0===_config$experiments||null===(_config$experiments$n=_config$experiments.newFormattingToolbar)||void 0===_config$experiments$n?void 0:_config$experiments$n.enabled})}},tooltip:getTooltip(),getLabel:function(){return""},type:wixRichContentEditorCommon.BUTTON_TYPES.BUTTON}},_ref2}},!1===(null===(_config$LINK_TYPE2=config.LINK)||void 0===_config$LINK_TYPE2||null===(_config$LINK_TYPE2$to=_config$LINK_TYPE2.toolbar)||void 0===_config$LINK_TYPE2$to?void 0:_config$LINK_TYPE2$to.inlineToolbar)?{}:{InlinePluginToolbarButtons:createInlineButtons(config)},{name:"link"})}(_extends__default.default({},config,{settings:settings,closeInlinePluginToolbar:closeInlinePluginToolbar})),decorators=[{strategy:linkEntityStrategy,component:function(props){var componentData=null==props?void 0:props.contentState.getEntity(null==props?void 0:props.entityKey).getData();return React__default.default.createElement(LinkViewer,Object.assign({componentData:componentData,anchorTarget:anchorTarget,relValue:relValue,theme:theme},props))}}],shouldConvertToLinkPreview=function(linkifyData){var _linkifyData$block;return linkifyData&&"unstyled"===(null===(_linkifyData$block=linkifyData.block)||void 0===_linkifyData$block?void 0:_linkifyData$block.getType())&&config[LINK_PREVIEW_TYPE]},getBlockLinkUrl=function(linkifyData){var string=linkifyData.string;if(linkifyData.block.getText()===string)return string};function closeInlinePluginToolbar(){commonPubsub.set("cursorOnInlinePlugin",null)}var getLinkifyData=function(editorState){var strData=findLastStringWithNoSpacesAndSoftLines(editorState);return shouldLinkify(strData)?strData:void 0},shouldLinkify=function(consecutiveString){return consecutiveString.string.length>=settings.minLinkifyLength&&wixRichContentCommon.isValidUrl(consecutiveString.string)&&!(rangeContainsEntity(consecutiveString)&&blockContainsPlainText(consecutiveString))&&!(null!=settings&&settings.disableAutoLink)},findLastStringWithNoSpacesAndSoftLines=function(editorState){var selection=editorState.getSelection(),blockKey=selection.getAnchorKey(),block=editorState.getCurrentContent().getBlockForKey(blockKey),text=block.getText(),endIndex=selection.getEndOffset(),spaceIndex=text.lastIndexOf(" ",endIndex)+1,softLineIndex=text.lastIndexOf("\n",endIndex)+1,index=Math.max(spaceIndex,softLineIndex);return{string:text.slice(index,endIndex),block:block,blockKey:blockKey,index:index,endIndex:endIndex}},rangeContainsEntity=function(_ref){for(var block=_ref.block,index=_ref.index,endIndex=_ref.endIndex,i=index;i<endIndex;i++)if(null!==block.getEntityAt(i))return!0;return!1},blockContainsPlainText=function(_ref2){var block=_ref2.block,string=_ref2.string;return block.getText().length>string.length},addLinkAt=function(_ref3,editorState){var string=_ref3.string,index=_ref3.index,endIndex=_ref3.endIndex,blockKey=_ref3.blockKey;return wixRichContentEditorCommon.insertLinkInPosition(editorState,blockKey,index,endIndex,{url:string,rel:rel,target:target})};return wixRichContentPluginCommons.createBasePlugin(_extends__default.default({theme:theme,toolbar:toolbar,type:type,anchorTarget:anchorTarget,relValue:relValue,settings:settings,commonPubsub:commonPubsub,defaultPluginData:DEFAULTS},rest),{decorators:decorators,handleBeforeInput:function(chars,editorState,eventTimeStamp,pluginFunctions){return/\s/.test(chars)&&(linkifyData=getLinkifyData(editorState)),"not-handled"},handleReturn:function(event,editorState,pluginFunctions){if(linkifyData=getLinkifyData(editorState),shouldConvertToLinkPreview(linkifyData)){var _linkifyData,url=getBlockLinkUrl(linkifyData),blockKey=null===(_linkifyData=linkifyData)||void 0===_linkifyData?void 0:_linkifyData.block.getKey();if(url&&blockKey){var linkData=wixRichContentEditorCommon.createLinkEntityData({url:url,target:target,rel:rel});addLinkPreview(editorState,config,blockKey,linkData)}}return"not-handled"},onChange:function(editorState){var selection=editorState.getSelection();wixRichContentEditorCommon.hasLinksInSelection(editorState)&&selection.isCollapsed()&&selection.getHasFocus()?setTimeout((function(){var commonPubsubData,boundingRect=wixRichContentEditorCommon.getVisibleSelectionRect(window);commonPubsubData={type:type,boundingRect:boundingRect},commonPubsub.set("cursorOnInlinePlugin",commonPubsubData)})):closeInlinePluginToolbar();var newEditorState=editorState;return!function(editorState){var contentState=editorState.getCurrentContent(),contentChanged=contentState!==prevContentState;return prevContentState=contentState,contentChanged&&"insert-fragment"===editorState.getLastChangeType()}(editorState)?linkifyData&&(newEditorState=addLinkAt(linkifyData,editorState)):newEditorState=wixRichContentEditorCommon.fixPastedLinks(editorState,{anchorTarget:anchorTarget,relValue:relValue}),linkifyData=void 0,newEditorState}})};createLinkPlugin.functionName="LINK";var createLinkData=function(pluginData,isRicosSchema){return void 0===pluginData&&(pluginData={}),void 0===isRicosSchema&&(isRicosSchema=!1),isRicosSchema?toDraftData.convertDecorationDataToDraft("LINK",pluginData):pluginData},linkDataDefaults_linkData={link:{target:"SELF",url:"",anchor:"",rel:{nofollow:null,sponsored:null,ugc:null},customData:null}},urlRegex=/(?:https?:\/\/)?(?:www\.)?[-a-zA-Z0-9@:%._+~#=]{1,256}\.[a-zA-Z]{2,}\b(?:[-a-zA-Z0-9@:%._+~#=?!&/]*)(?:[-a-zA-Z0-9@:%._+~#=?!&/]*)/gi,urlRegexExact=new RegExp("^"+urlRegex.source+"$","gi"),urlRegexExactWithSpace=new RegExp("^"+urlRegex.source+"[\\s\\n]$","gi"),linkifyLastWord=function(_ref){var _text$match,editor=_ref.editor,_editor$state$selecti=editor.state.selection.$from,nodeBefore=_editor$state$selecti.nodeBefore,pos=_editor$state$selecti.pos,_ref2=nodeBefore||{},text=_ref2.text,nodeBeforeSize=_ref2.nodeSize,url=null==text||null===(_text$match=text.match(urlRegex))||void 0===_text$match?void 0:_text$match[0],urlIndex=text?text.search(urlRegex):-1;if(nodeBeforeSize&&url&&-1!==urlIndex){var from=pos-nodeBeforeSize+urlIndex;editor.chain().focus().setTextSelection({from:from,to:pos}).setLink({link:{url:url}}).setTextSelection(pos).run()}return!1},createTiptapExtensions=function(defaultOptions){return[{type:"mark",createExtensionConfig:function(_ref3){var markPasteRule=_ref3.markPasteRule,markInputRule=_ref3.markInputRule,Plugin=_ref3.Plugin,PluginKey=_ref3.PluginKey;return{name:"link",priority:1e3,inclusive:!1,defaultOptions:_extends__default.default({openOnClick:!0,linkOnPaste:!0,HTMLAttributes:{link:{}}},defaultOptions),addAttributes:function(){return linkDataDefaults_linkData},parseHTML:function(){return[{tag:"a[href]"}]},renderHTML:function(_ref4){var HTMLAttributes=_ref4.HTMLAttributes,link=styles.link,linkInViewer=styles.linkInViewer,classes=classNames__default.default(link,linkInViewer),_parseLink=function(_ref5){var url=_ref5.url,rel=_ref5.rel,target=_ref5.target,anchor=_ref5.anchor,customData=_ref5.customData;return{anchor:anchor,url:url,rel:rel&&Object.entries(rel).flatMap((function(_ref6){var key=_ref6[0];return _ref6[1]?key:[]})).join(" "),target:target&&"_"+target.toLowerCase(),customData:customData}}(HTMLAttributes.link);return["a",{href:_parseLink.url,rel:_parseLink.rel,target:_parseLink.target,class:classes},0]},addCommands:function(){return{setLink:function(attributes){return function(_ref5){return _ref5.commands.setMark("link",attributes)}},toggleLink:function(attributes){return function(_ref6){return _ref6.commands.toggleMark("link",attributes)}},unsetLink:function(){return function(_ref7){return _ref7.commands.unsetMark("link")}}}},addPasteRules:function(){return[markPasteRule(urlRegex,this.type,(function(match){return{link:{url:match[0]}}}))]},addInputRules:function(){return[markInputRule(urlRegexExactWithSpace,this.type,(function(match){return{link:{url:match[0].trim()}}}))]},addProseMirrorPlugins:function(){var _this=this,plugins=[];return this.options.openOnClick&&plugins.push(new Plugin({key:new PluginKey("handleClickLink"),props:{handleClick:function(view,pos,event){var _event$target,attrs=_this.editor.getAttributes("link");return!(!(null===(_event$target=event.target)||void 0===_event$target?void 0:_event$target.closest("a"))||!attrs.href)&&(window.open(attrs.href,attrs.target),!0)}}})),this.options.linkOnPaste&&plugins.push(new Plugin({key:new PluginKey("handlePasteLink"),props:{handlePaste:function(view,event,slice){if(view.state.selection.empty)return!1;var textContent="";return slice.content.forEach((function(node){textContent+=node.textContent})),!(!textContent||!textContent.match(urlRegexExact))&&(_this.editor.commands.setMark(_this.type,{link:{url:textContent}}),!0)}}})),plugins}}}},{type:"extension",createExtensionConfig:function(){return{name:"linkEnter",addKeyboardShortcuts:function(){return{Enter:linkifyLastWord,Space:linkifyLastWord}}}}}]};exports.EXTERNAL_LINK_TYPE="wix-draft-plugin-external-link",exports.LINK_TYPE="LINK",exports.LinkViewer=LinkViewer,exports.createLinkPlugin=createLinkPlugin,exports.pluginLink=function(config){var pluginConfig=_extends__default.default({},DEFAULTS.config,config);return{config:pluginConfig,type:"LINK",createPlugin:createLinkPlugin,ModalsMap:{},createPluginData:createLinkData,tiptapExtensions:createTiptapExtensions(pluginConfig)}};
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var _extends=require("@babel/runtime/helpers/extends"),_objectWithoutPropertiesLoose=require("@babel/runtime/helpers/objectWithoutPropertiesLoose"),wixRichContentCommon=require("wix-rich-content-common"),wixRichContentPluginCommons=require("wix-rich-content-plugin-commons"),_inheritsLoose=require("@babel/runtime/helpers/inheritsLoose"),React=require("react"),classNames=require("classnames"),pluginDividerSchema=require("wix-rich-content-common/dist/statics/schemas/plugin-divider.schema.json"),lodash=require("lodash"),wixRichContentEditorCommon=require("wix-rich-content-editor-common"),toDraftData=require("ricos-content/libs/toDraftData"),ricosContent=require("ricos-content");function _interopDefaultLegacy(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var _extends__default=_interopDefaultLegacy(_extends),_objectWithoutPropertiesLoose__default=_interopDefaultLegacy(_objectWithoutPropertiesLoose),_inheritsLoose__default=_interopDefaultLegacy(_inheritsLoose),React__default=_interopDefaultLegacy(React),classNames__default=_interopDefaultLegacy(classNames),pluginDividerSchema__default=_interopDefaultLegacy(pluginDividerSchema),LINE_TYPES=Object.freeze(["single","double","dashed","dotted"]),SIZES=Object.freeze(["large","medium","small"]),ALIGNMENTS=["left","center","right"],DEFAULTS=Object.freeze({type:"single",config:{size:"large",alignment:"center",textWrap:wixRichContentCommon.NO_WRAP}}),DIVIDER_TYPE="wix-draft-plugin-divider",getNextValue=function(array,currentValue){return array[(array.indexOf(currentValue)+1)%array.length]},Divider$1=function(_temp){var _this=this,_ref=void 0===_temp?{}:_temp,type=_ref.type,config=_ref.config;this.getNextAlignmentConfig=function(){var _this$config,alignment=getNextValue(ALIGNMENTS,null===(_this$config=_this.config)||void 0===_this$config?void 0:_this$config.alignment);return _extends__default.default({},_this.config,{alignment:alignment})},this.getNextSizeConfig=function(){var _this$config2,size=getNextValue(SIZES,null===(_this$config2=_this.config)||void 0===_this$config2?void 0:_this$config2.size);return _extends__default.default({},_this.config,{size:size})},this.isAlignmentDisabled=function(){return"large"===_this.size},this.type=type||DEFAULTS.type,this.config=_extends__default.default({},DEFAULTS.config,config),this.size=this.config.size,this.alignment=this.config.alignment},lineProps=function(width,lineDistance){return void 0===lineDistance&&(lineDistance=1),{x2:width,y1:lineDistance,y2:lineDistance}},DividerLine=function(_ref){var type=_ref.type,size=_ref.size,alignment=_ref.alignment,width=_ref.width,multilineDistance=_ref.multilineDistance,styles=_ref.styles,className=_ref.className,fillParent=_ref.fillParent,isMobile=_ref.isMobile,linesPropsArr=function(type,width,multilineDistance){void 0===multilineDistance&&(multilineDistance=7);var linePropsArr=[lineProps(width)];return"double"===type&&linePropsArr.push(lineProps(width,multilineDistance)),linePropsArr}(type,width,multilineDistance),lineClassName=classNames__default.default(styles.divider,styles["divider--"+type],styles["divider--"+size+(isMobile?"--mobile":"")],styles["divider--"+alignment],fillParent?styles["divider--fill-parent"]:"",className);return React__default.default.createElement("svg",{className:lineClassName},linesPropsArr.map((function(lineProp,i){return React__default.default.createElement("line",_extends__default.default({key:i},lineProp))})))},styles={"divider-container":"_3zNzG","divider-container--double":"_3uLbE",divider:"_1L18v","divider--single":"_3fmOK","divider--double":"_3GOMV","divider--dashed":"_2MyQc","divider--dotted":"XDMdA","divider--small":"SFUYo","divider--small--mobile":"_1jnDu","divider--medium":"_15dwK","divider--large--mobile":"_2PezL","divider--medium--mobile":"_2dkSI","divider--large":"_3q8-N","divider--left":"_2AY-i","divider--center":"_2ikV9","divider--right":"_2P8vY","divider--fill-parent":"_3Yq1D"},DividerComponent=function(_PureComponent){function DividerComponent(props){var _this;return _this=_PureComponent.call(this,props)||this,wixRichContentCommon.validate(props.componentData,pluginDividerSchema__default.default),_this}_inheritsLoose__default.default(DividerComponent,_PureComponent);var _proto=DividerComponent.prototype;return _proto.componentWillReceiveProps=function(nextProps){lodash.isEqual(nextProps.componentData,this.props.componentData)||wixRichContentCommon.validate(nextProps.componentData,pluginDividerSchema__default.default)},_proto.render=function(){this.styles=this.styles||wixRichContentCommon.mergeStyles({styles:styles,theme:this.props.theme});var divider=new Divider$1(this.props.componentData),type=divider.type,size=divider.size,alignment=divider.alignment,className=classNames__default.default(this.styles["divider-container"],this.styles["divider-container--"+type],this.props.isMobile&&this.styles["divider-container--mobile"],this.props.className);return React__default.default.createElement("div",{className:className,"data-hook":"divider-"+type},React__default.default.createElement(DividerLine,{type:type,width:"100%",size:size,alignment:alignment,styles:this.styles,isMobile:this.props.isMobile}))},DividerComponent}(React.PureComponent);DividerComponent.sizeClassName=function(componentData,theme){return""};var getDividerFromStore=function(store){return new Divider$1(store.get("componentData"))},updateStoreConfig=function(store,config){store.update("componentData",{config:config})},changeType=function(type,_componentData,store){store.update("componentData",{type:type.value})},changeAlignmentMobile=function(_ref){var store=_ref.store,divider=getDividerFromStore(store);updateStoreConfig(store,divider.getNextAlignmentConfig())},changeSizeMobile=function(_ref2){var store=_ref2.store,divider=getDividerFromStore(store);updateStoreConfig(store,divider.getNextSizeConfig())},isAlignmentDisabled=function(componentData){return void 0===componentData&&(componentData={}),new Divider$1(componentData).isAlignmentDisabled()},getNextSizeIcon=function(componentData){var _SIZE_LARGE$SIZE_MEDI,size=new Divider$1(componentData).size;return(_SIZE_LARGE$SIZE_MEDI={},_SIZE_LARGE$SIZE_MEDI.large=wixRichContentPluginCommons.SizeMediumIcon,_SIZE_LARGE$SIZE_MEDI.medium=wixRichContentPluginCommons.SizeSmallIcon,_SIZE_LARGE$SIZE_MEDI.small=wixRichContentPluginCommons.SizeLargeIcon,_SIZE_LARGE$SIZE_MEDI)[size]},getNextAlignmentIcon=function(componentData){var _ALIGN_LEFT$ALIGN_CEN,alignment=new Divider$1(componentData).alignment;return(_ALIGN_LEFT$ALIGN_CEN={},_ALIGN_LEFT$ALIGN_CEN.left=wixRichContentEditorCommon.AlignLeftIcon,_ALIGN_LEFT$ALIGN_CEN.center=wixRichContentPluginCommons.AlignCenterIcon,_ALIGN_LEFT$ALIGN_CEN.right=wixRichContentEditorCommon.AlignRightIcon,_ALIGN_LEFT$ALIGN_CEN)[alignment]},createDropdownOptionComponent=function(_ref){var type=_ref.type,styles=_ref.styles;return function(){return React__default.default.createElement("div",{className:styles["divider-dropdown__option"]},React__default.default.createElement(DividerLine,{type:type,styles:styles,width:60,fillParent:!0,multilineDinstance:4,className:styles["divider-dropdown__divider"]}))}},createDropdownValueGetter=function(dropdownOptions){return function(store){var type=(store.get("componentData")||{}).type||DEFAULTS.type;return dropdownOptions.find((function(x){return x.value===type}))}},createInlineButtons=function(_ref){var _settings$toolbar,styles=_ref.styles,t=_ref.t,settings=_ref.settings,dropdownOptions=function(styles){return LINE_TYPES.map((function(type){return{value:type,component:createDropdownOptionComponent({type:type,styles:styles})}}))}(styles),icons=(null==settings||null===(_settings$toolbar=settings.toolbar)||void 0===_settings$toolbar?void 0:_settings$toolbar.icons)||{};return[{keyName:"type",type:wixRichContentPluginCommons.BUTTONS.DROPDOWN,options:dropdownOptions,onChange:changeType,getValue:createDropdownValueGetter(dropdownOptions),controlClassName:null==styles?void 0:styles["divider-dropdown__control"],tooltipTextKey:"DividerPlugin_SelectType_Tooltip",t:t,mobile:!0},{keyName:"separator1",type:wixRichContentPluginCommons.BUTTONS.SEPARATOR,mobile:!0},{keyName:"sizeSmall",type:wixRichContentPluginCommons.BUTTONS.SIZE_SMALL},{keyName:"sizeMedium",type:wixRichContentPluginCommons.BUTTONS.SIZE_MEDIUM},{keyName:"sizeLarge",type:wixRichContentPluginCommons.BUTTONS.SIZE_LARGE},{keyName:"sizeMobile",type:wixRichContentPluginCommons.BUTTONS.CUSTOM,icon:icons.sizeMobile||wixRichContentPluginCommons.SizeLargeIcon,onClick:changeSizeMobile,mobile:!0,desktop:!1,mapComponentDataToButtonProps:function(componentData){return{icon:getNextSizeIcon(componentData)}}},{keyName:"separator2",type:wixRichContentPluginCommons.BUTTONS.SEPARATOR,mobile:!0},{keyName:"alignLeft",type:wixRichContentPluginCommons.BUTTONS.TEXT_ALIGN_LEFT,mapComponentDataToButtonProps:function(componentData){return{disabled:isAlignmentDisabled(componentData)}}},{keyName:"alignCenter",type:wixRichContentPluginCommons.BUTTONS.TEXT_ALIGN_CENTER},{keyName:"alignRight",type:wixRichContentPluginCommons.BUTTONS.TEXT_ALIGN_RIGHT,mapComponentDataToButtonProps:function(componentData){return{disabled:isAlignmentDisabled(componentData)}}},{keyName:"alignMobile",type:wixRichContentPluginCommons.BUTTONS.CUSTOM,icon:icons.alignMobile||wixRichContentPluginCommons.AlignCenterIcon,onClick:changeAlignmentMobile,mobile:!0,desktop:!1,mapComponentDataToButtonProps:function(componentData){return{icon:getNextAlignmentIcon(componentData),disabled:isAlignmentDisabled(componentData)}}},{keyName:"separator3",type:wixRichContentPluginCommons.BUTTONS.SEPARATOR,mobile:!0},{keyName:"delete",type:wixRichContentPluginCommons.BUTTONS.DELETE,mobile:!0}]},InsertPluginIcon=function(props){return React__default.default.createElement("svg",Object.assign({width:19,height:19,viewBox:"0 0 19 19"},props),React__default.default.createElement("path",{fillRule:"evenodd",d:"M16.8 4c.11 0 .2.09.2.2v2.6a.2.2 0 0 1-.2.2h-.6a.2.2 0 0 1-.2-.2V5H3v1.8a.2.2 0 0 1-.2.2h-.6a.2.2 0 0 1-.2-.2V4.2c0-.11.09-.2.2-.2h14.6zM2.2 15a.2.2 0 0 1-.2-.2v-2.6c0-.11.09-.2.2-.2h.6c.11 0 .2.09.2.2V14h13v-1.8c0-.11.09-.2.2-.2h.6c.11 0 .2.09.2.2v2.6a.2.2 0 0 1-.2.2H2.2zm2-6h10.6c.11 0 .2.09.2.2v.6a.2.2 0 0 1-.2.2H4.2a.2.2 0 0 1-.2-.2v-.6c0-.11.09-.2.2-.2z"}))},createInsertButtons=function(_ref){var _settings$toolbar,_settings$toolbar$ico,t=_ref.t,settings=_ref.settings,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;return[{type:wixRichContentEditorCommon.BUTTON_TYPES.BUTTON,name:wixRichContentEditorCommon.INSERT_PLUGIN_BUTTONS.DIVIDER,tooltip:t("DividerPlugin_InsertButton_Tooltip"),toolbars:[wixRichContentEditorCommon.TOOLBARS.INSERT_PLUGIN,wixRichContentEditorCommon.TOOLBARS.MOBILE,wixRichContentEditorCommon.TOOLBARS.FOOTER,wixRichContentEditorCommon.TOOLBARS.SIDE],getIcon:function(){return icon},componentData:DEFAULTS}]},createToolbar=function(_ref){var settings=_ref.settings,styles=_ref.styles,t=_ref.t;return{InlineButtons:createInlineButtons({styles:styles,t:t,settings:settings}),InsertButtons:createInsertButtons({t:t,settings:settings}),name:"divider"}},Styles={"divider-container":"_39mIO","divider-container--double":"x2viY",divider:"_2T4x3","divider--single":"siDjN","divider--double":"_2jcYn","divider--dashed":"RNs5U","divider--dotted":"_3MgTY","divider--small":"_3Zfgl","divider--small--mobile":"_3KiFD","divider--medium":"_1OVpV","divider--large--mobile":"DHRvg","divider--medium--mobile":"_1TrbH","divider--large":"_3HfJE","divider--center":"_3WdJI","divider--fill-parent":"mfFSO","divider-dropdown__control":"_3FBAr","divider-dropdown__option":"_23gER","divider-dropdown__divider":"_2lLf2"};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 createDividerPlugin=function(config){var type=DIVIDER_TYPE,helpers=config.helpers,theme=config.theme,t=config.t,_config$type=config[type],settings=void 0===_config$type?{}:_config$type,rest=_objectWithoutPropertiesLoose__default.default(config,["helpers","theme","t",type].map(_toPropertyKey)),styles=wixRichContentCommon.mergeStyles({styles:Styles,theme:theme});return wixRichContentPluginCommons.createBasePlugin(_extends__default.default({component:DividerComponent,settings:settings,theme:theme,type:type,toolbar:createToolbar({settings:settings,helpers:helpers,styles:styles,theme:theme,t:t}),helpers:helpers,t:t,defaultPluginData:DEFAULTS},rest))};createDividerPlugin.functionName=DIVIDER_TYPE;var createDividerData=function(pluginData,isRicosSchema){void 0===pluginData&&(pluginData={}),void 0===isRicosSchema&&(isRicosSchema=!1);var dividerData=isRicosSchema?toDraftData.convertNodeDataToDraft("DIVIDER",pluginData):pluginData;return lodash.merge({},DEFAULTS,dividerData)},dividerDataDefaults={lineStyle:"SINGLE",width:"LARGE",alignment:"CENTER",containerData:{alignment:"CENTER",width:{size:null,custom:null},spoiler:{enabled:null,description:null,buttonText:null},height:{custom:null},textWrap:null}},Divider=function(_ref){var context=_ref.context,componentData=_ref.componentData,isMobile=context.isMobile,theme=context.theme;return React__default.default.createElement("div",null,React__default.default.createElement(DividerComponent,{componentData:componentData,isMobile:isMobile,theme:theme}))};exports.DEFAULTS=DEFAULTS,exports.DIVIDER_TYPE=DIVIDER_TYPE,exports.DividerComponent=DividerComponent,exports.createDividerData=createDividerData,exports.createDividerPlugin=createDividerPlugin,exports.pluginDivider=function(config){var defaultOptions,pluginConfig=_extends__default.default({},DEFAULTS.config,config);return{config:pluginConfig,type:DIVIDER_TYPE,createPlugin:createDividerPlugin,ModalsMap:{},createPluginData:createDividerData,tiptapExtensions:(defaultOptions=pluginConfig,[{type:"node",Component:Divider,componentDataDefaults:_extends__default.default({},dividerDataDefaults,{id:""}),createExtensionConfig:function(){return{name:ricosContent.TIPTAP_DIVIDER_TYPE,defaultOptions:defaultOptions}}}])}};
//# sourceMappingURL=module.cjs.js.map

@@ -1,2 +0,2 @@

import _extends from"@babel/runtime/helpers/extends";import _objectWithoutPropertiesLoose from"@babel/runtime/helpers/objectWithoutPropertiesLoose";import{BUTTONS,EditIcon,createBasePlugin}from"wix-rich-content-plugin-commons";import{deleteBlockText,createBlock,getModalStyles,EditorModals,LinkButton,hasLinksInSelection,removeLinksInSelection,InlineToolbarButton,getLinkDataInSelection,scrollToBlock,updateLinkAtCurrentSelection,getEntityData,insertCustomLink,FORMATTING_BUTTONS,insertLinkAtCurrentSelection,COMMANDS,MODIFIERS,LinkIcon,BUTTON_TYPES,isAtomicBlockInSelection,createLinkEntityData,getVisibleSelectionRect,fixPastedLinks,insertLinkInPosition}from"wix-rich-content-editor-common";import _asyncToGenerator from"@babel/runtime/helpers/asyncToGenerator";import _regeneratorRuntime from"@babel/runtime/regenerator";import{pickBy,isEqual,isEmpty}from"lodash";import{addAnchorTagToUrl,anchorScroll,isValidTelUrl,normalizeUrl,validate,mergeStyles,getRelValue,GlobalContext,ANCHOR_VIEWER_DATA_HOOK,LINK_VIEWER_DATA_HOOK,isValidUrl}from"wix-rich-content-common";import React,{Component}from"react";import _inheritsLoose from"@babel/runtime/helpers/inheritsLoose";import classNames from"classnames";import pluginLinkSchema from"wix-rich-content-common/dist/statics/schemas/plugin-link.schema.json";import _createClass from"@babel/runtime/helpers/createClass";import{convertDecorationDataToDraft}from"ricos-content/libs/toDraftData";import"uuid";var _ref7,_ref6,_ref3,_ref,DEFAULTS$1={config:{alignment:"center",size:"content",link:{target:"_blank",rel:""}}},LINK_PREVIEW_TYPE="wix-draft-plugin-link-preview",addLinkPreview=(_ref=_asyncToGenerator(_regeneratorRuntime.mark((function _callee(editorState,config,blockKey,linkData){var _ref2,_ref2$enableEmbed,enableEmbed,_ref2$enableLinkPrevi,enableLinkPreview,fetchData,linkPreview,title,html,fixedUrl,linkPreviewData;return _regeneratorRuntime.wrap((function(_context){for(;;)switch(_context.prev=_context.next){case 0:return _ref2=config[LINK_PREVIEW_TYPE]||{},_ref2$enableEmbed=_ref2.enableEmbed,enableEmbed=void 0===_ref2$enableEmbed||_ref2$enableEmbed,_ref2$enableLinkPrevi=_ref2.enableLinkPreview,enableLinkPreview=void 0===_ref2$enableLinkPrevi||_ref2$enableLinkPrevi,fetchData=_ref2.fetchData,_context.next=3,fetchLinkPreview(fetchData,linkData.url);case 3:if(_context.t0=_context.sent,_context.t0){_context.next=6;break}_context.t0={};case 6:if(linkPreview=_context.t0,title=linkPreview.title,html=linkPreview.html,fixedUrl=linkPreview.fixedUrl,!shouldAddEmbed(html,enableEmbed,fixedUrl)&&!shouldAddLinkPreview(title,enableLinkPreview)){_context.next=13;break}return _context.next=11,createLinkPreviewData(linkData,linkPreview,config[LINK_PREVIEW_TYPE]);case 11:linkPreviewData=_context.sent,addLinkPreviewBlock(editorState,config,blockKey,linkPreviewData);case 13:case"end":return _context.stop()}}),_callee)}))),function(_x,_x2,_x3,_x4){return _ref.apply(this,arguments)}),fetchLinkPreview=(_ref3=_asyncToGenerator(_regeneratorRuntime.mark((function _callee2(fetchData,url){var fixedUrl,_ref4,thumbnail_url,title,description,html;return _regeneratorRuntime.wrap((function(_context2){for(;;)switch(_context2.prev=_context2.next){case 0:return fixedUrl=url.split("↵").join(""),_context2.next=3,null==fetchData?void 0:fetchData(fixedUrl);case 3:if(_context2.t0=_context2.sent,_context2.t0){_context2.next=6;break}_context2.t0={};case 6:return _ref4=_context2.t0,thumbnail_url=_ref4.thumbnail_url,title=_ref4.title,description=_ref4.description,html=_ref4.html,_context2.abrupt("return",{thumbnailUrl:thumbnail_url,title:title,description:description,html:html,fixedUrl:fixedUrl});case 12:case"end":return _context2.stop()}}),_callee2)}))),function(_x5,_x6){return _ref3.apply(this,arguments)}),createLinkPreviewData=(_ref6=_asyncToGenerator(_regeneratorRuntime.mark((function _callee3(linkData,_ref5,linkPreviewConfig){var thumbnailUrl,title,description,html,fixedUrl,currentConfig,data;return _regeneratorRuntime.wrap((function(_context3){for(;;)switch(_context3.prev=_context3.next){case 0:if(thumbnailUrl=_ref5.thumbnailUrl,title=_ref5.title,description=_ref5.description,html=_ref5.html,fixedUrl=_ref5.fixedUrl,currentConfig=_extends({},DEFAULTS$1,linkPreviewConfig).config,data={config:_extends({},currentConfig,{link:_extends({},currentConfig.link,pickBy(linkData),{url:fixedUrl}),width:html&&350}),thumbnail_url:thumbnailUrl,title:title,description:description,html:html},_context3.t0=thumbnailUrl,!_context3.t0){_context3.next=8;break}return _context3.next=7,isValidImgSrc(thumbnailUrl);case 7:_context3.t0=_context3.sent;case 8:if(!_context3.t0){_context3.next=10;break}data.thumbnail_url=thumbnailUrl;case 10:return _context3.abrupt("return",data);case 11:case"end":return _context3.stop()}}),_callee3)}))),function(_x7,_x8,_x9){return _ref6.apply(this,arguments)}),addLinkPreviewBlock=(_ref7=_asyncToGenerator(_regeneratorRuntime.mark((function _callee4(editorState,config,blockKey,linkPreviewData){var setEditorState,withoutLinkBlock,_createBlock,newEditorState;return _regeneratorRuntime.wrap((function(_context4){for(;;)switch(_context4.prev=_context4.next){case 0:setEditorState=config.setEditorState,withoutLinkBlock=deleteBlockText(editorState,blockKey),_createBlock=createBlock(withoutLinkBlock,linkPreviewData,LINK_PREVIEW_TYPE),newEditorState=_createBlock.newEditorState,setEditorState(newEditorState);case 4:case"end":return _context4.stop()}}),_callee4)}))),function(_x10,_x11,_x12,_x13){return _ref7.apply(this,arguments)}),isValidImgSrc=function(url){return new Promise((function(resolve){var image=document.createElement("img");image.src=url,image.onload=function(){resolve(!0)},image.onerror=function(){resolve(!1)}}))},shouldAddLinkPreview=function(title,enableLinkPreview){return enableLinkPreview&&title},shouldAddEmbed=function(html,enableEmbed,url){return Array.isArray(enableEmbed)?enableEmbed.filter((function(whiteListType){return url.toLowerCase().includes(whiteListType.toLowerCase())})).length>0:html&&enableEmbed},EXTERNAL_LINK_TYPE="wix-draft-plugin-external-link",LINK_TYPE="LINK",styles={fontElementMap:"_35ss-",link:"_3Bkfb",linkInEditor:"_35evZ",linkInViewer:"_1lsz7",toolbarUrlContainer:"_10766",toolbarUrl:"_t6Zq",toolbarUrlAnchor:"_3WEE2"},LinkViewer=function(_Component){function LinkViewer(props){var _this;(_this=_Component.call(this,props)||this).handleClick=function(event){var _this$props=_this.props,componentData=_this$props.componentData,isInEditor=_this$props.isInEditor,config=_this$props.config,helpers=_this$props.helpers,customAnchorScroll=_this$props.customAnchorScroll,settings=null==config?void 0:config.LINK;if(settings){var _helpers$onViewerActi,onClick=settings.onClick,anchor=componentData.anchor,url=componentData.url;if(null==helpers||null===(_helpers$onViewerActi=helpers.onViewerAction)||void 0===_helpers$onViewerActi||_helpers$onViewerActi.call(helpers,"LINK","Click",componentData),null==onClick||onClick(event,(null==componentData?void 0:componentData.customData)||_this.getHref(url,anchor)),anchor&&(event.stopPropagation(),!isInEditor))if(event.preventDefault(),customAnchorScroll)customAnchorScroll(event,anchor);else{var anchorString="viewer-"+anchor,element=document.getElementById(anchorString);addAnchorTagToUrl(anchorString),anchorScroll(element,_this.context.experiments)}}},_this.resolveUrl=function(url){return isValidTelUrl(url)?url:normalizeUrl(url)},_this.getHref=function(url,anchor){return url?_this.resolveUrl(url):"#viewer-"+anchor},validate(props.componentData,pluginLinkSchema);var theme=_this.props.theme;return _this.styles=mergeStyles({styles:styles,theme:theme}),_this}_inheritsLoose(LinkViewer,_Component);var _proto=LinkViewer.prototype;return _proto.componentWillReceiveProps=function(nextProps){isEqual(nextProps.componentData,this.props.componentData)||validate(nextProps.componentData,pluginLinkSchema)},_proto.render=function(){var _classNames,_this$props2=this.props,componentData=_this$props2.componentData,anchorTarget=_this$props2.anchorTarget,children=_this$props2.children,isInEditor=_this$props2.isInEditor,url=componentData.url,anchor=componentData.anchor,_componentData$target=componentData.target,target=void 0===_componentData$target?anchorTarget:_componentData$target,rel=componentData.rel,anchorProps={href:this.getHref(url,anchor),target:anchor?"_self":target,rel:getRelValue(rel),className:classNames(this.styles.link,(_classNames={},_classNames[this.styles.linkInEditor]=isInEditor,_classNames[this.styles.linkInViewer]=!isInEditor,_classNames)),onClick:this.handleClick},dataHook=anchor?ANCHOR_VIEWER_DATA_HOOK:LINK_VIEWER_DATA_HOOK;return React.createElement("a",_extends({"data-hook":dataHook},anchorProps),children)},LinkViewer}(Component);LinkViewer.contextType=GlobalContext;var linkEntityStrategy=function(contentBlock,callback,contentState){contentBlock.findEntityRanges((function(character){var entityKey=character.getEntity();if(null!==entityKey){var entityType=contentState.getEntity(entityKey).getType();return"LINK"===entityType||"ricos-plugin-custom-link"===entityType}return!1}),callback)},TextLinkButton=function(_Component){function TextLinkButton(){for(var _this,_len=arguments.length,args=new Array(_len),_key=0;_key<_len;_key++)args[_key]=arguments[_key];return(_this=_Component.call.apply(_Component,[this].concat(args))||this).showLinkPanel=function(){var _this$props=_this.props,getEditorState=_this$props.getEditorState,setEditorState=_this$props.setEditorState,getEntityData=_this$props.getEntityData,insertCustomLink=_this$props.insertCustomLink,settings=_this$props.config.LINK,onLinkAdd=null==settings?void 0:settings.onLinkAdd;if(onLinkAdd){var _getEntityData;onLinkAdd(null===(_getEntityData=getEntityData(getEditorState()))||void 0===_getEntityData?void 0:_getEntityData.customData,(function(data){return setEditorState(insertCustomLink(getEditorState(),data))}))}else _this.openLinkPanel()},_this.openLinkPanel=function(){var _this$props2=_this.props,getEditorState=_this$props2.getEditorState,setEditorState=_this$props2.setEditorState,theme=_this$props2.theme,isMobile=_this$props2.isMobile,linkModal=_this$props2.linkModal,helpers=_this$props2.helpers,keyName=_this$props2.keyName,anchorTarget=_this$props2.anchorTarget,relValue=_this$props2.relValue,t=_this$props2.t,uiSettings=_this$props2.uiSettings,insertLinkFn=_this$props2.insertLinkFn,closeInlinePluginToolbar=_this$props2.closeInlinePluginToolbar,config=_this$props2.config,innerModal=_this$props2.innerModal,toolbarOffsetTop=_this$props2.toolbarOffsetTop,toolbarOffsetLeft=_this$props2.toolbarOffsetLeft,settings=config.LINK,linkTypes=null==settings?void 0:settings.linkTypes,OriginalLinkPanel=!linkTypes||isEmpty(linkTypes)||!Object.values(linkTypes).find((function(addon){return!!addon})),_ref$externalPopups=(uiSettings.linkPanel||{}).externalPopups,externalPopups=void 0!==_ref$externalPopups&&_ref$externalPopups,modalStyles=getModalStyles({fullScreen:isMobile,isMobile:isMobile,customStyles:isMobile||OriginalLinkPanel?{content:{position:"fixed"}}:{content:{width:512,maxWidth:512,height:390,border:"1px solid rgb(237, 237, 237)",borderRadius:"6px",boxShadow:"rgba(0, 0, 0, 0.07) 0px 4px 8px 0px",padding:20}}}),commonPanelProps={helpers:helpers,modalName:EditorModals.TEXT_LINK_MODAL,anchorTarget:anchorTarget,relValue:relValue,theme:theme,t:t,uiSettings:uiSettings,getEditorState:getEditorState,setEditorState:setEditorState,insertLinkFn:insertLinkFn,closeInlinePluginToolbar:closeInlinePluginToolbar,linkTypes:linkTypes};if(externalPopups||isMobile||linkModal)if(helpers&&helpers.openModal){var modalProps=_extends({modalStyles:modalStyles,hidePopup:helpers.closeModal,isMobile:isMobile},commonPanelProps);helpers.openModal(modalProps)}else console.error("Open external helper function is not defined for toolbar button with keyName "+keyName);else{var _modalProps=_extends({hidePopup:innerModal.closeInnerModal,top:toolbarOffsetTop,left:toolbarOffsetLeft,modalStyles:OriginalLinkPanel?null:{maxWidth:"none",padding:20}},commonPanelProps);innerModal.openInnerModal(_modalProps)}},_this}return _inheritsLoose(TextLinkButton,_Component),TextLinkButton.prototype.render=function(){var _config$LINK,_config$LINK$toolbar,_config$LINK$toolbar$,_this$props3=this.props,theme=_this$props3.theme,helpers=_this$props3.helpers,isMobile=_this$props3.isMobile,tabIndex=_this$props3.tabIndex,config=_this$props3.config,isActive=_this$props3.isActive,icon=_this$props3.icon,tooltipText=_this$props3.tooltipText,disabled=_this$props3.disabled,buttonStyles={button:theme.inlineToolbarButton,buttonWrapper:theme.inlineToolbarButton_wrapper,icon:theme.inlineToolbarButton_icon,active:theme.inlineToolbarButton_active},insertLinkIcon=(null==config||null===(_config$LINK=config.LINK)||void 0===_config$LINK||null===(_config$LINK$toolbar=_config$LINK.toolbar)||void 0===_config$LINK$toolbar||null===(_config$LINK$toolbar$=_config$LINK$toolbar.icons)||void 0===_config$LINK$toolbar$?void 0:_config$LINK$toolbar$.InsertPluginButtonIcon)||icon;return React.createElement(LinkButton,{onClick:this.showLinkPanel,isActive:isActive,helpers:helpers,theme:_extends({},theme,buttonStyles),isMobile:isMobile,tooltipText:tooltipText,tabIndex:tabIndex,pluginType:"LINK",icon:insertLinkIcon,disabled:disabled})},_createClass(TextLinkButton,[{key:"isActive",get:function(){return hasLinksInSelection(this.props.getEditorState())}}]),TextLinkButton}(Component),RemoveLinkIcon=function(props){return React.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink",width:"19",height:"19",viewBox:"0 0 19 19"},props),React.createElement("defs",null,React.createElement("path",{id:"remove-link",d:"M7.8 6c.11 0 .2.09.2.2v.807H4.5c-1.38 0-2.5 1.12-2.5 2.5 0 1.326 1.032 2.41 2.336 2.495l.164.005H8v.793c0 .11-.09.2-.2.2H4.5C2.567 13 1 11.433 1 9.5S2.567 6 4.5 6h3.3zm5.7 0C15.433 6 17 7.567 17 9.5S15.433 13 13.5 13h-3.3c-.11 0-.2-.09-.2-.2v-.807h3.5c1.38 0 2.5-1.12 2.5-2.5 0-1.381-1.12-2.5-2.5-2.5H10V6.2c0-.11.09-.2.2-.2h3.3zm-1.7 3c.11 0 .2.09.2.2v.6c0 .11-.09.2-.2.2H6.2c-.11 0-.2-.09-.2-.2v-.6c0-.11.09-.2.2-.2h5.6z"})),React.createElement("g",{fill:"none",fillRule:"evenodd"},React.createElement("use",{fill:"currentColor",transform:"rotate(-45 9 9.5)",xlinkHref:"#remove-link"}),React.createElement("path",{stroke:"currentColor",strokeLinecap:"square",d:"M3.5 3.5l11 12"})))},RemoveLinkButton=function(_Component){function RemoveLinkButton(){for(var _this,_len=arguments.length,args=new Array(_len),_key=0;_key<_len;_key++)args[_key]=arguments[_key];return(_this=_Component.call.apply(_Component,[this].concat(args))||this).deleteLink=function(){var _this$props=_this.props,getEditorState=_this$props.getEditorState,setEditorState=_this$props.setEditorState,closeInlinePluginToolbar=_this$props.closeInlinePluginToolbar;setEditorState(removeLinksInSelection(getEditorState(),setEditorState)),closeInlinePluginToolbar()},_this}return _inheritsLoose(RemoveLinkButton,_Component),RemoveLinkButton.prototype.render=function(){var _this$props2=this.props,theme=_this$props2.theme,helpers=_this$props2.helpers,isMobile=_this$props2.isMobile,t=_this$props2.t,tabIndex=_this$props2.tabIndex,linkButtonTooltip=t("LinkPanelContainer_RemoveButton"),buttonStyles={button:theme.inlineToolbarButton,buttonWrapper:theme.inlineToolbarButton_wrapper,icon:theme.inlineToolbarButton_icon,active:theme.inlineToolbarButton_active};return React.createElement(InlineToolbarButton,{onClick:this.deleteLink,helpers:helpers,theme:_extends({},theme,buttonStyles),isMobile:isMobile,tooltipText:linkButtonTooltip,tabIndex:tabIndex,icon:RemoveLinkIcon,dataHook:"RemoveLinkButton",pluginType:"LINK"})},RemoveLinkButton}(Component),UrlLinkButton=function(_Component){function UrlLinkButton(props){var _this;(_this=_Component.call(this,props)||this).handleClick=function(event){var _this$props=_this.props,getEditorState=_this$props.getEditorState,customAnchorScroll=_this$props.customAnchorScroll,_ref$anchor=(getLinkDataInSelection(getEditorState())||{}).anchor,anchor=void 0===_ref$anchor?"":_ref$anchor;customAnchorScroll?customAnchorScroll(event,anchor):scrollToBlock(anchor,_this.context.experiments)},_this.preventDefault=function(event){return event.preventDefault()};var theme=_this.props.theme;return _this.styles=mergeStyles({styles:styles,theme:theme}),_this}return _inheritsLoose(UrlLinkButton,_Component),UrlLinkButton.prototype.render=function(){var _classNames,styles=this.styles,_this$props2=this.props,getEditorState=_this$props2.getEditorState,t=_this$props2.t,_ref2=getLinkDataInSelection(getEditorState())||{},_ref2$url=_ref2.url,url=void 0===_ref2$url?"":_ref2$url,anchor=_ref2.anchor,target=_ref2.target,rel=_ref2.rel,href=url?normalizeUrl(url):void 0,anchorProps={href:href,target:target,rel:getRelValue(rel),className:classNames(styles.toolbarUrl,(_classNames={},_classNames[styles.toolbarUrlAnchor]=anchor,_classNames)),onMouseDown:this.preventDefault,onClick:anchor&&this.handleClick};return React.createElement("div",{className:styles.toolbarUrlContainer},React.createElement("a",anchorProps,href||t("LinkTo_Toolbar_GoTo")))},UrlLinkButton}(Component);UrlLinkButton.contextType=GlobalContext;var createInlineButtons=function(config){return[{keyName:"url",component:function(props){return React.createElement(UrlLinkButton,Object.assign({},config,props))},mobile:!0,type:BUTTONS.CUSTOM},{keyName:"separator1",type:BUTTONS.SEPARATOR,mobile:!0},{keyName:"edit",component:function(props){return React.createElement("div",{"data-hook":"EditLinkButton",style:{margin:"0 2px 0 -7px"}},React.createElement(TextLinkButton,Object.assign({insertLinkFn:updateLinkAtCurrentSelection,getEntityData:getEntityData,insertCustomLink:insertCustomLink,icon:EditIcon,tooltipText:config.t("LinkTo_Edit_Tooltip")},config,props)))},mobile:!0,type:BUTTONS.CUSTOM},{keyName:"separator2",type:BUTTONS.SEPARATOR,mobile:!0},{keyName:"remove",component:function(props){return React.createElement("div",{style:{margin:"0 -6px 0 -6px"}},React.createElement(RemoveLinkButton,Object.assign({},config,props)))},mobile:!0,type:BUTTONS.CUSTOM}]},openLinkModal=function(_ref){var helpers=_ref.helpers,isMobile=_ref.isMobile,anchorTarget=_ref.anchorTarget,relValue=_ref.relValue,t=_ref.t,theme=_ref.theme,getEditorState=_ref.getEditorState,setEditorState=_ref.setEditorState,uiSettings=_ref.uiSettings,closeInlinePluginToolbar=_ref.closeInlinePluginToolbar,settings=_ref.settings,modalStyles=getModalStyles({fullScreen:isMobile,isMobile:isMobile,customStyles:isMobile?{content:{position:"fixed"}}:{content:{maxWidth:"max-content",padding:20}}});if(helpers&&helpers.openModal){var modalProps={helpers:helpers,modalStyles:modalStyles,isMobile:isMobile,getEditorState:getEditorState,setEditorState:setEditorState,t:t,theme:theme,anchorTarget:anchorTarget,relValue:relValue,modalName:EditorModals.TEXT_LINK_MODAL,hidePopup:helpers.closeModal,uiSettings:uiSettings,insertLinkFn:insertLinkAtCurrentSelection,closeInlinePluginToolbar:closeInlinePluginToolbar,linkTypes:null==settings?void 0:settings.linkTypes};helpers.openModal(modalProps)}else console.error("Link plugin: failed to display Link modal dialog since helpers.openModal is not defined")},DEFAULTS={config:{linkTypes:{anchor:!0}}};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 createLinkPlugin=function(config){var type="LINK",theme=config.theme,anchorTarget=config.anchorTarget,relValue=config.relValue,_config$type=config[type],settings=void 0===_config$type?{}:_config$type,commonPubsub=config.commonPubsub,rest=_objectWithoutPropertiesLoose(config,["theme","anchorTarget","relValue",type,"commonPubsub"].map(_toPropertyKey)),target=anchorTarget,rel=relValue;settings.minLinkifyLength=settings.minLinkifyLength||6;var linkifyData,prevContentState,toolbar=function(config){var _config$LINK_TYPE2,_config$LINK_TYPE2$to,isDisabled=function(){return isAtomicBlockInSelection(config.getEditorState())},getTooltip=function(){return config.t(isDisabled()?"TextLinkButton_DisableButtonForPlugins_Tooltip":"TextLinkButton_Tooltip")};return _extends({TextButtonMapper:function(){var _ref2;return(_ref2={})[FORMATTING_BUTTONS.LINK]={component:function(props){return React.createElement(TextLinkButton,Object.assign({insertLinkFn:insertLinkAtCurrentSelection,getEntityData:getEntityData,insertCustomLink:insertCustomLink,isActive:hasLinksInSelection(config.getEditorState()),closeInlinePluginToolbar:config.closeInlinePluginToolbar,tooltipText:getTooltip(),innerModal:config.innerModal,disabled:isDisabled()},props))},keyBindings:[{keyCommand:{command:COMMANDS.LINK,modifiers:[MODIFIERS.COMMAND],key:"k"},commandHandler:function(editorState){if(config.onKeyboardShortcutClick({buttonName:COMMANDS.LINK,pluginId:"LINK"}),hasLinksInSelection(editorState))return config.closeInlinePluginToolbar(),removeLinksInSelection(editorState);isDisabled()||openLinkModal(config)}}],externalizedButtonProps:{onClick:function(e){e.preventDefault(),openLinkModal(config)},isActive:function(){return hasLinksInSelection(config.getEditorState())},isDisabled:isDisabled,getIcon:function(){var _config$LINK_TYPE,_config$LINK_TYPE$too,_config$LINK_TYPE$too2;return(null===(_config$LINK_TYPE=config.LINK)||void 0===_config$LINK_TYPE||null===(_config$LINK_TYPE$too=_config$LINK_TYPE.toolbar)||void 0===_config$LINK_TYPE$too||null===(_config$LINK_TYPE$too2=_config$LINK_TYPE$too.icons)||void 0===_config$LINK_TYPE$too2?void 0:_config$LINK_TYPE$too2.InsertPluginButtonIcon)||function(){var _config$experiments,_config$experiments$n;return LinkIcon({newFormattingToolbar:null==config||null===(_config$experiments=config.experiments)||void 0===_config$experiments||null===(_config$experiments$n=_config$experiments.newFormattingToolbar)||void 0===_config$experiments$n?void 0:_config$experiments$n.enabled})}},tooltip:getTooltip(),getLabel:function(){return""},type:BUTTON_TYPES.BUTTON}},_ref2}},!1===(null===(_config$LINK_TYPE2=config.LINK)||void 0===_config$LINK_TYPE2||null===(_config$LINK_TYPE2$to=_config$LINK_TYPE2.toolbar)||void 0===_config$LINK_TYPE2$to?void 0:_config$LINK_TYPE2$to.inlineToolbar)?{}:{InlinePluginToolbarButtons:createInlineButtons(config)},{name:"link"})}(_extends({},config,{settings:settings,closeInlinePluginToolbar:closeInlinePluginToolbar})),decorators=[{strategy:linkEntityStrategy,component:function(props){var componentData=null==props?void 0:props.contentState.getEntity(null==props?void 0:props.entityKey).getData();return React.createElement(LinkViewer,Object.assign({componentData:componentData,anchorTarget:anchorTarget,relValue:relValue,theme:theme},props))}}],shouldConvertToLinkPreview=function(linkifyData){var _linkifyData$block;return linkifyData&&"unstyled"===(null===(_linkifyData$block=linkifyData.block)||void 0===_linkifyData$block?void 0:_linkifyData$block.getType())&&config[LINK_PREVIEW_TYPE]},getBlockLinkUrl=function(linkifyData){var string=linkifyData.string;if(linkifyData.block.getText()===string)return string};function closeInlinePluginToolbar(){commonPubsub.set("cursorOnInlinePlugin",null)}var getLinkifyData=function(editorState){var strData=findLastStringWithNoSpacesAndSoftLines(editorState);return shouldLinkify(strData)?strData:void 0},shouldLinkify=function(consecutiveString){return consecutiveString.string.length>=settings.minLinkifyLength&&isValidUrl(consecutiveString.string)&&!(rangeContainsEntity(consecutiveString)&&blockContainsPlainText(consecutiveString))&&!(null!=settings&&settings.disableAutoLink)},findLastStringWithNoSpacesAndSoftLines=function(editorState){var selection=editorState.getSelection(),blockKey=selection.getAnchorKey(),block=editorState.getCurrentContent().getBlockForKey(blockKey),text=block.getText(),endIndex=selection.getEndOffset(),spaceIndex=text.lastIndexOf(" ",endIndex)+1,softLineIndex=text.lastIndexOf("\n",endIndex)+1,index=Math.max(spaceIndex,softLineIndex);return{string:text.slice(index,endIndex),block:block,blockKey:blockKey,index:index,endIndex:endIndex}},rangeContainsEntity=function(_ref){for(var block=_ref.block,index=_ref.index,endIndex=_ref.endIndex,i=index;i<endIndex;i++)if(null!==block.getEntityAt(i))return!0;return!1},blockContainsPlainText=function(_ref2){var block=_ref2.block,string=_ref2.string;return block.getText().length>string.length},addLinkAt=function(_ref3,editorState){var string=_ref3.string,index=_ref3.index,endIndex=_ref3.endIndex,blockKey=_ref3.blockKey;return insertLinkInPosition(editorState,blockKey,index,endIndex,{url:string,rel:rel,target:target})};return createBasePlugin(_extends({theme:theme,toolbar:toolbar,type:type,anchorTarget:anchorTarget,relValue:relValue,settings:settings,commonPubsub:commonPubsub,defaultPluginData:DEFAULTS},rest),{decorators:decorators,handleBeforeInput:function(chars,editorState,eventTimeStamp,pluginFunctions){return/\s/.test(chars)&&(linkifyData=getLinkifyData(editorState)),"not-handled"},handleReturn:function(event,editorState,pluginFunctions){if(linkifyData=getLinkifyData(editorState),shouldConvertToLinkPreview(linkifyData)){var _linkifyData,url=getBlockLinkUrl(linkifyData),blockKey=null===(_linkifyData=linkifyData)||void 0===_linkifyData?void 0:_linkifyData.block.getKey();if(url&&blockKey){var linkData=createLinkEntityData({url:url,target:target,rel:rel});addLinkPreview(editorState,config,blockKey,linkData)}}return"not-handled"},onChange:function(editorState){var selection=editorState.getSelection();hasLinksInSelection(editorState)&&selection.isCollapsed()&&selection.getHasFocus()?setTimeout((function(){var commonPubsubData,boundingRect=getVisibleSelectionRect(window);commonPubsubData={type:type,boundingRect:boundingRect},commonPubsub.set("cursorOnInlinePlugin",commonPubsubData)})):closeInlinePluginToolbar();var newEditorState=editorState;return!function(editorState){var contentState=editorState.getCurrentContent(),contentChanged=contentState!==prevContentState;return prevContentState=contentState,contentChanged&&"insert-fragment"===editorState.getLastChangeType()}(editorState)?linkifyData&&(newEditorState=addLinkAt(linkifyData,editorState)):newEditorState=fixPastedLinks(editorState,{anchorTarget:anchorTarget,relValue:relValue}),linkifyData=void 0,newEditorState}})};createLinkPlugin.functionName="LINK";var createLinkData=function(pluginData,isRicosSchema){return void 0===pluginData&&(pluginData={}),void 0===isRicosSchema&&(isRicosSchema=!1),isRicosSchema?convertDecorationDataToDraft("LINK",pluginData):pluginData},linkDataDefaults_linkData={link:{target:"SELF",url:"",anchor:"",rel:{nofollow:null,sponsored:null,ugc:null},customData:null}},urlRegex=/(?:https?:\/\/)?(?:www\.)?[-a-zA-Z0-9@:%._+~#=]{1,256}\.[a-zA-Z]{2,}\b(?:[-a-zA-Z0-9@:%._+~#=?!&/]*)(?:[-a-zA-Z0-9@:%._+~#=?!&/]*)/gi,urlRegexExact=new RegExp("^"+urlRegex.source+"$","gi"),urlRegexExactWithSpace=new RegExp("^"+urlRegex.source+"[\\s\\n]$","gi"),linkifyLastWord=function(_ref){var _text$match,editor=_ref.editor,_editor$state$selecti=editor.state.selection.$from,nodeBefore=_editor$state$selecti.nodeBefore,pos=_editor$state$selecti.pos,_ref2=nodeBefore||{},text=_ref2.text,nodeBeforeSize=_ref2.nodeSize,url=null==text||null===(_text$match=text.match(urlRegex))||void 0===_text$match?void 0:_text$match[0],urlIndex=text?text.search(urlRegex):-1;if(nodeBeforeSize&&url&&-1!==urlIndex){var from=pos-nodeBeforeSize+urlIndex;editor.chain().focus().setTextSelection({from:from,to:pos}).setLink({link:{url:url}}).setTextSelection(pos).run()}return!1},createTiptapExtensions=function(defaultOptions){return[{type:"mark",createExtensionConfig:function(_ref3){var markPasteRule=_ref3.markPasteRule,markInputRule=_ref3.markInputRule,Plugin=_ref3.Plugin,PluginKey=_ref3.PluginKey;return{name:"link",priority:1e3,inclusive:!1,defaultOptions:_extends({openOnClick:!0,linkOnPaste:!0,HTMLAttributes:{link:{}}},defaultOptions),addAttributes:function(){return linkDataDefaults_linkData},parseHTML:function(){return[{tag:"a[href]"}]},renderHTML:function(_ref4){var HTMLAttributes=_ref4.HTMLAttributes,classes=classNames(styles.link,styles.linkInViewer),_parseLink=function(_ref5){var url=_ref5.url,rel=_ref5.rel,target=_ref5.target,anchor=_ref5.anchor,customData=_ref5.customData;return{anchor:anchor,url:url,rel:rel&&Object.entries(rel).flatMap((function(_ref6){var key=_ref6[0];return _ref6[1]?key:[]})).join(" "),target:target&&"_"+target.toLowerCase(),customData:customData}}(HTMLAttributes.link);return["a",{href:_parseLink.url,rel:_parseLink.rel,target:_parseLink.target,class:classes},0]},addCommands:function(){return{setLink:function(attributes){return function(_ref5){return _ref5.commands.setMark("link",attributes)}},toggleLink:function(attributes){return function(_ref6){return _ref6.commands.toggleMark("link",attributes)}},unsetLink:function(){return function(_ref7){return _ref7.commands.unsetMark("link")}}}},addPasteRules:function(){return[markPasteRule(urlRegex,this.type,(function(match){return{link:{url:match[0]}}}))]},addInputRules:function(){return[markInputRule(urlRegexExactWithSpace,this.type,(function(match){return{link:{url:match[0].trim()}}}))]},addProseMirrorPlugins:function(){var _this=this,plugins=[];return this.options.openOnClick&&plugins.push(new Plugin({key:new PluginKey("handleClickLink"),props:{handleClick:function(view,pos,event){var _event$target,attrs=_this.editor.getAttributes("link");return!(!(null===(_event$target=event.target)||void 0===_event$target?void 0:_event$target.closest("a"))||!attrs.href)&&(window.open(attrs.href,attrs.target),!0)}}})),this.options.linkOnPaste&&plugins.push(new Plugin({key:new PluginKey("handlePasteLink"),props:{handlePaste:function(view,event,slice){if(view.state.selection.empty)return!1;var textContent="";return slice.content.forEach((function(node){textContent+=node.textContent})),!(!textContent||!textContent.match(urlRegexExact))&&(_this.editor.commands.setMark(_this.type,{link:{url:textContent}}),!0)}}})),plugins}}}},{type:"extension",createExtensionConfig:function(){return{name:"linkEnter",addKeyboardShortcuts:function(){return{Enter:linkifyLastWord,Space:linkifyLastWord}}}}}]},pluginLink=function(config){var pluginConfig=_extends({},DEFAULTS.config,config);return{config:pluginConfig,type:"LINK",createPlugin:createLinkPlugin,ModalsMap:{},createPluginData:createLinkData,tiptapExtensions:createTiptapExtensions(pluginConfig)}};export{EXTERNAL_LINK_TYPE,LINK_TYPE,LinkViewer,createLinkPlugin,pluginLink};
import _extends from"@babel/runtime/helpers/extends";import _objectWithoutPropertiesLoose from"@babel/runtime/helpers/objectWithoutPropertiesLoose";import{NO_WRAP,validate,mergeStyles}from"wix-rich-content-common";import{SizeMediumIcon,SizeSmallIcon,SizeLargeIcon,AlignCenterIcon,BUTTONS,createBasePlugin}from"wix-rich-content-plugin-commons";import _inheritsLoose from"@babel/runtime/helpers/inheritsLoose";import React,{PureComponent}from"react";import classNames from"classnames";import pluginDividerSchema from"wix-rich-content-common/dist/statics/schemas/plugin-divider.schema.json";import{isEqual,merge}from"lodash";import{AlignLeftIcon,AlignRightIcon,BUTTON_TYPES,INSERT_PLUGIN_BUTTONS,TOOLBARS}from"wix-rich-content-editor-common";import{convertNodeDataToDraft}from"ricos-content/libs/toDraftData";import{TIPTAP_DIVIDER_TYPE}from"ricos-content";var LINE_TYPES=Object.freeze(["single","double","dashed","dotted"]),SIZES=Object.freeze(["large","medium","small"]),ALIGNMENTS=["left","center","right"],DEFAULTS=Object.freeze({type:"single",config:{size:"large",alignment:"center",textWrap:NO_WRAP}}),DIVIDER_TYPE="wix-draft-plugin-divider",getNextValue=function(array,currentValue){return array[(array.indexOf(currentValue)+1)%array.length]},Divider$1=function(_temp){var _this=this,_ref=void 0===_temp?{}:_temp,type=_ref.type,config=_ref.config;this.getNextAlignmentConfig=function(){var _this$config,alignment=getNextValue(ALIGNMENTS,null===(_this$config=_this.config)||void 0===_this$config?void 0:_this$config.alignment);return _extends({},_this.config,{alignment:alignment})},this.getNextSizeConfig=function(){var _this$config2,size=getNextValue(SIZES,null===(_this$config2=_this.config)||void 0===_this$config2?void 0:_this$config2.size);return _extends({},_this.config,{size:size})},this.isAlignmentDisabled=function(){return"large"===_this.size},this.type=type||DEFAULTS.type,this.config=_extends({},DEFAULTS.config,config),this.size=this.config.size,this.alignment=this.config.alignment},lineProps=function(width,lineDistance){return void 0===lineDistance&&(lineDistance=1),{x2:width,y1:lineDistance,y2:lineDistance}},DividerLine=function(_ref){var type=_ref.type,size=_ref.size,alignment=_ref.alignment,width=_ref.width,multilineDistance=_ref.multilineDistance,styles=_ref.styles,className=_ref.className,fillParent=_ref.fillParent,isMobile=_ref.isMobile,linesPropsArr=function(type,width,multilineDistance){void 0===multilineDistance&&(multilineDistance=7);var linePropsArr=[lineProps(width)];return"double"===type&&linePropsArr.push(lineProps(width,multilineDistance)),linePropsArr}(type,width,multilineDistance),lineClassName=classNames(styles.divider,styles["divider--"+type],styles["divider--"+size+(isMobile?"--mobile":"")],styles["divider--"+alignment],fillParent?styles["divider--fill-parent"]:"",className);return React.createElement("svg",{className:lineClassName},linesPropsArr.map((function(lineProp,i){return React.createElement("line",_extends({key:i},lineProp))})))},styles={"divider-container":"_3zNzG","divider-container--double":"_3uLbE",divider:"_1L18v","divider--single":"_3fmOK","divider--double":"_3GOMV","divider--dashed":"_2MyQc","divider--dotted":"XDMdA","divider--small":"SFUYo","divider--small--mobile":"_1jnDu","divider--medium":"_15dwK","divider--large--mobile":"_2PezL","divider--medium--mobile":"_2dkSI","divider--large":"_3q8-N","divider--left":"_2AY-i","divider--center":"_2ikV9","divider--right":"_2P8vY","divider--fill-parent":"_3Yq1D"},DividerComponent=function(_PureComponent){function DividerComponent(props){var _this;return _this=_PureComponent.call(this,props)||this,validate(props.componentData,pluginDividerSchema),_this}_inheritsLoose(DividerComponent,_PureComponent);var _proto=DividerComponent.prototype;return _proto.componentWillReceiveProps=function(nextProps){isEqual(nextProps.componentData,this.props.componentData)||validate(nextProps.componentData,pluginDividerSchema)},_proto.render=function(){this.styles=this.styles||mergeStyles({styles:styles,theme:this.props.theme});var divider=new Divider$1(this.props.componentData),type=divider.type,size=divider.size,alignment=divider.alignment,className=classNames(this.styles["divider-container"],this.styles["divider-container--"+type],this.props.isMobile&&this.styles["divider-container--mobile"],this.props.className);return React.createElement("div",{className:className,"data-hook":"divider-"+type},React.createElement(DividerLine,{type:type,width:"100%",size:size,alignment:alignment,styles:this.styles,isMobile:this.props.isMobile}))},DividerComponent}(PureComponent);DividerComponent.sizeClassName=function(componentData,theme){return""};var getDividerFromStore=function(store){return new Divider$1(store.get("componentData"))},updateStoreConfig=function(store,config){store.update("componentData",{config:config})},changeType=function(type,_componentData,store){store.update("componentData",{type:type.value})},changeAlignmentMobile=function(_ref){var store=_ref.store,divider=getDividerFromStore(store);updateStoreConfig(store,divider.getNextAlignmentConfig())},changeSizeMobile=function(_ref2){var store=_ref2.store,divider=getDividerFromStore(store);updateStoreConfig(store,divider.getNextSizeConfig())},isAlignmentDisabled=function(componentData){return void 0===componentData&&(componentData={}),new Divider$1(componentData).isAlignmentDisabled()},getNextSizeIcon=function(componentData){var _SIZE_LARGE$SIZE_MEDI,size=new Divider$1(componentData).size;return(_SIZE_LARGE$SIZE_MEDI={},_SIZE_LARGE$SIZE_MEDI.large=SizeMediumIcon,_SIZE_LARGE$SIZE_MEDI.medium=SizeSmallIcon,_SIZE_LARGE$SIZE_MEDI.small=SizeLargeIcon,_SIZE_LARGE$SIZE_MEDI)[size]},getNextAlignmentIcon=function(componentData){var _ALIGN_LEFT$ALIGN_CEN,alignment=new Divider$1(componentData).alignment;return(_ALIGN_LEFT$ALIGN_CEN={},_ALIGN_LEFT$ALIGN_CEN.left=AlignLeftIcon,_ALIGN_LEFT$ALIGN_CEN.center=AlignCenterIcon,_ALIGN_LEFT$ALIGN_CEN.right=AlignRightIcon,_ALIGN_LEFT$ALIGN_CEN)[alignment]},createDropdownOptionComponent=function(_ref){var type=_ref.type,styles=_ref.styles;return function(){return React.createElement("div",{className:styles["divider-dropdown__option"]},React.createElement(DividerLine,{type:type,styles:styles,width:60,fillParent:!0,multilineDinstance:4,className:styles["divider-dropdown__divider"]}))}},createDropdownValueGetter=function(dropdownOptions){return function(store){var type=(store.get("componentData")||{}).type||DEFAULTS.type;return dropdownOptions.find((function(x){return x.value===type}))}},createInlineButtons=function(_ref){var _settings$toolbar,styles=_ref.styles,t=_ref.t,settings=_ref.settings,dropdownOptions=function(styles){return LINE_TYPES.map((function(type){return{value:type,component:createDropdownOptionComponent({type:type,styles:styles})}}))}(styles),icons=(null==settings||null===(_settings$toolbar=settings.toolbar)||void 0===_settings$toolbar?void 0:_settings$toolbar.icons)||{};return[{keyName:"type",type:BUTTONS.DROPDOWN,options:dropdownOptions,onChange:changeType,getValue:createDropdownValueGetter(dropdownOptions),controlClassName:null==styles?void 0:styles["divider-dropdown__control"],tooltipTextKey:"DividerPlugin_SelectType_Tooltip",t:t,mobile:!0},{keyName:"separator1",type:BUTTONS.SEPARATOR,mobile:!0},{keyName:"sizeSmall",type:BUTTONS.SIZE_SMALL},{keyName:"sizeMedium",type:BUTTONS.SIZE_MEDIUM},{keyName:"sizeLarge",type:BUTTONS.SIZE_LARGE},{keyName:"sizeMobile",type:BUTTONS.CUSTOM,icon:icons.sizeMobile||SizeLargeIcon,onClick:changeSizeMobile,mobile:!0,desktop:!1,mapComponentDataToButtonProps:function(componentData){return{icon:getNextSizeIcon(componentData)}}},{keyName:"separator2",type:BUTTONS.SEPARATOR,mobile:!0},{keyName:"alignLeft",type:BUTTONS.TEXT_ALIGN_LEFT,mapComponentDataToButtonProps:function(componentData){return{disabled:isAlignmentDisabled(componentData)}}},{keyName:"alignCenter",type:BUTTONS.TEXT_ALIGN_CENTER},{keyName:"alignRight",type:BUTTONS.TEXT_ALIGN_RIGHT,mapComponentDataToButtonProps:function(componentData){return{disabled:isAlignmentDisabled(componentData)}}},{keyName:"alignMobile",type:BUTTONS.CUSTOM,icon:icons.alignMobile||AlignCenterIcon,onClick:changeAlignmentMobile,mobile:!0,desktop:!1,mapComponentDataToButtonProps:function(componentData){return{icon:getNextAlignmentIcon(componentData),disabled:isAlignmentDisabled(componentData)}}},{keyName:"separator3",type:BUTTONS.SEPARATOR,mobile:!0},{keyName:"delete",type:BUTTONS.DELETE,mobile:!0}]},InsertPluginIcon=function(props){return React.createElement("svg",Object.assign({width:19,height:19,viewBox:"0 0 19 19"},props),React.createElement("path",{fillRule:"evenodd",d:"M16.8 4c.11 0 .2.09.2.2v2.6a.2.2 0 0 1-.2.2h-.6a.2.2 0 0 1-.2-.2V5H3v1.8a.2.2 0 0 1-.2.2h-.6a.2.2 0 0 1-.2-.2V4.2c0-.11.09-.2.2-.2h14.6zM2.2 15a.2.2 0 0 1-.2-.2v-2.6c0-.11.09-.2.2-.2h.6c.11 0 .2.09.2.2V14h13v-1.8c0-.11.09-.2.2-.2h.6c.11 0 .2.09.2.2v2.6a.2.2 0 0 1-.2.2H2.2zm2-6h10.6c.11 0 .2.09.2.2v.6a.2.2 0 0 1-.2.2H4.2a.2.2 0 0 1-.2-.2v-.6c0-.11.09-.2.2-.2z"}))},createInsertButtons=function(_ref){var _settings$toolbar,_settings$toolbar$ico,t=_ref.t,settings=_ref.settings,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;return[{type:BUTTON_TYPES.BUTTON,name:INSERT_PLUGIN_BUTTONS.DIVIDER,tooltip:t("DividerPlugin_InsertButton_Tooltip"),toolbars:[TOOLBARS.INSERT_PLUGIN,TOOLBARS.MOBILE,TOOLBARS.FOOTER,TOOLBARS.SIDE],getIcon:function(){return icon},componentData:DEFAULTS}]},createToolbar=function(_ref){var settings=_ref.settings,styles=_ref.styles,t=_ref.t;return{InlineButtons:createInlineButtons({styles:styles,t:t,settings:settings}),InsertButtons:createInsertButtons({t:t,settings:settings}),name:"divider"}},Styles={"divider-container":"_39mIO","divider-container--double":"x2viY",divider:"_2T4x3","divider--single":"siDjN","divider--double":"_2jcYn","divider--dashed":"RNs5U","divider--dotted":"_3MgTY","divider--small":"_3Zfgl","divider--small--mobile":"_3KiFD","divider--medium":"_1OVpV","divider--large--mobile":"DHRvg","divider--medium--mobile":"_1TrbH","divider--large":"_3HfJE","divider--center":"_3WdJI","divider--fill-parent":"mfFSO","divider-dropdown__control":"_3FBAr","divider-dropdown__option":"_23gER","divider-dropdown__divider":"_2lLf2"};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 createDividerPlugin=function(config){var type=DIVIDER_TYPE,helpers=config.helpers,theme=config.theme,t=config.t,_config$type=config[type],settings=void 0===_config$type?{}:_config$type,rest=_objectWithoutPropertiesLoose(config,["helpers","theme","t",type].map(_toPropertyKey)),styles=mergeStyles({styles:Styles,theme:theme});return createBasePlugin(_extends({component:DividerComponent,settings:settings,theme:theme,type:type,toolbar:createToolbar({settings:settings,helpers:helpers,styles:styles,theme:theme,t:t}),helpers:helpers,t:t,defaultPluginData:DEFAULTS},rest))};createDividerPlugin.functionName=DIVIDER_TYPE;var createDividerData=function(pluginData,isRicosSchema){void 0===pluginData&&(pluginData={}),void 0===isRicosSchema&&(isRicosSchema=!1);var dividerData=isRicosSchema?convertNodeDataToDraft("DIVIDER",pluginData):pluginData;return merge({},DEFAULTS,dividerData)},dividerDataDefaults={lineStyle:"SINGLE",width:"LARGE",alignment:"CENTER",containerData:{alignment:"CENTER",width:{size:null,custom:null},spoiler:{enabled:null,description:null,buttonText:null},height:{custom:null},textWrap:null}},Divider=function(_ref){var context=_ref.context,componentData=_ref.componentData,isMobile=context.isMobile,theme=context.theme;return React.createElement("div",null,React.createElement(DividerComponent,{componentData:componentData,isMobile:isMobile,theme:theme}))},pluginDivider=function(config){var defaultOptions,pluginConfig=_extends({},DEFAULTS.config,config);return{config:pluginConfig,type:DIVIDER_TYPE,createPlugin:createDividerPlugin,ModalsMap:{},createPluginData:createDividerData,tiptapExtensions:(defaultOptions=pluginConfig,[{type:"node",Component:Divider,componentDataDefaults:_extends({},dividerDataDefaults,{id:""}),createExtensionConfig:function(){return{name:TIPTAP_DIVIDER_TYPE,defaultOptions:defaultOptions}}}])}};export{DEFAULTS,DIVIDER_TYPE,DividerComponent,createDividerData,createDividerPlugin,pluginDivider};
//# 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"),classNames=require("classnames"),wixRichContentCommon=require("wix-rich-content-common"),pluginLinkSchema=require("wix-rich-content-common/dist/statics/schemas/plugin-link.schema.json"),lodash=require("lodash");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),pluginLinkSchema__default=_interopDefaultLegacy(pluginLinkSchema),styles={fontElementMap:"_35ss-",link:"_3Bkfb",linkInEditor:"_35evZ",linkInViewer:"_1lsz7",toolbarUrlContainer:"_10766",toolbarUrl:"_t6Zq",toolbarUrlAnchor:"_3WEE2"},LinkViewer=function(_Component){function LinkViewer(props){var _this;(_this=_Component.call(this,props)||this).handleClick=function(event){var _this$props=_this.props,componentData=_this$props.componentData,isInEditor=_this$props.isInEditor,config=_this$props.config,helpers=_this$props.helpers,customAnchorScroll=_this$props.customAnchorScroll,settings=null==config?void 0:config.LINK;if(settings){var _helpers$onViewerActi,onClick=settings.onClick,anchor=componentData.anchor,url=componentData.url;if(null==helpers||null===(_helpers$onViewerActi=helpers.onViewerAction)||void 0===_helpers$onViewerActi||_helpers$onViewerActi.call(helpers,"LINK","Click",componentData),null==onClick||onClick(event,(null==componentData?void 0:componentData.customData)||_this.getHref(url,anchor)),anchor&&(event.stopPropagation(),!isInEditor))if(event.preventDefault(),customAnchorScroll)customAnchorScroll(event,anchor);else{var anchorString="viewer-"+anchor,element=document.getElementById(anchorString);wixRichContentCommon.addAnchorTagToUrl(anchorString),wixRichContentCommon.anchorScroll(element,_this.context.experiments)}}},_this.resolveUrl=function(url){return wixRichContentCommon.isValidTelUrl(url)?url:wixRichContentCommon.normalizeUrl(url)},_this.getHref=function(url,anchor){return url?_this.resolveUrl(url):"#viewer-"+anchor},wixRichContentCommon.validate(props.componentData,pluginLinkSchema__default.default);var theme=_this.props.theme;return _this.styles=wixRichContentCommon.mergeStyles({styles:styles,theme:theme}),_this}_inheritsLoose__default.default(LinkViewer,_Component);var _proto=LinkViewer.prototype;return _proto.componentWillReceiveProps=function(nextProps){lodash.isEqual(nextProps.componentData,this.props.componentData)||wixRichContentCommon.validate(nextProps.componentData,pluginLinkSchema__default.default)},_proto.render=function(){var _classNames,_this$props2=this.props,componentData=_this$props2.componentData,anchorTarget=_this$props2.anchorTarget,children=_this$props2.children,isInEditor=_this$props2.isInEditor,url=componentData.url,anchor=componentData.anchor,_componentData$target=componentData.target,target=void 0===_componentData$target?anchorTarget:_componentData$target,rel=componentData.rel,anchorProps={href:this.getHref(url,anchor),target:anchor?"_self":target,rel:wixRichContentCommon.getRelValue(rel),className:classNames__default.default(this.styles.link,(_classNames={},_classNames[this.styles.linkInEditor]=isInEditor,_classNames[this.styles.linkInViewer]=!isInEditor,_classNames)),onClick:this.handleClick},dataHook=anchor?wixRichContentCommon.ANCHOR_VIEWER_DATA_HOOK:wixRichContentCommon.LINK_VIEWER_DATA_HOOK;return React__default.default.createElement("a",_extends__default.default({"data-hook":dataHook},anchorProps),children)},LinkViewer}(React.Component);LinkViewer.contextType=wixRichContentCommon.GlobalContext;var typeMapper=function(){var _ref;return(_ref={})["wix-draft-plugin-external-link"]={component:LinkViewer,elementType:"inline"},_ref.LINK={component:LinkViewer,elementType:"inline"},_ref["ricos-plugin-custom-link"]={component:LinkViewer,elementType:"inline"},_ref},DEFAULTS_config={linkTypes:{anchor:!0}};exports.LINK_TYPE="LINK",exports.LinkViewer=LinkViewer,exports.linkTypeMapper=typeMapper,exports.pluginLink=function(config){return{config:_extends__default.default({},DEFAULTS_config,config),type:"LINK",typeMapper:typeMapper}};
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var _extends=require("@babel/runtime/helpers/extends"),_inheritsLoose=require("@babel/runtime/helpers/inheritsLoose"),React=require("react"),classNames=require("classnames"),wixRichContentCommon=require("wix-rich-content-common"),pluginDividerSchema=require("wix-rich-content-common/dist/statics/schemas/plugin-divider.schema.json"),lodash=require("lodash");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),pluginDividerSchema__default=_interopDefaultLegacy(pluginDividerSchema);Object.freeze(["single","double","dashed","dotted"]);var SIZES=Object.freeze(["large","medium","small"]),ALIGNMENTS=["left","center","right"],DEFAULTS=Object.freeze({type:"single",config:{size:"large",alignment:"center",textWrap:wixRichContentCommon.NO_WRAP}}),getNextValue=function(array,currentValue){return array[(array.indexOf(currentValue)+1)%array.length]},Divider=function(_temp){var _this=this,_ref=void 0===_temp?{}:_temp,type=_ref.type,config=_ref.config;this.getNextAlignmentConfig=function(){var _this$config,alignment=getNextValue(ALIGNMENTS,null===(_this$config=_this.config)||void 0===_this$config?void 0:_this$config.alignment);return _extends__default.default({},_this.config,{alignment:alignment})},this.getNextSizeConfig=function(){var _this$config2,size=getNextValue(SIZES,null===(_this$config2=_this.config)||void 0===_this$config2?void 0:_this$config2.size);return _extends__default.default({},_this.config,{size:size})},this.isAlignmentDisabled=function(){return"large"===_this.size},this.type=type||DEFAULTS.type,this.config=_extends__default.default({},DEFAULTS.config,config),this.size=this.config.size,this.alignment=this.config.alignment},lineProps=function(width,lineDistance){return void 0===lineDistance&&(lineDistance=1),{x2:width,y1:lineDistance,y2:lineDistance}},DividerLine=function(_ref){var type=_ref.type,size=_ref.size,alignment=_ref.alignment,width=_ref.width,multilineDistance=_ref.multilineDistance,styles=_ref.styles,className=_ref.className,fillParent=_ref.fillParent,isMobile=_ref.isMobile,linesPropsArr=function(type,width,multilineDistance){void 0===multilineDistance&&(multilineDistance=7);var linePropsArr=[lineProps(width)];return"double"===type&&linePropsArr.push(lineProps(width,multilineDistance)),linePropsArr}(type,width,multilineDistance),lineClassName=classNames__default.default(styles.divider,styles["divider--"+type],styles["divider--"+size+(isMobile?"--mobile":"")],styles["divider--"+alignment],fillParent?styles["divider--fill-parent"]:"",className);return React__default.default.createElement("svg",{className:lineClassName},linesPropsArr.map((function(lineProp,i){return React__default.default.createElement("line",_extends__default.default({key:i},lineProp))})))},sizeClassName=function(_componentData,_theme){return""},styles={"divider-container":"_3zNzG","divider-container--double":"_3uLbE",divider:"_1L18v","divider--single":"_3fmOK","divider--double":"_3GOMV","divider--dashed":"_2MyQc","divider--dotted":"XDMdA","divider--small":"SFUYo","divider--small--mobile":"_1jnDu","divider--medium":"_15dwK","divider--large--mobile":"_2PezL","divider--medium--mobile":"_2dkSI","divider--large":"_3q8-N","divider--left":"_2AY-i","divider--center":"_2ikV9","divider--right":"_2P8vY","divider--fill-parent":"_3Yq1D"},DividerComponent=function(_PureComponent){function DividerComponent(props){var _this;return _this=_PureComponent.call(this,props)||this,wixRichContentCommon.validate(props.componentData,pluginDividerSchema__default.default),_this}_inheritsLoose__default.default(DividerComponent,_PureComponent);var _proto=DividerComponent.prototype;return _proto.componentWillReceiveProps=function(nextProps){lodash.isEqual(nextProps.componentData,this.props.componentData)||wixRichContentCommon.validate(nextProps.componentData,pluginDividerSchema__default.default)},_proto.render=function(){this.styles=this.styles||wixRichContentCommon.mergeStyles({styles:styles,theme:this.props.theme});var divider=new Divider(this.props.componentData),type=divider.type,size=divider.size,alignment=divider.alignment,className=classNames__default.default(this.styles["divider-container"],this.styles["divider-container--"+type],this.props.isMobile&&this.styles["divider-container--mobile"],this.props.className);return React__default.default.createElement("div",{className:className,"data-hook":"divider-"+type},React__default.default.createElement(DividerLine,{type:type,width:"100%",size:size,alignment:alignment,styles:this.styles,isMobile:this.props.isMobile}))},DividerComponent}(React.PureComponent);DividerComponent.sizeClassName=function(componentData,theme){return""};var DIVIDER_TYPE="wix-draft-plugin-divider",typeMapper=function(){var _ref;return(_ref={})[DIVIDER_TYPE]={component:DividerComponent,classNameStrategies:{size:sizeClassName}},_ref};exports.DIVIDER_TYPE=DIVIDER_TYPE,exports.dividerTypeMapper=typeMapper,exports.pluginDivider=function(config){return{config:_extends__default.default({},DEFAULTS.config,config),type:DIVIDER_TYPE,typeMapper:typeMapper}};
//# 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 classNames from"classnames";import{addAnchorTagToUrl,anchorScroll,isValidTelUrl,normalizeUrl,validate,mergeStyles,getRelValue,GlobalContext,ANCHOR_VIEWER_DATA_HOOK,LINK_VIEWER_DATA_HOOK}from"wix-rich-content-common";import pluginLinkSchema from"wix-rich-content-common/dist/statics/schemas/plugin-link.schema.json";import{isEqual}from"lodash";var LINK_TYPE="LINK",styles={fontElementMap:"_35ss-",link:"_3Bkfb",linkInEditor:"_35evZ",linkInViewer:"_1lsz7",toolbarUrlContainer:"_10766",toolbarUrl:"_t6Zq",toolbarUrlAnchor:"_3WEE2"},LinkViewer=function(_Component){function LinkViewer(props){var _this;(_this=_Component.call(this,props)||this).handleClick=function(event){var _this$props=_this.props,componentData=_this$props.componentData,isInEditor=_this$props.isInEditor,config=_this$props.config,helpers=_this$props.helpers,customAnchorScroll=_this$props.customAnchorScroll,settings=null==config?void 0:config.LINK;if(settings){var _helpers$onViewerActi,onClick=settings.onClick,anchor=componentData.anchor,url=componentData.url;if(null==helpers||null===(_helpers$onViewerActi=helpers.onViewerAction)||void 0===_helpers$onViewerActi||_helpers$onViewerActi.call(helpers,"LINK","Click",componentData),null==onClick||onClick(event,(null==componentData?void 0:componentData.customData)||_this.getHref(url,anchor)),anchor&&(event.stopPropagation(),!isInEditor))if(event.preventDefault(),customAnchorScroll)customAnchorScroll(event,anchor);else{var anchorString="viewer-"+anchor,element=document.getElementById(anchorString);addAnchorTagToUrl(anchorString),anchorScroll(element,_this.context.experiments)}}},_this.resolveUrl=function(url){return isValidTelUrl(url)?url:normalizeUrl(url)},_this.getHref=function(url,anchor){return url?_this.resolveUrl(url):"#viewer-"+anchor},validate(props.componentData,pluginLinkSchema);var theme=_this.props.theme;return _this.styles=mergeStyles({styles:styles,theme:theme}),_this}_inheritsLoose(LinkViewer,_Component);var _proto=LinkViewer.prototype;return _proto.componentWillReceiveProps=function(nextProps){isEqual(nextProps.componentData,this.props.componentData)||validate(nextProps.componentData,pluginLinkSchema)},_proto.render=function(){var _classNames,_this$props2=this.props,componentData=_this$props2.componentData,anchorTarget=_this$props2.anchorTarget,children=_this$props2.children,isInEditor=_this$props2.isInEditor,url=componentData.url,anchor=componentData.anchor,_componentData$target=componentData.target,target=void 0===_componentData$target?anchorTarget:_componentData$target,rel=componentData.rel,anchorProps={href:this.getHref(url,anchor),target:anchor?"_self":target,rel:getRelValue(rel),className:classNames(this.styles.link,(_classNames={},_classNames[this.styles.linkInEditor]=isInEditor,_classNames[this.styles.linkInViewer]=!isInEditor,_classNames)),onClick:this.handleClick},dataHook=anchor?ANCHOR_VIEWER_DATA_HOOK:LINK_VIEWER_DATA_HOOK;return React.createElement("a",_extends({"data-hook":dataHook},anchorProps),children)},LinkViewer}(Component);LinkViewer.contextType=GlobalContext;var typeMapper=function(){var _ref;return(_ref={})["wix-draft-plugin-external-link"]={component:LinkViewer,elementType:"inline"},_ref.LINK={component:LinkViewer,elementType:"inline"},_ref["ricos-plugin-custom-link"]={component:LinkViewer,elementType:"inline"},_ref},DEFAULTS_config={linkTypes:{anchor:!0}},pluginLink=function(config){return{config:_extends({},DEFAULTS_config,config),type:"LINK",typeMapper:typeMapper}};export{LINK_TYPE,LinkViewer,typeMapper as linkTypeMapper,pluginLink};
import _extends from"@babel/runtime/helpers/extends";import _inheritsLoose from"@babel/runtime/helpers/inheritsLoose";import React,{PureComponent}from"react";import classNames from"classnames";import{NO_WRAP,validate,mergeStyles}from"wix-rich-content-common";import pluginDividerSchema from"wix-rich-content-common/dist/statics/schemas/plugin-divider.schema.json";import{isEqual}from"lodash";Object.freeze(["single","double","dashed","dotted"]);var SIZES=Object.freeze(["large","medium","small"]),ALIGNMENTS=["left","center","right"],DEFAULTS=Object.freeze({type:"single",config:{size:"large",alignment:"center",textWrap:NO_WRAP}}),getNextValue=function(array,currentValue){return array[(array.indexOf(currentValue)+1)%array.length]},Divider=function(_temp){var _this=this,_ref=void 0===_temp?{}:_temp,type=_ref.type,config=_ref.config;this.getNextAlignmentConfig=function(){var _this$config,alignment=getNextValue(ALIGNMENTS,null===(_this$config=_this.config)||void 0===_this$config?void 0:_this$config.alignment);return _extends({},_this.config,{alignment:alignment})},this.getNextSizeConfig=function(){var _this$config2,size=getNextValue(SIZES,null===(_this$config2=_this.config)||void 0===_this$config2?void 0:_this$config2.size);return _extends({},_this.config,{size:size})},this.isAlignmentDisabled=function(){return"large"===_this.size},this.type=type||DEFAULTS.type,this.config=_extends({},DEFAULTS.config,config),this.size=this.config.size,this.alignment=this.config.alignment},lineProps=function(width,lineDistance){return void 0===lineDistance&&(lineDistance=1),{x2:width,y1:lineDistance,y2:lineDistance}},DividerLine=function(_ref){var type=_ref.type,size=_ref.size,alignment=_ref.alignment,width=_ref.width,multilineDistance=_ref.multilineDistance,styles=_ref.styles,className=_ref.className,fillParent=_ref.fillParent,isMobile=_ref.isMobile,linesPropsArr=function(type,width,multilineDistance){void 0===multilineDistance&&(multilineDistance=7);var linePropsArr=[lineProps(width)];return"double"===type&&linePropsArr.push(lineProps(width,multilineDistance)),linePropsArr}(type,width,multilineDistance),lineClassName=classNames(styles.divider,styles["divider--"+type],styles["divider--"+size+(isMobile?"--mobile":"")],styles["divider--"+alignment],fillParent?styles["divider--fill-parent"]:"",className);return React.createElement("svg",{className:lineClassName},linesPropsArr.map((function(lineProp,i){return React.createElement("line",_extends({key:i},lineProp))})))},sizeClassName=function(_componentData,_theme){return""},styles={"divider-container":"_3zNzG","divider-container--double":"_3uLbE",divider:"_1L18v","divider--single":"_3fmOK","divider--double":"_3GOMV","divider--dashed":"_2MyQc","divider--dotted":"XDMdA","divider--small":"SFUYo","divider--small--mobile":"_1jnDu","divider--medium":"_15dwK","divider--large--mobile":"_2PezL","divider--medium--mobile":"_2dkSI","divider--large":"_3q8-N","divider--left":"_2AY-i","divider--center":"_2ikV9","divider--right":"_2P8vY","divider--fill-parent":"_3Yq1D"},DividerComponent=function(_PureComponent){function DividerComponent(props){var _this;return _this=_PureComponent.call(this,props)||this,validate(props.componentData,pluginDividerSchema),_this}_inheritsLoose(DividerComponent,_PureComponent);var _proto=DividerComponent.prototype;return _proto.componentWillReceiveProps=function(nextProps){isEqual(nextProps.componentData,this.props.componentData)||validate(nextProps.componentData,pluginDividerSchema)},_proto.render=function(){this.styles=this.styles||mergeStyles({styles:styles,theme:this.props.theme});var divider=new Divider(this.props.componentData),type=divider.type,size=divider.size,alignment=divider.alignment,className=classNames(this.styles["divider-container"],this.styles["divider-container--"+type],this.props.isMobile&&this.styles["divider-container--mobile"],this.props.className);return React.createElement("div",{className:className,"data-hook":"divider-"+type},React.createElement(DividerLine,{type:type,width:"100%",size:size,alignment:alignment,styles:this.styles,isMobile:this.props.isMobile}))},DividerComponent}(PureComponent);DividerComponent.sizeClassName=function(componentData,theme){return""};var DIVIDER_TYPE="wix-draft-plugin-divider",typeMapper=function(){var _ref;return(_ref={})[DIVIDER_TYPE]={component:DividerComponent,classNameStrategies:{size:sizeClassName}},_ref},pluginDivider=function(config){return{config:_extends({},DEFAULTS.config,config),type:DIVIDER_TYPE,typeMapper:typeMapper}};export{DIVIDER_TYPE,typeMapper as dividerTypeMapper,pluginDivider};
//# sourceMappingURL=module.viewer.js.map

@@ -1,5 +0,30 @@

export declare const DEFAULTS: {
export declare const LINE_SINGLE = "single";
export declare const LINE_DOUBLE = "double";
export declare const LINE_DASHED = "dashed";
export declare const LINE_DOTTED = "dotted";
export declare const LINE_TYPES: readonly string[];
export declare const ALIGN_LEFT = "left";
export declare const ALIGN_CENTER = "center";
export declare const ALIGN_RIGHT = "right";
export declare const SIZE_SMALL = "small";
export declare const SIZE_MEDIUM = "medium";
export declare const SIZE_LARGE = "large";
export declare const SIZES: readonly string[];
export declare const ALIGNMENTS: string[];
export declare const DEFAULTS: Readonly<{
type: string;
config: {
linkTypes: {
anchor: boolean;
size: string;
alignment: string;
textWrap: string;
};
}>;
export declare const newDefaults: {
type: string;
width: string;
alignment: string;
containerData: {
alignment: string;
width: {
type: string;
};

@@ -6,0 +31,0 @@ };

@@ -1,4 +0,4 @@

import { LinkPluginEditorConfig } from './types';
import { DividerPluginEditorConfig } from './types';
import { EditorPluginCreator } from 'wix-rich-content-common';
export declare const pluginLink: EditorPluginCreator<LinkPluginEditorConfig>;
export declare const pluginDivider: EditorPluginCreator<DividerPluginEditorConfig>;
//# sourceMappingURL=editor.d.ts.map

@@ -1,5 +0,7 @@

export { createLinkPlugin } from './createLinkPlugin';
export { EXTERNAL_LINK_TYPE, LINK_TYPE } from './types';
export { default as LinkViewer } from './LinkViewer';
export { pluginLink } from './editor';
export { createDividerPlugin } from './createDividerPlugin';
export { DIVIDER_TYPE } from './types';
export { pluginDivider } from './editor';
export { default as DividerComponent } from './divider-component';
export { DEFAULTS } from './defaults';
export { createDividerData } from './createDividerData';
//# sourceMappingURL=index.d.ts.map
import { CreateInlineButtons } from 'wix-rich-content-common';
declare const createInlineButtons: CreateInlineButtons;
export default createInlineButtons;
export declare const createInlineButtons: CreateInlineButtons;
//# sourceMappingURL=inline-buttons.d.ts.map

@@ -1,19 +0,9 @@

/// <reference types="react" />
import { EditorPluginConfig, ViewerPluginConfig } from 'wix-rich-content-common';
export declare const EXTERNAL_LINK_TYPE = "wix-draft-plugin-external-link";
export declare const LINK_TYPE = "LINK";
export declare const CUSTOM_LINK_TYPE = "ricos-plugin-custom-link";
export interface LinkPluginEditorConfig extends EditorPluginConfig {
toolbar?: {
hidden?: string[];
icons?: {
[key: string]: (props: any) => JSX.Element;
};
inlineToolbar?: boolean;
};
export declare const DIVIDER_TYPE = "wix-draft-plugin-divider";
export interface DividerPluginEditorConfig extends EditorPluginConfig {
[key: string]: any;
}
export interface LinkPluginViewerConfig extends ViewerPluginConfig {
export interface DividerPluginViewerConfig extends ViewerPluginConfig {
[key: string]: any;
}
//# sourceMappingURL=types.d.ts.map

@@ -1,6 +0,6 @@

import { LINK_TYPE, LinkPluginViewerConfig } from './types';
import { typeMapper } from './typeMapper-loadable';
import { DIVIDER_TYPE, DividerPluginViewerConfig } from './types';
import { ViewerPluginCreator } from 'wix-rich-content-common';
export { typeMapper as linkTypeMapper, LINK_TYPE };
export declare const pluginLink: ViewerPluginCreator<LinkPluginViewerConfig>;
export { typeMapper as dividerTypeMapper, DIVIDER_TYPE };
export declare const pluginDivider: ViewerPluginCreator<DividerPluginViewerConfig>;
//# sourceMappingURL=viewer-loadable.d.ts.map

@@ -1,7 +0,6 @@

import { LINK_TYPE, LinkPluginViewerConfig } from './types';
import { typeMapper } from './typeMapper';
import { DIVIDER_TYPE, DividerPluginViewerConfig } from './types';
import { ViewerPluginCreator } from 'wix-rich-content-common';
export { typeMapper as linkTypeMapper, LINK_TYPE };
export { default as LinkViewer } from './LinkViewer';
export declare const pluginLink: ViewerPluginCreator<LinkPluginViewerConfig>;
export { typeMapper as dividerTypeMapper, DIVIDER_TYPE };
export declare const pluginDivider: ViewerPluginCreator<DividerPluginViewerConfig>;
//# sourceMappingURL=viewer.d.ts.map

@@ -1,1 +0,1 @@

{"name":"richlagetest","version":"0.0.0-0c51a1140f567e2d087a75e68f679500b8a1d7fc"}
{"name":"richlagetest","version":"0.0.0-11457cdb98d3c734cd386b95cbcc4ec4720169eb"}

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

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc