Socket
Socket
Sign inDemoInstall

richlagetest

Package Overview
Dependencies
Maintainers
1
Versions
150
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

richlagetest - npm Package Compare versions

Comparing version 0.0.0-79e90eb34d73fa9c9d6e3b1db7b9e456d68b6f0f to 0.0.0-7a2950045a340c7970c0c90c372a4d06bd563d80

dist/src/createIndentPlugin.d.ts

2

dist/module.cjs.js

@@ -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"),React=require("react"),_assertThisInitialized=require("@babel/runtime/helpers/assertThisInitialized"),_inheritsLoose=require("@babel/runtime/helpers/inheritsLoose"),classNames=require("classnames"),wixRichContentUiComponents=require("wix-rich-content-ui-components"),wixRichContentCommon=require("wix-rich-content-common"),lodash=require("lodash"),wixRichContentEditorCommon=require("wix-rich-content-editor-common"),pluginHtmlSchema=require("wix-rich-content-common/dist/statics/schemas/plugin-html.schema.json"),toDraftData=require("ricos-content/libs/toDraftData");function _interopDefaultLegacy(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var _VALIDATORS,_NORMALIZERS,_TOOLTIP_TEXT_BY_SRC_,_extends__default=_interopDefaultLegacy(_extends),_objectWithoutPropertiesLoose__default=_interopDefaultLegacy(_objectWithoutPropertiesLoose),React__default=_interopDefaultLegacy(React),_assertThisInitialized__default=_interopDefaultLegacy(_assertThisInitialized),_inheritsLoose__default=_interopDefaultLegacy(_inheritsLoose),classNames__default=_interopDefaultLegacy(classNames),pluginHtmlSchema__default=_interopDefaultLegacy(pluginHtmlSchema),EditIcon=function(props){return React__default.default.createElement("svg",Object.assign({width:19,viewBox:"0 0 19 19"},props),React__default.default.createElement("path",{d:"M11.498 5.326L3 13.8V16h2.2l8.486-8.486-2.188-2.188zm.688-.687l2.199 2.176L16 5.2 13.83 3l-1.644 1.64zM2 13.523a.2.2 0 0 1 .059-.141l11.1-11.1a1 1 0 0 1 1.414 0l2.146 2.145a1 1 0 0 1 0 1.414l-11.1 11.1a.2.2 0 0 1-.142.059H2.2a.2.2 0 0 1-.2-.2v-3.277zM5 4h1.8c.11 0 .2.09.2.2v.6a.2.2 0 0 1-.2.2H5v1.8a.2.2 0 0 1-.2.2h-.6a.2.2 0 0 1-.2-.2V5H2.2a.2.2 0 0 1-.2-.2v-.6c0-.11.09-.2.2-.2H4V2.2c0-.11.09-.2.2-.2h.6c.11 0 .2.09.2.2V4z"}))},InsertPluginIcon=function(props){return React__default.default.createElement("svg",Object.assign({viewBox:"0 0 19 19",width:"19",height:"19"},props),React__default.default.createElement("path",{d:"M4.889 5L1 8.89l3.889 3.888.707-.708-3.182-3.18 3.182-3.184zm8.818 7.779l3.89-3.89L13.706 5 13 5.708l3.182 3.181L13 12.072z"}),React__default.default.createElement("path",{stroke:"currentColor",d:"M11.948 2L7 15.978"}))},Adsense=function(props){return React__default.default.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",width:"19",height:"24",viewBox:"0 0 24 24"},props),React__default.default.createElement("g",{fillRule:"evenodd"},React__default.default.createElement("path",{d:"M17.764 0c.277 0 .5.224.5.5 0 .075-.016.149-.049.216l-2.767 5.767L8.702 20.99 8.7 20.99l-.199.431c-.163.354-.518.58-.907.58H.5c-.276 0-.5-.224-.5-.5 0-.078.018-.154.053-.224l1.593-3.187L7.618 5.283l-.04.028L9.768.58c.163-.354.518-.58.907-.58h7.09zM20.848 11c.276 0 .5.224.5.5 0 .076-.017.15-.05.218l-1.505 3.099-2.814 6.034-.262.57c-.164.353-.518.579-.907.579h-4.687v-.001L9.691 22l1.644-3.469L14.845 11h6.003z",transform:"translate(1 1)"})))},DEFAULTS_CONFIG={alignment:"center"},htmlButtonsTypes={html:"html",adsense:"adsense"},defaults=function(isAdsense){return{srcType:"html",src:"",config:_extends__default.default({},DEFAULTS_CONFIG,isAdsense&&{isAdsense:isAdsense})}},styles$2_container="_2rikd",styles$2_tooltip="_2JU9j",AdsenseTitle=function(_ref){var t=_ref.t;return React__default.default.createElement("div",{className:styles$2_container},t("HtmlEditPanel_HtmlInput_AdSense_Title"),React__default.default.createElement("div",{className:styles$2_tooltip},React__default.default.createElement(wixRichContentUiComponents.InfoIcon,{tooltipText:t("HtmlEditPanel_HtmlInput_AdSense_Tooltip")})))},styles$1={fontElementMap:"tBbsp",htmlEditPanel_button:"l7Urd",htmlEditPanel:"_1Whgf",htmlEditPanel_input:"_1vXv2",htmlEditPanel_textArea:"_33T-k",htmlEditPanel_buttons:"_3W4Az",htmlEditPanel_primaryButton:"RVO-5",htmlEditPanel_secondaryButton:"_1zKYg"},VALIDATORS=((_VALIDATORS={}).html=function(){return null},_VALIDATORS.url=function(url){var error=null;return url&&wixRichContentCommon.isValidUrl(url)?!wixRichContentCommon.startsWithHttps(url)&&wixRichContentCommon.hasProtocol(url)&&(error="HtmlEditPanel_HttpsError"):error="HtmlEditPanel_UrlError",error},_VALIDATORS),NORMALIZERS=((_NORMALIZERS={}).html=lodash.identity,_NORMALIZERS.url=function(url){return wixRichContentCommon.hasProtocol(url)?url:"https://"+lodash.trimStart(url,"//")},_NORMALIZERS),HtmlEditPanel=function(_Component){function HtmlEditPanel(){for(var _this$state,_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).initialData=_this.props.componentData,_this.styles=wixRichContentCommon.mergeStyles({styles:styles$1,theme:_this.props.theme}),_this.state=((_this$state={srcType:_this.initialData.srcType})[_this.initialData.srcType]=_this.initialData.src,_this$state.submitted=!1,_this$state),_this.handleSrcTypeChange=function(srcType){_this.setState({srcType:srcType})},_this.handleSrcChange=function(target){var _this$setState,name=target.name,value=target.value;_this.setState(((_this$setState={})[name]=value,_this$setState),(function(){return _this.updateComponentData()}))},_this.handleCancelClick=function(){_this.props.store.update("componentData",_this.initialData),_this.props.close()},_this.updateComponentData=function(){var srcType=_this.state.srcType;_this.isValid()&&_this.props.store.update("componentData",{srcType:srcType,src:NORMALIZERS[srcType](_this.state[srcType])||""}),_this.setState({submitted:!0})},_this.getError=function(){var srcType=_this.state.srcType;return VALIDATORS[srcType](_this.state[srcType])},_this.isValid=function(){return!_this.getError()},_this.render=function(){var styles=_assertThisInitialized__default.default(_this).styles,_this$state2=_this.state,srcType=_this$state2.srcType,submitted=_this$state2.submitted,_this$props=_this.props,t=_this$props.t,tabIndex=_this$props.tabIndex,theme=_this$props.theme,config=_this$props.componentData.config,inputBaseProps={onChange:_this.handleSrcChange,getTarget:!0,tabIndex:tabIndex,theme:theme};return React__default.default.createElement("div",{className:styles.htmlEditPanel},null!=config&&config.isAdsense?React__default.default.createElement(AdsenseTitle,{t:t}):React__default.default.createElement(wixRichContentUiComponents.RadioGroupHorizontal,{theme:theme,name:"srcType",value:_this.state.srcType,onChange:_this.handleSrcTypeChange,dataSource:[{value:"html",labelText:t("HtmlEditPanel_Code"),dataHook:"htmlEditPanel_radioHtml"},{value:"url",labelText:t("HtmlEditPanel_Source"),dataHook:"htmlEditPanel_radioUrl"}],inline:!0}),React__default.default.createElement("div",{className:styles.htmlEditPanel_input},"html"===srcType&&React__default.default.createElement("div",{className:styles.htmlEditPanel_textArea},React__default.default.createElement(wixRichContentUiComponents.InputWithLabel,_extends__default.default({name:"html",value:_this.state.html,placeholder:null!=config&&config.isAdsense?t("HtmlEditPanel_HtmlInput_AdSense_Placeholder"):t("HtmlEditPanel_HtmlInput_Placeholder"),isTextArea:!0,isFullHeight:!0,dataHook:"htmlEditPanel_htmlInput"},inputBaseProps))),"url"===srcType&&React__default.default.createElement(wixRichContentUiComponents.TextInput,_extends__default.default({name:"url",value:_this.state.url,"data-hook":"htmlEditPanel_htmlInput",error:submitted?t(_this.getError()):null,placeholder:t("HtmlEditPanel_UrlInput_Placeholder")},inputBaseProps))),React__default.default.createElement("div",{className:styles.htmlEditPanel_buttons},React__default.default.createElement("button",{className:classNames__default.default(styles.htmlEditPanel_button,styles.htmlEditPanel_secondaryButton),onClick:_this.handleCancelClick,"data-hook":"htmlEditPanel_Cancel"},t("HtmlEditPanel_Cancel")),React__default.default.createElement("button",{className:classNames__default.default(styles.htmlEditPanel_button,styles.htmlEditPanel_primaryButton),onClick:_this.props.close,"data-hook":"htmlEditPanel_Update"},t("HtmlEditPanel_Update"))))},_this}return _inheritsLoose__default.default(HtmlEditPanel,_Component),HtmlEditPanel}(React.Component),getAlignmentButtonPropsFn=function(getEditorBounds){return function(_ref){var _componentData$config,componentData=_ref.componentData,editorBounds=null==getEditorBounds?void 0:getEditorBounds(),maxAlignmentWidth=editorBounds?editorBounds.width-1:739;return{disabled:((null==componentData||null===(_componentData$config=componentData.config)||void 0===_componentData$config?void 0:_componentData$config.width)||0)>maxAlignmentWidth}}},TOOLTIP_TEXT_BY_SRC_TYPE=((_TOOLTIP_TEXT_BY_SRC_={}).html="HtmlPlugin_EditHtml_Tooltip",_TOOLTIP_TEXT_BY_SRC_.url="HtmlPlugin_EditUrl_Tooltip",_TOOLTIP_TEXT_BY_SRC_),createInlineButtons=function(_ref2){var _settings$toolbar,_ref2$settings=_ref2.settings,settings=void 0===_ref2$settings?{}:_ref2$settings,getEditorBounds=_ref2.getEditorBounds,maxWidth=settings.maxWidth,_settings$minWidth=settings.minWidth,minWidth=void 0===_settings$minWidth?35:_settings$minWidth,_settings$maxHeight=settings.maxHeight,maxHeight=void 0===_settings$maxHeight?1200:_settings$maxHeight,_settings$minHeight=settings.minHeight,minHeight=void 0===_settings$minHeight?35:_settings$minHeight,icons=(null==settings||null===(_settings$toolbar=settings.toolbar)||void 0===_settings$toolbar?void 0:_settings$toolbar.icons)||{};return[{type:wixRichContentPluginCommons.BUTTONS.INLINE_PANEL,keyName:"edit",panelContent:wixRichContentCommon.translate()(HtmlEditPanel),icon:icons.edit||EditIcon,mapComponentDataToButtonProps:function(_ref3){var src=_ref3.src,srcType=_ref3.srcType;return{tooltipTextKey:src?TOOLTIP_TEXT_BY_SRC_TYPE[srcType]:"HtmlPlugin_EditEmpty_Tooltip"}}},{type:wixRichContentPluginCommons.BUTTONS.SEPARATOR,keyName:"separator1"},{type:wixRichContentPluginCommons.BUTTONS.WIDTH,getEditorBounds:getEditorBounds,keyName:"width",min:minWidth,mapStoreDataToPanelProps:function(){var bounds=getEditorBounds();return bounds&&bounds.width?{max:maxWidth?Math.min(maxWidth,bounds.width):bounds.width}:{max:maxWidth||940}}},{type:wixRichContentPluginCommons.BUTTONS.HEIGHT,keyName:"height",min:minHeight,max:maxHeight,inputMax:9999},{type:wixRichContentPluginCommons.BUTTONS.SEPARATOR,keyName:"separator2"},{type:wixRichContentPluginCommons.BUTTONS.TEXT_ALIGN_LEFT,keyName:"alignLeft",icon:icons.alignLeft||wixRichContentPluginCommons.SizeSmallLeftIcon,mapStoreDataToButtonProps:getAlignmentButtonPropsFn(getEditorBounds)},{type:wixRichContentPluginCommons.BUTTONS.TEXT_ALIGN_CENTER,keyName:"alignCenter",icon:icons.alignCenter||wixRichContentPluginCommons.SizeSmallCenterIcon},{type:wixRichContentPluginCommons.BUTTONS.TEXT_ALIGN_RIGHT,keyName:"alignRight",icon:icons.alignRight||wixRichContentPluginCommons.SizeSmallRightIcon,mapStoreDataToButtonProps:getAlignmentButtonPropsFn(getEditorBounds)},{type:wixRichContentPluginCommons.BUTTONS.SEPARATOR,keyName:"separator3"},{type:wixRichContentPluginCommons.BUTTONS.DELETE,keyName:"delete",mobile:!0}]},createInsertButtons=function(_ref){var _settings$toolbar,_settings$toolbar$ico,_buttonsMap,helpers=_ref.helpers,t=_ref.t,settings=_ref.settings,_settings$exposeButto=settings.exposeButtons,exposeButtons=void 0===_settings$exposeButto?[htmlButtonsTypes.html]:_settings$exposeButto,siteDomain=settings.siteDomain,icon=(null==settings||null===(_settings$toolbar=settings.toolbar)||void 0===_settings$toolbar||null===(_settings$toolbar$ico=_settings$toolbar.icons)||void 0===_settings$toolbar$ico?void 0:_settings$toolbar$ico.InsertPluginButtonIcon)||InsertPluginIcon,index=exposeButtons.indexOf(htmlButtonsTypes.adsense);!siteDomain&&index>-1&&exposeButtons.splice(index,1);var buttonsMap=((_buttonsMap={})[htmlButtonsTypes.html]={type:wixRichContentEditorCommon.BUTTON_TYPES.BUTTON,name:wixRichContentEditorCommon.INSERT_PLUGIN_BUTTONS.HTML,helpers:helpers,toolbars:[wixRichContentEditorCommon.TOOLBARS.INSERT_PLUGIN,wixRichContentEditorCommon.TOOLBARS.MOBILE,wixRichContentEditorCommon.TOOLBARS.FOOTER,wixRichContentEditorCommon.TOOLBARS.SIDE],tooltip:t("HtmlPlugin_InsertButton_Tooltip"),getIcon:function(){return icon},componentData:defaults(!1)},_buttonsMap[htmlButtonsTypes.adsense]={type:wixRichContentEditorCommon.BUTTON_TYPES.BUTTON,name:wixRichContentEditorCommon.INSERT_PLUGIN_BUTTONS.ADSENSE,componentData:defaults(!0),helpers:helpers,toolbars:[wixRichContentEditorCommon.TOOLBARS.INSERT_PLUGIN,wixRichContentEditorCommon.TOOLBARS.MOBILE,wixRichContentEditorCommon.TOOLBARS.FOOTER,wixRichContentEditorCommon.TOOLBARS.SIDE],section:"BlockToolbar_Section_Embed_Anywhere",tooltip:t("AdSensePlugin_InsertButton_Tooltip"),getIcon:function(){return Adsense}},_buttonsMap);return exposeButtons.map((function(buttonType){return buttonsMap[buttonType]}))},createToolbar=function(_ref){var helpers=_ref.helpers,t=_ref.t,isMobile=_ref.isMobile,settings=_ref.settings,getEditorBounds=_ref.getEditorBounds;return{InlineButtons:createInlineButtons({settings:settings,getEditorBounds:getEditorBounds}),InsertButtons:isMobile?[]:createInsertButtons({helpers:helpers,t:t,settings:settings}),name:"html"}},htmlIframeSrc="\n <head>\n <style type=\"text/css\">\n iframe[class|='instagram'],\n blockquote[class|='instagram'] {\n /* fallback script for ios below */\n min-width: 0 !important;\n width: calc(100vw - 2px);\n }\n\n body {\n margin: 0;\n max-width: calc(100vw);\n display: inline-block;\n float: left;\n width: 100%;\n box-sizing: border-box;\n }\n body > iframe {\n margin: 0 !important;\n width: calc(100vw - 2px) !important;\n }\n body::before,\n body::after {\n content: '.';\n height: 0;\n margin: 0;\n overflow: hidden;\n visibility: hidden;\n display: block;\n clear: both;\n }\n </style>\n <script>\n var isIOS = /iPad|iPhone|iPod/.test(navigator.userAgent) && !window.MSStream;\n (function fixInstagramWidth() {\n // This is a fallback for the styles above. Because inline styles can't be overridden in ios.\n var callback = function() {\n try {\n if (document.body.firstChild.className.indexOf('instagram') >= 0) {\n document.body.firstChild.style.minWidth = '0';\n document.body.firstChild.style.width = 'calc(100vw - 2px)';\n }\n } catch (e) {}\n };\n\n var observer = new MutationObserver(callback);\n\n observer.observe(document, {\n childList: true,\n subtree: true,\n });\n })();\n\n function initSendHeight(id) {\n /**\n * Handle image load by triggering a resize\n */\n function imageLoaded(event) {\n if (!event || event.type !== 'load') {\n return;\n }\n\n var img = event.srcElement;\n // Remove image from loading stack\n var imageIndex = images.indexOf(img);\n if (imageIndex !== -1) {\n images.splice(imageIndex, 1);\n }\n\n handleResize();\n }\n\n /**\n * Add 'load' event listener and store reference to image\n * @param {elm} img Image being loaded\n */\n var images = [];\n function addImage(img) {\n if (images.indexOf(img) === -1) {\n img.addEventListener('load', imageLoaded);\n images.push(img);\n }\n }\n\n /**\n * Filter out images in the DOM that haven't loaded yet and add listener\n */\n function addImageLoadListeners() {\n var imgs = document.querySelectorAll('img');\n for (var i = 0; i < imgs.length; i++) {\n var image = imgs[i];\n // Do nothing if image is already loaded\n if (\n image.nodeName === 'IMG' &&\n image.src &&\n image.complete === false &&\n image.readyState !== 4\n ) {\n addImage(image);\n }\n }\n }\n\n function getHeight() {\n var height = parseInt(document.body.offsetHeight, 10);\n var styles = document.defaultView.getComputedStyle(document.body);\n height += parseInt(styles.getPropertyValue('margin-bottom'), 10);\n height += parseInt(styles.getPropertyValue('margin-top'), 10);\n return height;\n }\n\n function handleResize() {\n multipleDelayedSendHeight();\n }\n\n function handleIframeAdded(iframe) {\n if (isIOS) {\n iframe.onload = function() {\n var src = iframe.src; \n if (src.indexOf('reloadMe') > -1) {\n return;\n }\n iframe.src = src.replace('?', '?reloadMe=1&');\n };\n }\n }\n\n var timerId;\n function multipleDelayedSendHeight() {\n sendHeight();\n clearTimeout(timerId);\n let delay = 100;\n timerId = setTimeout(function request() {\n sendHeight();\n delay *= 2;\n if (delay < 20000) {\n timerId = setTimeout(request, delay);\n }\n }, delay);\n }\n\n function sendHeight() {\n var height = getHeight();\n parent.postMessage({ type: 'htmlPlugin:heightResize', id: id, height: height }, '*');\n }\n\n function setupMutationObserver() {\n var target = document.querySelector('body');\n var observer = new MutationObserver(function(mutations) {\n addImageLoadListeners();\n handleResize();\n mutations.forEach(function(mutation) {\n mutation.addedNodes.forEach(function(el) {\n if (el.nodeName === 'IFRAME') {\n handleIframeAdded(el);\n }\n });\n });\n });\n\n var config = {\n attributes: true,\n childList: true,\n characterData: true,\n subtree: true,\n };\n\n observer.observe(target, config);\n }\n\n window.addEventListener('resize', handleResize); //this handles width change\n setupMutationObserver();\n handleResize();\n }\n\n window.addEventListener('message', function(event) {\n if (event.data.type !== 'htmlPlugin:updateContent') {\n return;\n }\n\n var content = [\n '<!DOCTYPE html>',\n '<html>',\n '<head>' + document.head.innerHTML + '</head>',\n '<body>' + event.data.content + '</body>',\n '</html>',\n ].join('');\n\n document.open('text/html', 'replace');\n document.write(content);\n document.close();\n initSendHeight(event.data.id);\n });\n <\/script>\n </head>\n\n <body></body>\n",styles_iframe="_2xvJT",_excluded=["iframeRef"],Iframe=function(_ref){var _context$experiments$,iframeRef=_ref.iframeRef,otherProps=_objectWithoutPropertiesLoose__default.default(_ref,_excluded),loading=null!==(_context$experiments$=React.useContext(wixRichContentCommon.GlobalContext).experiments.lazyImagesAndIframes)&&void 0!==_context$experiments$&&_context$experiments$.enabled?"lazy":void 0;return React__default.default.createElement("iframe",Object.assign({ref:iframeRef,className:styles_iframe,title:"remote content",style:{backgroundColor:"transparent"},loading:loading},otherProps))},isSSR="undefined"==typeof window,IframeHtml=function(_Component){function IframeHtml(){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).state={shouldRender:!1},_this.id=Math.random().toString(36).substr(2,9),_this.writeToIframe=function(iframeElement){var _iframeElement$conten;_this.iframe=iframeElement;var iframeDocument=null==iframeElement||null===(_iframeElement$conten=iframeElement.contentWindow)||void 0===_iframeElement$conten?void 0:_iframeElement$conten.document;iframeDocument&&(iframeDocument.open("text/html","replace"),iframeDocument.write(htmlIframeSrc),iframeDocument.close())},_this.updateIframeContent=function(content){var _this$iframe;_this.shouldIgnoreLoad=!0,null===(_this$iframe=_this.iframe)||void 0===_this$iframe||_this$iframe.contentWindow.postMessage({type:"htmlPlugin:updateContent",id:_this.id,content:content},"*")},_this.handleIframeMessage=function(_ref){var data=_ref.data,type=data.type,id=data.id,height=data.height;"htmlPlugin:heightResize"===type&&id===_this.id&&_this.props.onHeightChange(height)},_this.handleIframeLoad=function(){!_this.shouldIgnoreLoad&&_this.updateIframeContent(_this.props.html)},_this.setIframe=function(iframe){_this.iframe=iframe},_this}_inheritsLoose__default.default(IframeHtml,_Component);var _proto=IframeHtml.prototype;return _proto.componentDidMount=function(){this.setState({shouldRender:!0}),!isSSR&&window.addEventListener("message",this.handleIframeMessage)},_proto.componentWillUnmount=function(){!isSSR&&window.removeEventListener("message",this.handleIframeMessage)},_proto.componentWillReceiveProps=function(nextProps){this.props.html!==nextProps.html&&this.updateIframeContent(nextProps.html)},_proto.render=function(){var iframeSandboxDomain=this.props.iframeSandboxDomain,iframeProps={style:{backgroundColor:"transparent"},onLoad:this.handleIframeLoad};if(iframeSandboxDomain){var strippedUrl=iframeSandboxDomain.replace(/\/$/,"");iframeProps.src=strippedUrl+"/html/db9376e69cfa487ea0fa0b912ae51a4f_v1.html",iframeProps.iframeRef=this.setIframe}else iframeProps.iframeRef=this.writeToIframe;return this.state.shouldRender?React__default.default.createElement(Iframe,iframeProps):null},IframeHtml}(React.Component),IframeUrl=function(props){return React__default.default.createElement(Iframe,Object.assign({},props,{sandbox:"allow-popups allow-presentation allow-forms allow-same-origin allow-scripts"}))},htmlComponentStyles={htmlComponent:"yuWXS",htmlComponent_placeholder:"_3tucQ"},HtmlComponent=function(_Component){function HtmlComponent(){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).state={siteDomain:void 0},_this.setHeight=function(iframeHeight){var _this$props$store;iframeHeight!==_this.state.iframeHeight&&(_this.setState({iframeHeight:iframeHeight}),null===(_this$props$store=_this.props.store)||void 0===_this$props$store||_this$props$store.update("componentData",{config:{height:iframeHeight}}))},_this.getIframeHeight=function(){var _this$props=_this.props,_this$props$settings=_this$props.settings,height=(_this$props$settings=void 0===_this$props$settings?{}:_this$props$settings).height,config=_this$props.componentData.config,iframeHeight=_this.state.iframeHeight,maxDiff=Math.min(50,.1*_this.state.iframeHeight),normalizedHeight=iframeHeight;return config.height&&(normalizedHeight=iframeHeight&&config.height<iframeHeight&&config.height+maxDiff>iframeHeight?iframeHeight:config.height),normalizedHeight||height||550},_this}_inheritsLoose__default.default(HtmlComponent,_Component);var _proto=HtmlComponent.prototype;return _proto.componentDidMount=function(){var _this$props2=this.props,config=_this$props2.componentData.config,_this$props2$settings=_this$props2.settings,settings=void 0===_this$props2$settings?{}:_this$props2$settings,width=settings.width,height=settings.height,siteDomain=settings.siteDomain;config.width||(width?config.width=width:this.element?config.width=this.element.getBoundingClientRect().width:config.width=350),config.height||(config.height=height||550),this.setState({siteDomain:siteDomain})},HtmlComponent.getDerivedStateFromProps=function(props,state){var componentData=props.componentData;if("html"===componentData.srcType){var html=componentData&&componentData.src,pageURL=function(siteDomain){if(siteDomain){var res=/http.+com/gm.exec(siteDomain);return res?res[0]:res}}(state.siteDomain);if(pageURL&&html&&html.includes&&html.includes("adsbygoogle")){var updatedAd='<ins class="adsbygoogle"\n\tdata-page-url="'+pageURL+'"';html=html.replace(new RegExp('<ins class="adsbygoogle"',"g"),updatedAd)}return{html:html}}},_proto.render=function(){var _this$context$experim,_this2=this,html=this.state.html,_this$props3=this.props,iframeSandboxDomain=_this$props3.iframeSandboxDomain,theme=_this$props3.theme,componentData=_this$props3.componentData,_this$props3$settings=_this$props3.settings,width=(_this$props3$settings=void 0===_this$props3$settings?{}:_this$props3$settings).width;this.styles=this.styles||wixRichContentCommon.mergeStyles({styles:htmlComponentStyles,theme:theme}),wixRichContentCommon.validate(componentData,pluginHtmlSchema__default.default);var src=componentData.src,srcType=componentData.srcType,_componentData$config=componentData.config,currentWidth=(_componentData$config=void 0===_componentData$config?{}:_componentData$config).width,style={width:this.props.isMobile?"auto":currentWidth||width||350,height:this.getIframeHeight(),maxHeight:this.state.iframeHeight,maxWidth:"100%"};return React__default.default.createElement("div",{className:this.styles.htmlComponent,ref:function(_ref){return _this2.element=_ref},style:style,"data-hook":"HtmlComponent"},"html"===srcType&&src&&React__default.default.createElement(IframeHtml,{iframeSandboxDomain:iframeSandboxDomain||(null===(_this$context$experim=this.context.experiments.forceIframeSandboxDomain)||void 0===_this$context$experim?void 0:_this$context$experim.enabled)&&"https://www.filesusr.com",key:"html",tabIndex:0,html:html,onHeightChange:this.setHeight}),"url"===srcType&&wixRichContentCommon.isValidUrl(src)&&React__default.default.createElement(IframeUrl,{key:"url",tabIndex:0,src:wixRichContentCommon.normalizeUrl(src)}),!src&&!wixRichContentCommon.isValidUrl(src)&&React__default.default.createElement("div",{className:this.styles.htmlComponent_placeholder}))},HtmlComponent}(React.Component);HtmlComponent.contextType=wixRichContentCommon.GlobalContext;var HTML_TYPE="wix-draft-plugin-html";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 createHtmlPlugin=function(config){var helpers=config.helpers,isMobile=config.isMobile,t=config.t,_config$HTML_TYPE=config[HTML_TYPE],settings=void 0===_config$HTML_TYPE?{}:_config$HTML_TYPE,getEditorBounds=config.getEditorBounds,rest=_objectWithoutPropertiesLoose__default.default(config,["helpers","isMobile","t",HTML_TYPE,"getEditorBounds"].map(_toPropertyKey)),simulateEditClick=function(_ref){var e=_ref.e,pubsub=_ref.pubsub;return setTimeout((function(){return pubsub.set("onClickTrigger",{event:e,key:"edit"})}))};return wixRichContentPluginCommons.createBasePlugin(_extends__default.default({onOverlayClick:simulateEditClick,component:HtmlComponent,settings:settings,type:HTML_TYPE,toolbar:createToolbar({helpers:helpers,t:t,isMobile:isMobile,settings:settings,getEditorBounds:getEditorBounds}),helpers:helpers,isMobile:isMobile,t:t,getEditorBounds:getEditorBounds,defaultPluginData:defaults(),onComponentMount:simulateEditClick},rest))};createHtmlPlugin.functionName=HTML_TYPE;var createHtmlData=function(pluginData,isRicosSchema){void 0===pluginData&&(pluginData={}),void 0===isRicosSchema&&(isRicosSchema=!1);var htmlData=isRicosSchema?toDraftData.convertNodeDataToDraft("HTML",pluginData):pluginData;return lodash.merge({},defaults(),htmlData)};exports.HTML_TYPE=HTML_TYPE,exports.createHtmlPlugin=createHtmlPlugin,exports.htmlButtonsTypes=htmlButtonsTypes,exports.pluginHtml=function(config){return{config:_extends__default.default({},DEFAULTS_CONFIG,config),type:HTML_TYPE,createPlugin:createHtmlPlugin,ModalsMap:{},createPluginData:createHtmlData}};
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var _extends=require("@babel/runtime/helpers/extends"),_objectWithoutPropertiesLoose=require("@babel/runtime/helpers/objectWithoutPropertiesLoose"),wixRichContentEditorCommon=require("wix-rich-content-editor-common"),React=require("react"),wixRichContentPluginCommons=require("wix-rich-content-plugin-commons");function _interopDefaultLegacy(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var _extends__default=_interopDefaultLegacy(_extends),_objectWithoutPropertiesLoose__default=_interopDefaultLegacy(_objectWithoutPropertiesLoose),React__default=_interopDefaultLegacy(React),decreaseIndentPluginIcon=function(props){return props.newFormattingToolbar?React__default.default.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",width:"13",height:"13",viewBox:"0 0 13 13"},props),React__default.default.createElement("g",{fill:"none",fillRule:"evenodd"},React__default.default.createElement("g",{fill:"currentColor"},React__default.default.createElement("g",null,React__default.default.createElement("path",{d:"M17.001 15.999V17H4v-1.001h13.001zM17 12v1h-7v-1h7zM7 8v5l-3-2.5L7 8zm10 0v1h-7V8h7zm.001-4v1H4V4h13.001z",transform:"translate(-570.000000, -81.000000) translate(566.000000, 77.000000)"}))))):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:"decrease-indent",d:"M3.973 3l1.89 2 .002.006.098.157.037.191-.037.191-.098.157-.003.005-1.889 2L3.306 7l1.082-1.146H0v-1h4.388L3.306 3.707 3.973 3z"})),React__default.default.createElement("g",{fillRule:"evenodd",transform:"translate(2 4)"},React__default.default.createElement("path",{d:"M3.2 0h10.6c.11 0 .2.09.2.2v.6c0 .11-.09.2-.2.2H3.2C3.09 1 3 .91 3 .8V.2c0-.11.09-.2.2-.2zM8.2 5h5.6c.11 0 .2.09.2.2v.6c0 .11-.09.2-.2.2H8.2c-.11 0-.2-.09-.2-.2v-.6c0-.11.09-.2.2-.2zM3.2 10h10.6c.11 0 .2.09.2.2v.6c0 .11-.09.2-.2.2H3.2c-.11 0-.2-.09-.2-.2v-.6c0-.11.09-.2.2-.2z"}),React__default.default.createElement("use",{transform:"rotate(-180 3 5.354)",xlinkHref:"#decrease-indent"})))},increaseIndentPluginIcon=function(props){return props.newFormattingToolbar?React__default.default.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",width:"14",height:"13",viewBox:"0 0 14 13"},props),React__default.default.createElement("g",{fill:"none",fillRule:"evenodd"},React__default.default.createElement("g",{fill:"currentColor"},React__default.default.createElement("g",null,React__default.default.createElement("path",{d:"M16.5 15.999V17h-13v-1.001h13zm0-3.999v1h-7v-1h7zm-13-4l3 2.5-3 2.5V8zm13 0v1h-7V8h7zm0-4v1h-13V4h13z",transform:"translate(-537.000000, -81.000000) translate(534.000000, 77.000000)"}))))):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:"increase-indent",d:"M3.973 3l1.89 2 .002.006.098.157.037.191-.037.191-.098.157-.003.005-1.889 2L3.306 7l1.082-1.146H0v-1h4.388L3.306 3.707 3.973 3z"})),React__default.default.createElement("g",{fillRule:"evenodd",transform:"translate(2 4)"},React__default.default.createElement("g",{fillRule:"nonzero"},React__default.default.createElement("path",{d:"M.2 0h10.6c.11 0 .2.09.2.2v.6c0 .11-.09.2-.2.2H.2C.09 1 0 .91 0 .8V.2C0 .09.09 0 .2 0zM5.2 5h5.6c.11 0 .2.09.2.2v.6c0 .11-.09.2-.2.2H5.2c-.11 0-.2-.09-.2-.2v-.6c0-.11.09-.2.2-.2zM.2 10h10.6c.11 0 .2.09.2.2v.6c0 .11-.09.2-.2.2H.2c-.11 0-.2-.09-.2-.2v-.6c0-.11.09-.2.2-.2z",transform:"translate(3)"})),React__default.default.createElement("use",{xlinkHref:"#increase-indent"})))},INDENT_TYPE="wix-rich-content-plugin-indent",IndentButton=function(props){var theme=props.theme,helpers=props.helpers,isMobile=props.isMobile,t=props.t,tabIndex=props.tabIndex,setEditorState=props.setEditorState,getEditorState=props.getEditorState,adjustment=props.adjustment,tooltipKey=props.tooltipKey,dataHook=props.dataHook,icon=props.icon,INCREASE_INDENT=wixRichContentEditorCommon.FORMATTING_BUTTONS.INCREASE_INDENT,DECREASE_INDENT=wixRichContentEditorCommon.FORMATTING_BUTTONS.DECREASE_INDENT;return React__default.default.createElement(wixRichContentEditorCommon.InlineToolbarButton,{onClick:function(){var editorState=getEditorState(),newState=wixRichContentEditorCommon.indentSelectedBlocks(editorState,adjustment);newState!==editorState&&setEditorState(newState)},helpers:helpers,theme:theme,isMobile:isMobile,tooltipText:t(tooltipKey),dataHook:dataHook,formattingButtonName:adjustment>0?INCREASE_INDENT:DECREASE_INDENT,tabIndex:tabIndex,icon:icon,pluginType:INDENT_TYPE})},DecreaseIndentButton=function(props){return React__default.default.createElement(IndentButton,Object.assign({},props,{adjustment:-1,tooltipKey:"decreaseIndentButton_Tooltip",dataHook:"decreaseIndentButton",icon:decreaseIndentPluginIcon}))},IncreaseIndentButton=function(props){return React__default.default.createElement(IndentButton,Object.assign({},props,{adjustment:1,tooltipKey:"increaseIndentButton_Tooltip",dataHook:"increaseIndentButton",icon:increaseIndentPluginIcon}))},createToolbar=function(_ref){var getEditorState=_ref.getEditorState,settings=_ref.settings,setEditorState=_ref.setEditorState,t=_ref.t,experiments=_ref.experiments,onKeyboardShortcutClick=_ref.onKeyboardShortcutClick,getIconByDirection=function(type){var _experiments$newForma,_settings$toolbar,_settings$toolbar$ico,_settings$toolbar2,_settings$toolbar2$ic,_settings$toolbar3,_settings$toolbar3$ic,_settings$toolbar4,_settings$toolbar4$ic,editorState=getEditorState(),content=editorState.getCurrentContent(),key=editorState.getSelection().getStartKey(),selectedBlockKey=content.getBlockForKey(key).getKey(),directionMap=editorState.getDirectionMap(),newFormattingToolbar=null==experiments||null===(_experiments$newForma=experiments.newFormattingToolbar)||void 0===_experiments$newForma?void 0:_experiments$newForma.enabled;return{LTR:{indent:(null==settings||null===(_settings$toolbar=settings.toolbar)||void 0===_settings$toolbar||null===(_settings$toolbar$ico=_settings$toolbar.icons)||void 0===_settings$toolbar$ico?void 0:_settings$toolbar$ico.IncreaseIndent)||function(){return increaseIndentPluginIcon({newFormattingToolbar:newFormattingToolbar})},unindent:(null==settings||null===(_settings$toolbar2=settings.toolbar)||void 0===_settings$toolbar2||null===(_settings$toolbar2$ic=_settings$toolbar2.icons)||void 0===_settings$toolbar2$ic?void 0:_settings$toolbar2$ic.DecreaseIndent)||function(){return decreaseIndentPluginIcon({newFormattingToolbar:newFormattingToolbar})}},RTL:{unindent:(null==settings||null===(_settings$toolbar3=settings.toolbar)||void 0===_settings$toolbar3||null===(_settings$toolbar3$ic=_settings$toolbar3.icons)||void 0===_settings$toolbar3$ic?void 0:_settings$toolbar3$ic.IncreaseIndent)||function(){return increaseIndentPluginIcon({newFormattingToolbar:newFormattingToolbar})},indent:(null==settings||null===(_settings$toolbar4=settings.toolbar)||void 0===_settings$toolbar4||null===(_settings$toolbar4$ic=_settings$toolbar4.icons)||void 0===_settings$toolbar4$ic?void 0:_settings$toolbar4$ic.DecreaseIndent)||function(){return decreaseIndentPluginIcon({newFormattingToolbar:newFormattingToolbar})}}}[directionMap.get(selectedBlockKey)][type]};return{TextButtonMapper:function(){var _ref2;return(_ref2={})[wixRichContentEditorCommon.FORMATTING_BUTTONS.DECREASE_INDENT]={component:DecreaseIndentButton,externalizedButtonProps:{onClick:function(e){e.preventDefault();var indented=wixRichContentEditorCommon.indentSelectedBlocks(getEditorState(),-1);setEditorState(indented)},isActive:function(){return!1},getIcon:function(){return getIconByDirection("unindent")},tooltip:t("decreaseIndentButton_Tooltip"),getLabel:function(){return""},type:wixRichContentEditorCommon.BUTTON_TYPES.BUTTON,isDisabled:function(){return wixRichContentEditorCommon.isAtomicBlockFocused(getEditorState())}},keyBindings:[{keyCommand:{command:wixRichContentEditorCommon.COMMANDS.DECREASE_INDENT,modifiers:[wixRichContentEditorCommon.MODIFIERS.COMMAND,wixRichContentEditorCommon.MODIFIERS.SHIFT],key:"m"},commandHandler:function(editorState){return onKeyboardShortcutClick({buttonName:wixRichContentEditorCommon.COMMANDS.DECREASE_INDENT,pluginId:INDENT_TYPE}),wixRichContentEditorCommon.indentSelectedBlocks(editorState,-1)}}]},_ref2[wixRichContentEditorCommon.FORMATTING_BUTTONS.INCREASE_INDENT]={component:IncreaseIndentButton,externalizedButtonProps:{onClick:function(e){e.preventDefault();var indented=wixRichContentEditorCommon.indentSelectedBlocks(getEditorState(),1);setEditorState(indented)},isActive:function(){return!1},getIcon:function(){return getIconByDirection("indent")},tooltip:t("increaseIndentButton_Tooltip"),getLabel:function(){return""},type:wixRichContentEditorCommon.BUTTON_TYPES.BUTTON,isDisabled:function(){return wixRichContentEditorCommon.isAtomicBlockFocused(getEditorState())}},keyBindings:[{keyCommand:{command:wixRichContentEditorCommon.COMMANDS.INCREASE_INDENT,modifiers:[wixRichContentEditorCommon.MODIFIERS.COMMAND],key:"m"},commandHandler:function(editorState){return onKeyboardShortcutClick({buttonName:wixRichContentEditorCommon.COMMANDS.INCREASE_INDENT,pluginId:INDENT_TYPE}),wixRichContentEditorCommon.indentSelectedBlocks(editorState,1)}}]},_ref2},name:"indent"}},DEFAULTS=Object.freeze({type:INDENT_TYPE,config:{}});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 createIndentPlugin=function(config){var helpers=config.helpers,t=config.t,_config$INDENT_TYPE=config[INDENT_TYPE],settings=void 0===_config$INDENT_TYPE?{}:_config$INDENT_TYPE,isMobile=config.isMobile,rest=_objectWithoutPropertiesLoose__default.default(config,["helpers","t",INDENT_TYPE,"isMobile"].map(_toPropertyKey));return wixRichContentPluginCommons.createBasePlugin(_extends__default.default({type:INDENT_TYPE,toolbar:createToolbar(config),helpers:helpers,settings:settings,t:t,isMobile:isMobile,defaultPluginData:DEFAULTS},rest))};createIndentPlugin.functionName=INDENT_TYPE;exports.INDENT_TYPE=INDENT_TYPE,exports.createIndentPlugin=createIndentPlugin,exports.pluginIndent=function(config){return{config:_extends__default.default({},DEFAULTS.config,config),type:INDENT_TYPE,createPlugin:createIndentPlugin}};
//# 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,SizeSmallLeftIcon,SizeSmallCenterIcon,SizeSmallRightIcon,createBasePlugin}from"wix-rich-content-plugin-commons";import React,{Component,useContext}from"react";import _assertThisInitialized from"@babel/runtime/helpers/assertThisInitialized";import _inheritsLoose from"@babel/runtime/helpers/inheritsLoose";import classNames from"classnames";import{InfoIcon,RadioGroupHorizontal,InputWithLabel,TextInput}from"wix-rich-content-ui-components";import{isValidUrl,startsWithHttps,hasProtocol,mergeStyles,translate,GlobalContext,validate,normalizeUrl}from"wix-rich-content-common";import{identity,trimStart,merge}from"lodash";import{BUTTON_TYPES,INSERT_PLUGIN_BUTTONS,TOOLBARS}from"wix-rich-content-editor-common";import pluginHtmlSchema from"wix-rich-content-common/dist/statics/schemas/plugin-html.schema.json";import{convertNodeDataToDraft}from"ricos-content/libs/toDraftData";var _VALIDATORS,_NORMALIZERS,_TOOLTIP_TEXT_BY_SRC_,EditIcon=function(props){return React.createElement("svg",Object.assign({width:19,viewBox:"0 0 19 19"},props),React.createElement("path",{d:"M11.498 5.326L3 13.8V16h2.2l8.486-8.486-2.188-2.188zm.688-.687l2.199 2.176L16 5.2 13.83 3l-1.644 1.64zM2 13.523a.2.2 0 0 1 .059-.141l11.1-11.1a1 1 0 0 1 1.414 0l2.146 2.145a1 1 0 0 1 0 1.414l-11.1 11.1a.2.2 0 0 1-.142.059H2.2a.2.2 0 0 1-.2-.2v-3.277zM5 4h1.8c.11 0 .2.09.2.2v.6a.2.2 0 0 1-.2.2H5v1.8a.2.2 0 0 1-.2.2h-.6a.2.2 0 0 1-.2-.2V5H2.2a.2.2 0 0 1-.2-.2v-.6c0-.11.09-.2.2-.2H4V2.2c0-.11.09-.2.2-.2h.6c.11 0 .2.09.2.2V4z"}))},InsertPluginIcon=function(props){return React.createElement("svg",Object.assign({viewBox:"0 0 19 19",width:"19",height:"19"},props),React.createElement("path",{d:"M4.889 5L1 8.89l3.889 3.888.707-.708-3.182-3.18 3.182-3.184zm8.818 7.779l3.89-3.89L13.706 5 13 5.708l3.182 3.181L13 12.072z"}),React.createElement("path",{stroke:"currentColor",d:"M11.948 2L7 15.978"}))},Adsense=function(props){return React.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",width:"19",height:"24",viewBox:"0 0 24 24"},props),React.createElement("g",{fillRule:"evenodd"},React.createElement("path",{d:"M17.764 0c.277 0 .5.224.5.5 0 .075-.016.149-.049.216l-2.767 5.767L8.702 20.99 8.7 20.99l-.199.431c-.163.354-.518.58-.907.58H.5c-.276 0-.5-.224-.5-.5 0-.078.018-.154.053-.224l1.593-3.187L7.618 5.283l-.04.028L9.768.58c.163-.354.518-.58.907-.58h7.09zM20.848 11c.276 0 .5.224.5.5 0 .076-.017.15-.05.218l-1.505 3.099-2.814 6.034-.262.57c-.164.353-.518.579-.907.579h-4.687v-.001L9.691 22l1.644-3.469L14.845 11h6.003z",transform:"translate(1 1)"})))},DEFAULTS_CONFIG={alignment:"center"},htmlButtonsTypes={html:"html",adsense:"adsense"},defaults=function(isAdsense){return{srcType:"html",src:"",config:_extends({},DEFAULTS_CONFIG,isAdsense&&{isAdsense:isAdsense})}},styles$2_container="_2rikd",styles$2_tooltip="_2JU9j",AdsenseTitle=function(_ref){var t=_ref.t;return React.createElement("div",{className:styles$2_container},t("HtmlEditPanel_HtmlInput_AdSense_Title"),React.createElement("div",{className:styles$2_tooltip},React.createElement(InfoIcon,{tooltipText:t("HtmlEditPanel_HtmlInput_AdSense_Tooltip")})))},styles$1={fontElementMap:"tBbsp",htmlEditPanel_button:"l7Urd",htmlEditPanel:"_1Whgf",htmlEditPanel_input:"_1vXv2",htmlEditPanel_textArea:"_33T-k",htmlEditPanel_buttons:"_3W4Az",htmlEditPanel_primaryButton:"RVO-5",htmlEditPanel_secondaryButton:"_1zKYg"},VALIDATORS=((_VALIDATORS={}).html=function(){return null},_VALIDATORS.url=function(url){var error=null;return url&&isValidUrl(url)?!startsWithHttps(url)&&hasProtocol(url)&&(error="HtmlEditPanel_HttpsError"):error="HtmlEditPanel_UrlError",error},_VALIDATORS),NORMALIZERS=((_NORMALIZERS={}).html=identity,_NORMALIZERS.url=function(url){return hasProtocol(url)?url:"https://"+trimStart(url,"//")},_NORMALIZERS),HtmlEditPanel=function(_Component){function HtmlEditPanel(){for(var _this$state,_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).initialData=_this.props.componentData,_this.styles=mergeStyles({styles:styles$1,theme:_this.props.theme}),_this.state=((_this$state={srcType:_this.initialData.srcType})[_this.initialData.srcType]=_this.initialData.src,_this$state.submitted=!1,_this$state),_this.handleSrcTypeChange=function(srcType){_this.setState({srcType:srcType})},_this.handleSrcChange=function(target){var _this$setState,name=target.name,value=target.value;_this.setState(((_this$setState={})[name]=value,_this$setState),(function(){return _this.updateComponentData()}))},_this.handleCancelClick=function(){_this.props.store.update("componentData",_this.initialData),_this.props.close()},_this.updateComponentData=function(){var srcType=_this.state.srcType;_this.isValid()&&_this.props.store.update("componentData",{srcType:srcType,src:NORMALIZERS[srcType](_this.state[srcType])||""}),_this.setState({submitted:!0})},_this.getError=function(){var srcType=_this.state.srcType;return VALIDATORS[srcType](_this.state[srcType])},_this.isValid=function(){return!_this.getError()},_this.render=function(){var styles=_assertThisInitialized(_this).styles,_this$state2=_this.state,srcType=_this$state2.srcType,submitted=_this$state2.submitted,_this$props=_this.props,t=_this$props.t,tabIndex=_this$props.tabIndex,theme=_this$props.theme,config=_this$props.componentData.config,inputBaseProps={onChange:_this.handleSrcChange,getTarget:!0,tabIndex:tabIndex,theme:theme};return React.createElement("div",{className:styles.htmlEditPanel},null!=config&&config.isAdsense?React.createElement(AdsenseTitle,{t:t}):React.createElement(RadioGroupHorizontal,{theme:theme,name:"srcType",value:_this.state.srcType,onChange:_this.handleSrcTypeChange,dataSource:[{value:"html",labelText:t("HtmlEditPanel_Code"),dataHook:"htmlEditPanel_radioHtml"},{value:"url",labelText:t("HtmlEditPanel_Source"),dataHook:"htmlEditPanel_radioUrl"}],inline:!0}),React.createElement("div",{className:styles.htmlEditPanel_input},"html"===srcType&&React.createElement("div",{className:styles.htmlEditPanel_textArea},React.createElement(InputWithLabel,_extends({name:"html",value:_this.state.html,placeholder:null!=config&&config.isAdsense?t("HtmlEditPanel_HtmlInput_AdSense_Placeholder"):t("HtmlEditPanel_HtmlInput_Placeholder"),isTextArea:!0,isFullHeight:!0,dataHook:"htmlEditPanel_htmlInput"},inputBaseProps))),"url"===srcType&&React.createElement(TextInput,_extends({name:"url",value:_this.state.url,"data-hook":"htmlEditPanel_htmlInput",error:submitted?t(_this.getError()):null,placeholder:t("HtmlEditPanel_UrlInput_Placeholder")},inputBaseProps))),React.createElement("div",{className:styles.htmlEditPanel_buttons},React.createElement("button",{className:classNames(styles.htmlEditPanel_button,styles.htmlEditPanel_secondaryButton),onClick:_this.handleCancelClick,"data-hook":"htmlEditPanel_Cancel"},t("HtmlEditPanel_Cancel")),React.createElement("button",{className:classNames(styles.htmlEditPanel_button,styles.htmlEditPanel_primaryButton),onClick:_this.props.close,"data-hook":"htmlEditPanel_Update"},t("HtmlEditPanel_Update"))))},_this}return _inheritsLoose(HtmlEditPanel,_Component),HtmlEditPanel}(Component),getAlignmentButtonPropsFn=function(getEditorBounds){return function(_ref){var _componentData$config,componentData=_ref.componentData,editorBounds=null==getEditorBounds?void 0:getEditorBounds(),maxAlignmentWidth=editorBounds?editorBounds.width-1:739;return{disabled:((null==componentData||null===(_componentData$config=componentData.config)||void 0===_componentData$config?void 0:_componentData$config.width)||0)>maxAlignmentWidth}}},TOOLTIP_TEXT_BY_SRC_TYPE=((_TOOLTIP_TEXT_BY_SRC_={}).html="HtmlPlugin_EditHtml_Tooltip",_TOOLTIP_TEXT_BY_SRC_.url="HtmlPlugin_EditUrl_Tooltip",_TOOLTIP_TEXT_BY_SRC_),createInlineButtons=function(_ref2){var _settings$toolbar,_ref2$settings=_ref2.settings,settings=void 0===_ref2$settings?{}:_ref2$settings,getEditorBounds=_ref2.getEditorBounds,maxWidth=settings.maxWidth,_settings$minWidth=settings.minWidth,minWidth=void 0===_settings$minWidth?35:_settings$minWidth,_settings$maxHeight=settings.maxHeight,maxHeight=void 0===_settings$maxHeight?1200:_settings$maxHeight,_settings$minHeight=settings.minHeight,minHeight=void 0===_settings$minHeight?35:_settings$minHeight,icons=(null==settings||null===(_settings$toolbar=settings.toolbar)||void 0===_settings$toolbar?void 0:_settings$toolbar.icons)||{};return[{type:BUTTONS.INLINE_PANEL,keyName:"edit",panelContent:translate()(HtmlEditPanel),icon:icons.edit||EditIcon,mapComponentDataToButtonProps:function(_ref3){var src=_ref3.src,srcType=_ref3.srcType;return{tooltipTextKey:src?TOOLTIP_TEXT_BY_SRC_TYPE[srcType]:"HtmlPlugin_EditEmpty_Tooltip"}}},{type:BUTTONS.SEPARATOR,keyName:"separator1"},{type:BUTTONS.WIDTH,getEditorBounds:getEditorBounds,keyName:"width",min:minWidth,mapStoreDataToPanelProps:function(){var bounds=getEditorBounds();return bounds&&bounds.width?{max:maxWidth?Math.min(maxWidth,bounds.width):bounds.width}:{max:maxWidth||940}}},{type:BUTTONS.HEIGHT,keyName:"height",min:minHeight,max:maxHeight,inputMax:9999},{type:BUTTONS.SEPARATOR,keyName:"separator2"},{type:BUTTONS.TEXT_ALIGN_LEFT,keyName:"alignLeft",icon:icons.alignLeft||SizeSmallLeftIcon,mapStoreDataToButtonProps:getAlignmentButtonPropsFn(getEditorBounds)},{type:BUTTONS.TEXT_ALIGN_CENTER,keyName:"alignCenter",icon:icons.alignCenter||SizeSmallCenterIcon},{type:BUTTONS.TEXT_ALIGN_RIGHT,keyName:"alignRight",icon:icons.alignRight||SizeSmallRightIcon,mapStoreDataToButtonProps:getAlignmentButtonPropsFn(getEditorBounds)},{type:BUTTONS.SEPARATOR,keyName:"separator3"},{type:BUTTONS.DELETE,keyName:"delete",mobile:!0}]},createInsertButtons=function(_ref){var _settings$toolbar,_settings$toolbar$ico,_buttonsMap,helpers=_ref.helpers,t=_ref.t,settings=_ref.settings,_settings$exposeButto=settings.exposeButtons,exposeButtons=void 0===_settings$exposeButto?[htmlButtonsTypes.html]:_settings$exposeButto,siteDomain=settings.siteDomain,icon=(null==settings||null===(_settings$toolbar=settings.toolbar)||void 0===_settings$toolbar||null===(_settings$toolbar$ico=_settings$toolbar.icons)||void 0===_settings$toolbar$ico?void 0:_settings$toolbar$ico.InsertPluginButtonIcon)||InsertPluginIcon,index=exposeButtons.indexOf(htmlButtonsTypes.adsense);!siteDomain&&index>-1&&exposeButtons.splice(index,1);var buttonsMap=((_buttonsMap={})[htmlButtonsTypes.html]={type:BUTTON_TYPES.BUTTON,name:INSERT_PLUGIN_BUTTONS.HTML,helpers:helpers,toolbars:[TOOLBARS.INSERT_PLUGIN,TOOLBARS.MOBILE,TOOLBARS.FOOTER,TOOLBARS.SIDE],tooltip:t("HtmlPlugin_InsertButton_Tooltip"),getIcon:function(){return icon},componentData:defaults(!1)},_buttonsMap[htmlButtonsTypes.adsense]={type:BUTTON_TYPES.BUTTON,name:INSERT_PLUGIN_BUTTONS.ADSENSE,componentData:defaults(!0),helpers:helpers,toolbars:[TOOLBARS.INSERT_PLUGIN,TOOLBARS.MOBILE,TOOLBARS.FOOTER,TOOLBARS.SIDE],section:"BlockToolbar_Section_Embed_Anywhere",tooltip:t("AdSensePlugin_InsertButton_Tooltip"),getIcon:function(){return Adsense}},_buttonsMap);return exposeButtons.map((function(buttonType){return buttonsMap[buttonType]}))},createToolbar=function(_ref){var helpers=_ref.helpers,t=_ref.t,isMobile=_ref.isMobile,settings=_ref.settings,getEditorBounds=_ref.getEditorBounds;return{InlineButtons:createInlineButtons({settings:settings,getEditorBounds:getEditorBounds}),InsertButtons:isMobile?[]:createInsertButtons({helpers:helpers,t:t,settings:settings}),name:"html"}},htmlIframeSrc="\n <head>\n <style type=\"text/css\">\n iframe[class|='instagram'],\n blockquote[class|='instagram'] {\n /* fallback script for ios below */\n min-width: 0 !important;\n width: calc(100vw - 2px);\n }\n\n body {\n margin: 0;\n max-width: calc(100vw);\n display: inline-block;\n float: left;\n width: 100%;\n box-sizing: border-box;\n }\n body > iframe {\n margin: 0 !important;\n width: calc(100vw - 2px) !important;\n }\n body::before,\n body::after {\n content: '.';\n height: 0;\n margin: 0;\n overflow: hidden;\n visibility: hidden;\n display: block;\n clear: both;\n }\n </style>\n <script>\n var isIOS = /iPad|iPhone|iPod/.test(navigator.userAgent) && !window.MSStream;\n (function fixInstagramWidth() {\n // This is a fallback for the styles above. Because inline styles can't be overridden in ios.\n var callback = function() {\n try {\n if (document.body.firstChild.className.indexOf('instagram') >= 0) {\n document.body.firstChild.style.minWidth = '0';\n document.body.firstChild.style.width = 'calc(100vw - 2px)';\n }\n } catch (e) {}\n };\n\n var observer = new MutationObserver(callback);\n\n observer.observe(document, {\n childList: true,\n subtree: true,\n });\n })();\n\n function initSendHeight(id) {\n /**\n * Handle image load by triggering a resize\n */\n function imageLoaded(event) {\n if (!event || event.type !== 'load') {\n return;\n }\n\n var img = event.srcElement;\n // Remove image from loading stack\n var imageIndex = images.indexOf(img);\n if (imageIndex !== -1) {\n images.splice(imageIndex, 1);\n }\n\n handleResize();\n }\n\n /**\n * Add 'load' event listener and store reference to image\n * @param {elm} img Image being loaded\n */\n var images = [];\n function addImage(img) {\n if (images.indexOf(img) === -1) {\n img.addEventListener('load', imageLoaded);\n images.push(img);\n }\n }\n\n /**\n * Filter out images in the DOM that haven't loaded yet and add listener\n */\n function addImageLoadListeners() {\n var imgs = document.querySelectorAll('img');\n for (var i = 0; i < imgs.length; i++) {\n var image = imgs[i];\n // Do nothing if image is already loaded\n if (\n image.nodeName === 'IMG' &&\n image.src &&\n image.complete === false &&\n image.readyState !== 4\n ) {\n addImage(image);\n }\n }\n }\n\n function getHeight() {\n var height = parseInt(document.body.offsetHeight, 10);\n var styles = document.defaultView.getComputedStyle(document.body);\n height += parseInt(styles.getPropertyValue('margin-bottom'), 10);\n height += parseInt(styles.getPropertyValue('margin-top'), 10);\n return height;\n }\n\n function handleResize() {\n multipleDelayedSendHeight();\n }\n\n function handleIframeAdded(iframe) {\n if (isIOS) {\n iframe.onload = function() {\n var src = iframe.src; \n if (src.indexOf('reloadMe') > -1) {\n return;\n }\n iframe.src = src.replace('?', '?reloadMe=1&');\n };\n }\n }\n\n var timerId;\n function multipleDelayedSendHeight() {\n sendHeight();\n clearTimeout(timerId);\n let delay = 100;\n timerId = setTimeout(function request() {\n sendHeight();\n delay *= 2;\n if (delay < 20000) {\n timerId = setTimeout(request, delay);\n }\n }, delay);\n }\n\n function sendHeight() {\n var height = getHeight();\n parent.postMessage({ type: 'htmlPlugin:heightResize', id: id, height: height }, '*');\n }\n\n function setupMutationObserver() {\n var target = document.querySelector('body');\n var observer = new MutationObserver(function(mutations) {\n addImageLoadListeners();\n handleResize();\n mutations.forEach(function(mutation) {\n mutation.addedNodes.forEach(function(el) {\n if (el.nodeName === 'IFRAME') {\n handleIframeAdded(el);\n }\n });\n });\n });\n\n var config = {\n attributes: true,\n childList: true,\n characterData: true,\n subtree: true,\n };\n\n observer.observe(target, config);\n }\n\n window.addEventListener('resize', handleResize); //this handles width change\n setupMutationObserver();\n handleResize();\n }\n\n window.addEventListener('message', function(event) {\n if (event.data.type !== 'htmlPlugin:updateContent') {\n return;\n }\n\n var content = [\n '<!DOCTYPE html>',\n '<html>',\n '<head>' + document.head.innerHTML + '</head>',\n '<body>' + event.data.content + '</body>',\n '</html>',\n ].join('');\n\n document.open('text/html', 'replace');\n document.write(content);\n document.close();\n initSendHeight(event.data.id);\n });\n <\/script>\n </head>\n\n <body></body>\n",styles_iframe="_2xvJT",_excluded=["iframeRef"],Iframe=function(_ref){var _context$experiments$,iframeRef=_ref.iframeRef,otherProps=_objectWithoutPropertiesLoose(_ref,_excluded),loading=null!==(_context$experiments$=useContext(GlobalContext).experiments.lazyImagesAndIframes)&&void 0!==_context$experiments$&&_context$experiments$.enabled?"lazy":void 0;return React.createElement("iframe",Object.assign({ref:iframeRef,className:styles_iframe,title:"remote content",style:{backgroundColor:"transparent"},loading:loading},otherProps))},isSSR="undefined"==typeof window,IframeHtml=function(_Component){function IframeHtml(){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).state={shouldRender:!1},_this.id=Math.random().toString(36).substr(2,9),_this.writeToIframe=function(iframeElement){var _iframeElement$conten;_this.iframe=iframeElement;var iframeDocument=null==iframeElement||null===(_iframeElement$conten=iframeElement.contentWindow)||void 0===_iframeElement$conten?void 0:_iframeElement$conten.document;iframeDocument&&(iframeDocument.open("text/html","replace"),iframeDocument.write(htmlIframeSrc),iframeDocument.close())},_this.updateIframeContent=function(content){var _this$iframe;_this.shouldIgnoreLoad=!0,null===(_this$iframe=_this.iframe)||void 0===_this$iframe||_this$iframe.contentWindow.postMessage({type:"htmlPlugin:updateContent",id:_this.id,content:content},"*")},_this.handleIframeMessage=function(_ref){var data=_ref.data,type=data.type,id=data.id,height=data.height;"htmlPlugin:heightResize"===type&&id===_this.id&&_this.props.onHeightChange(height)},_this.handleIframeLoad=function(){!_this.shouldIgnoreLoad&&_this.updateIframeContent(_this.props.html)},_this.setIframe=function(iframe){_this.iframe=iframe},_this}_inheritsLoose(IframeHtml,_Component);var _proto=IframeHtml.prototype;return _proto.componentDidMount=function(){this.setState({shouldRender:!0}),!isSSR&&window.addEventListener("message",this.handleIframeMessage)},_proto.componentWillUnmount=function(){!isSSR&&window.removeEventListener("message",this.handleIframeMessage)},_proto.componentWillReceiveProps=function(nextProps){this.props.html!==nextProps.html&&this.updateIframeContent(nextProps.html)},_proto.render=function(){var iframeSandboxDomain=this.props.iframeSandboxDomain,iframeProps={style:{backgroundColor:"transparent"},onLoad:this.handleIframeLoad};if(iframeSandboxDomain){var strippedUrl=iframeSandboxDomain.replace(/\/$/,"");iframeProps.src=strippedUrl+"/html/db9376e69cfa487ea0fa0b912ae51a4f_v1.html",iframeProps.iframeRef=this.setIframe}else iframeProps.iframeRef=this.writeToIframe;return this.state.shouldRender?React.createElement(Iframe,iframeProps):null},IframeHtml}(Component),IframeUrl=function(props){return React.createElement(Iframe,Object.assign({},props,{sandbox:"allow-popups allow-presentation allow-forms allow-same-origin allow-scripts"}))},htmlComponentStyles={htmlComponent:"yuWXS",htmlComponent_placeholder:"_3tucQ"},HtmlComponent=function(_Component){function HtmlComponent(){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).state={siteDomain:void 0},_this.setHeight=function(iframeHeight){var _this$props$store;iframeHeight!==_this.state.iframeHeight&&(_this.setState({iframeHeight:iframeHeight}),null===(_this$props$store=_this.props.store)||void 0===_this$props$store||_this$props$store.update("componentData",{config:{height:iframeHeight}}))},_this.getIframeHeight=function(){var _this$props=_this.props,_this$props$settings=_this$props.settings,height=(_this$props$settings=void 0===_this$props$settings?{}:_this$props$settings).height,config=_this$props.componentData.config,iframeHeight=_this.state.iframeHeight,maxDiff=Math.min(50,.1*_this.state.iframeHeight),normalizedHeight=iframeHeight;return config.height&&(normalizedHeight=iframeHeight&&config.height<iframeHeight&&config.height+maxDiff>iframeHeight?iframeHeight:config.height),normalizedHeight||height||550},_this}_inheritsLoose(HtmlComponent,_Component);var _proto=HtmlComponent.prototype;return _proto.componentDidMount=function(){var _this$props2=this.props,config=_this$props2.componentData.config,_this$props2$settings=_this$props2.settings,settings=void 0===_this$props2$settings?{}:_this$props2$settings,width=settings.width,height=settings.height,siteDomain=settings.siteDomain;config.width||(width?config.width=width:this.element?config.width=this.element.getBoundingClientRect().width:config.width=350),config.height||(config.height=height||550),this.setState({siteDomain:siteDomain})},HtmlComponent.getDerivedStateFromProps=function(props,state){var componentData=props.componentData;if("html"===componentData.srcType){var html=componentData&&componentData.src,pageURL=function(siteDomain){if(siteDomain){var res=/http.+com/gm.exec(siteDomain);return res?res[0]:res}}(state.siteDomain);if(pageURL&&html&&html.includes&&html.includes("adsbygoogle")){var updatedAd='<ins class="adsbygoogle"\n\tdata-page-url="'+pageURL+'"';html=html.replace(new RegExp('<ins class="adsbygoogle"',"g"),updatedAd)}return{html:html}}},_proto.render=function(){var _this$context$experim,_this2=this,html=this.state.html,_this$props3=this.props,iframeSandboxDomain=_this$props3.iframeSandboxDomain,theme=_this$props3.theme,componentData=_this$props3.componentData,_this$props3$settings=_this$props3.settings,width=(_this$props3$settings=void 0===_this$props3$settings?{}:_this$props3$settings).width;this.styles=this.styles||mergeStyles({styles:htmlComponentStyles,theme:theme}),validate(componentData,pluginHtmlSchema);var src=componentData.src,srcType=componentData.srcType,_componentData$config=componentData.config,currentWidth=(_componentData$config=void 0===_componentData$config?{}:_componentData$config).width,style={width:this.props.isMobile?"auto":currentWidth||width||350,height:this.getIframeHeight(),maxHeight:this.state.iframeHeight,maxWidth:"100%"};return React.createElement("div",{className:this.styles.htmlComponent,ref:function(_ref){return _this2.element=_ref},style:style,"data-hook":"HtmlComponent"},"html"===srcType&&src&&React.createElement(IframeHtml,{iframeSandboxDomain:iframeSandboxDomain||(null===(_this$context$experim=this.context.experiments.forceIframeSandboxDomain)||void 0===_this$context$experim?void 0:_this$context$experim.enabled)&&"https://www.filesusr.com",key:"html",tabIndex:0,html:html,onHeightChange:this.setHeight}),"url"===srcType&&isValidUrl(src)&&React.createElement(IframeUrl,{key:"url",tabIndex:0,src:normalizeUrl(src)}),!src&&!isValidUrl(src)&&React.createElement("div",{className:this.styles.htmlComponent_placeholder}))},HtmlComponent}(Component);HtmlComponent.contextType=GlobalContext;var HTML_TYPE="wix-draft-plugin-html";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 createHtmlPlugin=function(config){var helpers=config.helpers,isMobile=config.isMobile,t=config.t,_config$HTML_TYPE=config[HTML_TYPE],settings=void 0===_config$HTML_TYPE?{}:_config$HTML_TYPE,getEditorBounds=config.getEditorBounds,rest=_objectWithoutPropertiesLoose(config,["helpers","isMobile","t",HTML_TYPE,"getEditorBounds"].map(_toPropertyKey)),simulateEditClick=function(_ref){var e=_ref.e,pubsub=_ref.pubsub;return setTimeout((function(){return pubsub.set("onClickTrigger",{event:e,key:"edit"})}))};return createBasePlugin(_extends({onOverlayClick:simulateEditClick,component:HtmlComponent,settings:settings,type:HTML_TYPE,toolbar:createToolbar({helpers:helpers,t:t,isMobile:isMobile,settings:settings,getEditorBounds:getEditorBounds}),helpers:helpers,isMobile:isMobile,t:t,getEditorBounds:getEditorBounds,defaultPluginData:defaults(),onComponentMount:simulateEditClick},rest))};createHtmlPlugin.functionName=HTML_TYPE;var createHtmlData=function(pluginData,isRicosSchema){void 0===pluginData&&(pluginData={}),void 0===isRicosSchema&&(isRicosSchema=!1);var htmlData=isRicosSchema?convertNodeDataToDraft("HTML",pluginData):pluginData;return merge({},defaults(),htmlData)},pluginHtml=function(config){return{config:_extends({},DEFAULTS_CONFIG,config),type:HTML_TYPE,createPlugin:createHtmlPlugin,ModalsMap:{},createPluginData:createHtmlData}};export{HTML_TYPE,createHtmlPlugin,htmlButtonsTypes,pluginHtml};
import _extends from"@babel/runtime/helpers/extends";import _objectWithoutPropertiesLoose from"@babel/runtime/helpers/objectWithoutPropertiesLoose";import{FORMATTING_BUTTONS,InlineToolbarButton,indentSelectedBlocks,BUTTON_TYPES,isAtomicBlockFocused,COMMANDS,MODIFIERS}from"wix-rich-content-editor-common";import React from"react";import{createBasePlugin}from"wix-rich-content-plugin-commons";var decreaseIndentPluginIcon=function(props){return props.newFormattingToolbar?React.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",width:"13",height:"13",viewBox:"0 0 13 13"},props),React.createElement("g",{fill:"none",fillRule:"evenodd"},React.createElement("g",{fill:"currentColor"},React.createElement("g",null,React.createElement("path",{d:"M17.001 15.999V17H4v-1.001h13.001zM17 12v1h-7v-1h7zM7 8v5l-3-2.5L7 8zm10 0v1h-7V8h7zm.001-4v1H4V4h13.001z",transform:"translate(-570.000000, -81.000000) translate(566.000000, 77.000000)"}))))):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:"decrease-indent",d:"M3.973 3l1.89 2 .002.006.098.157.037.191-.037.191-.098.157-.003.005-1.889 2L3.306 7l1.082-1.146H0v-1h4.388L3.306 3.707 3.973 3z"})),React.createElement("g",{fillRule:"evenodd",transform:"translate(2 4)"},React.createElement("path",{d:"M3.2 0h10.6c.11 0 .2.09.2.2v.6c0 .11-.09.2-.2.2H3.2C3.09 1 3 .91 3 .8V.2c0-.11.09-.2.2-.2zM8.2 5h5.6c.11 0 .2.09.2.2v.6c0 .11-.09.2-.2.2H8.2c-.11 0-.2-.09-.2-.2v-.6c0-.11.09-.2.2-.2zM3.2 10h10.6c.11 0 .2.09.2.2v.6c0 .11-.09.2-.2.2H3.2c-.11 0-.2-.09-.2-.2v-.6c0-.11.09-.2.2-.2z"}),React.createElement("use",{transform:"rotate(-180 3 5.354)",xlinkHref:"#decrease-indent"})))},increaseIndentPluginIcon=function(props){return props.newFormattingToolbar?React.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",width:"14",height:"13",viewBox:"0 0 14 13"},props),React.createElement("g",{fill:"none",fillRule:"evenodd"},React.createElement("g",{fill:"currentColor"},React.createElement("g",null,React.createElement("path",{d:"M16.5 15.999V17h-13v-1.001h13zm0-3.999v1h-7v-1h7zm-13-4l3 2.5-3 2.5V8zm13 0v1h-7V8h7zm0-4v1h-13V4h13z",transform:"translate(-537.000000, -81.000000) translate(534.000000, 77.000000)"}))))):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:"increase-indent",d:"M3.973 3l1.89 2 .002.006.098.157.037.191-.037.191-.098.157-.003.005-1.889 2L3.306 7l1.082-1.146H0v-1h4.388L3.306 3.707 3.973 3z"})),React.createElement("g",{fillRule:"evenodd",transform:"translate(2 4)"},React.createElement("g",{fillRule:"nonzero"},React.createElement("path",{d:"M.2 0h10.6c.11 0 .2.09.2.2v.6c0 .11-.09.2-.2.2H.2C.09 1 0 .91 0 .8V.2C0 .09.09 0 .2 0zM5.2 5h5.6c.11 0 .2.09.2.2v.6c0 .11-.09.2-.2.2H5.2c-.11 0-.2-.09-.2-.2v-.6c0-.11.09-.2.2-.2zM.2 10h10.6c.11 0 .2.09.2.2v.6c0 .11-.09.2-.2.2H.2c-.11 0-.2-.09-.2-.2v-.6c0-.11.09-.2.2-.2z",transform:"translate(3)"})),React.createElement("use",{xlinkHref:"#increase-indent"})))},INDENT_TYPE="wix-rich-content-plugin-indent",IndentButton=function(props){var theme=props.theme,helpers=props.helpers,isMobile=props.isMobile,t=props.t,tabIndex=props.tabIndex,setEditorState=props.setEditorState,getEditorState=props.getEditorState,adjustment=props.adjustment,tooltipKey=props.tooltipKey,dataHook=props.dataHook,icon=props.icon,INCREASE_INDENT=FORMATTING_BUTTONS.INCREASE_INDENT,DECREASE_INDENT=FORMATTING_BUTTONS.DECREASE_INDENT;return React.createElement(InlineToolbarButton,{onClick:function(){var editorState=getEditorState(),newState=indentSelectedBlocks(editorState,adjustment);newState!==editorState&&setEditorState(newState)},helpers:helpers,theme:theme,isMobile:isMobile,tooltipText:t(tooltipKey),dataHook:dataHook,formattingButtonName:adjustment>0?INCREASE_INDENT:DECREASE_INDENT,tabIndex:tabIndex,icon:icon,pluginType:INDENT_TYPE})},DecreaseIndentButton=function(props){return React.createElement(IndentButton,Object.assign({},props,{adjustment:-1,tooltipKey:"decreaseIndentButton_Tooltip",dataHook:"decreaseIndentButton",icon:decreaseIndentPluginIcon}))},IncreaseIndentButton=function(props){return React.createElement(IndentButton,Object.assign({},props,{adjustment:1,tooltipKey:"increaseIndentButton_Tooltip",dataHook:"increaseIndentButton",icon:increaseIndentPluginIcon}))},createToolbar=function(_ref){var getEditorState=_ref.getEditorState,settings=_ref.settings,setEditorState=_ref.setEditorState,t=_ref.t,experiments=_ref.experiments,onKeyboardShortcutClick=_ref.onKeyboardShortcutClick,getIconByDirection=function(type){var _experiments$newForma,_settings$toolbar,_settings$toolbar$ico,_settings$toolbar2,_settings$toolbar2$ic,_settings$toolbar3,_settings$toolbar3$ic,_settings$toolbar4,_settings$toolbar4$ic,editorState=getEditorState(),content=editorState.getCurrentContent(),key=editorState.getSelection().getStartKey(),selectedBlockKey=content.getBlockForKey(key).getKey(),directionMap=editorState.getDirectionMap(),newFormattingToolbar=null==experiments||null===(_experiments$newForma=experiments.newFormattingToolbar)||void 0===_experiments$newForma?void 0:_experiments$newForma.enabled;return{LTR:{indent:(null==settings||null===(_settings$toolbar=settings.toolbar)||void 0===_settings$toolbar||null===(_settings$toolbar$ico=_settings$toolbar.icons)||void 0===_settings$toolbar$ico?void 0:_settings$toolbar$ico.IncreaseIndent)||function(){return increaseIndentPluginIcon({newFormattingToolbar:newFormattingToolbar})},unindent:(null==settings||null===(_settings$toolbar2=settings.toolbar)||void 0===_settings$toolbar2||null===(_settings$toolbar2$ic=_settings$toolbar2.icons)||void 0===_settings$toolbar2$ic?void 0:_settings$toolbar2$ic.DecreaseIndent)||function(){return decreaseIndentPluginIcon({newFormattingToolbar:newFormattingToolbar})}},RTL:{unindent:(null==settings||null===(_settings$toolbar3=settings.toolbar)||void 0===_settings$toolbar3||null===(_settings$toolbar3$ic=_settings$toolbar3.icons)||void 0===_settings$toolbar3$ic?void 0:_settings$toolbar3$ic.IncreaseIndent)||function(){return increaseIndentPluginIcon({newFormattingToolbar:newFormattingToolbar})},indent:(null==settings||null===(_settings$toolbar4=settings.toolbar)||void 0===_settings$toolbar4||null===(_settings$toolbar4$ic=_settings$toolbar4.icons)||void 0===_settings$toolbar4$ic?void 0:_settings$toolbar4$ic.DecreaseIndent)||function(){return decreaseIndentPluginIcon({newFormattingToolbar:newFormattingToolbar})}}}[directionMap.get(selectedBlockKey)][type]};return{TextButtonMapper:function(){var _ref2;return(_ref2={})[FORMATTING_BUTTONS.DECREASE_INDENT]={component:DecreaseIndentButton,externalizedButtonProps:{onClick:function(e){e.preventDefault();var indented=indentSelectedBlocks(getEditorState(),-1);setEditorState(indented)},isActive:function(){return!1},getIcon:function(){return getIconByDirection("unindent")},tooltip:t("decreaseIndentButton_Tooltip"),getLabel:function(){return""},type:BUTTON_TYPES.BUTTON,isDisabled:function(){return isAtomicBlockFocused(getEditorState())}},keyBindings:[{keyCommand:{command:COMMANDS.DECREASE_INDENT,modifiers:[MODIFIERS.COMMAND,MODIFIERS.SHIFT],key:"m"},commandHandler:function(editorState){return onKeyboardShortcutClick({buttonName:COMMANDS.DECREASE_INDENT,pluginId:INDENT_TYPE}),indentSelectedBlocks(editorState,-1)}}]},_ref2[FORMATTING_BUTTONS.INCREASE_INDENT]={component:IncreaseIndentButton,externalizedButtonProps:{onClick:function(e){e.preventDefault();var indented=indentSelectedBlocks(getEditorState(),1);setEditorState(indented)},isActive:function(){return!1},getIcon:function(){return getIconByDirection("indent")},tooltip:t("increaseIndentButton_Tooltip"),getLabel:function(){return""},type:BUTTON_TYPES.BUTTON,isDisabled:function(){return isAtomicBlockFocused(getEditorState())}},keyBindings:[{keyCommand:{command:COMMANDS.INCREASE_INDENT,modifiers:[MODIFIERS.COMMAND],key:"m"},commandHandler:function(editorState){return onKeyboardShortcutClick({buttonName:COMMANDS.INCREASE_INDENT,pluginId:INDENT_TYPE}),indentSelectedBlocks(editorState,1)}}]},_ref2},name:"indent"}},DEFAULTS=Object.freeze({type:INDENT_TYPE,config:{}});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 createIndentPlugin=function(config){var helpers=config.helpers,t=config.t,_config$INDENT_TYPE=config[INDENT_TYPE],settings=void 0===_config$INDENT_TYPE?{}:_config$INDENT_TYPE,isMobile=config.isMobile,rest=_objectWithoutPropertiesLoose(config,["helpers","t",INDENT_TYPE,"isMobile"].map(_toPropertyKey));return createBasePlugin(_extends({type:INDENT_TYPE,toolbar:createToolbar(config),helpers:helpers,settings:settings,t:t,isMobile:isMobile,defaultPluginData:DEFAULTS},rest))};createIndentPlugin.functionName=INDENT_TYPE;var pluginIndent=function(config){return{config:_extends({},DEFAULTS.config,config),type:INDENT_TYPE,createPlugin:createIndentPlugin}};export{INDENT_TYPE,createIndentPlugin,pluginIndent};
//# sourceMappingURL=module.js.map

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

"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var _extends=require("@babel/runtime/helpers/extends"),_inheritsLoose=require("@babel/runtime/helpers/inheritsLoose"),React=require("react"),wixRichContentCommon=require("wix-rich-content-common"),pluginHtmlSchema=require("wix-rich-content-common/dist/statics/schemas/plugin-html.schema.json"),_objectWithoutPropertiesLoose=require("@babel/runtime/helpers/objectWithoutPropertiesLoose");function _interopDefaultLegacy(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var _extends__default=_interopDefaultLegacy(_extends),_inheritsLoose__default=_interopDefaultLegacy(_inheritsLoose),React__default=_interopDefaultLegacy(React),pluginHtmlSchema__default=_interopDefaultLegacy(pluginHtmlSchema),_objectWithoutPropertiesLoose__default=_interopDefaultLegacy(_objectWithoutPropertiesLoose),DEFAULTS_VIEWER={},htmlIframeSrc="\n <head>\n <style type=\"text/css\">\n iframe[class|='instagram'],\n blockquote[class|='instagram'] {\n /* fallback script for ios below */\n min-width: 0 !important;\n width: calc(100vw - 2px);\n }\n\n body {\n margin: 0;\n max-width: calc(100vw);\n display: inline-block;\n float: left;\n width: 100%;\n box-sizing: border-box;\n }\n body > iframe {\n margin: 0 !important;\n width: calc(100vw - 2px) !important;\n }\n body::before,\n body::after {\n content: '.';\n height: 0;\n margin: 0;\n overflow: hidden;\n visibility: hidden;\n display: block;\n clear: both;\n }\n </style>\n <script>\n var isIOS = /iPad|iPhone|iPod/.test(navigator.userAgent) && !window.MSStream;\n (function fixInstagramWidth() {\n // This is a fallback for the styles above. Because inline styles can't be overridden in ios.\n var callback = function() {\n try {\n if (document.body.firstChild.className.indexOf('instagram') >= 0) {\n document.body.firstChild.style.minWidth = '0';\n document.body.firstChild.style.width = 'calc(100vw - 2px)';\n }\n } catch (e) {}\n };\n\n var observer = new MutationObserver(callback);\n\n observer.observe(document, {\n childList: true,\n subtree: true,\n });\n })();\n\n function initSendHeight(id) {\n /**\n * Handle image load by triggering a resize\n */\n function imageLoaded(event) {\n if (!event || event.type !== 'load') {\n return;\n }\n\n var img = event.srcElement;\n // Remove image from loading stack\n var imageIndex = images.indexOf(img);\n if (imageIndex !== -1) {\n images.splice(imageIndex, 1);\n }\n\n handleResize();\n }\n\n /**\n * Add 'load' event listener and store reference to image\n * @param {elm} img Image being loaded\n */\n var images = [];\n function addImage(img) {\n if (images.indexOf(img) === -1) {\n img.addEventListener('load', imageLoaded);\n images.push(img);\n }\n }\n\n /**\n * Filter out images in the DOM that haven't loaded yet and add listener\n */\n function addImageLoadListeners() {\n var imgs = document.querySelectorAll('img');\n for (var i = 0; i < imgs.length; i++) {\n var image = imgs[i];\n // Do nothing if image is already loaded\n if (\n image.nodeName === 'IMG' &&\n image.src &&\n image.complete === false &&\n image.readyState !== 4\n ) {\n addImage(image);\n }\n }\n }\n\n function getHeight() {\n var height = parseInt(document.body.offsetHeight, 10);\n var styles = document.defaultView.getComputedStyle(document.body);\n height += parseInt(styles.getPropertyValue('margin-bottom'), 10);\n height += parseInt(styles.getPropertyValue('margin-top'), 10);\n return height;\n }\n\n function handleResize() {\n multipleDelayedSendHeight();\n }\n\n function handleIframeAdded(iframe) {\n if (isIOS) {\n iframe.onload = function() {\n var src = iframe.src; \n if (src.indexOf('reloadMe') > -1) {\n return;\n }\n iframe.src = src.replace('?', '?reloadMe=1&');\n };\n }\n }\n\n var timerId;\n function multipleDelayedSendHeight() {\n sendHeight();\n clearTimeout(timerId);\n let delay = 100;\n timerId = setTimeout(function request() {\n sendHeight();\n delay *= 2;\n if (delay < 20000) {\n timerId = setTimeout(request, delay);\n }\n }, delay);\n }\n\n function sendHeight() {\n var height = getHeight();\n parent.postMessage({ type: 'htmlPlugin:heightResize', id: id, height: height }, '*');\n }\n\n function setupMutationObserver() {\n var target = document.querySelector('body');\n var observer = new MutationObserver(function(mutations) {\n addImageLoadListeners();\n handleResize();\n mutations.forEach(function(mutation) {\n mutation.addedNodes.forEach(function(el) {\n if (el.nodeName === 'IFRAME') {\n handleIframeAdded(el);\n }\n });\n });\n });\n\n var config = {\n attributes: true,\n childList: true,\n characterData: true,\n subtree: true,\n };\n\n observer.observe(target, config);\n }\n\n window.addEventListener('resize', handleResize); //this handles width change\n setupMutationObserver();\n handleResize();\n }\n\n window.addEventListener('message', function(event) {\n if (event.data.type !== 'htmlPlugin:updateContent') {\n return;\n }\n\n var content = [\n '<!DOCTYPE html>',\n '<html>',\n '<head>' + document.head.innerHTML + '</head>',\n '<body>' + event.data.content + '</body>',\n '</html>',\n ].join('');\n\n document.open('text/html', 'replace');\n document.write(content);\n document.close();\n initSendHeight(event.data.id);\n });\n <\/script>\n </head>\n\n <body></body>\n",styles_iframe="_2xvJT",_excluded=["iframeRef"],Iframe=function(_ref){var _context$experiments$,iframeRef=_ref.iframeRef,otherProps=_objectWithoutPropertiesLoose__default.default(_ref,_excluded),loading=null!==(_context$experiments$=React.useContext(wixRichContentCommon.GlobalContext).experiments.lazyImagesAndIframes)&&void 0!==_context$experiments$&&_context$experiments$.enabled?"lazy":void 0;return React__default.default.createElement("iframe",Object.assign({ref:iframeRef,className:styles_iframe,title:"remote content",style:{backgroundColor:"transparent"},loading:loading},otherProps))},isSSR="undefined"==typeof window,IframeHtml=function(_Component){function IframeHtml(){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).state={shouldRender:!1},_this.id=Math.random().toString(36).substr(2,9),_this.writeToIframe=function(iframeElement){var _iframeElement$conten;_this.iframe=iframeElement;var iframeDocument=null==iframeElement||null===(_iframeElement$conten=iframeElement.contentWindow)||void 0===_iframeElement$conten?void 0:_iframeElement$conten.document;iframeDocument&&(iframeDocument.open("text/html","replace"),iframeDocument.write(htmlIframeSrc),iframeDocument.close())},_this.updateIframeContent=function(content){var _this$iframe;_this.shouldIgnoreLoad=!0,null===(_this$iframe=_this.iframe)||void 0===_this$iframe||_this$iframe.contentWindow.postMessage({type:"htmlPlugin:updateContent",id:_this.id,content:content},"*")},_this.handleIframeMessage=function(_ref){var data=_ref.data,type=data.type,id=data.id,height=data.height;"htmlPlugin:heightResize"===type&&id===_this.id&&_this.props.onHeightChange(height)},_this.handleIframeLoad=function(){!_this.shouldIgnoreLoad&&_this.updateIframeContent(_this.props.html)},_this.setIframe=function(iframe){_this.iframe=iframe},_this}_inheritsLoose__default.default(IframeHtml,_Component);var _proto=IframeHtml.prototype;return _proto.componentDidMount=function(){this.setState({shouldRender:!0}),!isSSR&&window.addEventListener("message",this.handleIframeMessage)},_proto.componentWillUnmount=function(){!isSSR&&window.removeEventListener("message",this.handleIframeMessage)},_proto.componentWillReceiveProps=function(nextProps){this.props.html!==nextProps.html&&this.updateIframeContent(nextProps.html)},_proto.render=function(){var iframeSandboxDomain=this.props.iframeSandboxDomain,iframeProps={style:{backgroundColor:"transparent"},onLoad:this.handleIframeLoad};if(iframeSandboxDomain){var strippedUrl=iframeSandboxDomain.replace(/\/$/,"");iframeProps.src=strippedUrl+"/html/db9376e69cfa487ea0fa0b912ae51a4f_v1.html",iframeProps.iframeRef=this.setIframe}else iframeProps.iframeRef=this.writeToIframe;return this.state.shouldRender?React__default.default.createElement(Iframe,iframeProps):null},IframeHtml}(React.Component),IframeUrl=function(props){return React__default.default.createElement(Iframe,Object.assign({},props,{sandbox:"allow-popups allow-presentation allow-forms allow-same-origin allow-scripts"}))},htmlComponentStyles={htmlComponent:"yuWXS",htmlComponent_placeholder:"_3tucQ"},HtmlComponent=function(_Component){function HtmlComponent(){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).state={siteDomain:void 0},_this.setHeight=function(iframeHeight){var _this$props$store;iframeHeight!==_this.state.iframeHeight&&(_this.setState({iframeHeight:iframeHeight}),null===(_this$props$store=_this.props.store)||void 0===_this$props$store||_this$props$store.update("componentData",{config:{height:iframeHeight}}))},_this.getIframeHeight=function(){var _this$props=_this.props,_this$props$settings=_this$props.settings,height=(_this$props$settings=void 0===_this$props$settings?{}:_this$props$settings).height,config=_this$props.componentData.config,iframeHeight=_this.state.iframeHeight,maxDiff=Math.min(50,.1*_this.state.iframeHeight),normalizedHeight=iframeHeight;return config.height&&(normalizedHeight=iframeHeight&&config.height<iframeHeight&&config.height+maxDiff>iframeHeight?iframeHeight:config.height),normalizedHeight||height||550},_this}_inheritsLoose__default.default(HtmlComponent,_Component);var _proto=HtmlComponent.prototype;return _proto.componentDidMount=function(){var _this$props2=this.props,config=_this$props2.componentData.config,_this$props2$settings=_this$props2.settings,settings=void 0===_this$props2$settings?{}:_this$props2$settings,width=settings.width,height=settings.height,siteDomain=settings.siteDomain;config.width||(width?config.width=width:this.element?config.width=this.element.getBoundingClientRect().width:config.width=350),config.height||(config.height=height||550),this.setState({siteDomain:siteDomain})},HtmlComponent.getDerivedStateFromProps=function(props,state){var componentData=props.componentData;if("html"===componentData.srcType){var html=componentData&&componentData.src,pageURL=function(siteDomain){if(siteDomain){var res=/http.+com/gm.exec(siteDomain);return res?res[0]:res}}(state.siteDomain);if(pageURL&&html&&html.includes&&html.includes("adsbygoogle")){var updatedAd='<ins class="adsbygoogle"\n\tdata-page-url="'+pageURL+'"';html=html.replace(new RegExp('<ins class="adsbygoogle"',"g"),updatedAd)}return{html:html}}},_proto.render=function(){var _this$context$experim,_this2=this,html=this.state.html,_this$props3=this.props,iframeSandboxDomain=_this$props3.iframeSandboxDomain,theme=_this$props3.theme,componentData=_this$props3.componentData,_this$props3$settings=_this$props3.settings,width=(_this$props3$settings=void 0===_this$props3$settings?{}:_this$props3$settings).width;this.styles=this.styles||wixRichContentCommon.mergeStyles({styles:htmlComponentStyles,theme:theme}),wixRichContentCommon.validate(componentData,pluginHtmlSchema__default.default);var src=componentData.src,srcType=componentData.srcType,_componentData$config=componentData.config,currentWidth=(_componentData$config=void 0===_componentData$config?{}:_componentData$config).width,style={width:this.props.isMobile?"auto":currentWidth||width||350,height:this.getIframeHeight(),maxHeight:this.state.iframeHeight,maxWidth:"100%"};return React__default.default.createElement("div",{className:this.styles.htmlComponent,ref:function(_ref){return _this2.element=_ref},style:style,"data-hook":"HtmlComponent"},"html"===srcType&&src&&React__default.default.createElement(IframeHtml,{iframeSandboxDomain:iframeSandboxDomain||(null===(_this$context$experim=this.context.experiments.forceIframeSandboxDomain)||void 0===_this$context$experim?void 0:_this$context$experim.enabled)&&"https://www.filesusr.com",key:"html",tabIndex:0,html:html,onHeightChange:this.setHeight}),"url"===srcType&&wixRichContentCommon.isValidUrl(src)&&React__default.default.createElement(IframeUrl,{key:"url",tabIndex:0,src:wixRichContentCommon.normalizeUrl(src)}),!src&&!wixRichContentCommon.isValidUrl(src)&&React__default.default.createElement("div",{className:this.styles.htmlComponent_placeholder}))},HtmlComponent}(React.Component);HtmlComponent.contextType=wixRichContentCommon.GlobalContext;var HTML_TYPE="wix-draft-plugin-html",typeMapper=function(){var _ref;return(_ref={})[HTML_TYPE]={component:HtmlComponent},_ref};exports.HTML_TYPE=HTML_TYPE,exports.htmlTypeMapper=typeMapper,exports.pluginHtml=function(config){return{config:_extends__default.default({},DEFAULTS_VIEWER,config),type:HTML_TYPE,typeMapper:typeMapper}};
"use strict";function _interopDefaultLegacy(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}Object.defineProperty(exports,"__esModule",{value:!0});var _extends__default=_interopDefaultLegacy(require("@babel/runtime/helpers/extends")),INDENT_TYPE="wix-rich-content-plugin-indent",DEFAULTS=Object.freeze({type:INDENT_TYPE,config:{}});exports.INDENT_TYPE=INDENT_TYPE,exports.pluginIndent=function(config){return{config:_extends__default.default({},DEFAULTS.config,config),type:INDENT_TYPE}};
//# sourceMappingURL=module.viewer.cjs.js.map

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

import _extends from"@babel/runtime/helpers/extends";import _inheritsLoose from"@babel/runtime/helpers/inheritsLoose";import React,{useContext,Component}from"react";import{GlobalContext,mergeStyles,validate,isValidUrl,normalizeUrl}from"wix-rich-content-common";import pluginHtmlSchema from"wix-rich-content-common/dist/statics/schemas/plugin-html.schema.json";import _objectWithoutPropertiesLoose from"@babel/runtime/helpers/objectWithoutPropertiesLoose";var DEFAULTS_VIEWER={},htmlIframeSrc="\n <head>\n <style type=\"text/css\">\n iframe[class|='instagram'],\n blockquote[class|='instagram'] {\n /* fallback script for ios below */\n min-width: 0 !important;\n width: calc(100vw - 2px);\n }\n\n body {\n margin: 0;\n max-width: calc(100vw);\n display: inline-block;\n float: left;\n width: 100%;\n box-sizing: border-box;\n }\n body > iframe {\n margin: 0 !important;\n width: calc(100vw - 2px) !important;\n }\n body::before,\n body::after {\n content: '.';\n height: 0;\n margin: 0;\n overflow: hidden;\n visibility: hidden;\n display: block;\n clear: both;\n }\n </style>\n <script>\n var isIOS = /iPad|iPhone|iPod/.test(navigator.userAgent) && !window.MSStream;\n (function fixInstagramWidth() {\n // This is a fallback for the styles above. Because inline styles can't be overridden in ios.\n var callback = function() {\n try {\n if (document.body.firstChild.className.indexOf('instagram') >= 0) {\n document.body.firstChild.style.minWidth = '0';\n document.body.firstChild.style.width = 'calc(100vw - 2px)';\n }\n } catch (e) {}\n };\n\n var observer = new MutationObserver(callback);\n\n observer.observe(document, {\n childList: true,\n subtree: true,\n });\n })();\n\n function initSendHeight(id) {\n /**\n * Handle image load by triggering a resize\n */\n function imageLoaded(event) {\n if (!event || event.type !== 'load') {\n return;\n }\n\n var img = event.srcElement;\n // Remove image from loading stack\n var imageIndex = images.indexOf(img);\n if (imageIndex !== -1) {\n images.splice(imageIndex, 1);\n }\n\n handleResize();\n }\n\n /**\n * Add 'load' event listener and store reference to image\n * @param {elm} img Image being loaded\n */\n var images = [];\n function addImage(img) {\n if (images.indexOf(img) === -1) {\n img.addEventListener('load', imageLoaded);\n images.push(img);\n }\n }\n\n /**\n * Filter out images in the DOM that haven't loaded yet and add listener\n */\n function addImageLoadListeners() {\n var imgs = document.querySelectorAll('img');\n for (var i = 0; i < imgs.length; i++) {\n var image = imgs[i];\n // Do nothing if image is already loaded\n if (\n image.nodeName === 'IMG' &&\n image.src &&\n image.complete === false &&\n image.readyState !== 4\n ) {\n addImage(image);\n }\n }\n }\n\n function getHeight() {\n var height = parseInt(document.body.offsetHeight, 10);\n var styles = document.defaultView.getComputedStyle(document.body);\n height += parseInt(styles.getPropertyValue('margin-bottom'), 10);\n height += parseInt(styles.getPropertyValue('margin-top'), 10);\n return height;\n }\n\n function handleResize() {\n multipleDelayedSendHeight();\n }\n\n function handleIframeAdded(iframe) {\n if (isIOS) {\n iframe.onload = function() {\n var src = iframe.src; \n if (src.indexOf('reloadMe') > -1) {\n return;\n }\n iframe.src = src.replace('?', '?reloadMe=1&');\n };\n }\n }\n\n var timerId;\n function multipleDelayedSendHeight() {\n sendHeight();\n clearTimeout(timerId);\n let delay = 100;\n timerId = setTimeout(function request() {\n sendHeight();\n delay *= 2;\n if (delay < 20000) {\n timerId = setTimeout(request, delay);\n }\n }, delay);\n }\n\n function sendHeight() {\n var height = getHeight();\n parent.postMessage({ type: 'htmlPlugin:heightResize', id: id, height: height }, '*');\n }\n\n function setupMutationObserver() {\n var target = document.querySelector('body');\n var observer = new MutationObserver(function(mutations) {\n addImageLoadListeners();\n handleResize();\n mutations.forEach(function(mutation) {\n mutation.addedNodes.forEach(function(el) {\n if (el.nodeName === 'IFRAME') {\n handleIframeAdded(el);\n }\n });\n });\n });\n\n var config = {\n attributes: true,\n childList: true,\n characterData: true,\n subtree: true,\n };\n\n observer.observe(target, config);\n }\n\n window.addEventListener('resize', handleResize); //this handles width change\n setupMutationObserver();\n handleResize();\n }\n\n window.addEventListener('message', function(event) {\n if (event.data.type !== 'htmlPlugin:updateContent') {\n return;\n }\n\n var content = [\n '<!DOCTYPE html>',\n '<html>',\n '<head>' + document.head.innerHTML + '</head>',\n '<body>' + event.data.content + '</body>',\n '</html>',\n ].join('');\n\n document.open('text/html', 'replace');\n document.write(content);\n document.close();\n initSendHeight(event.data.id);\n });\n <\/script>\n </head>\n\n <body></body>\n",styles_iframe="_2xvJT",_excluded=["iframeRef"],Iframe=function(_ref){var _context$experiments$,iframeRef=_ref.iframeRef,otherProps=_objectWithoutPropertiesLoose(_ref,_excluded),loading=null!==(_context$experiments$=useContext(GlobalContext).experiments.lazyImagesAndIframes)&&void 0!==_context$experiments$&&_context$experiments$.enabled?"lazy":void 0;return React.createElement("iframe",Object.assign({ref:iframeRef,className:styles_iframe,title:"remote content",style:{backgroundColor:"transparent"},loading:loading},otherProps))},isSSR="undefined"==typeof window,IframeHtml=function(_Component){function IframeHtml(){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).state={shouldRender:!1},_this.id=Math.random().toString(36).substr(2,9),_this.writeToIframe=function(iframeElement){var _iframeElement$conten;_this.iframe=iframeElement;var iframeDocument=null==iframeElement||null===(_iframeElement$conten=iframeElement.contentWindow)||void 0===_iframeElement$conten?void 0:_iframeElement$conten.document;iframeDocument&&(iframeDocument.open("text/html","replace"),iframeDocument.write(htmlIframeSrc),iframeDocument.close())},_this.updateIframeContent=function(content){var _this$iframe;_this.shouldIgnoreLoad=!0,null===(_this$iframe=_this.iframe)||void 0===_this$iframe||_this$iframe.contentWindow.postMessage({type:"htmlPlugin:updateContent",id:_this.id,content:content},"*")},_this.handleIframeMessage=function(_ref){var data=_ref.data,type=data.type,id=data.id,height=data.height;"htmlPlugin:heightResize"===type&&id===_this.id&&_this.props.onHeightChange(height)},_this.handleIframeLoad=function(){!_this.shouldIgnoreLoad&&_this.updateIframeContent(_this.props.html)},_this.setIframe=function(iframe){_this.iframe=iframe},_this}_inheritsLoose(IframeHtml,_Component);var _proto=IframeHtml.prototype;return _proto.componentDidMount=function(){this.setState({shouldRender:!0}),!isSSR&&window.addEventListener("message",this.handleIframeMessage)},_proto.componentWillUnmount=function(){!isSSR&&window.removeEventListener("message",this.handleIframeMessage)},_proto.componentWillReceiveProps=function(nextProps){this.props.html!==nextProps.html&&this.updateIframeContent(nextProps.html)},_proto.render=function(){var iframeSandboxDomain=this.props.iframeSandboxDomain,iframeProps={style:{backgroundColor:"transparent"},onLoad:this.handleIframeLoad};if(iframeSandboxDomain){var strippedUrl=iframeSandboxDomain.replace(/\/$/,"");iframeProps.src=strippedUrl+"/html/db9376e69cfa487ea0fa0b912ae51a4f_v1.html",iframeProps.iframeRef=this.setIframe}else iframeProps.iframeRef=this.writeToIframe;return this.state.shouldRender?React.createElement(Iframe,iframeProps):null},IframeHtml}(Component),IframeUrl=function(props){return React.createElement(Iframe,Object.assign({},props,{sandbox:"allow-popups allow-presentation allow-forms allow-same-origin allow-scripts"}))},htmlComponentStyles={htmlComponent:"yuWXS",htmlComponent_placeholder:"_3tucQ"},HtmlComponent=function(_Component){function HtmlComponent(){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).state={siteDomain:void 0},_this.setHeight=function(iframeHeight){var _this$props$store;iframeHeight!==_this.state.iframeHeight&&(_this.setState({iframeHeight:iframeHeight}),null===(_this$props$store=_this.props.store)||void 0===_this$props$store||_this$props$store.update("componentData",{config:{height:iframeHeight}}))},_this.getIframeHeight=function(){var _this$props=_this.props,_this$props$settings=_this$props.settings,height=(_this$props$settings=void 0===_this$props$settings?{}:_this$props$settings).height,config=_this$props.componentData.config,iframeHeight=_this.state.iframeHeight,maxDiff=Math.min(50,.1*_this.state.iframeHeight),normalizedHeight=iframeHeight;return config.height&&(normalizedHeight=iframeHeight&&config.height<iframeHeight&&config.height+maxDiff>iframeHeight?iframeHeight:config.height),normalizedHeight||height||550},_this}_inheritsLoose(HtmlComponent,_Component);var _proto=HtmlComponent.prototype;return _proto.componentDidMount=function(){var _this$props2=this.props,config=_this$props2.componentData.config,_this$props2$settings=_this$props2.settings,settings=void 0===_this$props2$settings?{}:_this$props2$settings,width=settings.width,height=settings.height,siteDomain=settings.siteDomain;config.width||(width?config.width=width:this.element?config.width=this.element.getBoundingClientRect().width:config.width=350),config.height||(config.height=height||550),this.setState({siteDomain:siteDomain})},HtmlComponent.getDerivedStateFromProps=function(props,state){var componentData=props.componentData;if("html"===componentData.srcType){var html=componentData&&componentData.src,pageURL=function(siteDomain){if(siteDomain){var res=/http.+com/gm.exec(siteDomain);return res?res[0]:res}}(state.siteDomain);if(pageURL&&html&&html.includes&&html.includes("adsbygoogle")){var updatedAd='<ins class="adsbygoogle"\n\tdata-page-url="'+pageURL+'"';html=html.replace(new RegExp('<ins class="adsbygoogle"',"g"),updatedAd)}return{html:html}}},_proto.render=function(){var _this$context$experim,_this2=this,html=this.state.html,_this$props3=this.props,iframeSandboxDomain=_this$props3.iframeSandboxDomain,theme=_this$props3.theme,componentData=_this$props3.componentData,_this$props3$settings=_this$props3.settings,width=(_this$props3$settings=void 0===_this$props3$settings?{}:_this$props3$settings).width;this.styles=this.styles||mergeStyles({styles:htmlComponentStyles,theme:theme}),validate(componentData,pluginHtmlSchema);var src=componentData.src,srcType=componentData.srcType,_componentData$config=componentData.config,currentWidth=(_componentData$config=void 0===_componentData$config?{}:_componentData$config).width,style={width:this.props.isMobile?"auto":currentWidth||width||350,height:this.getIframeHeight(),maxHeight:this.state.iframeHeight,maxWidth:"100%"};return React.createElement("div",{className:this.styles.htmlComponent,ref:function(_ref){return _this2.element=_ref},style:style,"data-hook":"HtmlComponent"},"html"===srcType&&src&&React.createElement(IframeHtml,{iframeSandboxDomain:iframeSandboxDomain||(null===(_this$context$experim=this.context.experiments.forceIframeSandboxDomain)||void 0===_this$context$experim?void 0:_this$context$experim.enabled)&&"https://www.filesusr.com",key:"html",tabIndex:0,html:html,onHeightChange:this.setHeight}),"url"===srcType&&isValidUrl(src)&&React.createElement(IframeUrl,{key:"url",tabIndex:0,src:normalizeUrl(src)}),!src&&!isValidUrl(src)&&React.createElement("div",{className:this.styles.htmlComponent_placeholder}))},HtmlComponent}(Component);HtmlComponent.contextType=GlobalContext;var HTML_TYPE="wix-draft-plugin-html",typeMapper=function(){var _ref;return(_ref={})[HTML_TYPE]={component:HtmlComponent},_ref},pluginHtml=function(config){return{config:_extends({},DEFAULTS_VIEWER,config),type:HTML_TYPE,typeMapper:typeMapper}};export{HTML_TYPE,typeMapper as htmlTypeMapper,pluginHtml};
import _extends from"@babel/runtime/helpers/extends";var INDENT_TYPE="wix-rich-content-plugin-indent",DEFAULTS=Object.freeze({type:INDENT_TYPE,config:{}}),pluginIndent=function(config){return{config:_extends({},DEFAULTS.config,config),type:INDENT_TYPE}};export{INDENT_TYPE,pluginIndent};
//# sourceMappingURL=module.viewer.js.map

