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-5cec144654d3c83acaec9c34d801588198416d8b to 0.0.0-5fb84c120c5f98649ffa6814156f39e32214f189

dist/src/constants.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"),wixRichContentPluginCommons=require("wix-rich-content-plugin-commons"),React=require("react");function _interopDefaultLegacy(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var _extends__default=_interopDefaultLegacy(_extends),React__default=_interopDefaultLegacy(React);var headersRegEx=/{\$h\d}.*?{\$h}/g,headersMarkdownStrategy=function(contentBlock,callback){!function(text,regex,callback){for(var matchArr,start;null!==(matchArr=regex.exec(text));)callback(start=matchArr.index,start+matchArr[0].length)}(contentBlock.getText(),headersRegEx,callback)},DEFAULTS={config:{},configViewer:{hideMarkdown:!0}},createHeadersMarkdownDecorator=function(config){var _config$type=config["wix-draft-plugin-headers-markdown"],settings=void 0===_config$type?{}:_config$type;return{strategy:headersMarkdownStrategy,component:function(props){return function(_ref){var children=_ref.children,hideMarkdown=_ref.hideMarkdown,sliceElementText=function(element,start,end){if("string"==typeof element)return element.slice(start,end);if(element.props&&element.props.text){var text=element.props.text.slice(start,end);return React__default.default.cloneElement(element,{text:text})}return element},Type=_ref.decoratedText.match(/h\d/)[0];if(hideMarkdown){var lastIndex=children.length-1;children[0]=sliceElementText(children[0],5),children[lastIndex]=sliceElementText(children[lastIndex],0,-4)}return React__default.default.createElement(Type,null,children)}(_extends__default.default({},props,settings))}}},createHeadersMarkdownPlugin=function(config){var _config$type=config["wix-draft-plugin-headers-markdown"],settings=void 0===_config$type?{}:_config$type,plugin={decorators:[createHeadersMarkdownDecorator(config)]};return wixRichContentPluginCommons.createBasePlugin(_extends__default.default({settings:settings,type:"wix-draft-plugin-headers-markdown",defaultPluginData:DEFAULTS},config),plugin)};createHeadersMarkdownPlugin.functionName="wix-draft-plugin-headers-markdown";exports.HEADERS_MARKDOWN_TYPE="wix-draft-plugin-headers-markdown",exports.createHeadersMarkdownDecorator=createHeadersMarkdownDecorator,exports.createHeadersMarkdownPlugin=createHeadersMarkdownPlugin,exports.pluginHeadersMarkdown=function(config){return{config:_extends__default.default({},DEFAULTS.config,config),type:"wix-draft-plugin-headers-markdown",createPlugin:createHeadersMarkdownPlugin,ModalsMap:{}}};
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var _extends=require("@babel/runtime/helpers/extends"),_objectWithoutPropertiesLoose=require("@babel/runtime/helpers/objectWithoutPropertiesLoose"),React=require("react"),wixRichContentEditorCommon=require("wix-rich-content-editor-common"),_inheritsLoose=require("@babel/runtime/helpers/inheritsLoose"),wixRichContentCommon=require("wix-rich-content-common"),Modal=require("react-modal"),classNames=require("classnames"),wixRichContentPluginCommons=require("wix-rich-content-plugin-commons");function _interopDefaultLegacy(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var _extends__default=_interopDefaultLegacy(_extends),_objectWithoutPropertiesLoose__default=_interopDefaultLegacy(_objectWithoutPropertiesLoose),React__default=_interopDefaultLegacy(React),_inheritsLoose__default=_interopDefaultLegacy(_inheritsLoose),Modal__default=_interopDefaultLegacy(Modal),classNames__default=_interopDefaultLegacy(classNames),HEADING_TYPE_TO_ELEMENT=Object.freeze({"header-one":"H1","header-two":"H2","header-three":"H3","header-four":"H4","header-five":"H5","header-six":"H6",unstyled:"P"});Object.freeze({H1:"header-one",H2:"header-two",H3:"header-three",H4:"header-four",H5:"header-five",H6:"header-six",P:"unstyled"});var DEFAULT_HEADERS_DROPDOWN_OPTIONS=Object.freeze(["P","H1","H2","H3","H4","H5","H6"]),styles$1={fontElementMap:"_1v6jk",headingsPanel:"_1uJph",headingsPanel_selectedHeading:"_vFRU",headingsMobilePanel:"_6OoV",headingsPanelContainer:"_2lsQ2",headingsPanelContainer_mobile:"_1gtbV"},Panel=function(_Component){function Panel(){return _Component.apply(this,arguments)||this}return _inheritsLoose__default.default(Panel,_Component),Panel.prototype.render=function(){var _this$props=this.props,customHeadingsOptions=_this$props.customHeadingsOptions,selected=_this$props.selected,onSave=_this$props.onSave,styles=_this$props.styles,translateHeading=_this$props.translateHeading,isMobile=_this$props.isMobile;return React__default.default.createElement("div",{className:isMobile?styles.headingsMobilePanel:styles.headingsPanel,"data-hook":"headingsDropdownPanel"},customHeadingsOptions.map((function(heading){return function(heading,isSelected,_onClick,translateHeading){var content=translateHeading(heading),type=wixRichContentPluginCommons.HEADER_TYPE_MAP[heading];return React__default.default.createElement("button",{className:isSelected?styles$1.headingsPanel_selectedHeading:"",onClick:function(){return _onClick(type,heading)}},content)}(heading,selected===heading,onSave,translateHeading)})))},Panel}(React.Component),HeadingsDropDownPanel=function(_Component2){function HeadingsDropDownPanel(props){var _this;return(_this=_Component2.call(this,props)||this).onSaveHeading=function(type,headingName){return _this.props.onSave(type,headingName)},_this.state={heading:props.heading},_this.styles=wixRichContentCommon.mergeStyles({styles:styles$1,theme:props.theme}),_this}return _inheritsLoose__default.default(HeadingsDropDownPanel,_Component2),HeadingsDropDownPanel.prototype.render=function(){var _classNames,_this$props2=this.props,isMobile=_this$props2.isMobile,translateHeading=_this$props2.translateHeading,_this$props2$customHe=_this$props2.customHeadingsOptions,customHeadingsOptions=void 0===_this$props2$customHe?DEFAULT_HEADERS_DROPDOWN_OPTIONS:_this$props2$customHe,heading=this.state.heading,styles=this.styles,selected=heading;return React__default.default.createElement("div",{className:classNames__default.default(styles.headingsPanelContainer,(_classNames={},_classNames[styles.headingsPanelContainer_mobile]=isMobile,_classNames))},React__default.default.createElement(Panel,{styles:styles,selected:selected,onSave:this.onSaveHeading,isMobile:isMobile,translateHeading:translateHeading,customHeadingsOptions:customHeadingsOptions}))},HeadingsDropDownPanel}(React.Component);HeadingsDropDownPanel.contextType=wixRichContentCommon.GlobalContext,HeadingsDropDownPanel.defaultProps={heading:"P"};var styles={headingsModal:"_2smey",headingsModal_mobile:"_3WuK0",headingsModalOverlay:"_3Zx8x",headingsModalOverlay_mobile:"_3Qcwo",headingPopup_button:"_3Vgep",headingPopup:"_1uePs"},HeadingButton=function(_Component){function HeadingButton(props){var _this;return(_this=_Component.call(this,props)||this).findCurrentHeading=function(){var currentEditorState=_this.props.getEditorState(),selection=currentEditorState.getSelection(),headingType=currentEditorState.getCurrentContent().blockMap.get(selection.anchorKey).getType(),currentHeading=HEADING_TYPE_TO_ELEMENT[headingType]||"P";_this.setState({currentHeading:currentHeading})},_this.openPanel=function(){_this.currentEditorState=_this.oldEditorState=_this.props.getEditorState(),_this.selection=_this.oldEditorState.getSelection();var _this$buttonRef$getBo=_this.buttonRef.getBoundingClientRect(),bottom=_this$buttonRef$getBo.bottom,left=_this$buttonRef$getBo.left;_this.props.setKeepOpen(!0),_this.setState({isPanelOpen:!0,panelLeft:left-15,panelTop:bottom})},_this.closePanel=function(){_this.setState({isPanelOpen:!1}),_this.props.setKeepOpen(!1)},_this.updateHeading=function(type,element){var _helpers$onToolbarBut,_helpers$onPluginAdd,_helpers$onPluginAddS,_this$props=_this.props,setEditorState=_this$props.setEditorState,getEditorState=_this$props.getEditorState,helpers=_this$props.helpers,editorState=getEditorState(),isAddEvent=!wixRichContentEditorCommon.hasBlockType(type,editorState),newEditorState=wixRichContentEditorCommon.RichUtils.toggleBlockType(editorState,type);null==helpers||null===(_helpers$onToolbarBut=helpers.onToolbarButtonClick)||void 0===_helpers$onToolbarBut||_helpers$onToolbarBut.call(helpers,{pluginId:wixRichContentCommon.HEADINGS_DROPDOWN_TYPE,buttonName:wixRichContentEditorCommon.FORMATTING_BUTTONS.HEADINGS,value:type}),isAddEvent&&(null==helpers||null===(_helpers$onPluginAdd=helpers.onPluginAdd)||void 0===_helpers$onPluginAdd||_helpers$onPluginAdd.call(helpers,type,"FormattingToolbar")),setEditorState(wixRichContentEditorCommon.EditorState.forceSelection(newEditorState,_this.selection)),isAddEvent&&(null==helpers||null===(_helpers$onPluginAddS=helpers.onPluginAddSuccess)||void 0===_helpers$onPluginAddS||_helpers$onPluginAddS.call(helpers,type,"FormattingToolbar")),_this.currentEditorState=newEditorState,_this.setState({currentHeading:element})},_this.translateHeading=function(option){void 0===option&&(option="");var t=_this.props.t;return 1===option.length?t("FormattingToolbar_TextStyle_Paragraph"):t("FormattingToolbar_TextStyle_Heading",{number:option.slice(-1)})},_this.fixEllipsis=function(text){if(void 0===text&&(text=""),text.length>10){var number=text.slice(-1);return"number"==typeof number?text.slice(0,5)+"..."+number:text.slice(0,6)+"..."}return text},_this.save=function(type,element){_this.closePanel(),type?_this.updateHeading(type,element):_this.props.setEditorState(wixRichContentEditorCommon.EditorState.forceSelection(_this.currentEditorState,_this.selection))},_this.state={showPanel:!1,currentHeading:"P"},_this.styles=wixRichContentCommon.mergeStyles({styles:styles,theme:props.theme}),_this.dataHookText="headingsDropdownButton",_this}_inheritsLoose__default.default(HeadingButton,_Component);var _proto=HeadingButton.prototype;return _proto.componentWillReceiveProps=function(){this.findCurrentHeading()},HeadingButton.getModalParent=function(){return document.querySelector(".DraftEditor-root").parentNode},_proto.render=function(){var _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,toolbarName=_this$props2.toolbarName,customHeadings=_this$props2.customHeadings,inlinePopups=_this$props2.inlinePopups,tooltipText=t("FormattingToolbar_TextStyleButton_Tooltip"),_this$state=this.state,isPanelOpen=_this$state.isPanelOpen,panelTop=_this$state.panelTop,panelLeft=_this$state.panelLeft,currentHeading=_this$state.currentHeading,styles=this.styles,modalStyle=isMobile?{left:0,bottom:0,right:0}:{top:panelTop,left:panelLeft},buttonContent=this.fixEllipsis(this.translateHeading(currentHeading));return isMobile||"StaticTextToolbar"!==toolbarName||!inlinePopups?React__default.default.createElement(wixRichContentEditorCommon.InlineToolbarButton,{onClick:this.openPanel,isActive:isPanelOpen,helpers:helpers,theme:theme,isMobile:isMobile,tooltipText:tooltipText,dataHook:this.dataHookText,formattingButtonName:wixRichContentEditorCommon.FORMATTING_BUTTONS.HEADINGS,tabIndex:tabIndex,buttonContent:buttonContent,showArrowIcon:!0,pluginType:wixRichContentCommon.HEADINGS_DROPDOWN_TYPE,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.headingsModal,(_classNames={},_classNames[styles.headingsModal_mobile]=isMobile,_classNames)),overlayClassName:classNames__default.default(styles.headingsModalOverlay,(_classNames2={},_classNames2[styles.headingsModalOverlay_mobile]=isMobile,_classNames2)),parentSelector:HeadingButton.getModalParent,style:{content:modalStyle},ariaHideApp:!1},React__default.default.createElement(HeadingsDropDownPanel,_extends__default.default({customHeadingsOptions:customHeadings,heading:currentHeading,onSave:this.save,isMobile:isMobile,theme:theme,translateHeading:this.translateHeading},this.props)))):React__default.default.createElement("div",{className:styles.headingPopup_button},React__default.default.createElement(wixRichContentEditorCommon.InlineToolbarButton,{onClick:this.openPanel,isActive:isPanelOpen,helpers:helpers,theme:theme,isMobile:isMobile,tooltipText:tooltipText,dataHook:this.dataHookText,formattingButtonName:wixRichContentEditorCommon.FORMATTING_BUTTONS.HEADINGS,tabIndex:tabIndex,buttonContent:buttonContent,showArrowIcon:!0,pluginType:wixRichContentCommon.HEADINGS_DROPDOWN_TYPE,ref:function(_ref2){return _this2.buttonRef=_ref2}},isPanelOpen&&React__default.default.createElement("div",{className:styles.headingPopup},React__default.default.createElement(wixRichContentEditorCommon.ClickOutside,{onClickOutside:function(){return _this2.save()}},React__default.default.createElement(HeadingsDropDownPanel,_extends__default.default({customHeadingsOptions:customHeadings,heading:currentHeading,onSave:this.save,isMobile:isMobile,theme:theme,translateHeading:this.translateHeading},this.props))))))},HeadingButton}(React.Component);HeadingButton.defaultProps={inlinePopups:!1,setKeepOpen:function(){}};var HEADINGS_DROPDOWN_TYPE="wix-rich-content-plugin-headings",createToolbar=function(config){var _isActive,oldEditorState,oldSelection,theme=config.theme,getEditorState=config.getEditorState,isMobile=config.isMobile,_config$HEADINGS_DROP=config[HEADINGS_DROPDOWN_TYPE],settings=void 0===_config$HEADINGS_DROP?{}:_config$HEADINGS_DROP,helpers=config.helpers,t=config.t,setEditorState=config.setEditorState,save=function(type,element){var _helpers$closeModal;null==helpers||null===(_helpers$closeModal=helpers.closeModal)||void 0===_helpers$closeModal||_helpers$closeModal.call(helpers),_isActive=!1,type?updateHeading(type,element):setEditorState(wixRichContentEditorCommon.EditorState.forceSelection(oldEditorState,oldSelection))},updateHeading=function(type,element){var newEditorState=wixRichContentEditorCommon.RichUtils.toggleBlockType(getEditorState(),type);setEditorState(wixRichContentEditorCommon.EditorState.forceSelection(newEditorState,oldSelection)),oldEditorState=newEditorState,currentHeading=element},getCurrentHeading=function(){var _editorState$getCurre,editorState=getEditorState(),selection=editorState.getSelection(),headingType=null===(_editorState$getCurre=editorState.getCurrentContent().getBlockMap())||void 0===_editorState$getCurre?void 0:_editorState$getCurre.get(selection.getFocusKey()).getType();return HEADING_TYPE_TO_ELEMENT[headingType]||"P"},translateHeading=function(option){return void 0===option&&(option="P"),"P"===option?t("FormattingToolbar_TextStyle_Paragraph"):t("FormattingToolbar_TextStyle_Heading",{number:option.slice(-1)})},currentHeading="P",HeadingPanel=function(){return oldEditorState=getEditorState(),oldSelection=oldEditorState.getSelection(),currentHeading=getCurrentHeading(),React__default.default.createElement(HeadingsDropDownPanel,{customHeadingsOptions:null==settings?void 0:settings.customHeadings,heading:currentHeading,onSave:save,isMobile:isMobile,theme:theme,translateHeading:translateHeading})},modalStylesFn=function(ref){var _ref$getBoundingClien=ref.getBoundingClientRect(),bottom=_ref$getBoundingClien.bottom;return{content:{margin:0,width:142,overflow:"visible",transform:"translateY(0)",left:_ref$getBoundingClien.left-15,top:bottom},overlay:{background:"transparent"}}};return{name:"Headings",TextButtonMapper:function(){var _ref2;return(_ref2={})[wixRichContentEditorCommon.FORMATTING_BUTTONS.HEADINGS]={component:wixRichContentEditorCommon.decorateComponentWithProps(HeadingButton,settings),externalizedButtonProps:{onClose:function(){return _isActive=!1},onClick:function(_ref){return function(ref){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:HeadingPanel,theme:theme}),_isActive=!0}(_ref.ref)},isActive:function(){return _isActive},arrow:!0,isDisabled:function(){return wixRichContentEditorCommon.isAtomicBlockFocused(getEditorState())},getIcon:function(){var _settings$toolbar,_settings$toolbar$ico;return(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[getCurrentHeading()])||function(){return null}},tooltip:t("FormattingToolbar_TextStyleButton_Tooltip"),dataHook:"headingsDropdownButton",getLabel:function(){return translateHeading(getCurrentHeading())},type:wixRichContentEditorCommon.BUTTON_TYPES.DROPDOWN}},_ref2}}},DEFAULTS=Object.freeze({type:HEADINGS_DROPDOWN_TYPE,config:{}});function _toPropertyKey(arg){var key=function(input,hint){if("object"!=typeof input||null===input)return input;var prim=input[Symbol.toPrimitive];if(void 0!==prim){var res=prim.call(input,hint||"default");if("object"!=typeof res)return res;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===hint?String:Number)(input)}(arg,"string");return"symbol"==typeof key?key:String(key)}var _ModalsMap,createHeadingsPlugin=function(config){var helpers=config.helpers,t=config.t,_config$HEADINGS_DROP=config[HEADINGS_DROPDOWN_TYPE],settings=void 0===_config$HEADINGS_DROP?{}:_config$HEADINGS_DROP,isMobile=config.isMobile,rest=_objectWithoutPropertiesLoose__default.default(config,["helpers","t",HEADINGS_DROPDOWN_TYPE,"isMobile"].map(_toPropertyKey));return wixRichContentPluginCommons.createBasePlugin(_extends__default.default({toolbar:createToolbar(config),helpers:helpers,settings:settings,t:t,isMobile:isMobile,type:HEADINGS_DROPDOWN_TYPE,defaultPluginData:DEFAULTS},rest))};createHeadingsPlugin.functionName=HEADINGS_DROPDOWN_TYPE;var Modals={HEADINGS:"HEADINGS"},ModalsMap=((_ModalsMap={})[Modals.HEADINGS]=HeadingsDropDownPanel,_ModalsMap);exports.HEADINGS_DROPDOWN_TYPE=HEADINGS_DROPDOWN_TYPE,exports.Modals=Modals,exports.ModalsMap=ModalsMap,exports.createHeadingsPlugin=createHeadingsPlugin,exports.pluginHeadings=function(config){return{config:_extends__default.default({},DEFAULTS.config,config),type:HEADINGS_DROPDOWN_TYPE,createPlugin:createHeadingsPlugin,ModalsMap:ModalsMap}};
//# sourceMappingURL=module.cjs.js.map

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

