draft-extend
Advanced tools
Comparing version 2.0.0 to 2.0.2
@@ -9,2 +9,2 @@ !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 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)}componentWillMount(){this.keyCommandOverrides=r.List(this.props.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}}componentWillReceiveProps(e){if(e.decorators.length===this.state.decorator._decorators.length){if(this.state.decorator._decorators.every((t,n)=>t===e.decorators[n]))return}this.setState({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 W=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}},z=()=>{};const V=()=>{},Y=[],Z={},G=q((e,t=z)=>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:V,decorators:Y,buttons:Y,overlays:Y,blockRendererFn:V,blockStyleFn:V,keyBindingFn:V,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(W(ie(y)),W(t.htmlToStyle));n.__isMiddleware=!0;const r=I(W(u),W(t.htmlToBlock));r.__isMiddleware=!0;const o=I(W(m),W(t.htmlToEntity));o.__isMiddleware=!0;const s=I(W(p),W(t.textToEntity));s.__isMiddleware=!0;const i=I(W(h),W(t.styleToHTML));i.__isMiddleware=!0;const a=I(W(f),W(t.blockToHTML));a.__isMiddleware=!0;const d=I(W(g),W(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})})); | ||
*/}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})})); |
@@ -77,16 +77,16 @@ import React from 'react'; | ||
componentWillReceiveProps(nextProps) { | ||
if (nextProps.decorators.length === this.state.decorator._decorators.length) { | ||
const allDecoratorsMatch = this.state.decorator._decorators.every((decorator, i) => { | ||
return decorator === nextProps.decorators[i]; | ||
static getDerivedStateFromProps(props, state) { | ||
if (props.decorators.length === state.decorator._decorators.length) { | ||
const allDecoratorsMatch = state.decorator._decorators.every((decorator, i) => { | ||
return decorator === props.decorators[i]; | ||
}); | ||
if (allDecoratorsMatch) { | ||
return; | ||
return {}; | ||
} | ||
} | ||
this.setState({ | ||
decorator: new nextProps.baseDecorator(nextProps.decorators) | ||
}); | ||
return { | ||
decorator: new props.baseDecorator(props.decorators) | ||
}; | ||
} | ||
@@ -93,0 +93,0 @@ |
@@ -21,6 +21,3 @@ import React from 'react'; | ||
this.blur = this.blur.bind(this); | ||
} | ||
componentWillMount() { | ||
this.keyCommandOverrides = List(this.props.keyCommandListeners); | ||
this.keyCommandOverrides = List(props.keyCommandListeners); | ||
this.keyCommandListeners = List(); | ||
@@ -27,0 +24,0 @@ } |
@@ -124,19 +124,2 @@ "use strict"; | ||
(0, _createClass2["default"])(EditorWrapper, [{ | ||
key: "componentWillReceiveProps", | ||
value: function componentWillReceiveProps(nextProps) { | ||
if (nextProps.decorators.length === this.state.decorator._decorators.length) { | ||
var allDecoratorsMatch = this.state.decorator._decorators.every(function (decorator, i) { | ||
return decorator === nextProps.decorators[i]; | ||
}); | ||
if (allDecoratorsMatch) { | ||
return; | ||
} | ||
} | ||
this.setState({ | ||
decorator: new nextProps.baseDecorator(nextProps.decorators) | ||
}); | ||
} | ||
}, { | ||
key: "keyBindingFn", | ||
@@ -332,2 +315,19 @@ value: function keyBindingFn(e) { | ||
} | ||
}], [{ | ||
key: "getDerivedStateFromProps", | ||
value: function getDerivedStateFromProps(props, state) { | ||
if (props.decorators.length === state.decorator._decorators.length) { | ||
var allDecoratorsMatch = state.decorator._decorators.every(function (decorator, i) { | ||
return decorator === props.decorators[i]; | ||
}); | ||
if (allDecoratorsMatch) { | ||
return {}; | ||
} | ||
} | ||
return { | ||
decorator: new props.baseDecorator(props.decorators) | ||
}; | ||
} | ||
}]); | ||
@@ -334,0 +334,0 @@ return EditorWrapper; |
@@ -70,2 +70,4 @@ "use strict"; | ||
_this.blur = _this.blur.bind((0, _assertThisInitialized2["default"])(_this)); | ||
_this.keyCommandOverrides = (0, _immutable.List)(props.keyCommandListeners); | ||
_this.keyCommandListeners = (0, _immutable.List)(); | ||
return _this; | ||
@@ -75,8 +77,2 @@ } | ||
(0, _createClass2["default"])(KeyCommand, [{ | ||
key: "componentWillMount", | ||
value: function componentWillMount() { | ||
this.keyCommandOverrides = (0, _immutable.List)(this.props.keyCommandListeners); | ||
this.keyCommandListeners = (0, _immutable.List)(); | ||
} | ||
}, { | ||
key: "componentDidMount", | ||
@@ -83,0 +79,0 @@ value: function componentDidMount() { |
{ | ||
"name": "draft-extend", | ||
"version": "2.0.0", | ||
"version": "2.0.2", | ||
"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
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
0
208025
4178