@@ -1,43 +0,5 @@

export declare const SRC_TYPE_HTML = "html";
export declare const SRC_TYPE_URL = "url";
export declare const MAX_ALIGNMENT_WIDTH = 739;
export declare const MIN_WIDTH = 35;
export declare const INIT_WIDTH = 350;
export declare const MAX_WIDTH = 940;
export declare const MIN_HEIGHT = 35;
export declare const INIT_HEIGHT = 550;
export declare const MAX_HEIGHT = 1200;
export declare const MAX_HEIGHT_INPUT = 9999;
export declare const DEFAULTS_CONFIG: {
alignment: string;
};
export declare const htmlButtonsTypes: {
html: string;
adsense: string;
};
export declare const adsenseDefaults: () => {
srcType: string;
src: string;
config: {
alignment: string;
} | {
alignment: string;
} | {
isAdsense: true;
alignment: string;
};
};
export declare const defaults: (isAdsense?: boolean | undefined) => {
srcType: string;
src: string;
config: {
alignment: string;
} | {
alignment: string;
} | {
isAdsense: true;
alignment: string;
};
};
export declare const DEFAULTS_VIEWER: {};
export declare const DEFAULTS: Readonly<{
type: string;
config: {};
}>;
//# sourceMappingURL=defaults.d.ts.map

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

