draft-extend
Advanced tools
Comparing version 2.0.2 to 2.1.1
@@ -1,9 +0,1 @@ | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("react"),require("draft-js"),require("immutable"),require("react-dom")):"function"==typeof define&&define.amd?define(["exports","react","draft-js","immutable","react-dom"],t):t((e=e||self).DraftExtend={},e.React,e.Draft,e.Immutable,e.ReactDOM)}(this,(function(e,t,n,r,o){"use strict";function s(e,t){return e(t={exports:{}},t.exports),t.exports | ||
/** @license React v16.13.1 | ||
* react-is.production.min.js | ||
* | ||
* Copyright (c) Facebook, Inc. and its affiliates. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/}t=t&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t,o=o&&Object.prototype.hasOwnProperty.call(o,"default")?o.default:o;var i="function"==typeof Symbol&&Symbol.for,a=i?Symbol.for("react.element"):60103,d=i?Symbol.for("react.portal"):60106,c=i?Symbol.for("react.fragment"):60107,l=i?Symbol.for("react.strict_mode"):60108,y=i?Symbol.for("react.profiler"):60114,u=i?Symbol.for("react.provider"):60109,m=i?Symbol.for("react.context"):60110,p=i?Symbol.for("react.async_mode"):60111,h=i?Symbol.for("react.concurrent_mode"):60111,f=i?Symbol.for("react.forward_ref"):60112,g=i?Symbol.for("react.suspense"):60113,b=i?Symbol.for("react.suspense_list"):60120,C=i?Symbol.for("react.memo"):60115,S=i?Symbol.for("react.lazy"):60116,k=i?Symbol.for("react.block"):60121,E=i?Symbol.for("react.fundamental"):60117,L=i?Symbol.for("react.responder"):60118,v=i?Symbol.for("react.scope"):60119;function F(e){if("object"==typeof e&&null!==e){var t=e.$$typeof;switch(t){case a:switch(e=e.type){case p:case h:case c:case y:case l:case g:return e;default:switch(e=e&&e.$$typeof){case m:case f:case S:case C:case u:return e;default:return t}}case d:return t}}}function T(e){return F(e)===h}var O={AsyncMode:p,ConcurrentMode:h,ContextConsumer:m,ContextProvider:u,Element:a,ForwardRef:f,Fragment:c,Lazy:S,Memo:C,Portal:d,Profiler:y,StrictMode:l,Suspense:g,isAsyncMode:function(e){return T(e)||F(e)===p},isConcurrentMode:T,isContextConsumer:function(e){return F(e)===m},isContextProvider:function(e){return F(e)===u},isElement:function(e){return"object"==typeof e&&null!==e&&e.$$typeof===a},isForwardRef:function(e){return F(e)===f},isFragment:function(e){return F(e)===c},isLazy:function(e){return F(e)===S},isMemo:function(e){return F(e)===C},isPortal:function(e){return F(e)===d},isProfiler:function(e){return F(e)===y},isStrictMode:function(e){return F(e)===l},isSuspense:function(e){return F(e)===g},isValidElementType:function(e){return"string"==typeof e||"function"==typeof e||e===c||e===h||e===y||e===l||e===g||e===b||"object"==typeof e&&null!==e&&(e.$$typeof===S||e.$$typeof===C||e.$$typeof===u||e.$$typeof===m||e.$$typeof===f||e.$$typeof===E||e.$$typeof===L||e.$$typeof===v||e.$$typeof===k)},typeOf:F},M=s((function(e,t){}));M.AsyncMode,M.ConcurrentMode,M.ContextConsumer,M.ContextProvider,M.Element,M.ForwardRef,M.Fragment,M.Lazy,M.Memo,M.Portal,M.Profiler,M.StrictMode,M.Suspense,M.isAsyncMode,M.isConcurrentMode,M.isContextConsumer,M.isContextProvider,M.isElement,M.isForwardRef,M.isFragment,M.isLazy,M.isMemo,M.isPortal,M.isProfiler,M.isStrictMode,M.isSuspense,M.isValidElementType,M.typeOf,s((function(e){e.exports=O}));function w(){}function K(){}K.resetWarningCache=w;var R=s((function(e){e.exports=function(){function e(e,t,n,r,o,s){if("SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"!==s){var i=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw i.name="Invariant Violation",i}}function t(){return e}e.isRequired=e;var n={array:e,bigint:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:K,resetWarningCache:w};return n.PropTypes=n,n}()})),x=function(e,t,n,r,o,s,i,a){if(!e){var d;if(void 0===t)d=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var c=[n,r,o,s,i,a],l=0;(d=new Error(t.replace(/%s/g,(function(){return c[l++]})))).name="Invariant Violation"}throw d.framesToPop=1,d}};const B={addKeyCommandListener:R.func,removeKeyCommandListener:R.func,handleKeyCommand:R.func},A=e=>{class o extends t.Component{constructor(e){super(e),this.addKeyCommandListener=this.addKeyCommandListener.bind(this),this.removeKeyCommandListener=this.removeKeyCommandListener.bind(this),this.handleKeyCommand=this.handleKeyCommand.bind(this),this.focus=this.focus.bind(this),this.blur=this.blur.bind(this),this.keyCommandOverrides=r.List(e.keyCommandListeners),this.keyCommandListeners=r.List()}componentDidMount(){const e=Object.keys(B),t=e.filter(e=>void 0!==this.props[e]),n=0===t.length,r=t.length===e.length;x(n||r,`KeyCommandController: A KeyCommandController is receiving only some props (${t.join(", ")}) necessary to defer to a parent key command controller.`),r&&this.props.keyCommandListeners.forEach(e=>{this.props.addKeyCommandListener(e)})}componentWillUnmount(){this.props.removeKeyCommandListener&&this.props.keyCommandListeners.forEach(e=>{this.props.removeKeyCommandListener(e)})}addKeyCommandListener(e){const{addKeyCommandListener:t}=this.props;t?t(e):this.keyCommandListeners=this.keyCommandListeners.unshift(e)}removeKeyCommandListener(e){const{removeKeyCommandListener:t}=this.props;t?t(e):this.keyCommandListeners=this.keyCommandListeners.filterNot(t=>t===e)}handleKeyCommand(e,t=null){const{editorState:r,onChange:o,handleKeyCommand:s}=this.props;if(s)return s(e,t);return this.keyCommandListeners.concat(this.keyCommandOverrides).reduce(({state:r,hasChanged:s},i)=>{if(!0===s)return{state:r,hasChanged:s};const a=i(r,e,t),d=a instanceof n.EditorState;return!0===a||d&&a!==r?d?(o(a),{state:a,hasChanged:!0}):{state:r,hasChanged:!0}:{state:r,hasChanged:s}},{state:r,hasChanged:!1}).hasChanged}focus(){this.refs.editor.focus()}blur(){this.refs.editor.blur()}render(){const{editorState:n,onChange:r,keyCommandListeners:o,...s}=this.props;return t.createElement(e,Object.assign({},s,{ref:"editor",editorState:n,onChange:r,addKeyCommandListener:this.addKeyCommandListener,removeKeyCommandListener:this.removeKeyCommandListener,handleKeyCommand:this.handleKeyCommand}))}}return o.displayName=`KeyCommandController(${e.displayName})`,o.propTypes={editorState:R.object,onChange:R.func,keyCommandListeners:R.arrayOf(R.func),...B},o.defaultProps={keyCommandListeners:[]},o};class _ extends t.Component{constructor(e){super(e);const t=document.createElement("div");document.body.appendChild(t),this.state={node:t}}componentDidMount(){this.renderOverlay()}componentDidUpdate(){this.renderOverlay()}componentWillUnmount(){o.unmountComponentAtNode(this.state.node)}renderOverlay(){const e=t.Children.only(this.props.children);o.render(e,this.state.node)}render(){return null}}const P={className:R.string,editorState:R.object,onChange:R.func,decorators:R.array,baseDecorator:R.func,styleMap:R.object,styleFn:R.func,buttons:R.array,overlays:R.array,blockRendererFn:R.func,blockStyleFn:R.func,keyBindingFn:R.func,addKeyCommandListener:R.func.isRequired,removeKeyCommandListener:R.func.isRequired,handleReturn:R.func,onEscape:R.func,onTab:R.func,onUpArrow:R.func,onDownArrow:R.func,readOnly:R.bool,showButtons:R.bool,renderTray:R.func},D=()=>console.error("DraftEditorContext is not provided in this scope. Please check your setup."),j=t.createContext({getEditorState:D,getReadOnly:D,setReadOnly:D,onChange:D,focus:D,blur:D,editorRef:D});class $ extends t.Component{constructor(e){super(e);const{baseDecorator:t}=e,n=new t(e.decorators);this.state={decorator:n,readOnly:!1},this.keyBindingFn=this.keyBindingFn.bind(this),this.handleReturn=this.handleReturn.bind(this),this.onEscape=this.onEscape.bind(this),this.onTab=this.onTab.bind(this),this.onUpArrow=this.onUpArrow.bind(this),this.onDownArrow=this.onDownArrow.bind(this),this.focus=this.focus.bind(this),this.blur=this.blur.bind(this),this.getOtherProps=this.getOtherProps.bind(this),this.getReadOnly=this.getReadOnly.bind(this),this.setReadOnly=this.setReadOnly.bind(this),this.getDecoratedState=this.getDecoratedState.bind(this),this.contextValue={getEditorState:this.getDecoratedState,getReadOnly:this.getReadOnly,setReadOnly:this.setReadOnly,onChange:this.props.onChange,focus:this.focus,blur:this.blur,editorRef:this.refs.editor}}static getDerivedStateFromProps(e,t){if(e.decorators.length===t.decorator._decorators.length){if(t.decorator._decorators.every((t,n)=>t===e.decorators[n]))return{}}return{decorator:new e.baseDecorator(e.decorators)}}keyBindingFn(e){const t=this.props.keyBindingFn(e);return t||n.getDefaultKeyBinding(e)}handleReturn(e,t){return this.props.handleReturn&&this.props.handleReturn(e,t)||this.props.handleKeyCommand("return",e)}onEscape(e){return this.props.onEscape&&this.props.onEscape(e)||this.props.handleKeyCommand("escape",e)}onTab(e){return this.props.onTab&&this.props.onTab(e)||this.props.handleKeyCommand("tab",e)}onUpArrow(e){return this.props.onUpArrow&&this.props.onUpArrow(e)||this.props.handleKeyCommand("up-arrow",e)}onDownArrow(e){return this.props.onDownArrow&&this.props.onDownArrow(e)||this.props.handleKeyCommand("down-arrow",e)}focus(){this.refs.editor.focus()}blur(){this.refs.editor.blur()}getOtherProps(){const e=Object.keys(this.props),t=Object.keys(P);return e.filter(e=>-1===t.indexOf(e)).reduce((e,t)=>(e[t]=this.props[t],e),{})}getReadOnly(){return this.state.readOnly||this.props.readOnly}setReadOnly(e){this.setState({readOnly:e})}getDecoratedState(){const{editorState:e}=this.props,{decorator:t}=this.state,r=e.getDecorator();return r&&r._decorators===t._decorators?e:n.EditorState.set(e,{decorator:t})}renderTray(){const{renderTray:e}=this.props;return"function"!=typeof e?null:e()}renderPluginButtons(){const{onChange:e,addKeyCommandListener:n,removeKeyCommandListener:r,showButtons:o}=this.props;if(!1===o)return null;const s=this.getDecoratedState();return this.props.buttons.map((o,i)=>t.createElement(o,Object.assign({},this.getOtherProps(),{key:"button-"+i,attachedToEditor:!0,editorState:s,onChange:e,addKeyCommandListener:n,removeKeyCommandListener:r})))}renderOverlays(){const{onChange:e,addKeyCommandListener:n,removeKeyCommandListener:r}=this.props,o=this.getDecoratedState();return this.props.overlays.map((s,i)=>t.createElement(_,{key:i},t.createElement(s,Object.assign({},this.getOtherProps(),{editorState:o,onChange:e,addKeyCommandListener:n,removeKeyCommandListener:r}))))}render(){const{styleMap:e,styleFn:r,blockRendererFn:o,blockStyleFn:s,onChange:i,handleKeyCommand:a,...d}=this.props,c=this.getDecoratedState(),l="draft-extend "+this.props.className,y=this.getReadOnly();return t.createElement(j.Provider,{value:this.contextValue},t.createElement("div",{className:l},t.createElement("div",{className:"draft-extend-editor"},t.createElement(n.Editor,Object.assign({},d,{ref:"editor",editorState:c,readOnly:y,onChange:i,blockStyleFn:s,blockRendererFn:o,customStyleMap:e,customStyleFn:r,handleKeyCommand:a,keyBindingFn:this.keyBindingFn,handleReturn:this.handleReturn,onEscape:this.onEscape,onTab:this.onTab,onUpArrow:this.onUpArrow,onDownArrow:this.onDownArrow})),t.createElement("div",{className:"draft-extend-tray"},this.renderTray()),t.createElement("div",{className:"draft-extend-controls"},this.renderPluginButtons()),t.createElement("div",{className:"draft-extend-overlays"},this.renderOverlays()))))}}$.propTypes=P,$.defaultProps={className:"",editorState:n.EditorState.createEmpty(),onChange:()=>{},decorators:[],baseDecorator:n.CompositeDecorator,styleMap:{},styleFn:()=>{},buttons:[],overlays:[],blockRendererFn:()=>{},blockStyleFn:()=>{},keyBindingFn:()=>{},readOnly:!1,showButtons:!0};var N=A($);class U extends t.Component{constructor(e){super(e),this.getEditorState=this.getEditorState.bind(this)}getChildContext(){return{getEditorState:this.getEditorState,onChange:this.props.onChange}}getEditorState(){return this.props.editorState}renderButtons(){const{editorState:e,onChange:n,buttons:r,addKeyCommandListener:o,removeKeyCommandListener:s,...i}=this.props;return r.map((r,a)=>t.createElement(r,Object.assign({},i,{key:"button-"+a,editorState:e,onChange:n,addKeyCommandListener:o,removeKeyCommandListener:s})))}render(){return t.createElement("ul",{className:"draft-extend-controls"},this.renderButtons())}}U.propTypes={editorState:R.object,onChange:R.func,buttons:R.array,addKeyCommandListener:R.func.isRequired,removeKeyCommandListener:R.func.isRequired},U.childContextTypes={getEditorState:R.func,onChange:R.func};var H=A(U);function q(e){let t=r.Map();return(...n)=>{const o=r.List.of(...n);return t.has(o)||(t=t.set(o,e(...n))),t.get(o)}}var I=(...e)=>(...t)=>{if(0===e.length)return t[0];const n=e[e.length-1];return e.slice(0,-1).reduceRight((e,t)=>t(e),n(...t))};const z=e=>e&&e.__isMiddleware?e:t=>(...n)=>{if("object"==typeof e){const r=n[0];let o;if("string"==typeof r){o=e[r]}else o=e[r.type];return null!=o?o:t(...n)}let o;try{const s=e(...n);if(null==s)o=t(...n);else if(2===n.length&&"string"==typeof n[1]&&n[1]===s)o=t(...n);else if(Array.isArray(s))o=s.concat(t(...n));else if(r.OrderedSet.isOrderedSet(s)){o=n[n.length-1].union(s).union(t(...n))}else o="function"==typeof s?e(t)(...n):s}catch(r){o=e(t)(...n)}finally{return o}},V=()=>{};const W=()=>{},Y=[],Z={},G=q((e,t=V)=>e?(...n)=>{const r=e(...n);return null==r?t(...n):r}:t),J=q((...e)=>Object.assign({},...e)),Q=q((e,t)=>e.concat(t)),X=q((e=[])=>Array.isArray(e)?e:[e]);var ee=(e,t)=>{const n={styleMap:Z,styleFn:W,decorators:Y,buttons:Y,overlays:Y,blockRendererFn:W,blockStyleFn:W,keyBindingFn:W,keyCommandListeners:Y,...e},{styleMap:r,styleFn:o,decorators:s,buttons:i,overlays:a,blockRendererFn:d,blockStyleFn:c,keyBindingFn:l,keyCommandListener:y}=t,u=Q(n.keyCommandListeners,X(y));return{...n,styleMap:J(n.styleMap,r),styleFn:G(n.styleFn,o),decorators:Q(n.decorators,s),buttons:Q(n.buttons,i),overlays:Q(n.overlays,a),blockRendererFn:G(d,n.blockRendererFn),blockStyleFn:G(c,n.blockStyleFn),keyBindingFn:G(l,n.keyBindingFn),keyCommandListeners:u,keyCommandListener:u}};const te=()=>{},ne=[],re={},oe=e=>(...t)=>e(...t);oe.__isMiddleware=!0;const se=q(e=>Array.isArray(e)?e:[e]),ie=q(e=>(t,n)=>e(t,n,r.OrderedSet())),ae=({displayName:e="Plugin",decorators:n=ne,buttons:r=ne,overlays:o=ne,styleMap:s=re,styleFn:i=te,blockRendererFn:a=te,blockStyleFn:d=te,keyBindingFn:c=te,keyCommandListener:l=te,htmlToStyle:y=oe,htmlToBlock:u=oe,htmlToEntity:m=oe,textToEntity:p=oe,styleToHTML:h=oe,blockToHTML:f=oe,entityToHTML:g=oe})=>b=>{if(n=se(n),r=se(r),o=se(o),b.prototype&&b.prototype.isReactComponent){class y extends t.Component{constructor(e){super(e),this.focus=this.focus.bind(this),this.blur=this.blur.bind(this)}focus(){this.refs.child.focus&&this.refs.child.focus()}blur(){this.refs.child.blur&&this.refs.child.blur()}render(){const e=ee({styleMap:this.props.styleMap,styleFn:this.props.styleFn,decorators:this.props.decorators,buttons:this.props.buttons,overlays:this.props.overlays,blockRendererFn:this.props.blockRendererFn,blockStyleFn:this.props.blockStyleFn,keyBindingFn:this.props.keyBindingFn,keyCommandListeners:this.props.keyCommandListeners},{styleMap:s,styleFn:i,decorators:n,buttons:r,overlays:o,blockRendererFn:a,blockStyleFn:d,keyBindingFn:c,keyCommandListener:l}),{__keyCommandListener:y,...u}=e;return t.createElement(b,Object.assign({},this.props,{ref:"child"},u))}}return y.displayName=e,y.propTypes={styleMap:R.object,styleFn:R.func,decorators:R.array,buttons:R.array,overlays:R.array,blockRendererFn:R.func,blockStyleFn:R.func,keyBindingFn:R.func,keyCommandListeners:R.arrayOf(R.func)},y.defaultProps={styleMap:re,styleFn:te,decorators:ne,buttons:ne,overlays:ne,blockRendererFn:te,blockStyleFn:te,keyBindingFn:te,keyCommandListeners:ne},y}return b&&b.__isAccumulator?ee(b,{styleMap:s,styleFn:i,decorators:n,buttons:r,overlays:o,blockRendererFn:a,blockStyleFn:d,keyBindingFn:c,keyCommandListener:l}):(...e)=>{if(1===e.length&&("string"==typeof e[0]||e[0].hasOwnProperty("_map")&&null!=e[0].getBlockMap))return b({htmlToStyle:y,htmlToBlock:u,htmlToEntity:m,textToEntity:p,styleToHTML:h,blockToHTML:f,entityToHTML:g})(...e);{const t=e[0],n=I(z(ie(y)),z(t.htmlToStyle));n.__isMiddleware=!0;const r=I(z(u),z(t.htmlToBlock));r.__isMiddleware=!0;const o=I(z(m),z(t.htmlToEntity));o.__isMiddleware=!0;const s=I(z(p),z(t.textToEntity));s.__isMiddleware=!0;const i=I(z(h),z(t.styleToHTML));i.__isMiddleware=!0;const a=I(z(f),z(t.blockToHTML));a.__isMiddleware=!0;const d=I(z(g),z(t.entityToHTML));return d.__isMiddleware=!0,ae({htmlToStyle:n,htmlToBlock:r,htmlToEntity:o,textToEntity:s,styleToHTML:i,blockToHTML:a,entityToHTML:d})(b)}}},de=e=>e.replace(/[a-z][A-Z]/g,e=>e[0]+"-"+e[1].toLowerCase()),ce=e=>{const t=e.getCurrentContent().getBlockForKey(e.getSelection().getStartKey());if(t)return t.getEntityAt(e.getSelection().getStartOffset())};var le={camelCaseToHyphen:de,styleObjectToString:e=>Object.keys(e).map(t=>`${de(t)}: ${e[t]};`).join(" ").replace(/"/g,'\\"'),entityStrategy:e=>(t,r,o)=>{t.findEntityRanges(t=>{const r=t.getEntity();if(null===r)return!1;const s=o&&o.getEntity?o.getEntity(r):n.Entity.get(r);return s&&s.getType()===e},r)},getEntitySelection(e,t){const r=[];return e.getCurrentContent().getBlocksAsArray().forEach(e=>{e.findEntityRanges(e=>e.getEntity()===t,(t,o)=>{r.push(n.SelectionState.createEmpty(e.getKey()).merge({anchorOffset:t,focusOffset:o,isBackward:!1,hasFocus:!0}))})}),x(1===r.length,"getEntitySelection: More than one range with the same entityKey. Please use unique entity instances"),r[0]},insertBlockAtCursor(e,t){const o=e.getCurrentContent(),s=e.getSelection(),i=n.Modifier.removeRange(o,s,"backward"),a=i.getSelectionAfter(),d=n.Modifier.splitBlock(i,a),c=d.getSelectionAfter(),l=n.Modifier.setBlockType(d,c,t.getType()),y=[t,new n.ContentBlock({key:n.genKey(),type:"unstyled",text:"",characterList:r.List()})],u=n.BlockMapBuilder.createFromArray(y),m=n.Modifier.replaceWithFragment(l,c,u),p=m.merge({selectionBefore:s,selectionAfter:m.getSelectionAfter().set("hasFocus",!0)});return n.EditorState.push(e,p,"insert-fragment")},getSelectedInlineStyles(e){const t=e.getSelection(),n=e.getCurrentContent();return n.getBlockMap().skipUntil((e,n)=>n===t.getStartKey()).takeUntil((e,r)=>n.getKeyBefore(r)===t.getEndKey()).reduce((e,n)=>{const r=n.getKey();let o=0,s=n.getLength()-1;r===t.getStartKey()&&(o=t.getStartOffset()),r===t.getEndKey()&&(s=t.getEndOffset());for(let t=o;t<=s;t++)e=e.union(n.getInlineStyleAt(t));return e},r.Set())},matchAll(e,t){const n=[];let r=t.exec(e);for(;null!==r;)n.push(r.concat([r.index])),r=t.exec(e);return n},getActiveEntity:ce,isEntityActive(e,t){const r=ce(e),o=e.getCurrentContent();if(r){const e=o.getEntity?o.getEntity(r):n.Entity.get(r);return e&&e.type===t}return!1}};e.DraftEditorContext=j,e.Editor=N,e.KeyCommandController=A,e.Toolbar=H,e.accumulatePluginOptions=ee,e.compose=I,e.createPlugin=ae,e.pluginUtils=le,Object.defineProperty(e,"__esModule",{value:!0})})); | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("react"),require("draft-js"),require("immutable"),require("react-dom")):"function"==typeof define&&define.amd?define(["exports","react","draft-js","immutable","react-dom"],t):t((e=e||self).DraftExtend={},e.React,e.Draft,e.Immutable,e.ReactDOM)}(this,(function(e,t,n,r,o){"use strict";var s="default"in t?t.default:t;function i(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function a(e,t){return e(t={exports:{}},t.exports),t.exports}o=o&&o.hasOwnProperty("default")?o.default:o;var d=a((function(e,t){Object.defineProperty(t,"__esModule",{value:!0});var n="function"==typeof Symbol&&Symbol.for,r=n?Symbol.for("react.element"):60103,o=n?Symbol.for("react.portal"):60106,s=n?Symbol.for("react.fragment"):60107,i=n?Symbol.for("react.strict_mode"):60108,a=n?Symbol.for("react.profiler"):60114,d=n?Symbol.for("react.provider"):60109,c=n?Symbol.for("react.context"):60110,l=n?Symbol.for("react.async_mode"):60111,y=n?Symbol.for("react.concurrent_mode"):60111,u=n?Symbol.for("react.forward_ref"):60112,m=n?Symbol.for("react.suspense"):60113,p=n?Symbol.for("react.memo"):60115,h=n?Symbol.for("react.lazy"):60116;function f(e){if("object"==typeof e&&null!==e){var t=e.$$typeof;switch(t){case r:switch(e=e.type){case l:case y:case s:case a:case i:case m:return e;default:switch(e=e&&e.$$typeof){case c:case u:case d:return e;default:return t}}case h:case p:case o:return t}}}function g(e){return f(e)===y}t.typeOf=f,t.AsyncMode=l,t.ConcurrentMode=y,t.ContextConsumer=c,t.ContextProvider=d,t.Element=r,t.ForwardRef=u,t.Fragment=s,t.Lazy=h,t.Memo=p,t.Portal=o,t.Profiler=a,t.StrictMode=i,t.Suspense=m,t.isValidElementType=function(e){return"string"==typeof e||"function"==typeof e||e===s||e===y||e===a||e===i||e===m||"object"==typeof e&&null!==e&&(e.$$typeof===h||e.$$typeof===p||e.$$typeof===d||e.$$typeof===c||e.$$typeof===u)},t.isAsyncMode=function(e){return g(e)||f(e)===l},t.isConcurrentMode=g,t.isContextConsumer=function(e){return f(e)===c},t.isContextProvider=function(e){return f(e)===d},t.isElement=function(e){return"object"==typeof e&&null!==e&&e.$$typeof===r},t.isForwardRef=function(e){return f(e)===u},t.isFragment=function(e){return f(e)===s},t.isLazy=function(e){return f(e)===h},t.isMemo=function(e){return f(e)===p},t.isPortal=function(e){return f(e)===o},t.isProfiler=function(e){return f(e)===a},t.isStrictMode=function(e){return f(e)===i},t.isSuspense=function(e){return f(e)===m}}));i(d);d.typeOf,d.AsyncMode,d.ConcurrentMode,d.ContextConsumer,d.ContextProvider,d.Element,d.ForwardRef,d.Fragment,d.Lazy,d.Memo,d.Portal,d.Profiler,d.StrictMode,d.Suspense,d.isValidElementType,d.isAsyncMode,d.isConcurrentMode,d.isContextConsumer,d.isContextProvider,d.isElement,d.isForwardRef,d.isFragment,d.isLazy,d.isMemo,d.isPortal,d.isProfiler,d.isStrictMode,d.isSuspense;var c=a((function(e,t){}));i(c);c.typeOf,c.AsyncMode,c.ConcurrentMode,c.ContextConsumer,c.ContextProvider,c.Element,c.ForwardRef,c.Fragment,c.Lazy,c.Memo,c.Portal,c.Profiler,c.StrictMode,c.Suspense,c.isValidElementType,c.isAsyncMode,c.isConcurrentMode,c.isContextConsumer,c.isContextProvider,c.isElement,c.isForwardRef,c.isFragment,c.isLazy,c.isMemo,c.isPortal,c.isProfiler,c.isStrictMode,c.isSuspense,a((function(e){e.exports=d}));var l=Object.getOwnPropertySymbols,y=Object.prototype.hasOwnProperty,u=Object.prototype.propertyIsEnumerable;function m(e){if(null==e)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(e)}(function(){try{if(!Object.assign)return!1;var e=new String("abc");if(e[5]="de","5"===Object.getOwnPropertyNames(e)[0])return!1;for(var t={},n=0;n<10;n++)t["_"+String.fromCharCode(n)]=n;if("0123456789"!==Object.getOwnPropertyNames(t).map((function(e){return t[e]})).join(""))return!1;var r={};return"abcdefghijklmnopqrst".split("").forEach((function(e){r[e]=e})),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},r)).join("")}catch(e){return!1}})()&&Object.assign;var p="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";Function.call.bind(Object.prototype.hasOwnProperty);function h(){}function f(){}f.resetWarningCache=h;var g=a((function(e){e.exports=function(){function e(e,t,n,r,o,s){if(s!==p){var i=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw i.name="Invariant Violation",i}}function t(){return e}e.isRequired=e;var n={array:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:f,resetWarningCache:h};return n.PropTypes=n,n}()})),b=function(e,t,n,r,o,s,i,a){if(!e){var d;if(void 0===t)d=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var c=[n,r,o,s,i,a],l=0;(d=new Error(t.replace(/%s/g,(function(){return c[l++]})))).name="Invariant Violation"}throw d.framesToPop=1,d}};const C={addKeyCommandListener:g.func,removeKeyCommandListener:g.func,handleKeyCommand:g.func},S=e=>{class t extends s.Component{constructor(e){super(e),this.addKeyCommandListener=this.addKeyCommandListener.bind(this),this.removeKeyCommandListener=this.removeKeyCommandListener.bind(this),this.handleKeyCommand=this.handleKeyCommand.bind(this),this.focus=this.focus.bind(this),this.blur=this.blur.bind(this),this.keyCommandOverrides=r.List(e.keyCommandListeners),this.keyCommandListeners=r.List()}componentDidMount(){const e=Object.keys(C),t=e.filter(e=>void 0!==this.props[e]),n=0===t.length,r=t.length===e.length;b(n||r,`KeyCommandController: A KeyCommandController is receiving only some props (${t.join(", ")}) necessary to defer to a parent key command controller.`),r&&this.props.keyCommandListeners.forEach(e=>{this.props.addKeyCommandListener(e)})}componentWillUnmount(){this.props.removeKeyCommandListener&&this.props.keyCommandListeners.forEach(e=>{this.props.removeKeyCommandListener(e)})}addKeyCommandListener(e){const{addKeyCommandListener:t}=this.props;t?t(e):this.keyCommandListeners=this.keyCommandListeners.unshift(e)}removeKeyCommandListener(e){const{removeKeyCommandListener:t}=this.props;t?t(e):this.keyCommandListeners=this.keyCommandListeners.filterNot(t=>t===e)}handleKeyCommand(e,t=null){const{editorState:r,onChange:o,handleKeyCommand:s}=this.props;return s?s(e,t):this.keyCommandListeners.concat(this.keyCommandOverrides).reduce(({state:r,hasChanged:s},i)=>{if(!0===s)return{state:r,hasChanged:s};const a=i(r,e,t),d=a instanceof n.EditorState;return!0===a||d&&a!==r?d?(o(a),{state:a,hasChanged:!0}):{state:r,hasChanged:!0}:{state:r,hasChanged:s}},{state:r,hasChanged:!1}).hasChanged}focus(){this.refs.editor.focus()}blur(){this.refs.editor.blur()}render(){const{editorState:t,onChange:n,keyCommandListeners:r,...o}=this.props;return s.createElement(e,Object.assign({},o,{ref:"editor",editorState:t,onChange:n,addKeyCommandListener:this.addKeyCommandListener,removeKeyCommandListener:this.removeKeyCommandListener,handleKeyCommand:this.handleKeyCommand}))}}return t.displayName=`KeyCommandController(${e.displayName})`,t.propTypes={editorState:g.object,onChange:g.func,keyCommandListeners:g.arrayOf(g.func),...C},t.defaultProps={keyCommandListeners:[]},t};class k extends s.Component{constructor(e){super(e);const t=document.createElement("div");document.body.appendChild(t),this.state={node:t}}componentDidMount(){this.renderOverlay()}componentDidUpdate(){this.renderOverlay()}componentWillUnmount(){o.unmountComponentAtNode(this.state.node)}renderOverlay(){const e=s.Children.only(this.props.children);o.render(e,this.state.node)}render(){return null}}const E={className:g.string,editorState:g.object,onChange:g.func,decorators:g.array,baseDecorator:g.func,styleMap:g.object,styleFn:g.func,buttons:g.array,overlays:g.array,blockRendererFn:g.func,blockStyleFn:g.func,keyBindingFn:g.func,addKeyCommandListener:g.func.isRequired,removeKeyCommandListener:g.func.isRequired,handleReturn:g.func,onEscape:g.func,onTab:g.func,onUpArrow:g.func,onDownArrow:g.func,readOnly:g.bool,showButtons:g.bool,renderTray:g.func},O=()=>console.error("DraftEditorContext is not provided in this scope. Please check your setup."),v=s.createContext({getEditorState:O,getReadOnly:O,setReadOnly:O,onChange:O,focus:O,blur:O,editorRef:O});class L extends s.Component{constructor(e){super(e);const{baseDecorator:t}=e,n=new t(e.decorators);this.state={decorator:n,readOnly:!1},this.keyBindingFn=this.keyBindingFn.bind(this),this.handleReturn=this.handleReturn.bind(this),this.onEscape=this.onEscape.bind(this),this.onTab=this.onTab.bind(this),this.onUpArrow=this.onUpArrow.bind(this),this.onDownArrow=this.onDownArrow.bind(this),this.focus=this.focus.bind(this),this.blur=this.blur.bind(this),this.getOtherProps=this.getOtherProps.bind(this),this.getReadOnly=this.getReadOnly.bind(this),this.setReadOnly=this.setReadOnly.bind(this),this.getDecoratedState=this.getDecoratedState.bind(this),this.contextValue={getEditorState:this.getDecoratedState,getReadOnly:this.getReadOnly,setReadOnly:this.setReadOnly,onChange:this.props.onChange,focus:this.focus,blur:this.blur,editorRef:this.refs.editor}}static getDerivedStateFromProps(e,t){if(e.decorators.length===t.decorator._decorators.length){if(t.decorator._decorators.every((t,n)=>t===e.decorators[n]))return{}}return{decorator:new e.baseDecorator(e.decorators)}}keyBindingFn(e){const t=this.props.keyBindingFn(e);return t||n.getDefaultKeyBinding(e)}handleReturn(e,t){return this.props.handleReturn&&this.props.handleReturn(e,t)||this.props.handleKeyCommand("return",e)}onEscape(e){return this.props.onEscape&&this.props.onEscape(e)||this.props.handleKeyCommand("escape",e)}onTab(e){return this.props.onTab&&this.props.onTab(e)||this.props.handleKeyCommand("tab",e)}onUpArrow(e){return this.props.onUpArrow&&this.props.onUpArrow(e)||this.props.handleKeyCommand("up-arrow",e)}onDownArrow(e){return this.props.onDownArrow&&this.props.onDownArrow(e)||this.props.handleKeyCommand("down-arrow",e)}focus(){this.refs.editor.focus()}blur(){this.refs.editor.blur()}getOtherProps(){const e=Object.keys(this.props),t=Object.keys(E);return e.filter(e=>-1===t.indexOf(e)).reduce((e,t)=>(e[t]=this.props[t],e),{})}getReadOnly(){return this.state.readOnly||this.props.readOnly}setReadOnly(e){this.setState({readOnly:e})}getDecoratedState(){const{editorState:e}=this.props,{decorator:t}=this.state,r=e.getDecorator();return r&&r._decorators===t._decorators?e:n.EditorState.set(e,{decorator:t})}renderTray(){const{renderTray:e}=this.props;return"function"!=typeof e?null:e()}renderPluginButtons(){const{onChange:e,addKeyCommandListener:t,removeKeyCommandListener:n,showButtons:r}=this.props;if(!1===r)return null;const o=this.getDecoratedState();return this.props.buttons.map((r,i)=>s.createElement(r,Object.assign({},this.getOtherProps(),{key:`button-${i}`,attachedToEditor:!0,editorState:o,onChange:e,addKeyCommandListener:t,removeKeyCommandListener:n})))}renderOverlays(){const{onChange:e,addKeyCommandListener:t,removeKeyCommandListener:n}=this.props,r=this.getDecoratedState();return this.props.overlays.map((o,i)=>s.createElement(k,{key:i},s.createElement(o,Object.assign({},this.getOtherProps(),{editorState:r,onChange:e,addKeyCommandListener:t,removeKeyCommandListener:n}))))}render(){const{styleMap:e,styleFn:t,blockRendererFn:r,blockStyleFn:o,onChange:i,handleKeyCommand:a,...d}=this.props,c=this.getDecoratedState(),l=`draft-extend ${this.props.className}`,y=this.getReadOnly();return s.createElement(v.Provider,{value:this.contextValue},s.createElement("div",{className:l},s.createElement("div",{className:"draft-extend-editor"},s.createElement(n.Editor,Object.assign({},d,{ref:"editor",editorState:c,readOnly:y,onChange:i,blockStyleFn:o,blockRendererFn:r,customStyleMap:e,customStyleFn:t,handleKeyCommand:a,keyBindingFn:this.keyBindingFn,handleReturn:this.handleReturn,onEscape:this.onEscape,onTab:this.onTab,onUpArrow:this.onUpArrow,onDownArrow:this.onDownArrow})),s.createElement("div",{className:"draft-extend-tray"},this.renderTray()),s.createElement("div",{className:"draft-extend-controls"},this.renderPluginButtons()),s.createElement("div",{className:"draft-extend-overlays"},this.renderOverlays()))))}}L.propTypes=E,L.defaultProps={className:"",editorState:n.EditorState.createEmpty(),onChange:()=>{},decorators:[],baseDecorator:n.CompositeDecorator,styleMap:{},styleFn:()=>{},buttons:[],overlays:[],blockRendererFn:()=>{},blockStyleFn:()=>{},keyBindingFn:()=>{},readOnly:!1,showButtons:!0};var F=S(L);class T extends s.Component{constructor(e){super(e),this.getEditorState=this.getEditorState.bind(this)}getChildContext(){return{getEditorState:this.getEditorState,onChange:this.props.onChange}}getEditorState(){return this.props.editorState}renderButtons(){const{editorState:e,onChange:t,buttons:n,addKeyCommandListener:r,removeKeyCommandListener:o,...i}=this.props;return n.map((n,a)=>s.createElement(n,Object.assign({},i,{key:`button-${a}`,editorState:e,onChange:t,addKeyCommandListener:r,removeKeyCommandListener:o})))}render(){return s.createElement("ul",{className:"draft-extend-controls"},this.renderButtons())}}T.propTypes={editorState:g.object,onChange:g.func,buttons:g.array,addKeyCommandListener:g.func.isRequired,removeKeyCommandListener:g.func.isRequired},T.childContextTypes={getEditorState:g.func,onChange:g.func};var M=S(T);function w(e){let t=r.Map();return(...n)=>{const o=r.List.of(...n);return t.has(o)||(t=t.set(o,e(...n))),t.get(o)}}var K=(...e)=>(...t)=>{if(0===e.length)return t[0];const n=e[e.length-1];return e.slice(0,-1).reduceRight((e,t)=>t(e),n(...t))};const R=e=>e&&e.__isMiddleware?e:t=>(...n)=>{if("object"==typeof e){const r=n[0];let o;if("string"==typeof r){o=e[r]}else o=e[r.type];return null!=o?o:t(...n)}let o;try{const s=e(...n);if(null==s)o=t(...n);else if(2===n.length&&"string"==typeof n[1]&&n[1]===s)o=t(...n);else if(Array.isArray(s))o=s.concat(t(...n));else if(r.OrderedSet.isOrderedSet(s)){o=n[n.length-1].union(s).union(t(...n))}else o="function"==typeof s?e(t)(...n):s}catch(r){o=e(t)(...n)}finally{return o}},x=()=>{};const P=()=>{},j=[],_={},A=w((e,t=x)=>e?(...n)=>{const r=e(...n);return null==r?t(...n):r}:t),B=w((...e)=>Object.assign({},...e)),D=w((e,t)=>e.concat(t)),$=w((e=[])=>Array.isArray(e)?e:[e]);var N=(e,t)=>{const n={styleMap:_,styleFn:P,decorators:j,buttons:j,overlays:j,blockRendererFn:P,blockStyleFn:P,keyBindingFn:P,keyCommandListeners:j,...e},{styleMap:r,styleFn:o,decorators:s,buttons:i,overlays:a,blockRendererFn:d,blockStyleFn:c,keyBindingFn:l,keyCommandListener:y}=t,u=D(n.keyCommandListeners,$(y));return{...n,styleMap:B(n.styleMap,r),styleFn:A(n.styleFn,o),decorators:D(n.decorators,s),buttons:D(n.buttons,i),overlays:D(n.overlays,a),blockRendererFn:A(d,n.blockRendererFn),blockStyleFn:A(c,n.blockStyleFn),keyBindingFn:A(l,n.keyBindingFn),keyCommandListeners:u,keyCommandListener:u}};const U=()=>{},H=[],q={},I=e=>(...t)=>e(...t);I.__isMiddleware=!0;const z=w(e=>Array.isArray(e)?e:[e]),V=w(e=>(t,n)=>e(t,n,r.OrderedSet())),W=({displayName:e="Plugin",decorators:t=H,buttons:n=H,overlays:r=H,styleMap:o=q,styleFn:i=U,blockRendererFn:a=U,blockStyleFn:d=U,keyBindingFn:c=U,keyCommandListener:l=U,htmlToStyle:y=I,htmlToBlock:u=I,htmlToEntity:m=I,textToEntity:p=I,styleToHTML:h=I,blockToHTML:f=I,entityToHTML:b=I})=>C=>{if(t=z(t),n=z(n),r=z(r),C.prototype&&C.prototype.isReactComponent){class y extends s.Component{constructor(e){super(e),this.focus=this.focus.bind(this),this.blur=this.blur.bind(this)}focus(){this.refs.child.focus&&this.refs.child.focus()}blur(){this.refs.child.blur&&this.refs.child.blur()}render(){const e=N({styleMap:this.props.styleMap,styleFn:this.props.styleFn,decorators:this.props.decorators,buttons:this.props.buttons,overlays:this.props.overlays,blockRendererFn:this.props.blockRendererFn,blockStyleFn:this.props.blockStyleFn,keyBindingFn:this.props.keyBindingFn,keyCommandListeners:this.props.keyCommandListeners},{styleMap:o,styleFn:i,decorators:t,buttons:n,overlays:r,blockRendererFn:a,blockStyleFn:d,keyBindingFn:c,keyCommandListener:l}),{__keyCommandListener:y,...u}=e;return s.createElement(C,Object.assign({},this.props,{ref:"child"},u))}}return y.displayName=e,y.propTypes={styleMap:g.object,styleFn:g.func,decorators:g.array,buttons:g.array,overlays:g.array,blockRendererFn:g.func,blockStyleFn:g.func,keyBindingFn:g.func,keyCommandListeners:g.arrayOf(g.func)},y.defaultProps={styleMap:q,styleFn:U,decorators:H,buttons:H,overlays:H,blockRendererFn:U,blockStyleFn:U,keyBindingFn:U,keyCommandListeners:H},y}return C&&C.__isAccumulator?N(C,{styleMap:o,styleFn:i,decorators:t,buttons:n,overlays:r,blockRendererFn:a,blockStyleFn:d,keyBindingFn:c,keyCommandListener:l}):(...e)=>{if(1===e.length&&("string"==typeof e[0]||e[0].hasOwnProperty("_map")&&null!=e[0].getBlockMap))return C({htmlToStyle:y,htmlToBlock:u,htmlToEntity:m,textToEntity:p,styleToHTML:h,blockToHTML:f,entityToHTML:b})(...e);{const t=e[0],n=K(R(V(y)),R(t.htmlToStyle));n.__isMiddleware=!0;const r=K(R(u),R(t.htmlToBlock));r.__isMiddleware=!0;const o=K(R(m),R(t.htmlToEntity));o.__isMiddleware=!0;const s=K(R(p),R(t.textToEntity));s.__isMiddleware=!0;const i=K(R(h),R(t.styleToHTML));i.__isMiddleware=!0;const a=K(R(f),R(t.blockToHTML));a.__isMiddleware=!0;const d=K(R(b),R(t.entityToHTML));return d.__isMiddleware=!0,W({htmlToStyle:n,htmlToBlock:r,htmlToEntity:o,textToEntity:s,styleToHTML:i,blockToHTML:a,entityToHTML:d})(C)}}},Y=e=>e.replace(/[a-z][A-Z]/g,e=>e[0]+"-"+e[1].toLowerCase()),Z=e=>{const t=e.getCurrentContent().getBlockForKey(e.getSelection().getStartKey());if(t)return t.getEntityAt(e.getSelection().getStartOffset())};var G={camelCaseToHyphen:Y,styleObjectToString:e=>Object.keys(e).map(t=>`${Y(t)}: ${e[t]};`).join(" ").replace(/"/g,'\\"'),entityStrategy:e=>(t,r,o)=>{t.findEntityRanges(t=>{const r=t.getEntity();if(null===r)return!1;const s=o&&o.getEntity?o.getEntity(r):n.Entity.get(r);return s&&s.getType()===e},r)},getEntitySelection(e,t){const r=[];return e.getCurrentContent().getBlocksAsArray().forEach(e=>{e.findEntityRanges(e=>e.getEntity()===t,(t,o)=>{r.push(n.SelectionState.createEmpty(e.getKey()).merge({anchorOffset:t,focusOffset:o,isBackward:!1,hasFocus:!0}))})}),b(1===r.length,"getEntitySelection: More than one range with the same entityKey. Please use unique entity instances"),r[0]},insertBlockAtCursor(e,t){const o=e.getCurrentContent(),s=e.getSelection(),i=n.Modifier.removeRange(o,s,"backward"),a=i.getSelectionAfter(),d=n.Modifier.splitBlock(i,a),c=d.getSelectionAfter(),l=n.Modifier.setBlockType(d,c,t.getType()),y=[t,new n.ContentBlock({key:n.genKey(),type:"unstyled",text:"",characterList:r.List()})],u=n.BlockMapBuilder.createFromArray(y),m=n.Modifier.replaceWithFragment(l,c,u),p=m.merge({selectionBefore:s,selectionAfter:m.getSelectionAfter().set("hasFocus",!0)});return n.EditorState.push(e,p,"insert-fragment")},getSelectedInlineStyles(e){const t=e.getSelection(),n=e.getCurrentContent();return n.getBlockMap().skipUntil((e,n)=>n===t.getStartKey()).takeUntil((e,r)=>n.getKeyBefore(r)===t.getEndKey()).reduce((e,n)=>{const r=n.getKey();let o=0,s=n.getLength()-1;r===t.getStartKey()&&(o=t.getStartOffset()),r===t.getEndKey()&&(s=t.getEndOffset());for(let t=o;t<=s;t++)e=e.union(n.getInlineStyleAt(t));return e},r.Set())},matchAll(e,t){const n=[];let r=t.exec(e);for(;null!==r;)n.push(r.concat([r.index])),r=t.exec(e);return n},getActiveEntity:Z,isEntityActive(e,t){const r=Z(e),o=e.getCurrentContent();if(r){const e=o.getEntity?o.getEntity(r):n.Entity.get(r);return e&&e.type===t}return!1}};e.DraftEditorContext=v,e.Editor=F,e.KeyCommandController=S,e.Toolbar=M,e.accumulatePluginOptions=N,e.compose=K,e.createPlugin=W,e.pluginUtils=G,e.withDraftExtendContext=e=>{class n extends t.Component{render(){return s.createElement(e,Object.assign({draftContext:this.context},this.props))}}return n.contextType=v,n.WrappingComponent=e,n},Object.defineProperty(e,"__esModule",{value:!0})})); |
@@ -33,3 +33,3 @@ import React from 'react'; | ||
export const DraftEditorContext = /*#__PURE__*/React.createContext({ | ||
export const DraftEditorContext = React.createContext({ | ||
getEditorState: defaultContextFn, | ||
@@ -198,3 +198,3 @@ getReadOnly: defaultContextFn, | ||
return this.props.buttons.map((Button, index) => { | ||
return /*#__PURE__*/React.createElement(Button, Object.assign({}, this.getOtherProps(), { | ||
return React.createElement(Button, Object.assign({}, this.getOtherProps(), { | ||
key: `button-${index}`, | ||
@@ -218,5 +218,5 @@ attachedToEditor: true, | ||
return this.props.overlays.map((Overlay, index) => { | ||
return /*#__PURE__*/React.createElement(OverlayWrapper, { | ||
return React.createElement(OverlayWrapper, { | ||
key: index | ||
}, /*#__PURE__*/React.createElement(Overlay, Object.assign({}, this.getOtherProps(), { | ||
}, React.createElement(Overlay, Object.assign({}, this.getOtherProps(), { | ||
editorState: decoratedState, | ||
@@ -243,9 +243,9 @@ onChange: onChange, | ||
const readOnly = this.getReadOnly(); | ||
return /*#__PURE__*/React.createElement(DraftEditorContext.Provider, { | ||
return React.createElement(DraftEditorContext.Provider, { | ||
value: this.contextValue | ||
}, /*#__PURE__*/React.createElement("div", { | ||
}, React.createElement("div", { | ||
className: className | ||
}, /*#__PURE__*/React.createElement("div", { | ||
}, React.createElement("div", { | ||
className: "draft-extend-editor" | ||
}, /*#__PURE__*/React.createElement(Editor, Object.assign({}, otherProps, { | ||
}, React.createElement(Editor, Object.assign({}, otherProps, { | ||
ref: "editor", | ||
@@ -266,7 +266,7 @@ editorState: decoratedState, | ||
onDownArrow: this.onDownArrow | ||
})), /*#__PURE__*/React.createElement("div", { | ||
})), React.createElement("div", { | ||
className: "draft-extend-tray" | ||
}, this.renderTray()), /*#__PURE__*/React.createElement("div", { | ||
}, this.renderTray()), React.createElement("div", { | ||
className: "draft-extend-controls" | ||
}, this.renderPluginButtons()), /*#__PURE__*/React.createElement("div", { | ||
}, this.renderPluginButtons()), React.createElement("div", { | ||
className: "draft-extend-overlays" | ||
@@ -273,0 +273,0 @@ }, this.renderOverlays())))); |
@@ -141,3 +141,3 @@ import React from 'react'; | ||
} = this.props; | ||
return /*#__PURE__*/React.createElement(Component, Object.assign({}, others, { | ||
return React.createElement(Component, Object.assign({}, others, { | ||
ref: "editor", | ||
@@ -144,0 +144,0 @@ editorState: editorState, |
@@ -32,3 +32,3 @@ import React from 'react'; | ||
return buttons.map((Button, index) => { | ||
return /*#__PURE__*/React.createElement(Button, Object.assign({}, otherProps, { | ||
return React.createElement(Button, Object.assign({}, otherProps, { | ||
key: `button-${index}`, | ||
@@ -44,3 +44,3 @@ editorState: editorState, | ||
render() { | ||
return /*#__PURE__*/React.createElement("ul", { | ||
return React.createElement("ul", { | ||
className: "draft-extend-controls" | ||
@@ -47,0 +47,0 @@ }, this.renderButtons()); |
@@ -8,2 +8,3 @@ import Editor, { DraftEditorContext } from './components/Editor'; | ||
import compose from './util/compose'; | ||
export { Editor, Toolbar, KeyCommandController, createPlugin, accumulatePluginOptions, pluginUtils, compose, DraftEditorContext }; | ||
import { withDraftExtendContext } from './components/withDraftExtendContext'; | ||
export { Editor, Toolbar, KeyCommandController, createPlugin, accumulatePluginOptions, pluginUtils, compose, DraftEditorContext, withDraftExtendContext }; |
@@ -94,3 +94,3 @@ import React from 'react'; | ||
} = pluginAccumulation; | ||
return /*#__PURE__*/React.createElement(ToWrap, Object.assign({}, this.props, { | ||
return React.createElement(ToWrap, Object.assign({}, this.props, { | ||
ref: "child" | ||
@@ -97,0 +97,0 @@ }, editorPluginOptions)); |
@@ -18,2 +18,6 @@ "use strict"; | ||
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn")); | ||
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf")); | ||
var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized")); | ||
@@ -23,6 +27,2 @@ | ||
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn")); | ||
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf")); | ||
var _react = _interopRequireDefault(require("react")); | ||
@@ -38,8 +38,2 @@ | ||
var _excluded = ["styleMap", "styleFn", "blockRendererFn", "blockStyleFn", "onChange", "handleKeyCommand"]; | ||
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2["default"])(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2["default"])(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2["default"])(this, result); }; } | ||
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } | ||
var propTypes = { | ||
@@ -74,3 +68,3 @@ className: _propTypes["default"].string, | ||
var DraftEditorContext = /*#__PURE__*/_react["default"].createContext({ | ||
var DraftEditorContext = _react["default"].createContext({ | ||
getEditorState: defaultContextFn, | ||
@@ -87,7 +81,7 @@ getReadOnly: defaultContextFn, | ||
var EditorWrapper = /*#__PURE__*/function (_React$Component) { | ||
var EditorWrapper = | ||
/*#__PURE__*/ | ||
function (_React$Component) { | ||
(0, _inherits2["default"])(EditorWrapper, _React$Component); | ||
var _super = _createSuper(EditorWrapper); | ||
function EditorWrapper(props) { | ||
@@ -97,3 +91,3 @@ var _this; | ||
(0, _classCallCheck2["default"])(this, EditorWrapper); | ||
_this = _super.call(this, props); | ||
_this = (0, _possibleConstructorReturn2["default"])(this, (0, _getPrototypeOf2["default"])(EditorWrapper).call(this, props)); | ||
var baseDecorator = props.baseDecorator; | ||
@@ -245,3 +239,3 @@ var decorator = new baseDecorator(props.decorators); | ||
return this.props.buttons.map(function (Button, index) { | ||
return /*#__PURE__*/_react["default"].createElement(Button, (0, _extends2["default"])({}, _this3.getOtherProps(), { | ||
return _react["default"].createElement(Button, (0, _extends2["default"])({}, _this3.getOtherProps(), { | ||
key: "button-".concat(index), | ||
@@ -267,5 +261,5 @@ attachedToEditor: true, | ||
return this.props.overlays.map(function (Overlay, index) { | ||
return /*#__PURE__*/_react["default"].createElement(_OverlayWrapper["default"], { | ||
return _react["default"].createElement(_OverlayWrapper["default"], { | ||
key: index | ||
}, /*#__PURE__*/_react["default"].createElement(Overlay, (0, _extends2["default"])({}, _this4.getOtherProps(), { | ||
}, _react["default"].createElement(Overlay, (0, _extends2["default"])({}, _this4.getOtherProps(), { | ||
editorState: decoratedState, | ||
@@ -288,13 +282,13 @@ onChange: onChange, | ||
handleKeyCommand = _this$props3.handleKeyCommand, | ||
otherProps = (0, _objectWithoutProperties2["default"])(_this$props3, _excluded); | ||
otherProps = (0, _objectWithoutProperties2["default"])(_this$props3, ["styleMap", "styleFn", "blockRendererFn", "blockStyleFn", "onChange", "handleKeyCommand"]); | ||
var decoratedState = this.getDecoratedState(); | ||
var className = "draft-extend ".concat(this.props.className); | ||
var readOnly = this.getReadOnly(); | ||
return /*#__PURE__*/_react["default"].createElement(DraftEditorContext.Provider, { | ||
return _react["default"].createElement(DraftEditorContext.Provider, { | ||
value: this.contextValue | ||
}, /*#__PURE__*/_react["default"].createElement("div", { | ||
}, _react["default"].createElement("div", { | ||
className: className | ||
}, /*#__PURE__*/_react["default"].createElement("div", { | ||
}, _react["default"].createElement("div", { | ||
className: "draft-extend-editor" | ||
}, /*#__PURE__*/_react["default"].createElement(_draftJs.Editor, (0, _extends2["default"])({}, otherProps, { | ||
}, _react["default"].createElement(_draftJs.Editor, (0, _extends2["default"])({}, otherProps, { | ||
ref: "editor", | ||
@@ -315,7 +309,7 @@ editorState: decoratedState, | ||
onDownArrow: this.onDownArrow | ||
})), /*#__PURE__*/_react["default"].createElement("div", { | ||
})), _react["default"].createElement("div", { | ||
className: "draft-extend-tray" | ||
}, this.renderTray()), /*#__PURE__*/_react["default"].createElement("div", { | ||
}, this.renderTray()), _react["default"].createElement("div", { | ||
className: "draft-extend-controls" | ||
}, this.renderPluginButtons()), /*#__PURE__*/_react["default"].createElement("div", { | ||
}, this.renderPluginButtons()), _react["default"].createElement("div", { | ||
className: "draft-extend-overlays" | ||
@@ -322,0 +316,0 @@ }, this.renderOverlays())))); |
@@ -20,2 +20,6 @@ "use strict"; | ||
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn")); | ||
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf")); | ||
var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized")); | ||
@@ -25,6 +29,2 @@ | ||
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn")); | ||
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf")); | ||
var _react = _interopRequireDefault(require("react")); | ||
@@ -40,12 +40,6 @@ | ||
var _excluded = ["editorState", "onChange", "keyCommandListeners"]; | ||
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } | ||
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; } | ||
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(source, true).forEach(function (key) { (0, _defineProperty2["default"])(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } | ||
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2["default"])(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; } | ||
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2["default"])(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2["default"])(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2["default"])(this, result); }; } | ||
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } | ||
var providedProps = { | ||
@@ -58,7 +52,7 @@ addKeyCommandListener: _propTypes["default"].func, | ||
var KeyCommandController = function KeyCommandController(Component) { | ||
var KeyCommand = /*#__PURE__*/function (_React$Component) { | ||
var KeyCommand = | ||
/*#__PURE__*/ | ||
function (_React$Component) { | ||
(0, _inherits2["default"])(KeyCommand, _React$Component); | ||
var _super = _createSuper(KeyCommand); | ||
function KeyCommand(props) { | ||
@@ -68,3 +62,3 @@ var _this; | ||
(0, _classCallCheck2["default"])(this, KeyCommand); | ||
_this = _super.call(this, props); | ||
_this = (0, _possibleConstructorReturn2["default"])(this, (0, _getPrototypeOf2["default"])(KeyCommand).call(this, props)); | ||
_this.addKeyCommandListener = _this.addKeyCommandListener.bind((0, _assertThisInitialized2["default"])(_this)); | ||
@@ -206,4 +200,4 @@ _this.removeKeyCommandListener = _this.removeKeyCommandListener.bind((0, _assertThisInitialized2["default"])(_this)); | ||
keyCommandListeners = _this$props2.keyCommandListeners, | ||
others = (0, _objectWithoutProperties2["default"])(_this$props2, _excluded); | ||
return /*#__PURE__*/_react["default"].createElement(Component, (0, _extends2["default"])({}, others, { | ||
others = (0, _objectWithoutProperties2["default"])(_this$props2, ["editorState", "onChange", "keyCommandListeners"]); | ||
return _react["default"].createElement(Component, (0, _extends2["default"])({}, others, { | ||
ref: "editor", | ||
@@ -210,0 +204,0 @@ editorState: editorState, |
@@ -14,4 +14,2 @@ "use strict"; | ||
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits")); | ||
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn")); | ||
@@ -21,2 +19,4 @@ | ||
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits")); | ||
var _react = _interopRequireDefault(require("react")); | ||
@@ -26,11 +26,7 @@ | ||
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2["default"])(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2["default"])(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2["default"])(this, result); }; } | ||
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } | ||
var OverlayWrapper = /*#__PURE__*/function (_React$Component) { | ||
var OverlayWrapper = | ||
/*#__PURE__*/ | ||
function (_React$Component) { | ||
(0, _inherits2["default"])(OverlayWrapper, _React$Component); | ||
var _super = _createSuper(OverlayWrapper); | ||
function OverlayWrapper(props) { | ||
@@ -40,3 +36,3 @@ var _this; | ||
(0, _classCallCheck2["default"])(this, OverlayWrapper); | ||
_this = _super.call(this, props); | ||
_this = (0, _possibleConstructorReturn2["default"])(this, (0, _getPrototypeOf2["default"])(OverlayWrapper).call(this, props)); | ||
var node = document.createElement('div'); | ||
@@ -43,0 +39,0 @@ document.body.appendChild(node); |
@@ -18,2 +18,6 @@ "use strict"; | ||
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn")); | ||
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf")); | ||
var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized")); | ||
@@ -23,6 +27,2 @@ | ||
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn")); | ||
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf")); | ||
var _react = _interopRequireDefault(require("react")); | ||
@@ -34,13 +34,7 @@ | ||
var _excluded = ["editorState", "onChange", "buttons", "addKeyCommandListener", "removeKeyCommandListener"]; | ||
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2["default"])(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2["default"])(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2["default"])(this, result); }; } | ||
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } | ||
var Toolbar = /*#__PURE__*/function (_React$Component) { | ||
var Toolbar = | ||
/*#__PURE__*/ | ||
function (_React$Component) { | ||
(0, _inherits2["default"])(Toolbar, _React$Component); | ||
var _super = _createSuper(Toolbar); | ||
function Toolbar(props) { | ||
@@ -50,3 +44,3 @@ var _this; | ||
(0, _classCallCheck2["default"])(this, Toolbar); | ||
_this = _super.call(this, props); | ||
_this = (0, _possibleConstructorReturn2["default"])(this, (0, _getPrototypeOf2["default"])(Toolbar).call(this, props)); | ||
_this.getEditorState = _this.getEditorState.bind((0, _assertThisInitialized2["default"])(_this)); | ||
@@ -78,5 +72,5 @@ return _this; | ||
removeKeyCommandListener = _this$props.removeKeyCommandListener, | ||
otherProps = (0, _objectWithoutProperties2["default"])(_this$props, _excluded); | ||
otherProps = (0, _objectWithoutProperties2["default"])(_this$props, ["editorState", "onChange", "buttons", "addKeyCommandListener", "removeKeyCommandListener"]); | ||
return buttons.map(function (Button, index) { | ||
return /*#__PURE__*/_react["default"].createElement(Button, (0, _extends2["default"])({}, otherProps, { | ||
return _react["default"].createElement(Button, (0, _extends2["default"])({}, otherProps, { | ||
key: "button-".concat(index), | ||
@@ -93,3 +87,3 @@ editorState: editorState, | ||
value: function render() { | ||
return /*#__PURE__*/_react["default"].createElement("ul", { | ||
return _react["default"].createElement("ul", { | ||
className: "draft-extend-controls" | ||
@@ -96,0 +90,0 @@ }, this.renderButtons()); |
@@ -5,3 +5,3 @@ "use strict"; | ||
var _typeof = require("@babel/runtime/helpers/typeof"); | ||
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard"); | ||
@@ -11,2 +11,8 @@ Object.defineProperty(exports, "__esModule", { | ||
}); | ||
Object.defineProperty(exports, "Editor", { | ||
enumerable: true, | ||
get: function get() { | ||
return _Editor["default"]; | ||
} | ||
}); | ||
Object.defineProperty(exports, "DraftEditorContext", { | ||
@@ -18,6 +24,6 @@ enumerable: true, | ||
}); | ||
Object.defineProperty(exports, "Editor", { | ||
Object.defineProperty(exports, "Toolbar", { | ||
enumerable: true, | ||
get: function get() { | ||
return _Editor["default"]; | ||
return _Toolbar["default"]; | ||
} | ||
@@ -31,6 +37,6 @@ }); | ||
}); | ||
Object.defineProperty(exports, "Toolbar", { | ||
Object.defineProperty(exports, "createPlugin", { | ||
enumerable: true, | ||
get: function get() { | ||
return _Toolbar["default"]; | ||
return _createPlugin["default"]; | ||
} | ||
@@ -44,18 +50,18 @@ }); | ||
}); | ||
Object.defineProperty(exports, "compose", { | ||
Object.defineProperty(exports, "pluginUtils", { | ||
enumerable: true, | ||
get: function get() { | ||
return _compose["default"]; | ||
return _utils["default"]; | ||
} | ||
}); | ||
Object.defineProperty(exports, "createPlugin", { | ||
Object.defineProperty(exports, "compose", { | ||
enumerable: true, | ||
get: function get() { | ||
return _createPlugin["default"]; | ||
return _compose["default"]; | ||
} | ||
}); | ||
Object.defineProperty(exports, "pluginUtils", { | ||
Object.defineProperty(exports, "withDraftExtendContext", { | ||
enumerable: true, | ||
get: function get() { | ||
return _utils["default"]; | ||
return _withDraftExtendContext.withDraftExtendContext; | ||
} | ||
@@ -78,4 +84,2 @@ }); | ||
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } | ||
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; } | ||
var _withDraftExtendContext = require("./components/withDraftExtendContext"); |
@@ -16,5 +16,5 @@ "use strict"; | ||
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; } | ||
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } | ||
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2["default"])(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; } | ||
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(source, true).forEach(function (key) { (0, _defineProperty2["default"])(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } | ||
@@ -64,3 +64,3 @@ var emptyFunction = function emptyFunction() {}; | ||
var keyCommandListeners = memoizedConcat(accumulationWithDefaults.keyCommandListeners, memoizedCoerceArray(keyCommandListener)); | ||
return _objectSpread(_objectSpread({}, accumulationWithDefaults), {}, { | ||
return _objectSpread({}, accumulationWithDefaults, { | ||
styleMap: memoizedAssign(accumulationWithDefaults.styleMap, styleMap), | ||
@@ -67,0 +67,0 @@ styleFn: memoizedAccumulateFunction(accumulationWithDefaults.styleFn, styleFn), |
@@ -18,2 +18,6 @@ "use strict"; | ||
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn")); | ||
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf")); | ||
var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized")); | ||
@@ -23,6 +27,2 @@ | ||
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn")); | ||
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf")); | ||
var _react = _interopRequireDefault(require("react")); | ||
@@ -42,8 +42,2 @@ | ||
var _excluded = ["__keyCommandListener"]; | ||
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2["default"])(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2["default"])(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2["default"])(this, result); }; } | ||
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } | ||
var emptyFunction = function emptyFunction() {}; | ||
@@ -112,7 +106,7 @@ | ||
// wrapping an Editor component | ||
var Plugin = /*#__PURE__*/function (_React$Component) { | ||
var Plugin = | ||
/*#__PURE__*/ | ||
function (_React$Component) { | ||
(0, _inherits2["default"])(Plugin, _React$Component); | ||
var _super = _createSuper(Plugin); | ||
function Plugin(props) { | ||
@@ -122,3 +116,3 @@ var _this; | ||
(0, _classCallCheck2["default"])(this, Plugin); | ||
_this = _super.call(this, props); | ||
_this = (0, _possibleConstructorReturn2["default"])(this, (0, _getPrototypeOf2["default"])(Plugin).call(this, props)); | ||
_this.focus = _this.focus.bind((0, _assertThisInitialized2["default"])(_this)); | ||
@@ -170,4 +164,4 @@ _this.blur = _this.blur.bind((0, _assertThisInitialized2["default"])(_this)); | ||
var __keyCommandListener = pluginAccumulation.__keyCommandListener, | ||
editorPluginOptions = (0, _objectWithoutProperties2["default"])(pluginAccumulation, _excluded); | ||
return /*#__PURE__*/_react["default"].createElement(ToWrap, (0, _extends2["default"])({}, this.props, { | ||
editorPluginOptions = (0, _objectWithoutProperties2["default"])(pluginAccumulation, ["__keyCommandListener"]); | ||
return _react["default"].createElement(ToWrap, (0, _extends2["default"])({}, this.props, { | ||
ref: "child" | ||
@@ -174,0 +168,0 @@ }, editorPluginOptions)); |
{ | ||
"name": "draft-extend", | ||
"version": "2.0.2", | ||
"version": "2.1.1", | ||
"description": "Build extensible Draft.js editors with configurable plugins and integrated serialization.", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
210903
34
4297
1