import _extends from"@babel/runtime/helpers/extends";import{createBasePlugin}from"wix-rich-content-plugin-commons";import React from"react";var headersRegEx=/{\$h\d}.*?{\$h}/g,headersMarkdownStrategy=function(contentBlock,callback){!function(text,regex,callback){for(var matchArr,start;null!==(matchArr=regex.exec(text));)callback(start=matchArr.index,start+matchArr[0].length)}(contentBlock.getText(),headersRegEx,callback)},DEFAULTS={config:{},configViewer:{hideMarkdown:!0}},createHeadersMarkdownDecorator=function(config){var _config$type=config["wix-draft-plugin-headers-markdown"],settings=void 0===_config$type?{}:_config$type;return{strategy:headersMarkdownStrategy,component:function(props){return function(_ref){var children=_ref.children,hideMarkdown=_ref.hideMarkdown,sliceElementText=function(element,start,end){if("string"==typeof element)return element.slice(start,end);if(element.props&&element.props.text){var text=element.props.text.slice(start,end);return React.cloneElement(element,{text:text})}return element},Type=_ref.decoratedText.match(/h\d/)[0];if(hideMarkdown){var lastIndex=children.length-1;children[0]=sliceElementText(children[0],5),children[lastIndex]=sliceElementText(children[lastIndex],0,-4)}return React.createElement(Type,null,children)}(_extends({},props,settings))}}},createHeadersMarkdownPlugin=function(config){var _config$type=config["wix-draft-plugin-headers-markdown"],settings=void 0===_config$type?{}:_config$type,plugin={decorators:[createHeadersMarkdownDecorator(config)]};return createBasePlugin(_extends({settings:settings,type:"wix-draft-plugin-headers-markdown",defaultPluginData:DEFAULTS},config),plugin)};createHeadersMarkdownPlugin.functionName="wix-draft-plugin-headers-markdown";var pluginHeadersMarkdown=function(config){return{config:_extends({},DEFAULTS.config,config),type:"wix-draft-plugin-headers-markdown",createPlugin:createHeadersMarkdownPlugin,ModalsMap:{}}},HEADERS_MARKDOWN_TYPE="wix-draft-plugin-headers-markdown";export{HEADERS_MARKDOWN_TYPE,createHeadersMarkdownDecorator,createHeadersMarkdownPlugin,pluginHeadersMarkdown};
import _extends from"@babel/runtime/helpers/extends";import _objectWithoutPropertiesLoose from"@babel/runtime/helpers/objectWithoutPropertiesLoose";import React,{Component}from"react";import{hasBlockType,RichUtils,FORMATTING_BUTTONS,EditorState,InlineToolbarButton,ClickOutside,decorateComponentWithProps,isAtomicBlockFocused,BUTTON_TYPES,getModalStyles}from"wix-rich-content-editor-common";import _inheritsLoose from"@babel/runtime/helpers/inheritsLoose";import{mergeStyles,GlobalContext,HEADINGS_DROPDOWN_TYPE as HEADINGS_DROPDOWN_TYPE$1}from"wix-rich-content-common";import Modal from"react-modal";import classNames from"classnames";import{HEADER_TYPE_MAP,createBasePlugin}from"wix-rich-content-plugin-commons";var HEADING_TYPE_TO_ELEMENT=Object.freeze({"header-one":"H1","header-two":"H2","header-three":"H3","header-four":"H4","header-five":"H5","header-six":"H6",unstyled:"P"});Object.freeze({H1:"header-one",H2:"header-two",H3:"header-three",H4:"header-four",H5:"header-five",H6:"header-six",P:"unstyled"});var DEFAULT_HEADERS_DROPDOWN_OPTIONS=Object.freeze(["P","H1","H2","H3","H4","H5","H6"]),styles$1={fontElementMap:"_1v6jk",headingsPanel:"_1uJph",headingsPanel_selectedHeading:"_vFRU",headingsMobilePanel:"_6OoV",headingsPanelContainer:"_2lsQ2",headingsPanelContainer_mobile:"_1gtbV"},Panel=function(_Component){function Panel(){return _Component.apply(this,arguments)||this}return _inheritsLoose(Panel,_Component),Panel.prototype.render=function(){var _this$props=this.props,customHeadingsOptions=_this$props.customHeadingsOptions,selected=_this$props.selected,onSave=_this$props.onSave,styles=_this$props.styles,translateHeading=_this$props.translateHeading,isMobile=_this$props.isMobile;return React.createElement("div",{className:isMobile?styles.headingsMobilePanel:styles.headingsPanel,"data-hook":"headingsDropdownPanel"},customHeadingsOptions.map((function(heading){return function(heading,isSelected,_onClick,translateHeading){var content=translateHeading(heading),type=HEADER_TYPE_MAP[heading];return React.createElement("button",{className:isSelected?styles$1.headingsPanel_selectedHeading:"",onClick:function(){return _onClick(type,heading)}},content)}(heading,selected===heading,onSave,translateHeading)})))},Panel}(Component),HeadingsDropDownPanel=function(_Component2){function HeadingsDropDownPanel(props){var _this;return(_this=_Component2.call(this,props)||this).onSaveHeading=function(type,headingName){return _this.props.onSave(type,headingName)},_this.state={heading:props.heading},_this.styles=mergeStyles({styles:styles$1,theme:props.theme}),_this}return _inheritsLoose(HeadingsDropDownPanel,_Component2),HeadingsDropDownPanel.prototype.render=function(){var _classNames,_this$props2=this.props,isMobile=_this$props2.isMobile,translateHeading=_this$props2.translateHeading,_this$props2$customHe=_this$props2.customHeadingsOptions,customHeadingsOptions=void 0===_this$props2$customHe?DEFAULT_HEADERS_DROPDOWN_OPTIONS:_this$props2$customHe,heading=this.state.heading,styles=this.styles,selected=heading;return React.createElement("div",{className:classNames(styles.headingsPanelContainer,(_classNames={},_classNames[styles.headingsPanelContainer_mobile]=isMobile,_classNames))},React.createElement(Panel,{styles:styles,selected:selected,onSave:this.onSaveHeading,isMobile:isMobile,translateHeading:translateHeading,customHeadingsOptions:customHeadingsOptions}))},HeadingsDropDownPanel}(Component);HeadingsDropDownPanel.contextType=GlobalContext,HeadingsDropDownPanel.defaultProps={heading:"P"};var styles={headingsModal:"_2smey",headingsModal_mobile:"_3WuK0",headingsModalOverlay:"_3Zx8x",headingsModalOverlay_mobile:"_3Qcwo",headingPopup_button:"_3Vgep",headingPopup:"_1uePs"},HeadingButton=function(_Component){function HeadingButton(props){var _this;return(_this=_Component.call(this,props)||this).findCurrentHeading=function(){var currentEditorState=_this.props.getEditorState(),selection=currentEditorState.getSelection(),headingType=currentEditorState.getCurrentContent().blockMap.get(selection.anchorKey).getType(),currentHeading=HEADING_TYPE_TO_ELEMENT[headingType]||"P";_this.setState({currentHeading:currentHeading})},_this.openPanel=function(){_this.currentEditorState=_this.oldEditorState=_this.props.getEditorState(),_this.selection=_this.oldEditorState.getSelection();var _this$buttonRef$getBo=_this.buttonRef.getBoundingClientRect(),bottom=_this$buttonRef$getBo.bottom,left=_this$buttonRef$getBo.left;_this.props.setKeepOpen(!0),_this.setState({isPanelOpen:!0,panelLeft:left-15,panelTop:bottom})},_this.closePanel=function(){_this.setState({isPanelOpen:!1}),_this.props.setKeepOpen(!1)},_this.updateHeading=function(type,element){var _helpers$onToolbarBut,_helpers$onPluginAdd,_helpers$onPluginAddS,_this$props=_this.props,setEditorState=_this$props.setEditorState,getEditorState=_this$props.getEditorState,helpers=_this$props.helpers,editorState=getEditorState(),isAddEvent=!hasBlockType(type,editorState),newEditorState=RichUtils.toggleBlockType(editorState,type);null==helpers||null===(_helpers$onToolbarBut=helpers.onToolbarButtonClick)||void 0===_helpers$onToolbarBut||_helpers$onToolbarBut.call(helpers,{pluginId:HEADINGS_DROPDOWN_TYPE$1,buttonName:FORMATTING_BUTTONS.HEADINGS,value:type}),isAddEvent&&(null==helpers||null===(_helpers$onPluginAdd=helpers.onPluginAdd)||void 0===_helpers$onPluginAdd||_helpers$onPluginAdd.call(helpers,type,"FormattingToolbar")),setEditorState(EditorState.forceSelection(newEditorState,_this.selection)),isAddEvent&&(null==helpers||null===(_helpers$onPluginAddS=helpers.onPluginAddSuccess)||void 0===_helpers$onPluginAddS||_helpers$onPluginAddS.call(helpers,type,"FormattingToolbar")),_this.currentEditorState=newEditorState,_this.setState({currentHeading:element})},_this.translateHeading=function(option){void 0===option&&(option="");var t=_this.props.t;return 1===option.length?t("FormattingToolbar_TextStyle_Paragraph"):t("FormattingToolbar_TextStyle_Heading",{number:option.slice(-1)})},_this.fixEllipsis=function(text){if(void 0===text&&(text=""),text.length>10){var number=text.slice(-1);return"number"==typeof number?text.slice(0,5)+"..."+number:text.slice(0,6)+"..."}return text},_this.save=function(type,element){_this.closePanel(),type?_this.updateHeading(type,element):_this.props.setEditorState(EditorState.forceSelection(_this.currentEditorState,_this.selection))},_this.state={showPanel:!1,currentHeading:"P"},_this.styles=mergeStyles({styles:styles,theme:props.theme}),_this.dataHookText="headingsDropdownButton",_this}_inheritsLoose(HeadingButton,_Component);var _proto=HeadingButton.prototype;return _proto.componentWillReceiveProps=function(){this.findCurrentHeading()},HeadingButton.getModalParent=function(){return document.querySelector(".DraftEditor-root").parentNode},_proto.render=function(){var _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,toolbarName=_this$props2.toolbarName,customHeadings=_this$props2.customHeadings,inlinePopups=_this$props2.inlinePopups,tooltipText=t("FormattingToolbar_TextStyleButton_Tooltip"),_this$state=this.state,isPanelOpen=_this$state.isPanelOpen,panelTop=_this$state.panelTop,panelLeft=_this$state.panelLeft,currentHeading=_this$state.currentHeading,styles=this.styles,modalStyle=isMobile?{left:0,bottom:0,right:0}:{top:panelTop,left:panelLeft},buttonContent=this.fixEllipsis(this.translateHeading(currentHeading));return isMobile||"StaticTextToolbar"!==toolbarName||!inlinePopups?React.createElement(InlineToolbarButton,{onClick:this.openPanel,isActive:isPanelOpen,helpers:helpers,theme:theme,isMobile:isMobile,tooltipText:tooltipText,dataHook:this.dataHookText,formattingButtonName:FORMATTING_BUTTONS.HEADINGS,tabIndex:tabIndex,buttonContent:buttonContent,showArrowIcon:!0,pluginType:HEADINGS_DROPDOWN_TYPE$1,ref:function(_ref){return _this2.buttonRef=_ref}},React.createElement(Modal,{isOpen:isPanelOpen,onRequestClose:function(){return _this2.save()},className:classNames(styles.headingsModal,(_classNames={},_classNames[styles.headingsModal_mobile]=isMobile,_classNames)),overlayClassName:classNames(styles.headingsModalOverlay,(_classNames2={},_classNames2[styles.headingsModalOverlay_mobile]=isMobile,_classNames2)),parentSelector:HeadingButton.getModalParent,style:{content:modalStyle},ariaHideApp:!1},React.createElement(HeadingsDropDownPanel,_extends({customHeadingsOptions:customHeadings,heading:currentHeading,onSave:this.save,isMobile:isMobile,theme:theme,translateHeading:this.translateHeading},this.props)))):React.createElement("div",{className:styles.headingPopup_button},React.createElement(InlineToolbarButton,{onClick:this.openPanel,isActive:isPanelOpen,helpers:helpers,theme:theme,isMobile:isMobile,tooltipText:tooltipText,dataHook:this.dataHookText,formattingButtonName:FORMATTING_BUTTONS.HEADINGS,tabIndex:tabIndex,buttonContent:buttonContent,showArrowIcon:!0,pluginType:HEADINGS_DROPDOWN_TYPE$1,ref:function(_ref2){return _this2.buttonRef=_ref2}},isPanelOpen&&React.createElement("div",{className:styles.headingPopup},React.createElement(ClickOutside,{onClickOutside:function(){return _this2.save()}},React.createElement(HeadingsDropDownPanel,_extends({customHeadingsOptions:customHeadings,heading:currentHeading,onSave:this.save,isMobile:isMobile,theme:theme,translateHeading:this.translateHeading},this.props))))))},HeadingButton}(Component);HeadingButton.defaultProps={inlinePopups:!1,setKeepOpen:function(){}};var HEADINGS_DROPDOWN_TYPE="wix-rich-content-plugin-headings",createToolbar=function(config){var _isActive,oldEditorState,oldSelection,theme=config.theme,getEditorState=config.getEditorState,isMobile=config.isMobile,_config$HEADINGS_DROP=config[HEADINGS_DROPDOWN_TYPE],settings=void 0===_config$HEADINGS_DROP?{}:_config$HEADINGS_DROP,helpers=config.helpers,t=config.t,setEditorState=config.setEditorState,save=function(type,element){var _helpers$closeModal;null==helpers||null===(_helpers$closeModal=helpers.closeModal)||void 0===_helpers$closeModal||_helpers$closeModal.call(helpers),_isActive=!1,type?updateHeading(type,element):setEditorState(EditorState.forceSelection(oldEditorState,oldSelection))},updateHeading=function(type,element){var newEditorState=RichUtils.toggleBlockType(getEditorState(),type);setEditorState(EditorState.forceSelection(newEditorState,oldSelection)),oldEditorState=newEditorState,currentHeading=element},getCurrentHeading=function(){var _editorState$getCurre,editorState=getEditorState(),selection=editorState.getSelection(),headingType=null===(_editorState$getCurre=editorState.getCurrentContent().getBlockMap())||void 0===_editorState$getCurre?void 0:_editorState$getCurre.get(selection.getFocusKey()).getType();return HEADING_TYPE_TO_ELEMENT[headingType]||"P"},translateHeading=function(option){return void 0===option&&(option="P"),"P"===option?t("FormattingToolbar_TextStyle_Paragraph"):t("FormattingToolbar_TextStyle_Heading",{number:option.slice(-1)})},currentHeading="P",HeadingPanel=function(){return oldEditorState=getEditorState(),oldSelection=oldEditorState.getSelection(),currentHeading=getCurrentHeading(),React.createElement(HeadingsDropDownPanel,{customHeadingsOptions:null==settings?void 0:settings.customHeadings,heading:currentHeading,onSave:save,isMobile:isMobile,theme:theme,translateHeading:translateHeading})},modalStylesFn=function(ref){var _ref$getBoundingClien=ref.getBoundingClientRect(),bottom=_ref$getBoundingClien.bottom;return{content:{margin:0,width:142,overflow:"visible",transform:"translateY(0)",left:_ref$getBoundingClien.left-15,top:bottom},overlay:{background:"transparent"}}};return{name:"Headings",TextButtonMapper:function(){var _ref2;return(_ref2={})[FORMATTING_BUTTONS.HEADINGS]={component:decorateComponentWithProps(HeadingButton,settings),externalizedButtonProps:{onClose:function(){return _isActive=!1},onClick:function(_ref){return function(ref){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:HeadingPanel,theme:theme}),_isActive=!0}(_ref.ref)},isActive:function(){return _isActive},arrow:!0,isDisabled:function(){return isAtomicBlockFocused(getEditorState())},getIcon:function(){var _settings$toolbar,_settings$toolbar$ico;return(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[getCurrentHeading()])||function(){return null}},tooltip:t("FormattingToolbar_TextStyleButton_Tooltip"),dataHook:"headingsDropdownButton",getLabel:function(){return translateHeading(getCurrentHeading())},type:BUTTON_TYPES.DROPDOWN}},_ref2}}},DEFAULTS=Object.freeze({type:HEADINGS_DROPDOWN_TYPE,config:{}});function _toPropertyKey(arg){var key=function(input,hint){if("object"!=typeof input||null===input)return input;var prim=input[Symbol.toPrimitive];if(void 0!==prim){var res=prim.call(input,hint||"default");if("object"!=typeof res)return res;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===hint?String:Number)(input)}(arg,"string");return"symbol"==typeof key?key:String(key)}var _ModalsMap,createHeadingsPlugin=function(config){var helpers=config.helpers,t=config.t,_config$HEADINGS_DROP=config[HEADINGS_DROPDOWN_TYPE],settings=void 0===_config$HEADINGS_DROP?{}:_config$HEADINGS_DROP,isMobile=config.isMobile,rest=_objectWithoutPropertiesLoose(config,["helpers","t",HEADINGS_DROPDOWN_TYPE,"isMobile"].map(_toPropertyKey));return createBasePlugin(_extends({toolbar:createToolbar(config),helpers:helpers,settings:settings,t:t,isMobile:isMobile,type:HEADINGS_DROPDOWN_TYPE,defaultPluginData:DEFAULTS},rest))};createHeadingsPlugin.functionName=HEADINGS_DROPDOWN_TYPE;var Modals={HEADINGS:"HEADINGS"},ModalsMap=((_ModalsMap={})[Modals.HEADINGS]=HeadingsDropDownPanel,_ModalsMap),pluginHeadings=function(config){return{config:_extends({},DEFAULTS.config,config),type:HEADINGS_DROPDOWN_TYPE,createPlugin:createHeadingsPlugin,ModalsMap:ModalsMap}};export{HEADINGS_DROPDOWN_TYPE,Modals,ModalsMap,createHeadingsPlugin,pluginHeadings};
//# sourceMappingURL=module.js.map

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