import { HtmlPluginEditorConfig } from './types';
import { IndentPluginEditorConfig } from './types';
import { EditorPluginCreator } from 'wix-rich-content-common';
export declare const pluginHtml: EditorPluginCreator<HtmlPluginEditorConfig>;
export declare const pluginIndent: EditorPluginCreator<IndentPluginEditorConfig>;
//# sourceMappingURL=editor.d.ts.map

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

export { createHtmlPlugin } from './createHtmlPlugin';
export { HTML_TYPE } from './types';
export { pluginHtml } from './editor';
export { htmlButtonsTypes } from './defaults';
export { createIndentPlugin } from './createIndentPlugin';
export { INDENT_TYPE } from './types';
export { pluginIndent } from './editor';
//# sourceMappingURL=index.d.ts.map
import { EditorPluginConfig, ViewerPluginConfig } from 'wix-rich-content-common';
export declare const HTML_TYPE = "wix-draft-plugin-html";
export interface HtmlPluginEditorConfig extends EditorPluginConfig {
export declare const INDENT_TYPE = "wix-rich-content-plugin-indent";
export interface IndentPluginEditorConfig extends EditorPluginConfig {
[key: string]: any;
}
export interface HtmlPluginViewerConfig extends ViewerPluginConfig {
export interface IndentPluginViewerConfig extends ViewerPluginConfig {
[key: string]: any;
}
//# sourceMappingURL=types.d.ts.map

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

import { typeMapper } from './typeMapper';
import { HTML_TYPE, HtmlPluginViewerConfig } from './types';
import { INDENT_TYPE, IndentPluginViewerConfig } from './types';
import { ViewerPluginCreator } from 'wix-rich-content-common';
export { typeMapper as htmlTypeMapper, HTML_TYPE };
export declare const pluginHtml: ViewerPluginCreator<HtmlPluginViewerConfig>;
export { INDENT_TYPE };
export declare const pluginIndent: ViewerPluginCreator<IndentPluginViewerConfig>;
//# sourceMappingURL=viewer.d.ts.map

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

{"name":"richlagetest","version":"0.0.0-79e90eb34d73fa9c9d6e3b1db7b9e456d68b6f0f"}
{"name":"richlagetest","version":"0.0.0-7a2950045a340c7970c0c90c372a4d06bd563d80"}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc