richlagetest
Advanced tools
Comparing version 0.0.0-0c51a1140f567e2d087a75e68f679500b8a1d7fc to 0.0.0-1069081560a8a079b92ad18bd78cc0c99685c90c
@@ -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"),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:"var(--ricos-settings-whitebox-border-radius, 6px)",boxShadow:"var(--ricos-settings-whitebox-box-shadow, 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)}}; | ||
//# 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{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:"var(--ricos-settings-whitebox-border-radius, 6px)",boxShadow:"var(--ricos-settings-whitebox-box-shadow, 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}; | ||
//# sourceMappingURL=module.js.map |
@@ -1,1 +0,1 @@ | ||
{"name":"richlagetest","version":"0.0.0-0c51a1140f567e2d087a75e68f679500b8a1d7fc"} | ||
{"name":"richlagetest","version":"0.0.0-1069081560a8a079b92ad18bd78cc0c99685c90c"} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
262412
568
12