export declare const DEFAULTS: {
export declare const DEFAULTS: Readonly<{
type: string;
config: {};
configViewer: {
hideMarkdown: boolean;
};
};
}>;
//# sourceMappingURL=defaults.d.ts.map

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

import { HeadersMarkdownPluginEditorConfig } from './types';
import { HeadingsPluginEditorConfig } from './types';
import { EditorPluginCreator } from 'wix-rich-content-common';
export declare const pluginHeadersMarkdown: EditorPluginCreator<HeadersMarkdownPluginEditorConfig>;
export declare const pluginHeadings: EditorPluginCreator<HeadingsPluginEditorConfig>;
//# sourceMappingURL=editor.d.ts.map

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

export { createHeadersMarkdownPlugin } from './createHeadersMarkdownPlugin';
export { createHeadersMarkdownDecorator } from './viewer';
export declare const HEADERS_MARKDOWN_TYPE = "wix-draft-plugin-headers-markdown";
export { pluginHeadersMarkdown } from './editor';
export { createHeadingsPlugin } from './createHeadingsPlugin';
export { HEADINGS_DROPDOWN_TYPE } from './types';
export { pluginHeadings } from './editor';
export { Modals, ModalsMap } from './modals';
//# sourceMappingURL=index.d.ts.map

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

import { EditorPluginConfig, ViewerPluginConfig } from 'wix-rich-content-common';
export declare const HEADERS_MARKDOWN_TYPE = "wix-draft-plugin-headers-markdown";
export interface HeadersMarkdownPluginEditorConfig extends EditorPluginConfig {
[key: string]: any;
import { EditorPluginConfig } from 'wix-rich-content-common';
export declare const HEADINGS_DROPDOWN_TYPE = "wix-rich-content-plugin-headings";
declare type HeadingType = 'P' | 'H1' | 'H2' | 'H3' | 'H4' | 'H5' | 'H6';
export interface HeadingsPluginEditorConfig extends EditorPluginConfig {
inlinePopups?: boolean;
customHeadings?: HeadingType[];
allowHeadingCustomization?: boolean;
}
export interface HeadersMarkdownPluginViewerConfig extends ViewerPluginConfig {
[key: string]: any;
}
export {};
//# sourceMappingURL=types.d.ts.map

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

{"name":"richlagetest","version":"0.0.0-5cec144654d3c83acaec9c34d801588198416d8b"}
{"name":"richlagetest","version":"0.0.0-5fb84c120c5f98649ffa6814156f39e32214f189"}

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