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-c3497ae916083b3348946dca8135c80bbe4d3833 to 0.0.0-c80ebe0f334c651e467a7f8a85a31b62795915b5

dist/src/createLineSpacingPlugin.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"),wixRichContentEditorCommon=require("wix-rich-content-editor-common"),React=require("react"),_inheritsLoose=require("@babel/runtime/helpers/inheritsLoose"),wixRichContentCommon=require("wix-rich-content-common"),wixRichContentUiComponents=require("wix-rich-content-ui-components"),InfiniteScroll=require("react-infinite-scroller"),MDSpinner=require("react-md-spinner"),reactCustomScrollbars=require("react-custom-scrollbars"),lodash=require("lodash"),pluginGiphySchema=require("wix-rich-content-common/dist/statics/schemas/plugin-giphy.schema.json"),toDraftData=require("ricos-content/libs/toDraftData"),ricosContent=require("ricos-content");function _interopDefaultLegacy(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var _extends__default=_interopDefaultLegacy(_extends),_objectWithoutPropertiesLoose__default=_interopDefaultLegacy(_objectWithoutPropertiesLoose),React__default=_interopDefaultLegacy(React),_inheritsLoose__default=_interopDefaultLegacy(_inheritsLoose),InfiniteScroll__default=_interopDefaultLegacy(InfiniteScroll),MDSpinner__default=_interopDefaultLegacy(MDSpinner),pluginGiphySchema__default=_interopDefaultLegacy(pluginGiphySchema),InsertPluginIcon=function(props){return React__default.default.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",width:19,height:13,viewBox:"0 0 19 13"},props),React__default.default.createElement("g",{fill:"none",fillRule:"evenodd",stroke:"currentColor"},React__default.default.createElement("path",{d:"M10 1v11.2M14.51 12.227V1.405h4.502M14.154 5.407h3.85M6 3.089a2.08 2.08 0 0 0-2.041-1.684h-.875a2.59 2.59 0 0 0-2.59 2.59v5.068a2.753 2.753 0 0 0 2.753 2.753h.346A2.407 2.407 0 0 0 6 9.409V8a1 1 0 0 0-1-1H2.804"})))},MediaReplaceIcon=function(props){return React__default.default.createElement("svg",Object.assign({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:"giphy-replace-path",d:"M3 7.8V3.2c0-.11.09-.2.2-.2h.6c.11 0 .2.09.2.2v2.592A6.607 6.607 0 0 1 9.412 3C13.05 3 16 5.91 16 9.5c0 .168-.006.335-.02.5h-1.016a5.51 5.51 0 0 0 .022-.5c0-3.038-2.495-5.5-5.574-5.5a5.583 5.583 0 0 0-4.967 3H7.8c.11 0 .2.09.2.2v.6a.2.2 0 0 1-.2.2H3.2a.2.2 0 0 1-.2-.2zm13 3.4v4.6a.2.2 0 0 1-.2.2h-.6a.2.2 0 0 1-.2-.2v-2.592A6.607 6.607 0 0 1 9.588 16C5.95 16 3 13.09 3 9.5c0-.168.006-.335.02-.5h1.016a5.496 5.496 0 0 0-.022.5c0 3.038 2.495 5.5 5.574 5.5a5.583 5.583 0 0 0 4.967-3H11.2a.2.2 0 0 1-.2-.2v-.6c0-.11.09-.2.2-.2h4.6c.11 0 .2.09.2.2z"})),React__default.default.createElement("g",{fillRule:"evenodd"},React__default.default.createElement("mask",{id:"giphy-replace-mask"},React__default.default.createElement("use",{xlinkHref:"#giphy-replace-path"})),React__default.default.createElement("use",{fillRule:"nonzero",xlinkHref:"#giphy-replace-path"})))},CloseIcon=function(props){return React__default.default.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24"},props),React__default.default.createElement("path",{fillRule:"evenodd",d:"M17.077 6l.923.923L12.923 12 18 17.077l-.923.923L12 12.923 6.923 18 6 17.077 11.076 12 6 6.923 6.923 6 12 11.077 17.077 6z"}))},PoweredByGiphy=function(props){return React__default.default.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink",width:79,height:9,viewBox:"0 0 53 6"},props),React__default.default.createElement("defs",null,React__default.default.createElement("path",{id:"giphy-a",d:"M.203.01h5.254V6H.203z"}),React__default.default.createElement("path",{id:"giphy-c",d:"M0 5.99h52.224V0H0z"})),React__default.default.createElement("g",{fill:"none",fillRule:"evenodd",opacity:".3"},React__default.default.createElement("g",{fill:"currentColor"},React__default.default.createElement("path",{d:"M.418 3.536h.793c.691 0 .688-1.14 0-1.14H.418v1.14zm0 .42v.875H0V1.98c.4 0 .811-.004 1.211-.004 1.248 0 1.252 1.97 0 1.979H.418z"}),React__default.default.createElement("path",{d:"M3.76 4.472c.651 0 .924-.5.924-1.046 0-.525-.277-1.07-.916-1.082-.605 0-.93.46-.93 1.082.007.505.276 1.046.923 1.046m1.338-1.054c0 .77-.43 1.474-1.338 1.474-.909 0-1.338-.72-1.338-1.47 0-.867.556-1.494 1.345-1.494.894.005 1.331.72 1.331 1.49M8.21 4.835h-.37l-.348-1.006-.287-.956-.288.96-.344 1.002h-.367l-.95-2.854h.468l.666 2.194.676-2.194h.27l.69 2.194.651-2.194h.467zM11.474 4.83H9.541V1.982h1.922v.444H9.96v.77h1.443v.422H9.96v.766h1.514zM12.432 2.397V3.43h.796c.348 0 .5-.24.5-.508 0-.257-.152-.525-.496-.525h-.8zM14.27 4.83h-.49l-.796-.985h-.553v.985h-.419V1.977c.407 0 .811.004 1.219.004.605 0 .923.452.923.933 0 .406-.195.806-.71.887l.78.948.046.082zM16.642 4.83h-1.933V1.982h1.922v.444h-1.504v.77h1.443v.422h-1.443v.766h1.515zM17.595 4.39h.576c.64 0 .908-.512.897-1.013-.011-.48-.28-.96-.897-.96h-.576V4.39zm.576-2.409c.893 0 1.3.696 1.312 1.4.015.721-.396 1.45-1.312 1.45h-.99V1.98h.99zM21.33 4.407h.786c.231 0 .553-.081.553-.395 0-.305-.31-.443-.55-.443h-.789v.838zm0-1.245h.79c.313 0 .47-.135.47-.358 0-.2-.16-.411-.474-.411h-.786v.769zm.786-1.18c.497 0 .889.248.889.813 0 .24-.116.456-.363.566.315.102.445.44.445.656 0 .622-.456.814-.971.814h-1.2V1.98h1.2zM24.404 3.24l.744-1.259h.504v.021l-1.039 1.66v1.169h-.418V3.662l-1.01-1.66v-.02h.497z"})),React__default.default.createElement("g",null,React__default.default.createElement("g",{transform:"translate(26.66)"},React__default.default.createElement("mask",{id:"giphy-b",fill:"#fff"},React__default.default.createElement("use",{xlinkHref:"#giphy-a"})),React__default.default.createElement("path",{fill:"currentColor",d:"M4.38 1.85a1.728 1.728 0 0 0-1.23-.494c-.877 0-1.447.551-1.447 1.661 0 .73.362 1.63 1.447 1.63.284 0 .73-.057 1.038-.292v-.73H2.827V2.37h2.63v2.52C5.12 5.612 4.181 6 3.142 6 1.011 6 .203 4.5.203 3.017S1.126.011 3.15.011c.746 0 1.407.162 2.115.915l-.885.924z"})),React__default.default.createElement("mask",{id:"giphy-d",fill:"#fff"},React__default.default.createElement("use",{xlinkHref:"#giphy-c"})),React__default.default.createElement("path",{fill:"currentColor",d:"M32.981 5.846h1.516V.173H32.98zM37.113 2.96h1.092c.423 0 .639-.323.639-.696 0-.373-.224-.714-.639-.714h-1.092v1.41zm0 1.354v1.532H35.59V.173h2.615c1.446 0 2.162.956 2.162 2.066 0 1.16-.724 2.059-2.162 2.075h-1.092zM44.507 5.854V3.706h-1.939v2.148h-1.523V.181h1.523v2.156h1.939V.18h1.507v5.673zM49.347 2.118L50.51.173h1.715v.073l-2.138 3.339v2.261h-1.523V3.585L46.516.237V.173h1.716z"}))))},styles$2={giphy_api_input_modal_container:"_1H5Sv",giphy_api_input_modal_navbar:"AWRFT",giphy_api_input_modal_closeButton:"_1MqKv"},DEFAULTS=Object.freeze({config:{size:"content",alignment:"center"},configViewer:{sizes:{desktop:"original",mobile:"original"}}}),DEFAULT_RESOLUTION=Object.freeze({desktop:"original",mobile:"original"}),MOBILE_FULL_SCREEN_CUSTOM_STYLE=Object.freeze({overlay:{backgroundColor:"transparent"},content:{top:0,left:0,overflow:"hidden",paddingRight:"6px"}}),commonDesktopModalStyles={width:"320px",boxSizing:"border-box",height:"364px",overflow:"visible",paddingRight:"12px",paddingLeft:"12px",display:"block",position:"absolute",zIndex:6,paddingTop:"12px"},DESKTOP_FLY_OUT_MODAL_STYLES=Object.freeze({overlay:{backgroundColor:"rgba(0, 0, 0, 0)",zIndex:5},content:_extends__default.default({},commonDesktopModalStyles,{border:"solid 1px rgba(51, 51, 51, 0.1)",boxShadow:"0 0 10px 0 rgba(0, 0, 0, 0.06)"})}),EXTERNAL_POPUP_STYLES=Object.freeze({content:commonDesktopModalStyles}),styles$1={fontElementMap:"_2F-EW",giphy_selecter_container:"_1FHxh",giphy_selecter_infinite_scroll_container:"_2JQ7f",giphy_selecter_infinite_scroll:"_2gKZe",giphy_selecter_customize_scrollbar_container:"MHsyA",giphy_selecter_headerInfiniteScroll:"_39rDb",giphy_selecter_scrollbarThumb:"_2R9xz",giphy_selecter_powerdByGiphy:"JsDyy",giphy_selecter_gif_img_container:"_1HSqB",giphy_selecter_gif_img:"_327u_",giphy_selecter_spinner_more:"_1EDWs",giphy_selecter_spinner_empty_modal:"c-iaq",giphy_selecter_error_msg:"_3jFM4",giphy_empty_state:"zhAYz"},GiphyEmptyState=function(_ref){var t=_ref.t;return React__default.default.createElement("div",{className:styles$1.giphy_empty_state},React__default.default.createElement("div",null,t("GiphyPlugin_Search_EmptyState_Title")),React__default.default.createElement("div",null,t("GiphyPlugin_Search_EmptyState_Text")))},GiphySelector=function(_Component){function GiphySelector(props){var _this;(_this=_Component.call(this,props)||this).getGifs=function(searchTag,page){searchTag?_this.giphySdkCore.search("gifs",{q:searchTag,offset:25*page,limit:25}).then((function(response){page>1?_this.setState({gifs:_this.state.gifs.concat(response.data),hasMoreItems:!0,page:_this.state.page+1,didFail:!1}):_this.setState({gifs:response.data,hasMoreItems:!0,page:_this.state.page+1,didFail:!1})})).catch((function(){_this.setState({didFail:!0,hasMoreItems:!1})})):_this.giphySdkCore.trending("gifs",{limit:100}).then((function(response){searchTag||_this.setState({gifs:response.data,hasMoreItems:!1,didFail:!1})})).catch((function(){_this.setState({didFail:!0,hasMoreItems:!1})}))},_this.getMoreGifs=function(){var searchTag=_this.props.searchTag;_this.getGifs(searchTag,_this.state.page)},_this.getBoundOnClick=function(giphy){var componentData=_this.convertGiphyToComponentData(giphy);return function(){return _this.selectGif(componentData)}},_this.getBoundKeyDown=function(giphy){var componentData=_this.convertGiphyToComponentData(giphy);return function(e){var onCloseRequested=_this.props.onCloseRequested;"Escape"===e.key&&(null==onCloseRequested||onCloseRequested()),"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),_this.selectGif(componentData))}};var componentData=_this.props.componentData;_this.state={url:componentData.src||"",isLoaded:!1,hasMoreItems:!0,gifs:[],page:0,didFail:!1},_this.styles=wixRichContentCommon.mergeStyles({styles:styles$1,theme:_this.props.theme});var gphApiClient=require("giphy-js-sdk-core");return _this.giphySdkCore=gphApiClient(_this.props.giphySdkApiKey),_this}_inheritsLoose__default.default(GiphySelector,_Component);var _proto=GiphySelector.prototype;return _proto.selectGif=function(gif){var _this$props=this.props,componentData=_this$props.componentData,pubsub=_this$props.pubsub,onConfirm=_this$props.onConfirm,onCloseRequested=_this$props.onCloseRequested;onConfirm?onConfirm(_extends__default.default({},componentData,{gif:gif})):pubsub.update("componentData",{gif:gif}),onCloseRequested()},_proto.convertGiphyToComponentData=function(giphy){var _giphy$images$downsiz,_giphy$images$downsiz2,_giphy$images$downsiz3;return{originalUrl:giphy.images.original.url,originalMp4:giphy.images.original.mp4,stillUrl:giphy.images.original_still.url,downsizedUrl:(null===(_giphy$images$downsiz=giphy.images.downsized)||void 0===_giphy$images$downsiz?void 0:_giphy$images$downsiz.url)||giphy.images.original.url,downsizedStillUrl:(null===(_giphy$images$downsiz2=giphy.images.downsized_still)||void 0===_giphy$images$downsiz2?void 0:_giphy$images$downsiz2.url)||giphy.images.original.url,downsizedSmallMp4:(null===(_giphy$images$downsiz3=giphy.images.downsized_small)||void 0===_giphy$images$downsiz3?void 0:_giphy$images$downsiz3.mp4)||giphy.images.original.mp4,height:parseInt(giphy.images.original.height,10),width:parseInt(giphy.images.original.width,10)}},_proto.componentWillReceiveProps=function(nextProps){var _this2=this;null!==this.timer&&clearTimeout(this.timer),this.timer=setTimeout((function(){return _this2.getGifs(nextProps.searchTag)}),300)},_proto.componentDidMount=function(){this.timer=null},_proto.render=function(){var _this3=this,styles=this.styles,_this$props2=this.props,t=_this$props2.t,searchTag=_this$props2.searchTag,_this$state=this.state,gifs=_this$state.gifs,hasMoreItems=_this$state.hasMoreItems,didFail=_this$state.didFail,loader=React__default.default.createElement("div",{className:styles["giphy_selecter_spinner_"+(gifs.length?"more":"empty_modal")]},React__default.default.createElement(MDSpinner__default.default,{borderSize:1.5,singleColor:"#000000"}));return React__default.default.createElement("div",null,React__default.default.createElement("div",{className:styles.giphy_selecter_infinite_scroll_container},!gifs.length&&searchTag?React__default.default.createElement(GiphyEmptyState,{t:t}):React__default.default.createElement(reactCustomScrollbars.Scrollbars,{renderThumbVertical:function(){return React__default.default.createElement("div",{className:styles.giphy_selecter_scrollbarThumb})},className:styles.giphy_selecter_customize_scrollbar_container},React__default.default.createElement(InfiniteScroll__default.default,{pageStart:0,loadMore:this.getMoreGifs.bind(this),hasMore:hasMoreItems,loader:this.state.didFail?null:loader,useWindow:!1,className:styles.giphy_selecter_infinite_scroll},gifs.map((function(giphy,i){return React__default.default.createElement("div",{key:i,role:"button",tabIndex:0,className:styles.giphy_selecter_gif_img_container,onKeyDown:_this3.getBoundKeyDown(giphy),onClick:_this3.getBoundOnClick(giphy)},React__default.default.createElement("img",{className:styles.giphy_selecter_gif_img,src:giphy.images.fixed_width_downsampled.url,alt:giphy.title||"gif"}))}))))),React__default.default.createElement("div",{className:styles.giphy_selecter_container},React__default.default.createElement(PoweredByGiphy,{className:styles.giphy_selecter_powerdByGiphy})),didFail&&!gifs.length?React__default.default.createElement("div",{className:styles.giphy_selecter_error_msg}," ",t("GiphyPlugin_ApiErrorMsg")):null)},GiphySelector}(React.Component),GIPHY_TYPE="wix-draft-plugin-giphy",GiphyApiInputModal=function(_Component){function GiphyApiInputModal(props){var _this;return(_this=_Component.call(this,props)||this).triggerBi=lodash.debounce((function(){var _this$props=_this.props,helpers=_this$props.helpers,toolbarName=_this$props.toolbarName;helpers.onPluginAction("searchInsideThePlugin",{searchTerm:_this.state.searchTag,plugin_id:GIPHY_TYPE,entry_point:toolbarName})}),200),_this.onChange=function(searchTag){_this.setState({searchTag:searchTag}),_this.triggerBi()},_this.onCloseRequested=function(){_this.setState({isOpen:!1}),_this.props.helpers.closeModal()},_this.handleClearText=function(){_this.setState({searchTag:""})},_this.styles=wixRichContentCommon.mergeStyles({styles:styles$2,theme:props.theme}),_this.state={searchTag:""},_this}return _inheritsLoose__default.default(GiphyApiInputModal,_Component),GiphyApiInputModal.prototype.render=function(){var _this2=this,styles=this.styles,_this$props2=this.props,t=_this$props2.t,isMobile=_this$props2.isMobile,languageDir=_this$props2.languageDir,searchTag=this.state.searchTag,mobileNavbar=React__default.default.createElement("div",null,React__default.default.createElement("div",{className:styles.giphy_api_input_modal_navbar},t("GiphyUploadModal_mobileNavbar_Title"),React__default.default.createElement("div",{onClick:this.onCloseRequested,role:"button",tabIndex:"0",onKeyPress:null,className:styles.giphy_api_input_modal_closeButton},React__default.default.createElement(CloseIcon,null))));return React__default.default.createElement("div",{dir:languageDir},isMobile?React__default.default.createElement("div",null,mobileNavbar):null,React__default.default.createElement("div",{className:styles.giphy_api_input_modal_container,"data-hook":"giphyUploadModal"},React__default.default.createElement(wixRichContentUiComponents.TextSearchInput,{inputRef:function(ref){return _this2.input=ref},onClose:this.onCloseRequested,placeHolder:t("GiphyUploadModal_Search_Placeholder"),onChange:this.onChange,value:this.state.searchTag,"data-hook":"giphyUploadModalInput"}),React__default.default.createElement(GiphySelector,_extends__default.default({searchTag:searchTag,onCloseRequested:this.onCloseRequested},this.props))))},GiphyApiInputModal}(React.Component),createInlineButtons=function(_ref){var _settings$toolbar,_settings$toolbar$ico,t=_ref.t,settings=_ref.settings,isMobile=_ref.isMobile,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.replace)||MediaReplaceIcon,modalStyles=isMobile?wixRichContentEditorCommon.getModalStyles({customStyles:MOBILE_FULL_SCREEN_CUSTOM_STYLE,fullScreen:!0,isMobile:isMobile}):void 0;return[{keyName:"sizeOriginal",type:wixRichContentPluginCommons.BUTTONS.SIZE_ORIGINAL,mobile:!1},{keyName:"sizeSmallCenter",type:wixRichContentPluginCommons.BUTTONS.SIZE_SMALL_CENTER,mobile:!1},{keyName:"sizeContent",type:wixRichContentPluginCommons.BUTTONS.SIZE_CONTENT,mobile:!1},{keyName:"sizeFullWidth",type:wixRichContentPluginCommons.BUTTONS.SIZE_FULL_WIDTH,mobile:!1},{keyName:"separator1",type:wixRichContentPluginCommons.BUTTONS.SEPARATOR,mobile:!1},{keyName:"sizeSmallLeft",type:wixRichContentPluginCommons.BUTTONS.SIZE_SMALL_LEFT,mobile:!1},{keyName:"sizeSimallRight",type:wixRichContentPluginCommons.BUTTONS.SIZE_SMALL_RIGHT,mobile:!1},{keyName:"separator2",type:wixRichContentPluginCommons.BUTTONS.SEPARATOR,mobile:!1},{keyName:"replace",type:wixRichContentPluginCommons.BUTTONS.EXTERNAL_MODAL,icon:icon,modalElement:wixRichContentEditorCommon.decorateComponentWithProps(GiphyApiInputModal,settings),modalStyles:modalStyles,modalStylesFn:function(_ref2){var buttonRef=_ref2.buttonRef,modalStyles=wixRichContentEditorCommon.getModalStyles({customStyles:DESKTOP_FLY_OUT_MODAL_STYLES,fullScreen:!0,isMobile:isMobile}),_buttonRef$getBoundin=buttonRef.getBoundingClientRect(),top=_buttonRef$getBoundin.top,modalLeft=_buttonRef$getBoundin.left-15,modalTop=top>357?top-365:top+30;return _extends__default.default({},modalStyles,{content:_extends__default.default({},modalStyles.content,{top:modalTop,left:modalLeft,margin:0,position:"absolute"})})},mobile:!0,tooltipTextKey:"ReplaceGiphyButton_Tooltip",t:t},{keyName:"delete",type:wixRichContentPluginCommons.BUTTONS.DELETE,mobile:!0}]},createInsertButtons=function(_ref){var _settings$toolbar,_settings$toolbar$ico,_modalStylesByToolbar,t=_ref.t,settings=_ref.settings,isMobile=_ref.isMobile,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,modalStylesByToolbar=((_modalStylesByToolbar={})[wixRichContentEditorCommon.TOOLBARS.FOOTER]=isMobile?wixRichContentEditorCommon.getModalStyles({customStyles:MOBILE_FULL_SCREEN_CUSTOM_STYLE,fullScreen:!0,isMobile:isMobile}):void 0,_modalStylesByToolbar[wixRichContentEditorCommon.TOOLBARS.INSERT_PLUGIN]=isMobile?wixRichContentEditorCommon.getModalStyles({customStyles:MOBILE_FULL_SCREEN_CUSTOM_STYLE,fullScreen:!0,isMobile:isMobile}):wixRichContentEditorCommon.getModalStyles({customStyles:EXTERNAL_POPUP_STYLES,fullScreen:!1,isMobile:isMobile}),_modalStylesByToolbar),buttonProps={type:wixRichContentEditorCommon.BUTTON_TYPES.MODAL,name:wixRichContentEditorCommon.INSERT_PLUGIN_BUTTONS.GIF,tooltip:t("GiphyPlugin_InsertButton_Tooltip"),getIcon:function(){return icon},componentData:settings.componentDataDefaults||DEFAULTS,modalElement:wixRichContentEditorCommon.decorateComponentWithProps(GiphyApiInputModal,settings)};return[_extends__default.default({},buttonProps,{toolbars:settings.insertToolbars||[wixRichContentEditorCommon.TOOLBARS.FOOTER,wixRichContentEditorCommon.TOOLBARS.SIDE,wixRichContentEditorCommon.TOOLBARS.MOBILE],modalStyles:modalStylesByToolbar[wixRichContentEditorCommon.TOOLBARS.FOOTER],modalStylesFn:function(_ref2){var buttonRef=_ref2.buttonRef,toolbarName=_ref2.toolbarName;return wixRichContentEditorCommon.getBottomToolbarModalStyles(buttonRef,{customStyles:DESKTOP_FLY_OUT_MODAL_STYLES,isMobile:isMobile},toolbarName)}}),_extends__default.default({},buttonProps,{toolbars:[wixRichContentEditorCommon.TOOLBARS.INSERT_PLUGIN],modalStyles:modalStylesByToolbar[wixRichContentEditorCommon.TOOLBARS.INSERT_PLUGIN]})]},createToolbar=function(_ref){var t=_ref.t,settings=_ref.settings,isMobile=_ref.isMobile;return{InlineButtons:createInlineButtons({t:t,settings:settings,isMobile:isMobile}),InsertButtons:createInsertButtons({t:t,settings:settings,isMobile:isMobile}),name:"giphy"}},styles={giphy_player:"_1JieR"},GiphyViewer=function(_Component){function GiphyViewer(props){var _this;return(_this=_Component.call(this,props)||this).getSourceUrl=function(){var _this$props=_this.props,gif=_this$props.componentData.gif,isMobile=_this$props.isMobile,_this$props$settings=_this$props.settings,settings=void 0===_this$props$settings?{}:_this$props$settings;if(!gif)return null;var _DEFAULT_RESOLUTION$s=_extends__default.default({},DEFAULT_RESOLUTION,settings),mobile=_DEFAULT_RESOLUTION$s.mobile,desktop=_DEFAULT_RESOLUTION$s.desktop,size=isMobile?mobile:desktop,originalMp4=gif.originalMp4,originalUrl=gif.originalUrl;return{original:originalMp4,downsizedSmall:gif.downsizedSmallMp4}[size]||originalUrl},wixRichContentCommon.validate(props.componentData,pluginGiphySchema__default.default),_this}_inheritsLoose__default.default(GiphyViewer,_Component);var _proto=GiphyViewer.prototype;return _proto.componentWillReceiveProps=function(nextProps){lodash.isEqual(nextProps.componentData,this.props.componentData)||wixRichContentCommon.validate(nextProps.componentData,pluginGiphySchema__default.default)},_proto.render=function(){this.styles=this.styles||wixRichContentCommon.mergeStyles({styles:styles,theme:this.props.theme});var _this$props2=this.props,componentData=_this$props2.componentData,setComponentUrl=_this$props2.setComponentUrl,gifUrl=this.getSourceUrl();return gifUrl?(null==setComponentUrl||setComponentUrl(gifUrl),gifUrl.endsWith(".mp4")?React__default.default.createElement("video",{role:"img",autoPlay:!0,muted:!0,loop:!0,playsInline:!0,"aria-label":"gif",className:this.styles.giphy_player,src:gifUrl}):React__default.default.createElement("img",{role:"img","aria-label":"gif",className:this.styles.giphy_player,src:componentData.gif.originalUrl,alt:"gif"})):null},GiphyViewer}(React.Component);GiphyViewer.defaultProps={width:"100%",height:"100%",controls:!0};var GiphyComponent=function(_Component){function GiphyComponent(props){var _this;return(_this=_Component.call(this,props)||this).handleReady=function(){_this.state.isLoaded||_this.setState({isLoaded:!0})},_this.renderPlayer=function(){var _this$props=_this.props,componentData=_this$props.componentData,theme=_this$props.theme,settings=_this$props.settings,isMobile=_this$props.isMobile,setComponentUrl=_this$props.setComponentUrl;return React__default.default.createElement(GiphyViewer,{ref:_this.setPlayer,componentData:componentData,theme:theme,settings:settings,isMobile:isMobile,setComponentUrl:setComponentUrl})},_this.onKeyDown=function(e,handler){"Enter"!==e.key&&" "!==e.key||handler()},_this.state={isLoading:!1,isLoaded:!1},_this}return _inheritsLoose__default.default(GiphyComponent,_Component),GiphyComponent.prototype.render=function(){var _this2=this,onClick=this.props.onClick;return React__default.default.createElement("div",{"data-hook":"giphyPlayer",onClick:onClick,onKeyDown:function(e){return _this2.onKeyDown(e,onClick)}},this.renderPlayer())},GiphyComponent}(React.Component);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)}GiphyComponent.type={GIPHY_TYPE:GIPHY_TYPE};var _ModalsMap,createGiphyPlugin=function(config){var type=GIPHY_TYPE,helpers=config.helpers,t=config.t,_config$type=config[type],settings=void 0===_config$type?{}:_config$type,isMobile=config.isMobile,rest=_objectWithoutPropertiesLoose__default.default(config,["helpers","t",type,"isMobile"].map(_toPropertyKey));return wixRichContentPluginCommons.createBasePlugin(_extends__default.default({component:GiphyComponent,type:GIPHY_TYPE,toolbar:createToolbar({helpers:helpers,t:t,settings:settings,isMobile:isMobile}),helpers:helpers,settings:settings,t:t,isMobile:isMobile,defaultPluginData:DEFAULTS},rest))};createGiphyPlugin.functionName=GIPHY_TYPE;var Modals={GIPHY_API_INPUT:"giphy-api-input"},ModalsMap=((_ModalsMap={})[Modals.GIPHY_API_INPUT]=GiphyApiInputModal,_ModalsMap),createGiphyData=function(pluginData,isRicosSchema){void 0===pluginData&&(pluginData={}),void 0===isRicosSchema&&(isRicosSchema=!1);var giphyData=isRicosSchema?toDraftData.convertNodeDataToDraft("GIF",pluginData):pluginData;return lodash.merge({},DEFAULTS,giphyData)},Gif=function(_ref){var context=_ref.context,componentData=_ref.componentData,isMobile=context.isMobile,theme=context.theme,_context$config=context.config,settings=(void 0===_context$config?{}:_context$config)[GIPHY_TYPE]||{};return React__default.default.createElement(GiphyComponent,{componentData:componentData,isMobile:isMobile,theme:theme,settings:settings,onClick:function(){},setComponentUrl:function(){return null}})},gifDataDefaults={height:0,width:0,containerData:{alignment:"CENTER",width:{size:null,custom:null},spoiler:{enabled:null,description:null,buttonText:null},height:{custom:null},textWrap:null},original:null,downsized:null},name=ricosContent.TIPTAP_GIF_TYPE;exports.GIPHY_TYPE=GIPHY_TYPE,exports.GiphyViewer=GiphyViewer,exports.Modals=Modals,exports.ModalsMap=ModalsMap,exports.createGiphyPlugin=createGiphyPlugin,exports.pluginGiphy=function(config){var defaultOptions,pluginConfig=_extends__default.default({},DEFAULTS.config,config);return{config:pluginConfig,type:GIPHY_TYPE,createPlugin:createGiphyPlugin,ModalsMap:ModalsMap,createPluginData:createGiphyData,tiptapExtensions:(defaultOptions=pluginConfig,[{type:"node",Component:Gif,componentDataDefaults:_extends__default.default({},gifDataDefaults,{id:""}),createExtensionConfig:function(){return{name:name,defaultOptions:defaultOptions,addCommands:function(){return{}}}}}])}};
"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"),lodash=require("lodash"),_inheritsLoose=require("@babel/runtime/helpers/inheritsLoose"),wixRichContentCommon=require("wix-rich-content-common"),wixRichContentEditorCommon=require("wix-rich-content-editor-common"),Modal=require("react-modal"),classNames=require("classnames");function _interopDefaultLegacy(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var _extends__default=_interopDefaultLegacy(_extends),_objectWithoutPropertiesLoose__default=_interopDefaultLegacy(_objectWithoutPropertiesLoose),React__default=_interopDefaultLegacy(React),_inheritsLoose__default=_interopDefaultLegacy(_inheritsLoose),Modal__default=_interopDefaultLegacy(Modal),classNames__default=_interopDefaultLegacy(classNames),LineSpacingIcon=function(props){return props.newFormattingToolbar?React__default.default.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",width:"17",height:"15",viewBox:"0 0 17 15"},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:"M4.5 3L7 6H5v9h2l-2.5 3L2 15h2V6H2l2.5-3zM18 16v1H9v-1h9zm0-4v1H9v-1h9zm0-4v1H9V8h9zm0-4v1H9V4h9z",transform:"translate(-605.000000, -80.000000) translate(603.500000, 77.000000)"}))))):React__default.default.createElement("svg",Object.assign({width:19,height:19,viewBox:"0 0 19 19"},props),React__default.default.createElement("path",{d:"M9.2 7h7.6c.11 0 .2.09.2.2v.6a.2.2 0 0 1-.2.2H9.2a.2.2 0 0 1-.2-.2v-.6c0-.11.09-.2.2-.2zm0 3h7.6c.11 0 .2.09.2.2v.6a.2.2 0 0 1-.2.2H9.2a.2.2 0 0 1-.2-.2v-.6c0-.11.09-.2.2-.2zm0 3h7.6c.11 0 .2.09.2.2v.6a.2.2 0 0 1-.2.2H9.2a.2.2 0 0 1-.2-.2v-.6c0-.11.09-.2.2-.2zm0-9h7.6c.11 0 .2.09.2.2v.6a.2.2 0 0 1-.2.2H9.2a.2.2 0 0 1-.2-.2v-.6c0-.11.09-.2.2-.2z"}),React__default.default.createElement("path",{d:"M5.854 4.707L7 5.853l.707-.707-2-2-.005-.003-.157-.104L5.354 3l-.191.039-.157.104L5 3.146l-2 2s.708.706.707.707l1.147-1.146v8.586l-1.146-1.146-.707.707 2 2 .162.108.189.038.193-.039.162-.107 2-2L7 12.147l-1.146 1.146V4.707z"}))},styles={lineHeightsPanel:"_22Yra",lineHeightsPanel_selectedLineHeight:"W4aQP",lineSpacingMobilePanel_selectedLineHeight:"BMbAI",lineSpacingMobilePanel:"_1ZEpf",lineSpacingMobilePanel_heights:"_1ZRz9",lineSpacingMobilePanel_buttons:"ak4LK",customSpacingPanel:"_2Jf9a",customSpacingPanel_mobile:"_1K2CE",customSpacingPanel_labeledInput:"_2l5vW",lineSpacing_separator:"_1ziH-",customSpacingPanel_buttons:"_2kls2",lineSpacingContainer:"_11bfQ",lineSpacingContainer_mobile:"_3nZp1",lineSpacingModal:"_3PNI9",lineSpacingModal_mobile:"_19sHr",lineSpacingModalOverlay:"_3O-Bu",lineSpacingPopup_button:"lRuWu",lineSpacingPopup:"_3a7Rh"},LineHeightsPanel=function(_ref){var selectedHeight=_ref.selectedHeight,onSave=_ref.onSave,showCustomPanel=_ref.showCustomPanel,styles=_ref.styles,t=_ref.t;return React__default.default.createElement("div",{className:styles.lineHeightsPanel},[1,1.5,2,2.5,3].map((function(height){return function(height,isSelected,_onClick){return React__default.default.createElement("button",{className:isSelected?styles.lineHeightsPanel_selectedLineHeight:"",key:height,onClick:function(){return _onClick(""+height)}},height)}(height,parseFloat(selectedHeight)===height,onSave)})),React__default.default.createElement("button",{onClick:showCustomPanel},t("LineSpacing_customSpacing")))},MobilePanel=function(_ref2){var selectedHeight=_ref2.selectedHeight,styles=_ref2.styles,t=_ref2.t,onChange=_ref2.onChange,onSave=_ref2.onSave,onCancel=_ref2.onCancel;return React__default.default.createElement("div",{className:styles.lineSpacingMobilePanel},React__default.default.createElement("div",null,t("LineSpacing_lineSpacing")),React__default.default.createElement("div",{className:styles.lineSpacingMobilePanel_heights},[1,1.5,2,2.5,3].map((function(height){return function(height,isSelected,_onClick2){return React__default.default.createElement("button",{className:isSelected?styles.lineSpacingMobilePanel_selectedLineHeight:"",key:height,onClick:function(){return _onClick2(""+height)}},height)}(height,parseFloat(selectedHeight)===height,onChange)}))),React__default.default.createElement(Separator,null),React__default.default.createElement("div",{className:styles.lineSpacingMobilePanel_buttons},React__default.default.createElement("button",{onClick:onCancel},t("LineSpacing_cancel")),React__default.default.createElement("button",{onClick:function(){return onSave()}},t("LineSpacing_save"))))},LabeledInput=function(_ref3){var label=_ref3.label,name=_ref3.name,_ref3$unit=_ref3.unit,unit=void 0===_ref3$unit?"":_ref3$unit,_ref3$defaultValue=_ref3.defaultValue,defaultValue=void 0===_ref3$defaultValue?0:_ref3$defaultValue,spacing=_ref3.spacing,_onChange2=_ref3.onChange,min=_ref3.min,max=_ref3.max,value=void 0===spacing[name]?defaultValue:parseFloat(spacing[name]);return React__default.default.createElement("label",{className:styles.customSpacingPanel_labeledInput},React__default.default.createElement("span",null,label),React__default.default.createElement("input",{type:"number",min:min,max:max,value:value,onChange:function(e){var _onChange;return _onChange2(((_onChange={})[name]=Number(e.target.value)+unit,_onChange))}}))},Separator=function(){return React__default.default.createElement("div",{className:styles.lineSpacing_separator})},CustomPanel=function(_ref4){var spacing=_ref4.spacing,onChange=_ref4.onChange,onSave=_ref4.onSave,onCancel=_ref4.onCancel,styles=_ref4.styles,t=_ref4.t;return React__default.default.createElement("div",{className:styles.customSpacingPanel},React__default.default.createElement(LabeledInput,{label:t("LineSpacing_lineSpacing"),name:"line-height",defaultValue:1.5,onChange:onChange,spacing:spacing,min:1,max:100}),React__default.default.createElement(Separator,null),React__default.default.createElement(LabeledInput,{label:t("LineSpacing_beforeParagraph"),name:"padding-top",unit:"px",onChange:onChange,spacing:spacing,min:0,max:250}),React__default.default.createElement(LabeledInput,{label:t("LineSpacing_afterParagraph"),name:"padding-bottom",unit:"px",onChange:onChange,spacing:spacing,min:0,max:250}),React__default.default.createElement("div",{className:styles.customSpacingPanel_buttons},React__default.default.createElement("button",{onClick:onCancel},t("LineSpacing_cancel")),React__default.default.createElement("button",{onClick:function(){return onSave()}},t("LineSpacing_save"))))},Panel=function(_Component){function Panel(props){var _this;return(_this=_Component.call(this,props)||this).showCustomPanel=function(){_this.setState({isCustomPanel:!0})},_this.onBlur=function(e){var target=e.target,relatedTarget=e.relatedTarget;e.currentTarget.contains(relatedTarget)||setTimeout((function(){return target.focus()}))},_this.onChange=function(spacing){var merged=_extends__default.default({},_this.state.spacing,spacing);_this.setState({spacing:merged}),_this.props.onChange(merged)},_this.onSave=function(spacing){_this.props.onSave(_extends__default.default({},_this.state.spacing,spacing))},_this.state={spacing:props.spacing},_this.styles=wixRichContentCommon.mergeStyles({styles:styles,theme:props.theme}),_this}return _inheritsLoose__default.default(Panel,_Component),Panel.prototype.render=function(){var _classNames,_this$props=this.props,onCancel=_this$props.onCancel,t=_this$props.t,isMobile=_this$props.isMobile,_this$state=this.state,isCustomPanel=_this$state.isCustomPanel,spacing=_this$state.spacing,styles=this.styles,showCustomPanel=this.showCustomPanel,onChange=this.onChange,onSave=this.onSave,selectedHeight=spacing["line-height"],panel=isMobile?React__default.default.createElement(MobilePanel,{styles:styles,selectedHeight:selectedHeight,t:t,onChange:function(height){return onChange({"line-height":height})},onSave:onSave,onCancel:onCancel}):isCustomPanel?React__default.default.createElement(CustomPanel,{spacing:spacing,onChange:onChange,onSave:onSave,onCancel:onCancel,styles:styles,t:t,isMobile:isMobile}):React__default.default.createElement(LineHeightsPanel,{styles:styles,selectedHeight:selectedHeight,showCustomPanel:showCustomPanel,t:t,onSave:function(height){return onSave({"line-height":height})}});return React__default.default.createElement("div",{onBlur:this.onBlur,className:classNames__default.default(styles.lineSpacingContainer,(_classNames={},_classNames[styles.lineSpacingContainer_mobile]=isMobile,_classNames))},panel)},Panel}(React.Component);Panel.defaultProps={spacing:{}};var LineSpacingButton=function(_Component){function LineSpacingButton(props){var _this;return(_this=_Component.call(this,props)||this).onOpenPanel=function(){_this.currentEditorState=_this.oldEditorState=_this.props.getEditorState(),_this.selection=_this.oldEditorState.getSelection();var spacing=LineSpacingButton.getBlockSpacing(_this.oldEditorState);_this.oldSpacing=spacing,_this.setState({isPanelOpen:!0,spacing:spacing})},_this.openPanel=function(){_this.onOpenPanel();var _this$buttonRef$getBo=_this.buttonRef.getBoundingClientRect(),bottom=_this$buttonRef$getBo.bottom,left=_this$buttonRef$getBo.left;_this.props.setKeepOpen(!0),_this.setState({panelLeft:left,panelTop:bottom})},_this.closePanel=function(){_this.setState({isPanelOpen:!1}),_this.props.setKeepOpen(!1)},_this.updateSpacing=function(spacing){var _helpers$onToolbarBut,dynamicStyles=spacing,_this$props=_this.props,setEditorState=_this$props.setEditorState,onUpdate=_this$props.onUpdate,helpers=_this$props.helpers,newEditorState=wixRichContentEditorCommon.mergeBlockData(_this.oldEditorState,{dynamicStyles:dynamicStyles});setEditorState(newEditorState),null==helpers||null===(_helpers$onToolbarBut=helpers.onToolbarButtonClick)||void 0===_helpers$onToolbarBut||_helpers$onToolbarBut.call(helpers,{buttonName:wixRichContentEditorCommon.FORMATTING_BUTTONS.LINE_SPACING,pluginId:"line-spacing",value:null==spacing?void 0:spacing["line-height"]}),_this.currentEditorState=newEditorState,onUpdate(dynamicStyles)},_this.save=function(spacing){_this.closePanel(),spacing?_this.updateSpacing(spacing):_this.setEditorState(_this.currentEditorState)},_this.cancel=function(){var onUpdate=_this.props.onUpdate;_this.setEditorState(_this.oldEditorState),onUpdate(_this.oldSpacing),_this.closePanel()},_this.setEditorState=function(editorState){return _this.props.setEditorState(_this.fixSelection(editorState,_this.selection))},_this.fixSelection=wixRichContentEditorCommon.EditorState.forceSelection,_this.state={showPanel:!1},_this.styles=wixRichContentCommon.mergeStyles({styles:styles,theme:props.theme}),_this.dataHookName="LineSpacingButton",_this}return _inheritsLoose__default.default(LineSpacingButton,_Component),LineSpacingButton.getBlockSpacing=function(editorState){var _getAnchorBlockData$d=wixRichContentEditorCommon.getAnchorBlockData(editorState).dynamicStyles,dynamicStyles=void 0===_getAnchorBlockData$d?{}:_getAnchorBlockData$d;return lodash.pick(dynamicStyles,["line-height","padding-top","padding-bottom"])},LineSpacingButton.getModalParent=function(){return document.querySelector(".DraftEditor-root").parentNode},LineSpacingButton.prototype.render=function(){var _toolbar$icons,_classNames,_classNames2,_this2=this,_this$props2=this.props,theme=_this$props2.theme,helpers=_this$props2.helpers,isMobile=_this$props2.isMobile,t=_this$props2.t,tabIndex=_this$props2.tabIndex,defaultSpacing=_this$props2.defaultSpacing,toolbar=_this$props2.toolbar,toolbarName=_this$props2.toolbarName,inlinePopups=_this$props2.inlinePopups,_this$state=this.state,isPanelOpen=_this$state.isPanelOpen,spacing=_this$state.spacing,panelTop=_this$state.panelTop,panelLeft=_this$state.panelLeft,styles=this.styles,icon=(null==toolbar||null===(_toolbar$icons=toolbar.icons)||void 0===_toolbar$icons?void 0:_toolbar$icons.InsertPluginButtonIcon)||LineSpacingIcon,modalStyle=isMobile?{left:0,bottom:0,right:0}:{top:panelTop,left:panelLeft};return isMobile||"StaticTextToolbar"!==toolbarName||!inlinePopups?React__default.default.createElement(wixRichContentEditorCommon.InlineToolbarButton,{onClick:this.openPanel,isActive:!!isPanelOpen,helpers:helpers,theme:theme,isMobile:isMobile,tooltipText:t("LineSpacingButton_Tooltip"),dataHook:this.dataHookName,formattingButtonName:wixRichContentEditorCommon.FORMATTING_BUTTONS.LINE_SPACING,tabIndex:tabIndex,icon:icon,pluginType:"line-spacing",ref:function(_ref){return _this2.buttonRef=_ref}},React__default.default.createElement(Modal__default.default,{isOpen:isPanelOpen,onRequestClose:function(){return _this2.save()},className:classNames__default.default(styles.lineSpacingModal,(_classNames={},_classNames[styles.lineSpacingModal_mobile]=isMobile,_classNames)),overlayClassName:classNames__default.default(styles.lineSpacingModalOverlay,(_classNames2={},_classNames2[styles.lineSpacingModalOverlay_mobile]=isMobile,_classNames2)),parentSelector:LineSpacingButton.getModalParent,style:{content:modalStyle},ariaHideApp:!1},React__default.default.createElement(Panel,{spacing:_extends__default.default({},defaultSpacing,spacing),onChange:this.updateSpacing,onSave:this.save,onCancel:this.cancel,styles:this.styles,t:t,isMobile:isMobile,theme:theme}))):React__default.default.createElement("div",{className:styles.lineSpacingPopup_button},React__default.default.createElement(wixRichContentEditorCommon.InlineToolbarButton,{onClick:this.openPanel,isActive:!!isPanelOpen,helpers:helpers,theme:theme,isMobile:isMobile,tooltipText:t("LineSpacingButton_Tooltip"),dataHook:this.dataHookName,formattingButtonName:wixRichContentEditorCommon.FORMATTING_BUTTONS.LINE_SPACING,tabIndex:tabIndex,icon:icon,pluginType:"line-spacing",ref:function(_ref2){return _this2.buttonRef=_ref2}},isPanelOpen&&React__default.default.createElement("div",{className:styles.lineSpacingPopup},React__default.default.createElement(wixRichContentEditorCommon.ClickOutside,{onClickOutside:function(){return _this2.save()}},React__default.default.createElement(Panel,{spacing:_extends__default.default({},defaultSpacing,spacing),onChange:this.updateSpacing,onSave:this.save,onCancel:this.cancel,styles:this.styles,t:t,isMobile:isMobile,theme:theme})))))},LineSpacingButton}(React.Component);LineSpacingButton.defaultProps={inlinePopups:!1,setKeepOpen:function(){},onUpdate:function(){}};var createToolbar=function(config){var oldEditorState,spacing,getEditorState=config.getEditorState,setEditorState=config.setEditorState,helpers=config.helpers,isMobile=config.isMobile,theme=config.theme,updateSpacing=function(spacing){var dynamicStyles=spacing,newEditorState=wixRichContentEditorCommon.mergeBlockData(oldEditorState||getEditorState(),{dynamicStyles:dynamicStyles});setEditorState(newEditorState)},LineSpacingPanel=function(_ref){var editorState,_getAnchorBlockData$d,dynamicStyles,closeCustomModal=_ref.closeCustomModal,onSelect=_ref.onSelect;return oldEditorState=getEditorState(),editorState=oldEditorState,_getAnchorBlockData$d=wixRichContentEditorCommon.getAnchorBlockData(editorState).dynamicStyles,dynamicStyles=void 0===_getAnchorBlockData$d?{}:_getAnchorBlockData$d,spacing=lodash.pick(dynamicStyles,["line-height","padding-top","padding-bottom"]),React__default.default.createElement(Panel,Object.assign({onChange:function(args){updateSpacing(args),onSelect&&onSelect(args)},onSave:function(args){!function(spacing){var _helpers$closeModal;null==helpers||null===(_helpers$closeModal=helpers.closeModal)||void 0===_helpers$closeModal||_helpers$closeModal.call(helpers),spacing?updateSpacing(spacing):setEditorState(oldEditorState)}(args),onSelect&&onSelect(args),closeCustomModal&&closeCustomModal()},onCancel:function(){var _helpers$closeModal2;null==helpers||null===(_helpers$closeModal2=helpers.closeModal)||void 0===_helpers$closeModal2||_helpers$closeModal2.call(helpers),setEditorState(oldEditorState),closeCustomModal&&closeCustomModal()},spacing:spacing},config))},modalStylesFn=function(ref){var _ref$getBoundingClien=ref.getBoundingClientRect(),bottom=_ref$getBoundingClien.bottom,left=_ref$getBoundingClien.left;return isMobile?{content:{position:"absolute",left:"0px",right:"0px",bottom:"0",border:"none",background:"white",overflow:"auto",outline:"none",padding:"0px",width:"100%",zIndex:6,top:"auto",transform:"translateY(0)",margin:0}}:{content:{display:"inline-table",transform:"translateY(0)",minHeight:"116px",height:"auto",position:"absolute",minWidth:"216px",maxWidth:"360px",width:"auto",top:bottom,left:left-15,borderRadius:"6px",border:"1px solid #ededed",margin:"0",background:"#fff"},overlay:{background:"transparent"}}};return{TextButtonMapper:function(){var _ref4;return(_ref4={})[wixRichContentEditorCommon.FORMATTING_BUTTONS.LINE_SPACING]={component:wixRichContentEditorCommon.decorateComponentWithProps(LineSpacingButton,config["line-spacing"]),externalizedButtonProps:{onClick:function(_ref3){return function(_ref2){var ref=_ref2.ref,render=_ref2.render;if(render)render(LineSpacingPanel);else{var _helpers$openModal,modalStyles=wixRichContentEditorCommon.getModalStyles({customStyles:modalStylesFn(ref),fullScreen:!1,isMobile:isMobile});null==helpers||null===(_helpers$openModal=helpers.openModal)||void 0===_helpers$openModal||_helpers$openModal.call(helpers,{modalStyles:modalStyles,helpers:helpers,isMobile:isMobile,modalElement:LineSpacingPanel,theme:theme})}}({ref:_ref3.ref,render:_ref3.render})},isActive:function(){return!1},isDisabled:function(){return wixRichContentEditorCommon.isAtomicBlockFocused(config.getEditorState())},getIcon:function(){var _config$LINE_SPACING_,_config$LINE_SPACING_2,_config$LINE_SPACING_3;return(null===(_config$LINE_SPACING_=config["line-spacing"])||void 0===_config$LINE_SPACING_||null===(_config$LINE_SPACING_2=_config$LINE_SPACING_.toolbar)||void 0===_config$LINE_SPACING_2||null===(_config$LINE_SPACING_3=_config$LINE_SPACING_2.icons)||void 0===_config$LINE_SPACING_3?void 0:_config$LINE_SPACING_3.InsertPluginButtonIcon)||function(){var _config$experiments,_config$experiments$n;return LineSpacingIcon({newFormattingToolbar:null==config||null===(_config$experiments=config.experiments)||void 0===_config$experiments||null===(_config$experiments$n=_config$experiments.newFormattingToolbar)||void 0===_config$experiments$n?void 0:_config$experiments$n.enabled})}},tooltip:config.t("LineSpacingButton_Tooltip"),getLabel:function(){return""},type:wixRichContentEditorCommon.BUTTON_TYPES.DROPDOWN,modal:LineSpacingPanel,onSelect:updateSpacing}},_ref4},name:"line-spacing"}},DEFAULTS=Object.freeze({type:"line-spacing",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 _ModalsMap,createLineSpacingPlugin=function(config){var type="line-spacing",theme=config.theme,isMobile=config.isMobile,t=config.t,_config$type=config[type],settings=void 0===_config$type?{}:_config$type,rest=_objectWithoutPropertiesLoose__default.default(config,["theme","isMobile","t",type].map(_toPropertyKey)),toolbar=createToolbar(config);return wixRichContentPluginCommons.createBasePlugin(_extends__default.default({theme:theme,toolbar:toolbar,isMobile:isMobile,t:t,settings:settings,type:type,defaultPluginData:DEFAULTS},rest))};createLineSpacingPlugin.functionName="line-spacing";var Modals={LINE_SPACING:"LINE_SPACING"},ModalsMap=((_ModalsMap={})[Modals.LINE_SPACING]=Panel,_ModalsMap);exports.LINE_SPACING_TYPE="line-spacing",exports.Modals=Modals,exports.ModalsMap=ModalsMap,exports.createLineSpacingPlugin=createLineSpacingPlugin,exports.pluginLineSpacing=function(config){return{config:_extends__default.default({},DEFAULTS.config,config),type:"line-spacing",createPlugin:createLineSpacingPlugin,ModalsMap:ModalsMap}};
//# sourceMappingURL=module.cjs.js.map

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

import _extends from"@babel/runtime/helpers/extends";import _objectWithoutPropertiesLoose from"@babel/runtime/helpers/objectWithoutPropertiesLoose";import{BUTTONS,createBasePlugin}from"wix-rich-content-plugin-commons";import{decorateComponentWithProps,getModalStyles,TOOLBARS,getBottomToolbarModalStyles,BUTTON_TYPES,INSERT_PLUGIN_BUTTONS}from"wix-rich-content-editor-common";import React,{Component}from"react";import _inheritsLoose from"@babel/runtime/helpers/inheritsLoose";import{mergeStyles,validate}from"wix-rich-content-common";import{TextSearchInput}from"wix-rich-content-ui-components";import InfiniteScroll from"react-infinite-scroller";import MDSpinner from"react-md-spinner";import{Scrollbars}from"react-custom-scrollbars";import{debounce,isEqual,merge}from"lodash";import pluginGiphySchema from"wix-rich-content-common/dist/statics/schemas/plugin-giphy.schema.json";import{convertNodeDataToDraft}from"ricos-content/libs/toDraftData";import{TIPTAP_GIF_TYPE}from"ricos-content";var InsertPluginIcon=function(props){return React.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",width:19,height:13,viewBox:"0 0 19 13"},props),React.createElement("g",{fill:"none",fillRule:"evenodd",stroke:"currentColor"},React.createElement("path",{d:"M10 1v11.2M14.51 12.227V1.405h4.502M14.154 5.407h3.85M6 3.089a2.08 2.08 0 0 0-2.041-1.684h-.875a2.59 2.59 0 0 0-2.59 2.59v5.068a2.753 2.753 0 0 0 2.753 2.753h.346A2.407 2.407 0 0 0 6 9.409V8a1 1 0 0 0-1-1H2.804"})))},MediaReplaceIcon=function(props){return React.createElement("svg",Object.assign({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:"giphy-replace-path",d:"M3 7.8V3.2c0-.11.09-.2.2-.2h.6c.11 0 .2.09.2.2v2.592A6.607 6.607 0 0 1 9.412 3C13.05 3 16 5.91 16 9.5c0 .168-.006.335-.02.5h-1.016a5.51 5.51 0 0 0 .022-.5c0-3.038-2.495-5.5-5.574-5.5a5.583 5.583 0 0 0-4.967 3H7.8c.11 0 .2.09.2.2v.6a.2.2 0 0 1-.2.2H3.2a.2.2 0 0 1-.2-.2zm13 3.4v4.6a.2.2 0 0 1-.2.2h-.6a.2.2 0 0 1-.2-.2v-2.592A6.607 6.607 0 0 1 9.588 16C5.95 16 3 13.09 3 9.5c0-.168.006-.335.02-.5h1.016a5.496 5.496 0 0 0-.022.5c0 3.038 2.495 5.5 5.574 5.5a5.583 5.583 0 0 0 4.967-3H11.2a.2.2 0 0 1-.2-.2v-.6c0-.11.09-.2.2-.2h4.6c.11 0 .2.09.2.2z"})),React.createElement("g",{fillRule:"evenodd"},React.createElement("mask",{id:"giphy-replace-mask"},React.createElement("use",{xlinkHref:"#giphy-replace-path"})),React.createElement("use",{fillRule:"nonzero",xlinkHref:"#giphy-replace-path"})))},CloseIcon=function(props){return React.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24"},props),React.createElement("path",{fillRule:"evenodd",d:"M17.077 6l.923.923L12.923 12 18 17.077l-.923.923L12 12.923 6.923 18 6 17.077 11.076 12 6 6.923 6.923 6 12 11.077 17.077 6z"}))},PoweredByGiphy=function(props){return React.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink",width:79,height:9,viewBox:"0 0 53 6"},props),React.createElement("defs",null,React.createElement("path",{id:"giphy-a",d:"M.203.01h5.254V6H.203z"}),React.createElement("path",{id:"giphy-c",d:"M0 5.99h52.224V0H0z"})),React.createElement("g",{fill:"none",fillRule:"evenodd",opacity:".3"},React.createElement("g",{fill:"currentColor"},React.createElement("path",{d:"M.418 3.536h.793c.691 0 .688-1.14 0-1.14H.418v1.14zm0 .42v.875H0V1.98c.4 0 .811-.004 1.211-.004 1.248 0 1.252 1.97 0 1.979H.418z"}),React.createElement("path",{d:"M3.76 4.472c.651 0 .924-.5.924-1.046 0-.525-.277-1.07-.916-1.082-.605 0-.93.46-.93 1.082.007.505.276 1.046.923 1.046m1.338-1.054c0 .77-.43 1.474-1.338 1.474-.909 0-1.338-.72-1.338-1.47 0-.867.556-1.494 1.345-1.494.894.005 1.331.72 1.331 1.49M8.21 4.835h-.37l-.348-1.006-.287-.956-.288.96-.344 1.002h-.367l-.95-2.854h.468l.666 2.194.676-2.194h.27l.69 2.194.651-2.194h.467zM11.474 4.83H9.541V1.982h1.922v.444H9.96v.77h1.443v.422H9.96v.766h1.514zM12.432 2.397V3.43h.796c.348 0 .5-.24.5-.508 0-.257-.152-.525-.496-.525h-.8zM14.27 4.83h-.49l-.796-.985h-.553v.985h-.419V1.977c.407 0 .811.004 1.219.004.605 0 .923.452.923.933 0 .406-.195.806-.71.887l.78.948.046.082zM16.642 4.83h-1.933V1.982h1.922v.444h-1.504v.77h1.443v.422h-1.443v.766h1.515zM17.595 4.39h.576c.64 0 .908-.512.897-1.013-.011-.48-.28-.96-.897-.96h-.576V4.39zm.576-2.409c.893 0 1.3.696 1.312 1.4.015.721-.396 1.45-1.312 1.45h-.99V1.98h.99zM21.33 4.407h.786c.231 0 .553-.081.553-.395 0-.305-.31-.443-.55-.443h-.789v.838zm0-1.245h.79c.313 0 .47-.135.47-.358 0-.2-.16-.411-.474-.411h-.786v.769zm.786-1.18c.497 0 .889.248.889.813 0 .24-.116.456-.363.566.315.102.445.44.445.656 0 .622-.456.814-.971.814h-1.2V1.98h1.2zM24.404 3.24l.744-1.259h.504v.021l-1.039 1.66v1.169h-.418V3.662l-1.01-1.66v-.02h.497z"})),React.createElement("g",null,React.createElement("g",{transform:"translate(26.66)"},React.createElement("mask",{id:"giphy-b",fill:"#fff"},React.createElement("use",{xlinkHref:"#giphy-a"})),React.createElement("path",{fill:"currentColor",d:"M4.38 1.85a1.728 1.728 0 0 0-1.23-.494c-.877 0-1.447.551-1.447 1.661 0 .73.362 1.63 1.447 1.63.284 0 .73-.057 1.038-.292v-.73H2.827V2.37h2.63v2.52C5.12 5.612 4.181 6 3.142 6 1.011 6 .203 4.5.203 3.017S1.126.011 3.15.011c.746 0 1.407.162 2.115.915l-.885.924z"})),React.createElement("mask",{id:"giphy-d",fill:"#fff"},React.createElement("use",{xlinkHref:"#giphy-c"})),React.createElement("path",{fill:"currentColor",d:"M32.981 5.846h1.516V.173H32.98zM37.113 2.96h1.092c.423 0 .639-.323.639-.696 0-.373-.224-.714-.639-.714h-1.092v1.41zm0 1.354v1.532H35.59V.173h2.615c1.446 0 2.162.956 2.162 2.066 0 1.16-.724 2.059-2.162 2.075h-1.092zM44.507 5.854V3.706h-1.939v2.148h-1.523V.181h1.523v2.156h1.939V.18h1.507v5.673zM49.347 2.118L50.51.173h1.715v.073l-2.138 3.339v2.261h-1.523V3.585L46.516.237V.173h1.716z"}))))},styles$2={giphy_api_input_modal_container:"_1H5Sv",giphy_api_input_modal_navbar:"AWRFT",giphy_api_input_modal_closeButton:"_1MqKv"},DEFAULTS=Object.freeze({config:{size:"content",alignment:"center"},configViewer:{sizes:{desktop:"original",mobile:"original"}}}),DEFAULT_RESOLUTION=Object.freeze({desktop:"original",mobile:"original"}),MOBILE_FULL_SCREEN_CUSTOM_STYLE=Object.freeze({overlay:{backgroundColor:"transparent"},content:{top:0,left:0,overflow:"hidden",paddingRight:"6px"}}),commonDesktopModalStyles={width:"320px",boxSizing:"border-box",height:"364px",overflow:"visible",paddingRight:"12px",paddingLeft:"12px",display:"block",position:"absolute",zIndex:6,paddingTop:"12px"},DESKTOP_FLY_OUT_MODAL_STYLES=Object.freeze({overlay:{backgroundColor:"rgba(0, 0, 0, 0)",zIndex:5},content:_extends({},commonDesktopModalStyles,{border:"solid 1px rgba(51, 51, 51, 0.1)",boxShadow:"0 0 10px 0 rgba(0, 0, 0, 0.06)"})}),EXTERNAL_POPUP_STYLES=Object.freeze({content:commonDesktopModalStyles}),styles$1={fontElementMap:"_2F-EW",giphy_selecter_container:"_1FHxh",giphy_selecter_infinite_scroll_container:"_2JQ7f",giphy_selecter_infinite_scroll:"_2gKZe",giphy_selecter_customize_scrollbar_container:"MHsyA",giphy_selecter_headerInfiniteScroll:"_39rDb",giphy_selecter_scrollbarThumb:"_2R9xz",giphy_selecter_powerdByGiphy:"JsDyy",giphy_selecter_gif_img_container:"_1HSqB",giphy_selecter_gif_img:"_327u_",giphy_selecter_spinner_more:"_1EDWs",giphy_selecter_spinner_empty_modal:"c-iaq",giphy_selecter_error_msg:"_3jFM4",giphy_empty_state:"zhAYz"},GiphyEmptyState=function(_ref){var t=_ref.t;return React.createElement("div",{className:styles$1.giphy_empty_state},React.createElement("div",null,t("GiphyPlugin_Search_EmptyState_Title")),React.createElement("div",null,t("GiphyPlugin_Search_EmptyState_Text")))},GiphySelector=function(_Component){function GiphySelector(props){var _this;(_this=_Component.call(this,props)||this).getGifs=function(searchTag,page){searchTag?_this.giphySdkCore.search("gifs",{q:searchTag,offset:25*page,limit:25}).then((function(response){page>1?_this.setState({gifs:_this.state.gifs.concat(response.data),hasMoreItems:!0,page:_this.state.page+1,didFail:!1}):_this.setState({gifs:response.data,hasMoreItems:!0,page:_this.state.page+1,didFail:!1})})).catch((function(){_this.setState({didFail:!0,hasMoreItems:!1})})):_this.giphySdkCore.trending("gifs",{limit:100}).then((function(response){searchTag||_this.setState({gifs:response.data,hasMoreItems:!1,didFail:!1})})).catch((function(){_this.setState({didFail:!0,hasMoreItems:!1})}))},_this.getMoreGifs=function(){var searchTag=_this.props.searchTag;_this.getGifs(searchTag,_this.state.page)},_this.getBoundOnClick=function(giphy){var componentData=_this.convertGiphyToComponentData(giphy);return function(){return _this.selectGif(componentData)}},_this.getBoundKeyDown=function(giphy){var componentData=_this.convertGiphyToComponentData(giphy);return function(e){var onCloseRequested=_this.props.onCloseRequested;"Escape"===e.key&&(null==onCloseRequested||onCloseRequested()),"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),_this.selectGif(componentData))}};var componentData=_this.props.componentData;_this.state={url:componentData.src||"",isLoaded:!1,hasMoreItems:!0,gifs:[],page:0,didFail:!1},_this.styles=mergeStyles({styles:styles$1,theme:_this.props.theme});var gphApiClient=require("giphy-js-sdk-core");return _this.giphySdkCore=gphApiClient(_this.props.giphySdkApiKey),_this}_inheritsLoose(GiphySelector,_Component);var _proto=GiphySelector.prototype;return _proto.selectGif=function(gif){var _this$props=this.props,componentData=_this$props.componentData,pubsub=_this$props.pubsub,onConfirm=_this$props.onConfirm,onCloseRequested=_this$props.onCloseRequested;onConfirm?onConfirm(_extends({},componentData,{gif:gif})):pubsub.update("componentData",{gif:gif}),onCloseRequested()},_proto.convertGiphyToComponentData=function(giphy){var _giphy$images$downsiz,_giphy$images$downsiz2,_giphy$images$downsiz3;return{originalUrl:giphy.images.original.url,originalMp4:giphy.images.original.mp4,stillUrl:giphy.images.original_still.url,downsizedUrl:(null===(_giphy$images$downsiz=giphy.images.downsized)||void 0===_giphy$images$downsiz?void 0:_giphy$images$downsiz.url)||giphy.images.original.url,downsizedStillUrl:(null===(_giphy$images$downsiz2=giphy.images.downsized_still)||void 0===_giphy$images$downsiz2?void 0:_giphy$images$downsiz2.url)||giphy.images.original.url,downsizedSmallMp4:(null===(_giphy$images$downsiz3=giphy.images.downsized_small)||void 0===_giphy$images$downsiz3?void 0:_giphy$images$downsiz3.mp4)||giphy.images.original.mp4,height:parseInt(giphy.images.original.height,10),width:parseInt(giphy.images.original.width,10)}},_proto.componentWillReceiveProps=function(nextProps){var _this2=this;null!==this.timer&&clearTimeout(this.timer),this.timer=setTimeout((function(){return _this2.getGifs(nextProps.searchTag)}),300)},_proto.componentDidMount=function(){this.timer=null},_proto.render=function(){var _this3=this,styles=this.styles,_this$props2=this.props,t=_this$props2.t,searchTag=_this$props2.searchTag,_this$state=this.state,gifs=_this$state.gifs,hasMoreItems=_this$state.hasMoreItems,didFail=_this$state.didFail,loader=React.createElement("div",{className:styles["giphy_selecter_spinner_"+(gifs.length?"more":"empty_modal")]},React.createElement(MDSpinner,{borderSize:1.5,singleColor:"#000000"}));return React.createElement("div",null,React.createElement("div",{className:styles.giphy_selecter_infinite_scroll_container},!gifs.length&&searchTag?React.createElement(GiphyEmptyState,{t:t}):React.createElement(Scrollbars,{renderThumbVertical:function(){return React.createElement("div",{className:styles.giphy_selecter_scrollbarThumb})},className:styles.giphy_selecter_customize_scrollbar_container},React.createElement(InfiniteScroll,{pageStart:0,loadMore:this.getMoreGifs.bind(this),hasMore:hasMoreItems,loader:this.state.didFail?null:loader,useWindow:!1,className:styles.giphy_selecter_infinite_scroll},gifs.map((function(giphy,i){return React.createElement("div",{key:i,role:"button",tabIndex:0,className:styles.giphy_selecter_gif_img_container,onKeyDown:_this3.getBoundKeyDown(giphy),onClick:_this3.getBoundOnClick(giphy)},React.createElement("img",{className:styles.giphy_selecter_gif_img,src:giphy.images.fixed_width_downsampled.url,alt:giphy.title||"gif"}))}))))),React.createElement("div",{className:styles.giphy_selecter_container},React.createElement(PoweredByGiphy,{className:styles.giphy_selecter_powerdByGiphy})),didFail&&!gifs.length?React.createElement("div",{className:styles.giphy_selecter_error_msg}," ",t("GiphyPlugin_ApiErrorMsg")):null)},GiphySelector}(Component),GIPHY_TYPE="wix-draft-plugin-giphy",GiphyApiInputModal=function(_Component){function GiphyApiInputModal(props){var _this;return(_this=_Component.call(this,props)||this).triggerBi=debounce((function(){var _this$props=_this.props,helpers=_this$props.helpers,toolbarName=_this$props.toolbarName;helpers.onPluginAction("searchInsideThePlugin",{searchTerm:_this.state.searchTag,plugin_id:GIPHY_TYPE,entry_point:toolbarName})}),200),_this.onChange=function(searchTag){_this.setState({searchTag:searchTag}),_this.triggerBi()},_this.onCloseRequested=function(){_this.setState({isOpen:!1}),_this.props.helpers.closeModal()},_this.handleClearText=function(){_this.setState({searchTag:""})},_this.styles=mergeStyles({styles:styles$2,theme:props.theme}),_this.state={searchTag:""},_this}return _inheritsLoose(GiphyApiInputModal,_Component),GiphyApiInputModal.prototype.render=function(){var _this2=this,styles=this.styles,_this$props2=this.props,t=_this$props2.t,isMobile=_this$props2.isMobile,languageDir=_this$props2.languageDir,searchTag=this.state.searchTag,mobileNavbar=React.createElement("div",null,React.createElement("div",{className:styles.giphy_api_input_modal_navbar},t("GiphyUploadModal_mobileNavbar_Title"),React.createElement("div",{onClick:this.onCloseRequested,role:"button",tabIndex:"0",onKeyPress:null,className:styles.giphy_api_input_modal_closeButton},React.createElement(CloseIcon,null))));return React.createElement("div",{dir:languageDir},isMobile?React.createElement("div",null,mobileNavbar):null,React.createElement("div",{className:styles.giphy_api_input_modal_container,"data-hook":"giphyUploadModal"},React.createElement(TextSearchInput,{inputRef:function(ref){return _this2.input=ref},onClose:this.onCloseRequested,placeHolder:t("GiphyUploadModal_Search_Placeholder"),onChange:this.onChange,value:this.state.searchTag,"data-hook":"giphyUploadModalInput"}),React.createElement(GiphySelector,_extends({searchTag:searchTag,onCloseRequested:this.onCloseRequested},this.props))))},GiphyApiInputModal}(Component),createInlineButtons=function(_ref){var _settings$toolbar,_settings$toolbar$ico,t=_ref.t,settings=_ref.settings,isMobile=_ref.isMobile,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.replace)||MediaReplaceIcon,modalStyles=isMobile?getModalStyles({customStyles:MOBILE_FULL_SCREEN_CUSTOM_STYLE,fullScreen:!0,isMobile:isMobile}):void 0;return[{keyName:"sizeOriginal",type:BUTTONS.SIZE_ORIGINAL,mobile:!1},{keyName:"sizeSmallCenter",type:BUTTONS.SIZE_SMALL_CENTER,mobile:!1},{keyName:"sizeContent",type:BUTTONS.SIZE_CONTENT,mobile:!1},{keyName:"sizeFullWidth",type:BUTTONS.SIZE_FULL_WIDTH,mobile:!1},{keyName:"separator1",type:BUTTONS.SEPARATOR,mobile:!1},{keyName:"sizeSmallLeft",type:BUTTONS.SIZE_SMALL_LEFT,mobile:!1},{keyName:"sizeSimallRight",type:BUTTONS.SIZE_SMALL_RIGHT,mobile:!1},{keyName:"separator2",type:BUTTONS.SEPARATOR,mobile:!1},{keyName:"replace",type:BUTTONS.EXTERNAL_MODAL,icon:icon,modalElement:decorateComponentWithProps(GiphyApiInputModal,settings),modalStyles:modalStyles,modalStylesFn:function(_ref2){var buttonRef=_ref2.buttonRef,modalStyles=getModalStyles({customStyles:DESKTOP_FLY_OUT_MODAL_STYLES,fullScreen:!0,isMobile:isMobile}),_buttonRef$getBoundin=buttonRef.getBoundingClientRect(),top=_buttonRef$getBoundin.top,modalLeft=_buttonRef$getBoundin.left-15,modalTop=top>357?top-365:top+30;return _extends({},modalStyles,{content:_extends({},modalStyles.content,{top:modalTop,left:modalLeft,margin:0,position:"absolute"})})},mobile:!0,tooltipTextKey:"ReplaceGiphyButton_Tooltip",t:t},{keyName:"delete",type:BUTTONS.DELETE,mobile:!0}]},createInsertButtons=function(_ref){var _settings$toolbar,_settings$toolbar$ico,_modalStylesByToolbar,t=_ref.t,settings=_ref.settings,isMobile=_ref.isMobile,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,modalStylesByToolbar=((_modalStylesByToolbar={})[TOOLBARS.FOOTER]=isMobile?getModalStyles({customStyles:MOBILE_FULL_SCREEN_CUSTOM_STYLE,fullScreen:!0,isMobile:isMobile}):void 0,_modalStylesByToolbar[TOOLBARS.INSERT_PLUGIN]=getModalStyles(isMobile?{customStyles:MOBILE_FULL_SCREEN_CUSTOM_STYLE,fullScreen:!0,isMobile:isMobile}:{customStyles:EXTERNAL_POPUP_STYLES,fullScreen:!1,isMobile:isMobile}),_modalStylesByToolbar),buttonProps={type:BUTTON_TYPES.MODAL,name:INSERT_PLUGIN_BUTTONS.GIF,tooltip:t("GiphyPlugin_InsertButton_Tooltip"),getIcon:function(){return icon},componentData:settings.componentDataDefaults||DEFAULTS,modalElement:decorateComponentWithProps(GiphyApiInputModal,settings)};return[_extends({},buttonProps,{toolbars:settings.insertToolbars||[TOOLBARS.FOOTER,TOOLBARS.SIDE,TOOLBARS.MOBILE],modalStyles:modalStylesByToolbar[TOOLBARS.FOOTER],modalStylesFn:function(_ref2){var buttonRef=_ref2.buttonRef,toolbarName=_ref2.toolbarName;return getBottomToolbarModalStyles(buttonRef,{customStyles:DESKTOP_FLY_OUT_MODAL_STYLES,isMobile:isMobile},toolbarName)}}),_extends({},buttonProps,{toolbars:[TOOLBARS.INSERT_PLUGIN],modalStyles:modalStylesByToolbar[TOOLBARS.INSERT_PLUGIN]})]},createToolbar=function(_ref){var t=_ref.t,settings=_ref.settings,isMobile=_ref.isMobile;return{InlineButtons:createInlineButtons({t:t,settings:settings,isMobile:isMobile}),InsertButtons:createInsertButtons({t:t,settings:settings,isMobile:isMobile}),name:"giphy"}},styles={giphy_player:"_1JieR"},GiphyViewer=function(_Component){function GiphyViewer(props){var _this;return(_this=_Component.call(this,props)||this).getSourceUrl=function(){var _this$props=_this.props,gif=_this$props.componentData.gif,isMobile=_this$props.isMobile,_this$props$settings=_this$props.settings;if(!gif)return null;var _DEFAULT_RESOLUTION$s=_extends({},DEFAULT_RESOLUTION,void 0===_this$props$settings?{}:_this$props$settings),mobile=_DEFAULT_RESOLUTION$s.mobile,desktop=_DEFAULT_RESOLUTION$s.desktop,size=isMobile?mobile:desktop,originalMp4=gif.originalMp4,originalUrl=gif.originalUrl;return{original:originalMp4,downsizedSmall:gif.downsizedSmallMp4}[size]||originalUrl},validate(props.componentData,pluginGiphySchema),_this}_inheritsLoose(GiphyViewer,_Component);var _proto=GiphyViewer.prototype;return _proto.componentWillReceiveProps=function(nextProps){isEqual(nextProps.componentData,this.props.componentData)||validate(nextProps.componentData,pluginGiphySchema)},_proto.render=function(){this.styles=this.styles||mergeStyles({styles:styles,theme:this.props.theme});var _this$props2=this.props,componentData=_this$props2.componentData,setComponentUrl=_this$props2.setComponentUrl,gifUrl=this.getSourceUrl();return gifUrl?(null==setComponentUrl||setComponentUrl(gifUrl),gifUrl.endsWith(".mp4")?React.createElement("video",{role:"img",autoPlay:!0,muted:!0,loop:!0,playsInline:!0,"aria-label":"gif",className:this.styles.giphy_player,src:gifUrl}):React.createElement("img",{role:"img","aria-label":"gif",className:this.styles.giphy_player,src:componentData.gif.originalUrl,alt:"gif"})):null},GiphyViewer}(Component);GiphyViewer.defaultProps={width:"100%",height:"100%",controls:!0};var GiphyComponent=function(_Component){function GiphyComponent(props){var _this;return(_this=_Component.call(this,props)||this).handleReady=function(){_this.state.isLoaded||_this.setState({isLoaded:!0})},_this.renderPlayer=function(){var _this$props=_this.props,componentData=_this$props.componentData,theme=_this$props.theme,settings=_this$props.settings,isMobile=_this$props.isMobile,setComponentUrl=_this$props.setComponentUrl;return React.createElement(GiphyViewer,{ref:_this.setPlayer,componentData:componentData,theme:theme,settings:settings,isMobile:isMobile,setComponentUrl:setComponentUrl})},_this.onKeyDown=function(e,handler){"Enter"!==e.key&&" "!==e.key||handler()},_this.state={isLoading:!1,isLoaded:!1},_this}return _inheritsLoose(GiphyComponent,_Component),GiphyComponent.prototype.render=function(){var _this2=this,onClick=this.props.onClick;return React.createElement("div",{"data-hook":"giphyPlayer",onClick:onClick,onKeyDown:function(e){return _this2.onKeyDown(e,onClick)}},this.renderPlayer())},GiphyComponent}(Component);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)}GiphyComponent.type={GIPHY_TYPE:GIPHY_TYPE};var _ModalsMap,createGiphyPlugin=function(config){var type=GIPHY_TYPE,helpers=config.helpers,t=config.t,_config$type=config[type],settings=void 0===_config$type?{}:_config$type,isMobile=config.isMobile,rest=_objectWithoutPropertiesLoose(config,["helpers","t",type,"isMobile"].map(_toPropertyKey));return createBasePlugin(_extends({component:GiphyComponent,type:GIPHY_TYPE,toolbar:createToolbar({helpers:helpers,t:t,settings:settings,isMobile:isMobile}),helpers:helpers,settings:settings,t:t,isMobile:isMobile,defaultPluginData:DEFAULTS},rest))};createGiphyPlugin.functionName=GIPHY_TYPE;var Modals={GIPHY_API_INPUT:"giphy-api-input"},ModalsMap=((_ModalsMap={})[Modals.GIPHY_API_INPUT]=GiphyApiInputModal,_ModalsMap),createGiphyData=function(pluginData,isRicosSchema){void 0===pluginData&&(pluginData={}),void 0===isRicosSchema&&(isRicosSchema=!1);var giphyData=isRicosSchema?convertNodeDataToDraft("GIF",pluginData):pluginData;return merge({},DEFAULTS,giphyData)},Gif=function(_ref){var context=_ref.context,componentData=_ref.componentData,isMobile=context.isMobile,theme=context.theme,_context$config=context.config,settings=(void 0===_context$config?{}:_context$config)[GIPHY_TYPE]||{};return React.createElement(GiphyComponent,{componentData:componentData,isMobile:isMobile,theme:theme,settings:settings,onClick:function(){},setComponentUrl:function(){return null}})},gifDataDefaults={height:0,width:0,containerData:{alignment:"CENTER",width:{size:null,custom:null},spoiler:{enabled:null,description:null,buttonText:null},height:{custom:null},textWrap:null},original:null,downsized:null},name=TIPTAP_GIF_TYPE,pluginGiphy=function(config){var defaultOptions,pluginConfig=_extends({},DEFAULTS.config,config);return{config:pluginConfig,type:GIPHY_TYPE,createPlugin:createGiphyPlugin,ModalsMap:ModalsMap,createPluginData:createGiphyData,tiptapExtensions:(defaultOptions=pluginConfig,[{type:"node",Component:Gif,componentDataDefaults:_extends({},gifDataDefaults,{id:""}),createExtensionConfig:function(){return{name:name,defaultOptions:defaultOptions,addCommands:function(){return{}}}}}])}};export{GIPHY_TYPE,GiphyViewer,Modals,ModalsMap,createGiphyPlugin,pluginGiphy};
import _extends from"@babel/runtime/helpers/extends";import _objectWithoutPropertiesLoose from"@babel/runtime/helpers/objectWithoutPropertiesLoose";import{createBasePlugin}from"wix-rich-content-plugin-commons";import React,{Component}from"react";import{pick}from"lodash";import _inheritsLoose from"@babel/runtime/helpers/inheritsLoose";import{mergeStyles}from"wix-rich-content-common";import{mergeBlockData,FORMATTING_BUTTONS,EditorState,getAnchorBlockData,InlineToolbarButton,ClickOutside,decorateComponentWithProps,isAtomicBlockFocused,BUTTON_TYPES,getModalStyles}from"wix-rich-content-editor-common";import Modal from"react-modal";import classNames from"classnames";var LINE_SPACING_TYPE="line-spacing",LineSpacingIcon=function(props){return props.newFormattingToolbar?React.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",width:"17",height:"15",viewBox:"0 0 17 15"},props),React.createElement("g",{fill:"none",fillRule:"evenodd"},React.createElement("g",{fill:"currentColor"},React.createElement("g",null,React.createElement("path",{d:"M4.5 3L7 6H5v9h2l-2.5 3L2 15h2V6H2l2.5-3zM18 16v1H9v-1h9zm0-4v1H9v-1h9zm0-4v1H9V8h9zm0-4v1H9V4h9z",transform:"translate(-605.000000, -80.000000) translate(603.500000, 77.000000)"}))))):React.createElement("svg",Object.assign({width:19,height:19,viewBox:"0 0 19 19"},props),React.createElement("path",{d:"M9.2 7h7.6c.11 0 .2.09.2.2v.6a.2.2 0 0 1-.2.2H9.2a.2.2 0 0 1-.2-.2v-.6c0-.11.09-.2.2-.2zm0 3h7.6c.11 0 .2.09.2.2v.6a.2.2 0 0 1-.2.2H9.2a.2.2 0 0 1-.2-.2v-.6c0-.11.09-.2.2-.2zm0 3h7.6c.11 0 .2.09.2.2v.6a.2.2 0 0 1-.2.2H9.2a.2.2 0 0 1-.2-.2v-.6c0-.11.09-.2.2-.2zm0-9h7.6c.11 0 .2.09.2.2v.6a.2.2 0 0 1-.2.2H9.2a.2.2 0 0 1-.2-.2v-.6c0-.11.09-.2.2-.2z"}),React.createElement("path",{d:"M5.854 4.707L7 5.853l.707-.707-2-2-.005-.003-.157-.104L5.354 3l-.191.039-.157.104L5 3.146l-2 2s.708.706.707.707l1.147-1.146v8.586l-1.146-1.146-.707.707 2 2 .162.108.189.038.193-.039.162-.107 2-2L7 12.147l-1.146 1.146V4.707z"}))},styles={lineHeightsPanel:"_22Yra",lineHeightsPanel_selectedLineHeight:"W4aQP",lineSpacingMobilePanel_selectedLineHeight:"BMbAI",lineSpacingMobilePanel:"_1ZEpf",lineSpacingMobilePanel_heights:"_1ZRz9",lineSpacingMobilePanel_buttons:"ak4LK",customSpacingPanel:"_2Jf9a",customSpacingPanel_mobile:"_1K2CE",customSpacingPanel_labeledInput:"_2l5vW",lineSpacing_separator:"_1ziH-",customSpacingPanel_buttons:"_2kls2",lineSpacingContainer:"_11bfQ",lineSpacingContainer_mobile:"_3nZp1",lineSpacingModal:"_3PNI9",lineSpacingModal_mobile:"_19sHr",lineSpacingModalOverlay:"_3O-Bu",lineSpacingPopup_button:"lRuWu",lineSpacingPopup:"_3a7Rh"},LineHeightsPanel=function(_ref){var selectedHeight=_ref.selectedHeight,onSave=_ref.onSave,showCustomPanel=_ref.showCustomPanel,styles=_ref.styles,t=_ref.t;return React.createElement("div",{className:styles.lineHeightsPanel},[1,1.5,2,2.5,3].map((function(height){return function(height,isSelected,_onClick){return React.createElement("button",{className:isSelected?styles.lineHeightsPanel_selectedLineHeight:"",key:height,onClick:function(){return _onClick(""+height)}},height)}(height,parseFloat(selectedHeight)===height,onSave)})),React.createElement("button",{onClick:showCustomPanel},t("LineSpacing_customSpacing")))},MobilePanel=function(_ref2){var selectedHeight=_ref2.selectedHeight,styles=_ref2.styles,t=_ref2.t,onChange=_ref2.onChange,onSave=_ref2.onSave,onCancel=_ref2.onCancel;return React.createElement("div",{className:styles.lineSpacingMobilePanel},React.createElement("div",null,t("LineSpacing_lineSpacing")),React.createElement("div",{className:styles.lineSpacingMobilePanel_heights},[1,1.5,2,2.5,3].map((function(height){return function(height,isSelected,_onClick2){return React.createElement("button",{className:isSelected?styles.lineSpacingMobilePanel_selectedLineHeight:"",key:height,onClick:function(){return _onClick2(""+height)}},height)}(height,parseFloat(selectedHeight)===height,onChange)}))),React.createElement(Separator,null),React.createElement("div",{className:styles.lineSpacingMobilePanel_buttons},React.createElement("button",{onClick:onCancel},t("LineSpacing_cancel")),React.createElement("button",{onClick:function(){return onSave()}},t("LineSpacing_save"))))},LabeledInput=function(_ref3){var label=_ref3.label,name=_ref3.name,_ref3$unit=_ref3.unit,unit=void 0===_ref3$unit?"":_ref3$unit,_ref3$defaultValue=_ref3.defaultValue,defaultValue=void 0===_ref3$defaultValue?0:_ref3$defaultValue,spacing=_ref3.spacing,_onChange2=_ref3.onChange,min=_ref3.min,max=_ref3.max,value=void 0===spacing[name]?defaultValue:parseFloat(spacing[name]);return React.createElement("label",{className:styles.customSpacingPanel_labeledInput},React.createElement("span",null,label),React.createElement("input",{type:"number",min:min,max:max,value:value,onChange:function(e){var _onChange;return _onChange2(((_onChange={})[name]=Number(e.target.value)+unit,_onChange))}}))},Separator=function(){return React.createElement("div",{className:styles.lineSpacing_separator})},CustomPanel=function(_ref4){var spacing=_ref4.spacing,onChange=_ref4.onChange,onSave=_ref4.onSave,onCancel=_ref4.onCancel,styles=_ref4.styles,t=_ref4.t;return React.createElement("div",{className:styles.customSpacingPanel},React.createElement(LabeledInput,{label:t("LineSpacing_lineSpacing"),name:"line-height",defaultValue:1.5,onChange:onChange,spacing:spacing,min:1,max:100}),React.createElement(Separator,null),React.createElement(LabeledInput,{label:t("LineSpacing_beforeParagraph"),name:"padding-top",unit:"px",onChange:onChange,spacing:spacing,min:0,max:250}),React.createElement(LabeledInput,{label:t("LineSpacing_afterParagraph"),name:"padding-bottom",unit:"px",onChange:onChange,spacing:spacing,min:0,max:250}),React.createElement("div",{className:styles.customSpacingPanel_buttons},React.createElement("button",{onClick:onCancel},t("LineSpacing_cancel")),React.createElement("button",{onClick:function(){return onSave()}},t("LineSpacing_save"))))},Panel=function(_Component){function Panel(props){var _this;return(_this=_Component.call(this,props)||this).showCustomPanel=function(){_this.setState({isCustomPanel:!0})},_this.onBlur=function(e){var target=e.target,relatedTarget=e.relatedTarget;e.currentTarget.contains(relatedTarget)||setTimeout((function(){return target.focus()}))},_this.onChange=function(spacing){var merged=_extends({},_this.state.spacing,spacing);_this.setState({spacing:merged}),_this.props.onChange(merged)},_this.onSave=function(spacing){_this.props.onSave(_extends({},_this.state.spacing,spacing))},_this.state={spacing:props.spacing},_this.styles=mergeStyles({styles:styles,theme:props.theme}),_this}return _inheritsLoose(Panel,_Component),Panel.prototype.render=function(){var _classNames,_this$props=this.props,onCancel=_this$props.onCancel,t=_this$props.t,isMobile=_this$props.isMobile,_this$state=this.state,isCustomPanel=_this$state.isCustomPanel,spacing=_this$state.spacing,styles=this.styles,showCustomPanel=this.showCustomPanel,onChange=this.onChange,onSave=this.onSave,selectedHeight=spacing["line-height"],panel=isMobile?React.createElement(MobilePanel,{styles:styles,selectedHeight:selectedHeight,t:t,onChange:function(height){return onChange({"line-height":height})},onSave:onSave,onCancel:onCancel}):isCustomPanel?React.createElement(CustomPanel,{spacing:spacing,onChange:onChange,onSave:onSave,onCancel:onCancel,styles:styles,t:t,isMobile:isMobile}):React.createElement(LineHeightsPanel,{styles:styles,selectedHeight:selectedHeight,showCustomPanel:showCustomPanel,t:t,onSave:function(height){return onSave({"line-height":height})}});return React.createElement("div",{onBlur:this.onBlur,className:classNames(styles.lineSpacingContainer,(_classNames={},_classNames[styles.lineSpacingContainer_mobile]=isMobile,_classNames))},panel)},Panel}(Component);Panel.defaultProps={spacing:{}};var LineSpacingButton=function(_Component){function LineSpacingButton(props){var _this;return(_this=_Component.call(this,props)||this).onOpenPanel=function(){_this.currentEditorState=_this.oldEditorState=_this.props.getEditorState(),_this.selection=_this.oldEditorState.getSelection();var spacing=LineSpacingButton.getBlockSpacing(_this.oldEditorState);_this.oldSpacing=spacing,_this.setState({isPanelOpen:!0,spacing:spacing})},_this.openPanel=function(){_this.onOpenPanel();var _this$buttonRef$getBo=_this.buttonRef.getBoundingClientRect(),bottom=_this$buttonRef$getBo.bottom,left=_this$buttonRef$getBo.left;_this.props.setKeepOpen(!0),_this.setState({panelLeft:left,panelTop:bottom})},_this.closePanel=function(){_this.setState({isPanelOpen:!1}),_this.props.setKeepOpen(!1)},_this.updateSpacing=function(spacing){var _helpers$onToolbarBut,dynamicStyles=spacing,_this$props=_this.props,setEditorState=_this$props.setEditorState,onUpdate=_this$props.onUpdate,helpers=_this$props.helpers,newEditorState=mergeBlockData(_this.oldEditorState,{dynamicStyles:dynamicStyles});setEditorState(newEditorState),null==helpers||null===(_helpers$onToolbarBut=helpers.onToolbarButtonClick)||void 0===_helpers$onToolbarBut||_helpers$onToolbarBut.call(helpers,{buttonName:FORMATTING_BUTTONS.LINE_SPACING,pluginId:"line-spacing",value:null==spacing?void 0:spacing["line-height"]}),_this.currentEditorState=newEditorState,onUpdate(dynamicStyles)},_this.save=function(spacing){_this.closePanel(),spacing?_this.updateSpacing(spacing):_this.setEditorState(_this.currentEditorState)},_this.cancel=function(){var onUpdate=_this.props.onUpdate;_this.setEditorState(_this.oldEditorState),onUpdate(_this.oldSpacing),_this.closePanel()},_this.setEditorState=function(editorState){return _this.props.setEditorState(_this.fixSelection(editorState,_this.selection))},_this.fixSelection=EditorState.forceSelection,_this.state={showPanel:!1},_this.styles=mergeStyles({styles:styles,theme:props.theme}),_this.dataHookName="LineSpacingButton",_this}return _inheritsLoose(LineSpacingButton,_Component),LineSpacingButton.getBlockSpacing=function(editorState){var _getAnchorBlockData$d=getAnchorBlockData(editorState).dynamicStyles;return pick(void 0===_getAnchorBlockData$d?{}:_getAnchorBlockData$d,["line-height","padding-top","padding-bottom"])},LineSpacingButton.getModalParent=function(){return document.querySelector(".DraftEditor-root").parentNode},LineSpacingButton.prototype.render=function(){var _toolbar$icons,_classNames,_classNames2,_this2=this,_this$props2=this.props,theme=_this$props2.theme,helpers=_this$props2.helpers,isMobile=_this$props2.isMobile,t=_this$props2.t,tabIndex=_this$props2.tabIndex,defaultSpacing=_this$props2.defaultSpacing,toolbar=_this$props2.toolbar,toolbarName=_this$props2.toolbarName,inlinePopups=_this$props2.inlinePopups,_this$state=this.state,isPanelOpen=_this$state.isPanelOpen,spacing=_this$state.spacing,panelTop=_this$state.panelTop,panelLeft=_this$state.panelLeft,styles=this.styles,icon=(null==toolbar||null===(_toolbar$icons=toolbar.icons)||void 0===_toolbar$icons?void 0:_toolbar$icons.InsertPluginButtonIcon)||LineSpacingIcon,modalStyle=isMobile?{left:0,bottom:0,right:0}:{top:panelTop,left:panelLeft};return isMobile||"StaticTextToolbar"!==toolbarName||!inlinePopups?React.createElement(InlineToolbarButton,{onClick:this.openPanel,isActive:!!isPanelOpen,helpers:helpers,theme:theme,isMobile:isMobile,tooltipText:t("LineSpacingButton_Tooltip"),dataHook:this.dataHookName,formattingButtonName:FORMATTING_BUTTONS.LINE_SPACING,tabIndex:tabIndex,icon:icon,pluginType:"line-spacing",ref:function(_ref){return _this2.buttonRef=_ref}},React.createElement(Modal,{isOpen:isPanelOpen,onRequestClose:function(){return _this2.save()},className:classNames(styles.lineSpacingModal,(_classNames={},_classNames[styles.lineSpacingModal_mobile]=isMobile,_classNames)),overlayClassName:classNames(styles.lineSpacingModalOverlay,(_classNames2={},_classNames2[styles.lineSpacingModalOverlay_mobile]=isMobile,_classNames2)),parentSelector:LineSpacingButton.getModalParent,style:{content:modalStyle},ariaHideApp:!1},React.createElement(Panel,{spacing:_extends({},defaultSpacing,spacing),onChange:this.updateSpacing,onSave:this.save,onCancel:this.cancel,styles:this.styles,t:t,isMobile:isMobile,theme:theme}))):React.createElement("div",{className:styles.lineSpacingPopup_button},React.createElement(InlineToolbarButton,{onClick:this.openPanel,isActive:!!isPanelOpen,helpers:helpers,theme:theme,isMobile:isMobile,tooltipText:t("LineSpacingButton_Tooltip"),dataHook:this.dataHookName,formattingButtonName:FORMATTING_BUTTONS.LINE_SPACING,tabIndex:tabIndex,icon:icon,pluginType:"line-spacing",ref:function(_ref2){return _this2.buttonRef=_ref2}},isPanelOpen&&React.createElement("div",{className:styles.lineSpacingPopup},React.createElement(ClickOutside,{onClickOutside:function(){return _this2.save()}},React.createElement(Panel,{spacing:_extends({},defaultSpacing,spacing),onChange:this.updateSpacing,onSave:this.save,onCancel:this.cancel,styles:this.styles,t:t,isMobile:isMobile,theme:theme})))))},LineSpacingButton}(Component);LineSpacingButton.defaultProps={inlinePopups:!1,setKeepOpen:function(){},onUpdate:function(){}};var createToolbar=function(config){var oldEditorState,spacing,getEditorState=config.getEditorState,setEditorState=config.setEditorState,helpers=config.helpers,isMobile=config.isMobile,theme=config.theme,updateSpacing=function(spacing){var dynamicStyles=spacing,newEditorState=mergeBlockData(oldEditorState||getEditorState(),{dynamicStyles:dynamicStyles});setEditorState(newEditorState)},LineSpacingPanel=function(_ref){var _getAnchorBlockData$d,closeCustomModal=_ref.closeCustomModal,onSelect=_ref.onSelect;return oldEditorState=getEditorState(),_getAnchorBlockData$d=getAnchorBlockData(oldEditorState).dynamicStyles,spacing=pick(void 0===_getAnchorBlockData$d?{}:_getAnchorBlockData$d,["line-height","padding-top","padding-bottom"]),React.createElement(Panel,Object.assign({onChange:function(args){updateSpacing(args),onSelect&&onSelect(args)},onSave:function(args){!function(spacing){var _helpers$closeModal;null==helpers||null===(_helpers$closeModal=helpers.closeModal)||void 0===_helpers$closeModal||_helpers$closeModal.call(helpers),spacing?updateSpacing(spacing):setEditorState(oldEditorState)}(args),onSelect&&onSelect(args),closeCustomModal&&closeCustomModal()},onCancel:function(){var _helpers$closeModal2;null==helpers||null===(_helpers$closeModal2=helpers.closeModal)||void 0===_helpers$closeModal2||_helpers$closeModal2.call(helpers),setEditorState(oldEditorState),closeCustomModal&&closeCustomModal()},spacing:spacing},config))},modalStylesFn=function(ref){var _ref$getBoundingClien=ref.getBoundingClientRect(),bottom=_ref$getBoundingClien.bottom,left=_ref$getBoundingClien.left;return isMobile?{content:{position:"absolute",left:"0px",right:"0px",bottom:"0",border:"none",background:"white",overflow:"auto",outline:"none",padding:"0px",width:"100%",zIndex:6,top:"auto",transform:"translateY(0)",margin:0}}:{content:{display:"inline-table",transform:"translateY(0)",minHeight:"116px",height:"auto",position:"absolute",minWidth:"216px",maxWidth:"360px",width:"auto",top:bottom,left:left-15,borderRadius:"6px",border:"1px solid #ededed",margin:"0",background:"#fff"},overlay:{background:"transparent"}}};return{TextButtonMapper:function(){var _ref4;return(_ref4={})[FORMATTING_BUTTONS.LINE_SPACING]={component:decorateComponentWithProps(LineSpacingButton,config["line-spacing"]),externalizedButtonProps:{onClick:function(_ref3){return function(_ref2){var ref=_ref2.ref,render=_ref2.render;if(render)render(LineSpacingPanel);else{var _helpers$openModal,modalStyles=getModalStyles({customStyles:modalStylesFn(ref),fullScreen:!1,isMobile:isMobile});null==helpers||null===(_helpers$openModal=helpers.openModal)||void 0===_helpers$openModal||_helpers$openModal.call(helpers,{modalStyles:modalStyles,helpers:helpers,isMobile:isMobile,modalElement:LineSpacingPanel,theme:theme})}}({ref:_ref3.ref,render:_ref3.render})},isActive:function(){return!1},isDisabled:function(){return isAtomicBlockFocused(config.getEditorState())},getIcon:function(){var _config$LINE_SPACING_,_config$LINE_SPACING_2,_config$LINE_SPACING_3;return(null===(_config$LINE_SPACING_=config["line-spacing"])||void 0===_config$LINE_SPACING_||null===(_config$LINE_SPACING_2=_config$LINE_SPACING_.toolbar)||void 0===_config$LINE_SPACING_2||null===(_config$LINE_SPACING_3=_config$LINE_SPACING_2.icons)||void 0===_config$LINE_SPACING_3?void 0:_config$LINE_SPACING_3.InsertPluginButtonIcon)||function(){var _config$experiments,_config$experiments$n;return LineSpacingIcon({newFormattingToolbar:null==config||null===(_config$experiments=config.experiments)||void 0===_config$experiments||null===(_config$experiments$n=_config$experiments.newFormattingToolbar)||void 0===_config$experiments$n?void 0:_config$experiments$n.enabled})}},tooltip:config.t("LineSpacingButton_Tooltip"),getLabel:function(){return""},type:BUTTON_TYPES.DROPDOWN,modal:LineSpacingPanel,onSelect:updateSpacing}},_ref4},name:"line-spacing"}},DEFAULTS=Object.freeze({type:"line-spacing",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 _ModalsMap,createLineSpacingPlugin=function(config){var type="line-spacing",theme=config.theme,isMobile=config.isMobile,t=config.t,_config$type=config[type],settings=void 0===_config$type?{}:_config$type,rest=_objectWithoutPropertiesLoose(config,["theme","isMobile","t",type].map(_toPropertyKey)),toolbar=createToolbar(config);return createBasePlugin(_extends({theme:theme,toolbar:toolbar,isMobile:isMobile,t:t,settings:settings,type:type,defaultPluginData:DEFAULTS},rest))};createLineSpacingPlugin.functionName="line-spacing";var Modals={LINE_SPACING:"LINE_SPACING"},ModalsMap=((_ModalsMap={})[Modals.LINE_SPACING]=Panel,_ModalsMap),pluginLineSpacing=function(config){return{config:_extends({},DEFAULTS.config,config),type:"line-spacing",createPlugin:createLineSpacingPlugin,ModalsMap:ModalsMap}};export{LINE_SPACING_TYPE,Modals,ModalsMap,createLineSpacingPlugin,pluginLineSpacing};
//# 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"),pluginGiphySchema=require("wix-rich-content-common/dist/statics/schemas/plugin-giphy.schema.json"),lodash=require("lodash");function _interopDefaultLegacy(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var _extends__default=_interopDefaultLegacy(_extends),_inheritsLoose__default=_interopDefaultLegacy(_inheritsLoose),React__default=_interopDefaultLegacy(React),pluginGiphySchema__default=_interopDefaultLegacy(pluginGiphySchema),styles={giphy_player:"_1JieR"},DEFAULTS=Object.freeze({config:{size:"content",alignment:"center"},configViewer:{sizes:{desktop:"original",mobile:"original"}}}),DEFAULT_RESOLUTION=Object.freeze({desktop:"original",mobile:"original"});Object.freeze({overlay:{backgroundColor:"transparent"},content:{top:0,left:0,overflow:"hidden",paddingRight:"6px"}});var commonDesktopModalStyles={width:"320px",boxSizing:"border-box",height:"364px",overflow:"visible",paddingRight:"12px",paddingLeft:"12px",display:"block",position:"absolute",zIndex:6,paddingTop:"12px"};Object.freeze({overlay:{backgroundColor:"rgba(0, 0, 0, 0)",zIndex:5},content:_extends__default.default({},commonDesktopModalStyles,{border:"solid 1px rgba(51, 51, 51, 0.1)",boxShadow:"0 0 10px 0 rgba(0, 0, 0, 0.06)"})}),Object.freeze({content:commonDesktopModalStyles});var GiphyViewer=function(_Component){function GiphyViewer(props){var _this;return(_this=_Component.call(this,props)||this).getSourceUrl=function(){var _this$props=_this.props,gif=_this$props.componentData.gif,isMobile=_this$props.isMobile,_this$props$settings=_this$props.settings,settings=void 0===_this$props$settings?{}:_this$props$settings;if(!gif)return null;var _DEFAULT_RESOLUTION$s=_extends__default.default({},DEFAULT_RESOLUTION,settings),mobile=_DEFAULT_RESOLUTION$s.mobile,desktop=_DEFAULT_RESOLUTION$s.desktop,size=isMobile?mobile:desktop,originalMp4=gif.originalMp4,originalUrl=gif.originalUrl;return{original:originalMp4,downsizedSmall:gif.downsizedSmallMp4}[size]||originalUrl},wixRichContentCommon.validate(props.componentData,pluginGiphySchema__default.default),_this}_inheritsLoose__default.default(GiphyViewer,_Component);var _proto=GiphyViewer.prototype;return _proto.componentWillReceiveProps=function(nextProps){lodash.isEqual(nextProps.componentData,this.props.componentData)||wixRichContentCommon.validate(nextProps.componentData,pluginGiphySchema__default.default)},_proto.render=function(){this.styles=this.styles||wixRichContentCommon.mergeStyles({styles:styles,theme:this.props.theme});var _this$props2=this.props,componentData=_this$props2.componentData,setComponentUrl=_this$props2.setComponentUrl,gifUrl=this.getSourceUrl();return gifUrl?(null==setComponentUrl||setComponentUrl(gifUrl),gifUrl.endsWith(".mp4")?React__default.default.createElement("video",{role:"img",autoPlay:!0,muted:!0,loop:!0,playsInline:!0,"aria-label":"gif",className:this.styles.giphy_player,src:gifUrl}):React__default.default.createElement("img",{role:"img","aria-label":"gif",className:this.styles.giphy_player,src:componentData.gif.originalUrl,alt:"gif"})):null},GiphyViewer}(React.Component);GiphyViewer.defaultProps={width:"100%",height:"100%",controls:!0};var GIPHY_TYPE="wix-draft-plugin-giphy",typeMapper=function(){var _ref;return(_ref={})[GIPHY_TYPE]={component:GiphyViewer},_ref};exports.GIPHY_TYPE=GIPHY_TYPE,exports.giphyTypeMapper=typeMapper,exports.pluginGiphy=function(config){return{config:_extends__default.default({},DEFAULTS.configViewer,config),type:GIPHY_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")),DEFAULTS=Object.freeze({type:"line-spacing",config:{}});exports.pluginLineSpacing=function(config){return{config:_extends__default.default({},DEFAULTS.config,config),type:"line-spacing"}};
//# sourceMappingURL=module.viewer.cjs.js.map

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

import _extends from"@babel/runtime/helpers/extends";import _inheritsLoose from"@babel/runtime/helpers/inheritsLoose";import React,{Component}from"react";import{validate,mergeStyles}from"wix-rich-content-common";import pluginGiphySchema from"wix-rich-content-common/dist/statics/schemas/plugin-giphy.schema.json";import{isEqual}from"lodash";var styles={giphy_player:"_1JieR"},DEFAULTS=Object.freeze({config:{size:"content",alignment:"center"},configViewer:{sizes:{desktop:"original",mobile:"original"}}}),DEFAULT_RESOLUTION=Object.freeze({desktop:"original",mobile:"original"});Object.freeze({overlay:{backgroundColor:"transparent"},content:{top:0,left:0,overflow:"hidden",paddingRight:"6px"}});var commonDesktopModalStyles={width:"320px",boxSizing:"border-box",height:"364px",overflow:"visible",paddingRight:"12px",paddingLeft:"12px",display:"block",position:"absolute",zIndex:6,paddingTop:"12px"};Object.freeze({overlay:{backgroundColor:"rgba(0, 0, 0, 0)",zIndex:5},content:_extends({},commonDesktopModalStyles,{border:"solid 1px rgba(51, 51, 51, 0.1)",boxShadow:"0 0 10px 0 rgba(0, 0, 0, 0.06)"})}),Object.freeze({content:commonDesktopModalStyles});var GiphyViewer=function(_Component){function GiphyViewer(props){var _this;return(_this=_Component.call(this,props)||this).getSourceUrl=function(){var _this$props=_this.props,gif=_this$props.componentData.gif,isMobile=_this$props.isMobile,_this$props$settings=_this$props.settings;if(!gif)return null;var _DEFAULT_RESOLUTION$s=_extends({},DEFAULT_RESOLUTION,void 0===_this$props$settings?{}:_this$props$settings),mobile=_DEFAULT_RESOLUTION$s.mobile,desktop=_DEFAULT_RESOLUTION$s.desktop,size=isMobile?mobile:desktop,originalMp4=gif.originalMp4,originalUrl=gif.originalUrl;return{original:originalMp4,downsizedSmall:gif.downsizedSmallMp4}[size]||originalUrl},validate(props.componentData,pluginGiphySchema),_this}_inheritsLoose(GiphyViewer,_Component);var _proto=GiphyViewer.prototype;return _proto.componentWillReceiveProps=function(nextProps){isEqual(nextProps.componentData,this.props.componentData)||validate(nextProps.componentData,pluginGiphySchema)},_proto.render=function(){this.styles=this.styles||mergeStyles({styles:styles,theme:this.props.theme});var _this$props2=this.props,componentData=_this$props2.componentData,setComponentUrl=_this$props2.setComponentUrl,gifUrl=this.getSourceUrl();return gifUrl?(null==setComponentUrl||setComponentUrl(gifUrl),gifUrl.endsWith(".mp4")?React.createElement("video",{role:"img",autoPlay:!0,muted:!0,loop:!0,playsInline:!0,"aria-label":"gif",className:this.styles.giphy_player,src:gifUrl}):React.createElement("img",{role:"img","aria-label":"gif",className:this.styles.giphy_player,src:componentData.gif.originalUrl,alt:"gif"})):null},GiphyViewer}(Component);GiphyViewer.defaultProps={width:"100%",height:"100%",controls:!0};var GIPHY_TYPE="wix-draft-plugin-giphy",typeMapper=function(){var _ref;return(_ref={})[GIPHY_TYPE]={component:GiphyViewer},_ref},pluginGiphy=function(config){return{config:_extends({},DEFAULTS.configViewer,config),type:GIPHY_TYPE,typeMapper:typeMapper}};export{GIPHY_TYPE,typeMapper as giphyTypeMapper,pluginGiphy};
import _extends from"@babel/runtime/helpers/extends";var DEFAULTS=Object.freeze({type:"line-spacing",config:{}}),pluginLineSpacing=function(config){return{config:_extends({},DEFAULTS.config,config),type:"line-spacing"}};export{pluginLineSpacing};
//# sourceMappingURL=module.viewer.js.map

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

import { GiphyPluginEditorConfig } from './types';
import { LineSpacingPluginEditorConfig } from './types';
import { EditorPluginCreator } from 'wix-rich-content-common';
export declare const pluginGiphy: EditorPluginCreator<GiphyPluginEditorConfig>;
export declare const pluginLineSpacing: EditorPluginCreator<LineSpacingPluginEditorConfig>;
//# sourceMappingURL=editor.d.ts.map

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

export { createGiphyPlugin } from './createGiphyPlugin';
export { default as GiphyViewer } from './giphy-viewer';
export { GIPHY_TYPE } from './types';
export { createLineSpacingPlugin } from './createLineSpacingPlugin';
export { LINE_SPACING_TYPE } from './types';
export { Modals, ModalsMap } from './modals';
export { pluginGiphy } from './editor';
export { pluginLineSpacing } from './editor';
//# sourceMappingURL=index.d.ts.map

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

import GiphyApiInputModal from './toolbar/giphyApiInputModal';
import LineSpacingPanel from './toolbar/LineSpacingPanel';
declare const Modals: {
GIPHY_API_INPUT: string;
LINE_SPACING: string;
};
declare const ModalsMap: {
[x: string]: typeof GiphyApiInputModal;
[x: string]: typeof LineSpacingPanel;
};
export { Modals, ModalsMap };
//# sourceMappingURL=modals.d.ts.map
import { EditorPluginConfig, ViewerPluginConfig } from 'wix-rich-content-common';
export declare const GIPHY_TYPE = "wix-draft-plugin-giphy";
export interface GiphyPluginEditorConfig extends EditorPluginConfig {
export declare const LINE_SPACING_TYPE = "line-spacing";
export interface LineSpacingPluginEditorConfig extends EditorPluginConfig {
inlinePopups?: boolean;
[key: string]: any;
}
export interface GiphyPluginViewerConfig extends ViewerPluginConfig {
export interface LineSpacingPluginViewerConfig extends ViewerPluginConfig {
[key: string]: any;
}
export interface GIFObject {
type: string;
id: string;
slug: string;
url: string;
bitly_gif_url: string;
bitly_url: string;
embed_url: string;
username: string;
source: string;
rating: string;
caption: string;
content_url: string;
source_tld: string;
source_post_url: string;
import_datetime: string;
trending_datetime: string;
images: ImageObject;
meta: MetaObject;
title: string;
}
export interface ImageObject {
fixed_height: {
url: string;
width: string;
height: string;
size: string;
mp4: string;
mp4_size: string;
webp: string;
webp_size: string;
};
fixed_height_still: {
url: string;
width: string;
height: string;
};
fixed_height_downsampled: {
url: string;
width: string;
height: string;
size: string;
webp: string;
webp_size: string;
};
fixed_width: {
url: string;
width: string;
height: string;
size: string;
mp4: string;
mp4_size: string;
webp: string;
webp_size: string;
};
fixed_width_still: {
url: string;
width: string;
height: string;
};
fixed_width_downsampled: {
url: string;
width: string;
height: string;
size: string;
webp: string;
webp_size: string;
};
fixed_height_small: {
url: string;
width: string;
height: string;
size: string;
webp: string;
webp_size: string;
};
fixed_height_small_still: {
url: string;
width: string;
height: string;
};
fixed_width_small: {
url: string;
width: string;
height: string;
size: string;
webp: string;
webp_size: string;
};
fixed_width_small_still: {
url: string;
width: string;
height: string;
};
downsized: {
url: string;
width: string;
height: string;
size: string;
};
downsized_still: {
url: string;
width: string;
height: string;
};
downsized_large: {
url: string;
width: string;
height: string;
size: string;
};
original: {
url: string;
width: string;
height: string;
size: string;
frames: string;
mp4: string;
mp4_size: string;
webp: string;
webp_size: string;
};
original_still: {
url: string;
width: string;
height: string;
};
}
export interface MetaObject {
msg: string;
status: number;
response_id: string;
}
//# sourceMappingURL=types.d.ts.map

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

import { typeMapper } from './typeMapper';
import { GIPHY_TYPE, GiphyPluginViewerConfig } from './types';
import { LineSpacingPluginViewerConfig } from './types';
import { ViewerPluginCreator } from 'wix-rich-content-common';
export { typeMapper as giphyTypeMapper, GIPHY_TYPE };
export declare const pluginGiphy: ViewerPluginCreator<GiphyPluginViewerConfig>;
export declare const pluginLineSpacing: ViewerPluginCreator<LineSpacingPluginViewerConfig>;
//# sourceMappingURL=viewer.d.ts.map

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

{"name":"richlagetest","version":"0.0.0-c3497ae916083b3348946dca8135c80bbe4d3833"}
{"name":"richlagetest","version":"0.0.0-c80ebe0f334c651e467a7f8a85a31b62795915b5"}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc