Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

draft-extend

Package Overview
Dependencies
Maintainers
10
Versions
33
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

draft-extend - npm Package Compare versions

Comparing version 1.6.4 to 1.6.5

esm/components/Editor.js

2

dist/draft-extend.min.js

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

!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("Immutable"),require("React"),require("Draft"),require("ReactDOM")):"function"==typeof define&&define.amd?define(["Immutable","React","Draft","ReactDOM"],t):"object"==typeof exports?exports.DraftExtend=t(require("Immutable"),require("React"),require("Draft"),require("ReactDOM")):e.DraftExtend=t(e.Immutable,e.React,e.Draft,e.ReactDOM)}(this,function(e,t,n,r){return function(e){function t(r){if(n[r])return n[r].exports;var o=n[r]={exports:{},id:r,loaded:!1};return e[r].call(o.exports,o,o.exports,t),o.loaded=!0,o.exports}var n={};return t.m=e,t.c=n,t.p="",t(0)}([function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0}),t.compose=t.pluginUtils=t.createPlugin=t.KeyCommandController=t.Toolbar=t.Editor=void 0;var o=n(8),a=r(o),i=n(10),u=r(i),s=n(4),l=r(s),d=n(11),c=r(d),f=n(12),y=r(f),p=n(6),h=r(p);t.Editor=a.default,t.Toolbar=u.default,t.KeyCommandController=l.default,t.createPlugin=c.default,t.pluginUtils=y.default,t.compose=h.default},function(t,n){t.exports=e},function(e,n){e.exports=t},function(e,t,n){e.exports=n(16)()},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function o(e,t){var n={};for(var r in e)t.indexOf(r)>=0||Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=e[r]);return n}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function u(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var s=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},l=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),d=n(2),c=r(d),f=n(3),y=r(f),p=n(7),h=r(p),m=n(1),v=n(5),b={addKeyCommandListener:y.default.func,removeKeyCommandListener:y.default.func,handleKeyCommand:y.default.func},g=function(e){var t=function(t){function n(e){a(this,n);var t=i(this,(n.__proto__||Object.getPrototypeOf(n)).call(this,e));return t.addKeyCommandListener=t.addKeyCommandListener.bind(t),t.removeKeyCommandListener=t.removeKeyCommandListener.bind(t),t.handleKeyCommand=t.handleKeyCommand.bind(t),t.focus=t.focus.bind(t),t.blur=t.blur.bind(t),t}return u(n,t),l(n,[{key:"componentWillMount",value:function(){this.keyCommandOverrides=(0,m.List)(this.props.keyCommandListeners),this.keyCommandListeners=(0,m.List)()}},{key:"componentDidMount",value:function(){var e=this,t=Object.keys(b),n=t.filter(function(t){return void 0!==e.props[t]}),r=0===n.length,o=n.length===t.length;(0,h.default)(r||o,"KeyCommandController: A KeyCommandController is receiving only some props ("+n.join(", ")+") necessary to defer to a parent key command controller."),o&&this.props.keyCommandListeners.forEach(function(t){e.props.addKeyCommandListener(t)})}},{key:"componentWillUnmount",value:function(){var e=this;this.props.removeKeyCommandListener&&this.props.keyCommandListeners.forEach(function(t){e.props.removeKeyCommandListener(t)})}},{key:"addKeyCommandListener",value:function e(t){var e=this.props.addKeyCommandListener;return e?void e(t):void(this.keyCommandListeners=this.keyCommandListeners.unshift(t))}},{key:"removeKeyCommandListener",value:function e(t){var e=this.props.removeKeyCommandListener;return e?void e(t):void(this.keyCommandListeners=this.keyCommandListeners.filterNot(function(e){return e===t}))}},{key:"handleKeyCommand",value:function e(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,r=this.props,o=r.editorState,a=r.onChange,e=r.handleKeyCommand;if(e)return e(t,n);var i=this.keyCommandListeners.concat(this.keyCommandOverrides).reduce(function(e,r){var o=e.state,i=e.hasChanged;if(i===!0)return{state:o,hasChanged:i};var u=r(o,t,n),s=u instanceof v.EditorState;return u===!0||s&&u!==o?s?(a(u),{state:u,hasChanged:!0}):{state:o,hasChanged:!0}:{state:o,hasChanged:i}},{state:o,hasChanged:!1});return i.hasChanged}},{key:"focus",value:function(){this.refs.editor.focus()}},{key:"blur",value:function(){this.refs.editor.blur()}},{key:"render",value:function(){var t=this.props,n=t.editorState,r=t.onChange,a=(t.keyCommandListeners,o(t,["editorState","onChange","keyCommandListeners"]));return c.default.createElement(e,s({},a,{ref:"editor",editorState:n,onChange:r,addKeyCommandListener:this.addKeyCommandListener,removeKeyCommandListener:this.removeKeyCommandListener,handleKeyCommand:this.handleKeyCommand}))}}]),n}(c.default.Component);return t.displayName="KeyCommandController("+e.displayName+")",t.propTypes=s({editorState:y.default.object,onChange:y.default.func,keyCommandListeners:y.default.arrayOf(y.default.func)},b),t.defaultProps={keyCommandListeners:[]},t};t.default=g},function(e,t){e.exports=n},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];return function(){if(0===t.length)return arguments.length<=0?void 0:arguments[0];var e=t[t.length-1],n=t.slice(0,-1);return n.reduceRight(function(e,t){return t(e)},e.apply(void 0,arguments))}}},function(e,t,n){"use strict";var r=function(e,t,n,r,o,a,i,u){if(!e){var s;if(void 0===t)s=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var l=[n,r,o,a,i,u],d=0;s=new Error(t.replace(/%s/g,function(){return l[d++]})),s.name="Invariant Violation"}throw s.framesToPop=1,s}};e.exports=r},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function o(e,t){var n={};for(var r in e)t.indexOf(r)>=0||Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=e[r]);return n}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function u(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var s=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},l=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),d=n(2),c=r(d),f=n(3),y=r(f),p=n(5),h=n(4),m=r(h),v=n(9),b=r(v),g={className:y.default.string,editorState:y.default.object,onChange:y.default.func,decorators:y.default.array,baseDecorator:y.default.func,styleMap:y.default.object,styleFn:y.default.func,buttons:y.default.array,overlays:y.default.array,blockRendererFn:y.default.func,blockStyleFn:y.default.func,keyBindingFn:y.default.func,addKeyCommandListener:y.default.func.isRequired,removeKeyCommandListener:y.default.func.isRequired,handleReturn:y.default.func,onEscape:y.default.func,onTab:y.default.func,onUpArrow:y.default.func,onDownArrow:y.default.func,readOnly:y.default.bool,showButtons:y.default.bool,renderTray:y.default.func},C=function(e){function t(e){a(this,t);var n=i(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e)),r=e.baseDecorator,o=new r(e.decorators);return n.state={decorator:o,readOnly:!1},n.keyBindingFn=n.keyBindingFn.bind(n),n.handleReturn=n.handleReturn.bind(n),n.onEscape=n.onEscape.bind(n),n.onTab=n.onTab.bind(n),n.onUpArrow=n.onUpArrow.bind(n),n.onDownArrow=n.onDownArrow.bind(n),n.focus=n.focus.bind(n),n.blur=n.blur.bind(n),n.getOtherProps=n.getOtherProps.bind(n),n.getReadOnly=n.getReadOnly.bind(n),n.setReadOnly=n.setReadOnly.bind(n),n.getDecoratedState=n.getDecoratedState.bind(n),n}return u(t,e),l(t,[{key:"getChildContext",value:function(){return{getEditorState:this.getDecoratedState,getReadOnly:this.getReadOnly,setReadOnly:this.setReadOnly,onChange:this.props.onChange,focus:this.focus,blur:this.blur,editorRef:this.refs.editor}}},{key:"componentWillReceiveProps",value:function(e){if(e.decorators.length===this.state.decorator._decorators.length){var t=this.state.decorator._decorators.every(function(t,n){return t===e.decorators[n]});if(t)return}this.setState({decorator:new e.baseDecorator(e.decorators)})}},{key:"keyBindingFn",value:function(e){var t=this.props.keyBindingFn(e);return t?t:(0,p.getDefaultKeyBinding)(e)}},{key:"handleReturn",value:function(e,t){return this.props.handleReturn&&this.props.handleReturn(e,t)||this.props.handleKeyCommand("return",e)}},{key:"onEscape",value:function(e){return this.props.onEscape&&this.props.onEscape(e)||this.props.handleKeyCommand("escape",e)}},{key:"onTab",value:function(e){return this.props.onTab&&this.props.onTab(e)||this.props.handleKeyCommand("tab",e)}},{key:"onUpArrow",value:function(e){return this.props.onUpArrow&&this.props.onUpArrow(e)||this.props.handleKeyCommand("up-arrow",e)}},{key:"onDownArrow",value:function(e){return this.props.onDownArrow&&this.props.onDownArrow(e)||this.props.handleKeyCommand("down-arrow",e)}},{key:"focus",value:function(){this.refs.editor.focus()}},{key:"blur",value:function(){this.refs.editor.blur()}},{key:"getOtherProps",value:function(){var e=this,t=Object.keys(this.props),n=Object.keys(g),r=t.filter(function(e){return n.indexOf(e)===-1});return r.reduce(function(t,n){return t[n]=e.props[n],t},{})}},{key:"getReadOnly",value:function(){return this.state.readOnly||this.props.readOnly}},{key:"setReadOnly",value:function(e){this.setState({readOnly:e})}},{key:"getDecoratedState",value:function(){var e=this.props.editorState,t=this.state.decorator,n=e.getDecorator();return n&&n._decorators===t._decorators?e:p.EditorState.set(e,{decorator:t})}},{key:"renderTray",value:function e(){var e=this.props.renderTray;return"function"!=typeof e?null:e()}},{key:"renderPluginButtons",value:function(){var e=this,t=this.props,n=t.onChange,r=t.addKeyCommandListener,o=t.removeKeyCommandListener,a=t.showButtons;if(a===!1)return null;var i=this.getDecoratedState();return this.props.buttons.map(function(t,a){return c.default.createElement(t,s({},e.getOtherProps(),{key:"button-"+a,attachedToEditor:!0,editorState:i,onChange:n,addKeyCommandListener:r,removeKeyCommandListener:o}))})}},{key:"renderOverlays",value:function(){var e=this,t=this.props,n=t.onChange,r=t.addKeyCommandListener,o=t.removeKeyCommandListener,a=this.getDecoratedState();return this.props.overlays.map(function(t,i){return c.default.createElement(b.default,{key:i},c.default.createElement(t,s({},e.getOtherProps(),{editorState:a,onChange:n,addKeyCommandListener:r,removeKeyCommandListener:o})))})}},{key:"render",value:function(){var e=this.props,t=e.styleMap,n=e.styleFn,r=e.blockRendererFn,a=e.blockStyleFn,i=e.onChange,u=e.handleKeyCommand,l=o(e,["styleMap","styleFn","blockRendererFn","blockStyleFn","onChange","handleKeyCommand"]),d=this.getDecoratedState(),f="draft-extend "+this.props.className,y=this.getReadOnly();return c.default.createElement("div",{className:f},c.default.createElement("div",{className:"draft-extend-editor"},c.default.createElement(p.Editor,s({},l,{ref:"editor",editorState:d,readOnly:y,onChange:i,blockStyleFn:a,blockRendererFn:r,customStyleMap:t,customStyleFn:n,handleKeyCommand:u,keyBindingFn:this.keyBindingFn,handleReturn:this.handleReturn,onEscape:this.onEscape,onTab:this.onTab,onUpArrow:this.onUpArrow,onDownArrow:this.onDownArrow})),c.default.createElement("div",{className:"draft-extend-tray"},this.renderTray()),c.default.createElement("div",{className:"draft-extend-controls"},this.renderPluginButtons()),c.default.createElement("div",{className:"draft-extend-overlays"},this.renderOverlays())))}}]),t}(c.default.Component);C.propTypes=g,C.defaultProps={className:"",editorState:p.EditorState.createEmpty(),onChange:function(){},decorators:[],baseDecorator:p.CompositeDecorator,styleMap:{},styleFn:function(){},buttons:[],overlays:[],blockRendererFn:function(){},blockStyleFn:function(){},keyBindingFn:function(){},readOnly:!1,showButtons:!0},C.childContextTypes={getEditorState:y.default.func,getReadOnly:y.default.func,setReadOnly:y.default.func,onChange:y.default.func,focus:y.default.func,blur:y.default.func,editorRef:y.default.object},t.default=(0,m.default)(C)},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var u=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),s=n(2),l=r(s),d=n(18),c=r(d),f=function(e){function t(e){o(this,t);var n=a(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e)),r=document.createElement("div");return document.body.appendChild(r),n.state={node:r},n}return i(t,e),u(t,[{key:"componentDidMount",value:function(){this.renderOverlay()}},{key:"componentDidUpdate",value:function(){this.renderOverlay()}},{key:"componentWillUnmount",value:function(){c.default.unmountComponentAtNode(this.state.node)}},{key:"renderOverlay",value:function(){var e=l.default.Children.only(this.props.children);c.default.render(e,this.state.node)}},{key:"render",value:function(){return null}}]),t}(l.default.Component);t.default=f},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function o(e,t){var n={};for(var r in e)t.indexOf(r)>=0||Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=e[r]);return n}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function u(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var s=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},l=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),d=n(2),c=r(d),f=n(3),y=r(f),p=n(4),h=r(p),m=function(e){function t(e){a(this,t);var n=i(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return n.getEditorState=n.getEditorState.bind(n),n}return u(t,e),l(t,[{key:"getChildContext",value:function(){return{getEditorState:this.getEditorState,onChange:this.props.onChange}}},{key:"getEditorState",value:function(){return this.props.editorState}},{key:"renderButtons",value:function(){var e=this.props,t=e.editorState,n=e.onChange,r=e.buttons,a=e.addKeyCommandListener,i=e.removeKeyCommandListener,u=o(e,["editorState","onChange","buttons","addKeyCommandListener","removeKeyCommandListener"]);return r.map(function(e,r){return c.default.createElement(e,s({},u,{key:"button-"+r,editorState:t,onChange:n,addKeyCommandListener:a,removeKeyCommandListener:i}))})}},{key:"render",value:function(){return c.default.createElement("ul",{className:"draft-extend-controls"},this.renderButtons())}}]),t}(c.default.Component);m.propTypes={editorState:y.default.object,onChange:y.default.func,buttons:y.default.array,addKeyCommandListener:y.default.func.isRequired,removeKeyCommandListener:y.default.func.isRequired},m.childContextTypes={getEditorState:y.default.func,onChange:y.default.func},t.default=(0,h.default)(m)},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var u=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},s=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),l=n(2),d=r(l),c=n(3),f=r(c),y=n(1),p=n(14),h=r(p),m=n(6),v=r(m),b=n(13),g=r(b),C=n(15),O=r(C),k=function(){},_=[],w={},E=function(e){return function(){return e.apply(void 0,arguments)}};E.__isMiddleware=!0;var S=(0,h.default)(v.default),T=(0,h.default)(g.default),L=(0,h.default)(function(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];return Object.assign.apply(Object,[{}].concat(t))}),j=(0,h.default)(function(e,t){return e.concat(t)}),K=(0,h.default)(function(e){return Array.isArray(e)?e:[e]}),M=(0,h.default)(function(e){return function(t,n){return e(t,n,(0,y.OrderedSet)())}}),P=(0,h.default)(O.default),R=function e(t){var n=t.displayName,r=void 0===n?"Plugin":n,l=t.decorators,c=void 0===l?_:l,y=t.buttons,p=void 0===y?_:y,h=t.overlays,m=void 0===h?_:h,v=t.styleMap,b=void 0===v?w:v,g=t.styleFn,C=void 0===g?k:g,O=t.blockRendererFn,R=void 0===O?k:O,F=t.blockStyleFn,x=void 0===F?k:F,A=t.keyBindingFn,B=void 0===A?k:A,D=t.keyCommandListener,U=void 0===D?k:D,N=t.htmlToStyle,q=void 0===N?E:N,H=t.htmlToBlock,I=void 0===H?E:H,W=t.htmlToEntity,V=void 0===W?E:W,z=t.textToEntity,Y=void 0===z?E:z,Z=t.styleToHTML,G=void 0===Z?E:Z,J=t.blockToHTML,Q=void 0===J?E:J,X=t.entityToHTML,$=void 0===X?E:X;return function(t){if(c=K(c),p=K(p),m=K(m),t.prototype&&t.prototype.isReactComponent){var n=function(e){function n(e){o(this,n);var t=a(this,(n.__proto__||Object.getPrototypeOf(n)).call(this,e));return t.focus=t.focus.bind(t),t.blur=t.blur.bind(t),t}return i(n,e),s(n,[{key:"focus",value:function(){this.refs.child.focus&&this.refs.child.focus()}},{key:"blur",value:function(){this.refs.child.blur&&this.refs.child.blur()}},{key:"render",value:function(){var e=L(this.props.styleMap,b),n=T(this.props.styleFn,C),r=j(this.props.decorators,c),o=j(this.props.buttons,p),a=j(this.props.overlays,m),i=T(R,this.props.blockRendererFn),s=T(x,this.props.blockStyleFn),l=T(B,this.props.keyBindingFn),f=j(this.props.keyCommandListeners,K(U));return d.default.createElement(t,u({},this.props,{ref:"child",styleMap:e,styleFn:n,decorators:r,buttons:o,overlays:a,blockRendererFn:i,blockStyleFn:s,keyBindingFn:l,keyCommandListeners:f}))}}]),n}(d.default.Component);return n.displayName=r,n.propTypes={styleMap:f.default.object,styleFn:f.default.func,decorators:f.default.array,buttons:f.default.array,overlays:f.default.array,blockRendererFn:f.default.func,blockStyleFn:f.default.func,keyBindingFn:f.default.func,keyCommandListeners:f.default.arrayOf(f.default.func)},n.defaultProps={styleMap:w,styleFn:k,decorators:_,buttons:_,overlays:_,blockRendererFn:k,blockStyleFn:k,keyBindingFn:k,keyCommandListeners:_},n}return function(){for(var n=arguments.length,r=Array(n),o=0;o<n;o++)r[o]=arguments[o];if(1===r.length&&("string"==typeof r[0]||r[0].hasOwnProperty("_map")&&null!=r[0].getBlockMap))return t({htmlToStyle:q,htmlToBlock:I,htmlToEntity:V,textToEntity:Y,styleToHTML:G,blockToHTML:Q,entityToHTML:$}).apply(void 0,r);var a=r[0],i=S(P(M(q)),P(a.htmlToStyle));i.__isMiddleware=!0;var u=S(P(I),P(a.htmlToBlock));u.__isMiddleware=!0;var s=S(P(V),P(a.htmlToEntity));s.__isMiddleware=!0;var l=S(P(Y),P(a.textToEntity));l.__isMiddleware=!0;var d=S(P(G),P(a.styleToHTML));d.__isMiddleware=!0;var c=S(P(Q),P(a.blockToHTML));c.__isMiddleware=!0;var f=S(P($),P(a.entityToHTML));return f.__isMiddleware=!0,e({htmlToStyle:i,htmlToBlock:u,htmlToEntity:s,textToEntity:l,styleToHTML:d,blockToHTML:c,entityToHTML:f})(t)}}};t.default=R},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var o=n(5),a=n(1),i=n(7),u=r(i),s=function(e){return e.replace(/[a-z][A-Z]/g,function(e){return e[0]+"-"+e[1].toLowerCase()})},l=function(e){var t=e.getCurrentContent().getBlockForKey(e.getSelection().getStartKey());if(t)return t.getEntityAt(e.getSelection().getStartOffset())};t.default={camelCaseToHyphen:s,styleObjectToString:function(e){return Object.keys(e).map(function(t){return s(t)+": "+e[t]+";"}).join(" ").replace(/"/g,'\\"')},entityStrategy:function(e){return function(t,n,r){t.findEntityRanges(function(t){var n=t.getEntity();if(null===n)return!1;var a=r&&r.getEntity?r.getEntity(n):o.Entity.get(n);return a&&a.getType()===e},n)}},getEntitySelection:function(e,t){var n=[];return e.getCurrentContent().getBlocksAsArray().forEach(function(e){e.findEntityRanges(function(e){return e.getEntity()===t},function(t,r){n.push(o.SelectionState.createEmpty(e.getKey()).merge({anchorOffset:t,focusOffset:r,isBackward:!1,hasFocus:!0}))})}),(0,u.default)(1===n.length,"getEntitySelection: More than one range with the same entityKey. Please use unique entity instances"),n[0]},insertBlockAtCursor:function(e,t){var n=e.getCurrentContent(),r=e.getSelection(),i=o.Modifier.removeRange(n,r,"backward"),u=i.getSelectionAfter(),s=o.Modifier.splitBlock(i,u),l=s.getSelectionAfter(),d=o.Modifier.setBlockType(s,l,t.getType()),c=[t,new o.ContentBlock({key:(0,o.genKey)(),type:"unstyled",text:"",characterList:(0,a.List)()})],f=o.BlockMapBuilder.createFromArray(c),y=o.Modifier.replaceWithFragment(d,l,f),p=y.merge({selectionBefore:r,selectionAfter:y.getSelectionAfter().set("hasFocus",!0)});return o.EditorState.push(e,p,"insert-fragment")},getSelectedInlineStyles:function(e){var t=e.getSelection(),n=e.getCurrentContent(),r=n.getBlockMap().skipUntil(function(e,n){return n===t.getStartKey()}).takeUntil(function(e,r){return n.getKeyBefore(r)===t.getEndKey()});return r.reduce(function(e,n){var r=n.getKey(),o=0,a=n.getLength()-1;r===t.getStartKey()&&(o=t.getStartOffset()),r===t.getEndKey()&&(a=t.getEndOffset());for(var i=o;i<=a;i++)e=e.union(n.getInlineStyleAt(i));return e},(0,a.Set)())},matchAll:function(e,t){for(var n=[],r=t.exec(e);null!==r;)n.push(r.concat([r.index])),r=t.exec(e);return n},getActiveEntity:l,isEntityActive:function(e,t){var n=l(e),r=e.getCurrentContent();if(n){var a=r.getEntity?r.getEntity(n):o.Entity.get(n);return a&&a.type===t}return!1}}},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e,t){return function(){var n=e.apply(void 0,arguments);return null===n||void 0===n?t.apply(void 0,arguments):n}}},function(e,t,n){"use strict";function r(e){var t=(0,o.Map)();return function(){var n=o.List.of.apply(o.List,arguments);return t.has(n)||(t=t.set(n,e.apply(void 0,arguments))),t.get(n)}}Object.defineProperty(t,"__esModule",{value:!0}),t.default=r;var o=n(1)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},o=n(1),a=function(e){return e&&e.__isMiddleware?e:function(t){return function(){if("object"===("undefined"==typeof e?"undefined":r(e))){var n=arguments.length<=0?void 0:arguments[0],a=void 0;if("string"==typeof n){var i=n;a=e[i]}else a=e[n.type];return null!==a&&void 0!==a?a:t.apply(void 0,arguments)}var u=void 0;try{var s=e.apply(void 0,arguments);if(null===s||void 0===s)u=t.apply(void 0,arguments);else if(2===arguments.length&&"string"==typeof(arguments.length<=1?void 0:arguments[1])&&(arguments.length<=1?void 0:arguments[1])===s)u=t.apply(void 0,arguments);else if(Array.isArray(s))u=s.concat(t.apply(void 0,arguments));else if(o.OrderedSet.isOrderedSet(s)){var l,d=(l=arguments.length-1,arguments.length<=l?void 0:arguments[l]);u=d.union(s).union(t.apply(void 0,arguments))}else u="function"==typeof s?e(t).apply(void 0,arguments):s}catch(n){u=e(t).apply(void 0,arguments)}finally{return u}}}};t.default=a},function(e,t,n){"use strict";function r(){}function o(){}var a=n(17);o.resetWarningCache=r,e.exports=function(){function e(e,t,n,r,o,i){if(i!==a){var u=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 u.name="Invariant Violation",u}}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:o,resetWarningCache:r};return n.PropTypes=n,n}},function(e,t){"use strict";var n="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";e.exports=n},function(e,t){e.exports=r}])});
!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){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function i(e,t){return e(t={exports:{}},t.exports),t.exports}t=t&&t.hasOwnProperty("default")?t.default:t,o=o&&o.hasOwnProperty("default")?o.default:o;var a=i((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,h=n?Symbol.for("react.suspense"):60113,p=n?Symbol.for("react.memo"):60115,m=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 h:return e;default:switch(e=e&&e.$$typeof){case c:case u:case d:return e;default:return t}}case m: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=m,t.Memo=p,t.Portal=o,t.Profiler=a,t.StrictMode=i,t.Suspense=h,t.isValidElementType=function(e){return"string"==typeof e||"function"==typeof e||e===s||e===y||e===a||e===i||e===h||"object"==typeof e&&null!==e&&(e.$$typeof===m||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)===m},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)===h}}));s(a);a.typeOf,a.AsyncMode,a.ConcurrentMode,a.ContextConsumer,a.ContextProvider,a.Element,a.ForwardRef,a.Fragment,a.Lazy,a.Memo,a.Portal,a.Profiler,a.StrictMode,a.Suspense,a.isValidElementType,a.isAsyncMode,a.isConcurrentMode,a.isContextConsumer,a.isContextProvider,a.isElement,a.isForwardRef,a.isFragment,a.isLazy,a.isMemo,a.isPortal,a.isProfiler,a.isStrictMode,a.isSuspense;var d=i((function(e,t){}));s(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,i((function(e){e.exports=a}));var c=Object.getOwnPropertySymbols,l=Object.prototype.hasOwnProperty,y=Object.prototype.propertyIsEnumerable;function u(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 h="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";Function.call.bind(Object.prototype.hasOwnProperty);function p(){}function m(){}m.resetWarningCache=p;var f=i((function(e){e.exports=function(){function e(e,t,n,r,o,s){if(s!==h){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:m,resetWarningCache:p};return n.PropTypes=n,n}()})),g=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:f.func,removeKeyCommandListener:f.func,handleKeyCommand:f.func},b=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(C),t=e.filter(e=>void 0!==this.props[e]),n=0===t.length,r=t.length===e.length;g(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: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:f.object,onChange:f.func,keyCommandListeners:f.arrayOf(f.func),...C},o.defaultProps={keyCommandListeners:[]},o};class S 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 O={className:f.string,editorState:f.object,onChange:f.func,decorators:f.array,baseDecorator:f.func,styleMap:f.object,styleFn:f.func,buttons:f.array,overlays:f.array,blockRendererFn:f.func,blockStyleFn:f.func,keyBindingFn:f.func,addKeyCommandListener:f.func.isRequired,removeKeyCommandListener:f.func.isRequired,handleReturn:f.func,onEscape:f.func,onTab:f.func,onUpArrow:f.func,onDownArrow:f.func,readOnly:f.bool,showButtons:f.bool,renderTray:f.func};class E 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)}getChildContext(){return{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(O);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(S,{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("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())))}}E.propTypes=O,E.defaultProps={className:"",editorState:n.EditorState.createEmpty(),onChange:()=>{},decorators:[],baseDecorator:n.CompositeDecorator,styleMap:{},styleFn:()=>{},buttons:[],overlays:[],blockRendererFn:()=>{},blockStyleFn:()=>{},keyBindingFn:()=>{},readOnly:!1,showButtons:!0},E.childContextTypes={getEditorState:f.func,getReadOnly:f.func,setReadOnly:f.func,onChange:f.func,focus:f.func,blur:f.func,editorRef:f.object};var k=b(E);class T 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())}}T.propTypes={editorState:f.object,onChange:f.func,buttons:f.array,addKeyCommandListener:f.func.isRequired,removeKeyCommandListener:f.func.isRequired},T.childContextTypes={getEditorState:f.func,onChange:f.func};var v=b(T);function L(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 w=(...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 M=()=>{},K=[],F={},R=e=>(...t)=>e(...t);R.__isMiddleware=!0;const P=L(w),j=L((e,t)=>(...n)=>{const r=e(...n);return null==r?t(...n):r}),x=L((...e)=>Object.assign({},...e)),A=L((e,t)=>e.concat(t)),_=L(e=>Array.isArray(e)?e:[e]),B=L(e=>(t,n)=>e(t,n,r.OrderedSet())),D=L(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}}),$=({displayName:e="Plugin",decorators:n=K,buttons:r=K,overlays:o=K,styleMap:s=F,styleFn:i=M,blockRendererFn:a=M,blockStyleFn:d=M,keyBindingFn:c=M,keyCommandListener:l=M,htmlToStyle:y=R,htmlToBlock:u=R,htmlToEntity:h=R,textToEntity:p=R,styleToHTML:m=R,blockToHTML:g=R,entityToHTML:C=R})=>b=>{if(n=_(n),r=_(r),o=_(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=x(this.props.styleMap,s),y=j(this.props.styleFn,i),u=A(this.props.decorators,n),h=A(this.props.buttons,r),p=A(this.props.overlays,o),m=j(a,this.props.blockRendererFn),f=j(d,this.props.blockStyleFn),g=j(c,this.props.keyBindingFn),C=A(this.props.keyCommandListeners,_(l));return t.createElement(b,Object.assign({},this.props,{ref:"child",styleMap:e,styleFn:y,decorators:u,buttons:h,overlays:p,blockRendererFn:m,blockStyleFn:f,keyBindingFn:g,keyCommandListeners:C}))}}return y.displayName=e,y.propTypes={styleMap:f.object,styleFn:f.func,decorators:f.array,buttons:f.array,overlays:f.array,blockRendererFn:f.func,blockStyleFn:f.func,keyBindingFn:f.func,keyCommandListeners:f.arrayOf(f.func)},y.defaultProps={styleMap:F,styleFn:M,decorators:K,buttons:K,overlays:K,blockRendererFn:M,blockStyleFn:M,keyBindingFn:M,keyCommandListeners:K},y}return(...e)=>{if(1===e.length&&("string"==typeof e[0]||e[0].hasOwnProperty("_map")&&null!=e[0].getBlockMap))return b({htmlToStyle:y,htmlToBlock:u,htmlToEntity:h,textToEntity:p,styleToHTML:m,blockToHTML:g,entityToHTML:C})(...e);{const t=e[0],n=P(D(B(y)),D(t.htmlToStyle));n.__isMiddleware=!0;const r=P(D(u),D(t.htmlToBlock));r.__isMiddleware=!0;const o=P(D(h),D(t.htmlToEntity));o.__isMiddleware=!0;const s=P(D(p),D(t.textToEntity));s.__isMiddleware=!0;const i=P(D(m),D(t.styleToHTML));i.__isMiddleware=!0;const a=P(D(g),D(t.blockToHTML));a.__isMiddleware=!0;const d=P(D(C),D(t.entityToHTML));return d.__isMiddleware=!0,$({htmlToStyle:n,htmlToBlock:r,htmlToEntity:o,textToEntity:s,styleToHTML:i,blockToHTML:a,entityToHTML:d})(b)}}},N=e=>e.replace(/[a-z][A-Z]/g,e=>e[0]+"-"+e[1].toLowerCase()),U=e=>{const t=e.getCurrentContent().getBlockForKey(e.getSelection().getStartKey());if(t)return t.getEntityAt(e.getSelection().getStartOffset())};var H={camelCaseToHyphen:N,styleObjectToString:e=>Object.keys(e).map(t=>`${N(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}))})}),g(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),h=n.Modifier.replaceWithFragment(l,c,u),p=h.merge({selectionBefore:s,selectionAfter:h.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:U,isEntityActive(e,t){const r=U(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.Editor=k,e.KeyCommandController=b,e.Toolbar=v,e.compose=w,e.createPlugin=$,e.pluginUtils=H,Object.defineProperty(e,"__esModule",{value:!0})}));

@@ -1,75 +0,72 @@

'use strict';
"use strict";
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", {
value: true
});
exports["default"] = void 0;
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
var _react = require('react');
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
var _react2 = _interopRequireDefault(_react);
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
var _propTypes = require('prop-types');
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
var _propTypes2 = _interopRequireDefault(_propTypes);
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
var _draftJs = require('draft-js');
var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
var _KeyCommandController = require('./KeyCommandController');
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
var _KeyCommandController2 = _interopRequireDefault(_KeyCommandController);
var _react = _interopRequireDefault(require("react"));
var _OverlayWrapper = require('./OverlayWrapper');
var _propTypes = _interopRequireDefault(require("prop-types"));
var _OverlayWrapper2 = _interopRequireDefault(_OverlayWrapper);
var _draftJs = require("draft-js");
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var _KeyCommandController = _interopRequireDefault(require("./KeyCommandController"));
function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; }
var _OverlayWrapper = _interopRequireDefault(require("./OverlayWrapper"));
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
var propTypes = {
className: _propTypes2.default.string,
editorState: _propTypes2.default.object,
onChange: _propTypes2.default.func,
decorators: _propTypes2.default.array,
baseDecorator: _propTypes2.default.func,
styleMap: _propTypes2.default.object,
styleFn: _propTypes2.default.func,
buttons: _propTypes2.default.array,
overlays: _propTypes2.default.array,
blockRendererFn: _propTypes2.default.func,
blockStyleFn: _propTypes2.default.func,
keyBindingFn: _propTypes2.default.func,
addKeyCommandListener: _propTypes2.default.func.isRequired,
removeKeyCommandListener: _propTypes2.default.func.isRequired,
handleReturn: _propTypes2.default.func,
onEscape: _propTypes2.default.func,
onTab: _propTypes2.default.func,
onUpArrow: _propTypes2.default.func,
onDownArrow: _propTypes2.default.func,
readOnly: _propTypes2.default.bool,
showButtons: _propTypes2.default.bool,
renderTray: _propTypes2.default.func
className: _propTypes["default"].string,
editorState: _propTypes["default"].object,
onChange: _propTypes["default"].func,
decorators: _propTypes["default"].array,
baseDecorator: _propTypes["default"].func,
styleMap: _propTypes["default"].object,
styleFn: _propTypes["default"].func,
buttons: _propTypes["default"].array,
overlays: _propTypes["default"].array,
blockRendererFn: _propTypes["default"].func,
blockStyleFn: _propTypes["default"].func,
keyBindingFn: _propTypes["default"].func,
addKeyCommandListener: _propTypes["default"].func.isRequired,
removeKeyCommandListener: _propTypes["default"].func.isRequired,
handleReturn: _propTypes["default"].func,
onEscape: _propTypes["default"].func,
onTab: _propTypes["default"].func,
onUpArrow: _propTypes["default"].func,
onDownArrow: _propTypes["default"].func,
readOnly: _propTypes["default"].bool,
showButtons: _propTypes["default"].bool,
renderTray: _propTypes["default"].func
};
var EditorWrapper = function (_React$Component) {
_inherits(EditorWrapper, _React$Component);
var EditorWrapper =
/*#__PURE__*/
function (_React$Component) {
(0, _inherits2["default"])(EditorWrapper, _React$Component);
function EditorWrapper(props) {
_classCallCheck(this, EditorWrapper);
var _this;
var _this = _possibleConstructorReturn(this, (EditorWrapper.__proto__ || Object.getPrototypeOf(EditorWrapper)).call(this, props));
(0, _classCallCheck2["default"])(this, EditorWrapper);
_this = (0, _possibleConstructorReturn2["default"])(this, (0, _getPrototypeOf2["default"])(EditorWrapper).call(this, props));
var baseDecorator = props.baseDecorator;
var decorator = new baseDecorator(props.decorators);

@@ -80,20 +77,19 @@ _this.state = {

};
_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.keyBindingFn = _this.keyBindingFn.bind((0, _assertThisInitialized2["default"])(_this));
_this.handleReturn = _this.handleReturn.bind((0, _assertThisInitialized2["default"])(_this));
_this.onEscape = _this.onEscape.bind((0, _assertThisInitialized2["default"])(_this));
_this.onTab = _this.onTab.bind((0, _assertThisInitialized2["default"])(_this));
_this.onUpArrow = _this.onUpArrow.bind((0, _assertThisInitialized2["default"])(_this));
_this.onDownArrow = _this.onDownArrow.bind((0, _assertThisInitialized2["default"])(_this));
_this.focus = _this.focus.bind((0, _assertThisInitialized2["default"])(_this));
_this.blur = _this.blur.bind((0, _assertThisInitialized2["default"])(_this));
_this.getOtherProps = _this.getOtherProps.bind((0, _assertThisInitialized2["default"])(_this));
_this.getReadOnly = _this.getReadOnly.bind((0, _assertThisInitialized2["default"])(_this));
_this.setReadOnly = _this.setReadOnly.bind((0, _assertThisInitialized2["default"])(_this));
_this.getDecoratedState = _this.getDecoratedState.bind((0, _assertThisInitialized2["default"])(_this));
return _this;
}
_createClass(EditorWrapper, [{
key: 'getChildContext',
(0, _createClass2["default"])(EditorWrapper, [{
key: "getChildContext",
value: function getChildContext() {

@@ -111,3 +107,3 @@ return {

}, {
key: 'componentWillReceiveProps',
key: "componentWillReceiveProps",
value: function componentWillReceiveProps(nextProps) {

@@ -118,2 +114,3 @@ if (nextProps.decorators.length === this.state.decorator._decorators.length) {

});
if (allDecoratorsMatch) {

@@ -129,5 +126,6 @@ return;

}, {
key: 'keyBindingFn',
key: "keyBindingFn",
value: function keyBindingFn(e) {
var pluginsCommand = this.props.keyBindingFn(e);
if (pluginsCommand) {

@@ -140,3 +138,3 @@ return pluginsCommand;

}, {
key: 'handleReturn',
key: "handleReturn",
value: function handleReturn(e, editorState) {

@@ -146,3 +144,3 @@ return this.props.handleReturn && this.props.handleReturn(e, editorState) || this.props.handleKeyCommand('return', e);

}, {
key: 'onEscape',
key: "onEscape",
value: function onEscape(e) {

@@ -152,3 +150,3 @@ return this.props.onEscape && this.props.onEscape(e) || this.props.handleKeyCommand('escape', e);

}, {
key: 'onTab',
key: "onTab",
value: function onTab(e) {

@@ -158,3 +156,3 @@ return this.props.onTab && this.props.onTab(e) || this.props.handleKeyCommand('tab', e);

}, {
key: 'onUpArrow',
key: "onUpArrow",
value: function onUpArrow(e) {

@@ -164,3 +162,3 @@ return this.props.onUpArrow && this.props.onUpArrow(e) || this.props.handleKeyCommand('up-arrow', e);

}, {
key: 'onDownArrow',
key: "onDownArrow",
value: function onDownArrow(e) {

@@ -170,3 +168,3 @@ return this.props.onDownArrow && this.props.onDownArrow(e) || this.props.handleKeyCommand('down-arrow', e);

}, {
key: 'focus',
key: "focus",
value: function focus() {

@@ -176,3 +174,3 @@ this.refs.editor.focus();

}, {
key: 'blur',
key: "blur",
value: function blur() {

@@ -182,3 +180,3 @@ this.refs.editor.blur();

}, {
key: 'getOtherProps',
key: "getOtherProps",
value: function getOtherProps() {

@@ -189,7 +187,5 @@ var _this2 = this;

var propTypeKeys = Object.keys(propTypes);
var propsToPass = propKeys.filter(function (prop) {
return propTypeKeys.indexOf(prop) === -1;
});
return propsToPass.reduce(function (acc, prop) {

@@ -201,3 +197,3 @@ acc[prop] = _this2.props[prop];

}, {
key: 'getReadOnly',
key: "getReadOnly",
value: function getReadOnly() {

@@ -207,13 +203,13 @@ return this.state.readOnly || this.props.readOnly;

}, {
key: 'setReadOnly',
key: "setReadOnly",
value: function setReadOnly(readOnly) {
this.setState({ readOnly: readOnly });
this.setState({
readOnly: readOnly
});
}
}, {
key: 'getDecoratedState',
key: "getDecoratedState",
value: function getDecoratedState() {
var editorState = this.props.editorState;
var decorator = this.state.decorator;
var currentDecorator = editorState.getDecorator();

@@ -225,10 +221,11 @@

return _draftJs.EditorState.set(editorState, { decorator: decorator });
return _draftJs.EditorState.set(editorState, {
decorator: decorator
});
}
}, {
key: 'renderTray',
key: "renderTray",
value: function renderTray() {
var renderTray = this.props.renderTray;
if (typeof renderTray !== 'function') {

@@ -241,13 +238,12 @@ return null;

}, {
key: 'renderPluginButtons',
key: "renderPluginButtons",
value: function renderPluginButtons() {
var _this3 = this;
var _props = this.props,
onChange = _props.onChange,
addKeyCommandListener = _props.addKeyCommandListener,
removeKeyCommandListener = _props.removeKeyCommandListener,
showButtons = _props.showButtons;
var _this$props = this.props,
onChange = _this$props.onChange,
addKeyCommandListener = _this$props.addKeyCommandListener,
removeKeyCommandListener = _this$props.removeKeyCommandListener,
showButtons = _this$props.showButtons;
if (showButtons === false) {

@@ -258,6 +254,5 @@ return null;

var decoratedState = this.getDecoratedState();
return this.props.buttons.map(function (Button, index) {
return _react2.default.createElement(Button, _extends({}, _this3.getOtherProps(), {
key: 'button-' + index,
return _react["default"].createElement(Button, (0, _extends2["default"])({}, _this3.getOtherProps(), {
key: "button-".concat(index),
attachedToEditor: true,

@@ -272,92 +267,69 @@ editorState: decoratedState,

}, {
key: 'renderOverlays',
key: "renderOverlays",
value: function renderOverlays() {
var _this4 = this;
var _props2 = this.props,
onChange = _props2.onChange,
addKeyCommandListener = _props2.addKeyCommandListener,
removeKeyCommandListener = _props2.removeKeyCommandListener;
var _this$props2 = this.props,
onChange = _this$props2.onChange,
addKeyCommandListener = _this$props2.addKeyCommandListener,
removeKeyCommandListener = _this$props2.removeKeyCommandListener;
var decoratedState = this.getDecoratedState();
return this.props.overlays.map(function (Overlay, index) {
return _react2.default.createElement(
_OverlayWrapper2.default,
{ key: index },
_react2.default.createElement(Overlay, _extends({}, _this4.getOtherProps(), {
editorState: decoratedState,
onChange: onChange,
addKeyCommandListener: addKeyCommandListener,
removeKeyCommandListener: removeKeyCommandListener
}))
);
return _react["default"].createElement(_OverlayWrapper["default"], {
key: index
}, _react["default"].createElement(Overlay, (0, _extends2["default"])({}, _this4.getOtherProps(), {
editorState: decoratedState,
onChange: onChange,
addKeyCommandListener: addKeyCommandListener,
removeKeyCommandListener: removeKeyCommandListener
})));
});
}
}, {
key: 'render',
key: "render",
value: function render() {
var _props3 = this.props,
styleMap = _props3.styleMap,
styleFn = _props3.styleFn,
blockRendererFn = _props3.blockRendererFn,
blockStyleFn = _props3.blockStyleFn,
onChange = _props3.onChange,
handleKeyCommand = _props3.handleKeyCommand,
otherProps = _objectWithoutProperties(_props3, ['styleMap', 'styleFn', 'blockRendererFn', 'blockStyleFn', 'onChange', 'handleKeyCommand']);
var _this$props3 = this.props,
styleMap = _this$props3.styleMap,
styleFn = _this$props3.styleFn,
blockRendererFn = _this$props3.blockRendererFn,
blockStyleFn = _this$props3.blockStyleFn,
onChange = _this$props3.onChange,
handleKeyCommand = _this$props3.handleKeyCommand,
otherProps = (0, _objectWithoutProperties2["default"])(_this$props3, ["styleMap", "styleFn", "blockRendererFn", "blockStyleFn", "onChange", "handleKeyCommand"]);
var decoratedState = this.getDecoratedState();
var className = 'draft-extend ' + this.props.className;
var className = "draft-extend ".concat(this.props.className);
var readOnly = this.getReadOnly();
return _react2.default.createElement(
'div',
{ className: className },
_react2.default.createElement(
'div',
{ className: 'draft-extend-editor' },
_react2.default.createElement(_draftJs.Editor, _extends({}, otherProps, {
ref: 'editor',
editorState: decoratedState,
readOnly: readOnly,
onChange: onChange,
blockStyleFn: blockStyleFn,
blockRendererFn: blockRendererFn,
customStyleMap: styleMap,
customStyleFn: styleFn,
handleKeyCommand: handleKeyCommand,
keyBindingFn: this.keyBindingFn,
handleReturn: this.handleReturn,
onEscape: this.onEscape,
onTab: this.onTab,
onUpArrow: this.onUpArrow,
onDownArrow: this.onDownArrow
})),
_react2.default.createElement(
'div',
{ className: 'draft-extend-tray' },
this.renderTray()
),
_react2.default.createElement(
'div',
{ className: 'draft-extend-controls' },
this.renderPluginButtons()
),
_react2.default.createElement(
'div',
{ className: 'draft-extend-overlays' },
this.renderOverlays()
)
)
);
return _react["default"].createElement("div", {
className: className
}, _react["default"].createElement("div", {
className: "draft-extend-editor"
}, _react["default"].createElement(_draftJs.Editor, (0, _extends2["default"])({}, otherProps, {
ref: "editor",
editorState: decoratedState,
readOnly: readOnly,
onChange: onChange,
blockStyleFn: blockStyleFn,
blockRendererFn: blockRendererFn,
customStyleMap: styleMap,
customStyleFn: styleFn,
handleKeyCommand: handleKeyCommand,
keyBindingFn: this.keyBindingFn,
handleReturn: this.handleReturn,
onEscape: this.onEscape,
onTab: this.onTab,
onUpArrow: this.onUpArrow,
onDownArrow: this.onDownArrow
})), _react["default"].createElement("div", {
className: "draft-extend-tray"
}, this.renderTray()), _react["default"].createElement("div", {
className: "draft-extend-controls"
}, this.renderPluginButtons()), _react["default"].createElement("div", {
className: "draft-extend-overlays"
}, this.renderOverlays())));
}
}]);
return EditorWrapper;
}(_react2.default.Component);
}(_react["default"].Component);
EditorWrapper.propTypes = propTypes;
EditorWrapper.defaultProps = {

@@ -379,13 +351,14 @@ className: '',

};
EditorWrapper.childContextTypes = {
getEditorState: _propTypes2.default.func,
getReadOnly: _propTypes2.default.func,
setReadOnly: _propTypes2.default.func,
onChange: _propTypes2.default.func,
focus: _propTypes2.default.func,
blur: _propTypes2.default.func,
editorRef: _propTypes2.default.object
getEditorState: _propTypes["default"].func,
getReadOnly: _propTypes["default"].func,
setReadOnly: _propTypes["default"].func,
onChange: _propTypes["default"].func,
focus: _propTypes["default"].func,
blur: _propTypes["default"].func,
editorRef: _propTypes["default"].object
};
exports.default = (0, _KeyCommandController2.default)(EditorWrapper);
var _default = (0, _KeyCommandController["default"])(EditorWrapper);
exports["default"] = _default;

@@ -1,62 +0,69 @@

'use strict';
"use strict";
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", {
value: true
});
exports["default"] = void 0;
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
var _react = require('react');
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
var _react2 = _interopRequireDefault(_react);
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
var _propTypes = require('prop-types');
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
var _propTypes2 = _interopRequireDefault(_propTypes);
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
var _invariant = require('invariant');
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
var _invariant2 = _interopRequireDefault(_invariant);
var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
var _immutable = require('immutable');
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
var _draftJs = require('draft-js');
var _react = _interopRequireDefault(require("react"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var _propTypes = _interopRequireDefault(require("prop-types"));
function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; }
var _invariant = _interopRequireDefault(require("invariant"));
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
var _immutable = require("immutable");
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
var _draftJs = require("draft-js");
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
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 = 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; }
var providedProps = {
addKeyCommandListener: _propTypes2.default.func,
removeKeyCommandListener: _propTypes2.default.func,
handleKeyCommand: _propTypes2.default.func
addKeyCommandListener: _propTypes["default"].func,
removeKeyCommandListener: _propTypes["default"].func,
handleKeyCommand: _propTypes["default"].func
};
var KeyCommandController = function KeyCommandController(Component) {
var KeyCommand = function (_React$Component) {
_inherits(KeyCommand, _React$Component);
var KeyCommand =
/*#__PURE__*/
function (_React$Component) {
(0, _inherits2["default"])(KeyCommand, _React$Component);
function KeyCommand(props) {
_classCallCheck(this, KeyCommand);
var _this;
var _this = _possibleConstructorReturn(this, (KeyCommand.__proto__ || Object.getPrototypeOf(KeyCommand)).call(this, props));
_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);
(0, _classCallCheck2["default"])(this, KeyCommand);
_this = (0, _possibleConstructorReturn2["default"])(this, (0, _getPrototypeOf2["default"])(KeyCommand).call(this, props));
_this.addKeyCommandListener = _this.addKeyCommandListener.bind((0, _assertThisInitialized2["default"])(_this));
_this.removeKeyCommandListener = _this.removeKeyCommandListener.bind((0, _assertThisInitialized2["default"])(_this));
_this.handleKeyCommand = _this.handleKeyCommand.bind((0, _assertThisInitialized2["default"])(_this));
_this.focus = _this.focus.bind((0, _assertThisInitialized2["default"])(_this));
_this.blur = _this.blur.bind((0, _assertThisInitialized2["default"])(_this));
return _this;
}
_createClass(KeyCommand, [{
key: 'componentWillMount',
(0, _createClass2["default"])(KeyCommand, [{
key: "componentWillMount",
value: function componentWillMount() {

@@ -67,3 +74,3 @@ this.keyCommandOverrides = (0, _immutable.List)(this.props.keyCommandListeners);

}, {
key: 'componentDidMount',
key: "componentDidMount",
value: function componentDidMount() {

@@ -79,5 +86,4 @@ var _this2 = this;

var allPresent = presentProps.length === propNames.length;
(0, _invariant["default"])(nonePresent || allPresent, "KeyCommandController: A KeyCommandController is receiving only some props (".concat(presentProps.join(', '), ") necessary to defer to a parent key command controller."));
(0, _invariant2.default)(nonePresent || allPresent, 'KeyCommandController: A KeyCommandController is receiving only some props (' + presentProps.join(', ') + ') necessary to defer to a parent key command controller.');
if (allPresent) {

@@ -90,3 +96,3 @@ this.props.keyCommandListeners.forEach(function (listener) {

}, {
key: 'componentWillUnmount',
key: "componentWillUnmount",
value: function componentWillUnmount() {

@@ -102,7 +108,6 @@ var _this3 = this;

}, {
key: 'addKeyCommandListener',
key: "addKeyCommandListener",
value: function addKeyCommandListener(listener) {
var addKeyCommandListener = this.props.addKeyCommandListener;
if (addKeyCommandListener) {

@@ -116,7 +121,6 @@ addKeyCommandListener(listener);

}, {
key: 'removeKeyCommandListener',
key: "removeKeyCommandListener",
value: function removeKeyCommandListener(listener) {
var removeKeyCommandListener = this.props.removeKeyCommandListener;
if (removeKeyCommandListener) {

@@ -132,11 +136,10 @@ removeKeyCommandListener(listener);

}, {
key: 'handleKeyCommand',
key: "handleKeyCommand",
value: function handleKeyCommand(command) {
var keyboardEvent = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
var _props = this.props,
editorState = _props.editorState,
onChange = _props.onChange,
handleKeyCommand = _props.handleKeyCommand;
var _this$props = this.props,
editorState = _this$props.editorState,
onChange = _this$props.onChange,
handleKeyCommand = _this$props.handleKeyCommand;
if (handleKeyCommand) {

@@ -168,2 +171,3 @@ return handleKeyCommand(command, keyboardEvent);

}
return {

@@ -179,8 +183,10 @@ state: state,

};
}, { state: editorState, hasChanged: false });
}, {
state: editorState,
hasChanged: false
});
return result.hasChanged;
}
}, {
key: 'focus',
key: "focus",
value: function focus() {

@@ -190,3 +196,3 @@ this.refs.editor.focus();

}, {
key: 'blur',
key: "blur",
value: function blur() {

@@ -196,12 +202,11 @@ this.refs.editor.blur();

}, {
key: 'render',
key: "render",
value: function render() {
var _props2 = this.props,
editorState = _props2.editorState,
onChange = _props2.onChange,
keyCommandListeners = _props2.keyCommandListeners,
others = _objectWithoutProperties(_props2, ['editorState', 'onChange', 'keyCommandListeners']);
return _react2.default.createElement(Component, _extends({}, others, {
ref: 'editor',
var _this$props2 = this.props,
editorState = _this$props2.editorState,
onChange = _this$props2.onChange,
keyCommandListeners = _this$props2.keyCommandListeners,
others = (0, _objectWithoutProperties2["default"])(_this$props2, ["editorState", "onChange", "keyCommandListeners"]);
return _react["default"].createElement(Component, (0, _extends2["default"])({}, others, {
ref: "editor",
editorState: editorState,

@@ -215,21 +220,18 @@ onChange: onChange,

}]);
return KeyCommand;
}(_react2.default.Component);
}(_react["default"].Component);
KeyCommand.displayName = 'KeyCommandController(' + Component.displayName + ')';
KeyCommand.propTypes = _extends({
editorState: _propTypes2.default.object,
onChange: _propTypes2.default.func,
keyCommandListeners: _propTypes2.default.arrayOf(_propTypes2.default.func)
KeyCommand.displayName = "KeyCommandController(".concat(Component.displayName, ")");
KeyCommand.propTypes = _objectSpread({
editorState: _propTypes["default"].object,
onChange: _propTypes["default"].func,
keyCommandListeners: _propTypes["default"].arrayOf(_propTypes["default"].func)
}, providedProps);
KeyCommand.defaultProps = {
keyCommandListeners: []
};
return KeyCommand;
};
exports.default = KeyCommandController;
var _default = KeyCommandController;
exports["default"] = _default;

@@ -1,42 +0,44 @@

'use strict';
"use strict";
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", {
value: true
});
exports["default"] = void 0;
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
var _react = require('react');
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
var _react2 = _interopRequireDefault(_react);
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
var _reactDom = require('react-dom');
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
var _reactDom2 = _interopRequireDefault(_reactDom);
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var _react = _interopRequireDefault(require("react"));
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
var _reactDom = _interopRequireDefault(require("react-dom"));
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
var OverlayWrapper =
/*#__PURE__*/
function (_React$Component) {
(0, _inherits2["default"])(OverlayWrapper, _React$Component);
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
var OverlayWrapper = function (_React$Component) {
_inherits(OverlayWrapper, _React$Component);
function OverlayWrapper(props) {
_classCallCheck(this, OverlayWrapper);
var _this;
var _this = _possibleConstructorReturn(this, (OverlayWrapper.__proto__ || Object.getPrototypeOf(OverlayWrapper)).call(this, props));
(0, _classCallCheck2["default"])(this, OverlayWrapper);
_this = (0, _possibleConstructorReturn2["default"])(this, (0, _getPrototypeOf2["default"])(OverlayWrapper).call(this, props));
var node = document.createElement('div');
document.body.appendChild(node);
_this.state = { node: node };
_this.state = {
node: node
};
return _this;
}
_createClass(OverlayWrapper, [{
key: 'componentDidMount',
(0, _createClass2["default"])(OverlayWrapper, [{
key: "componentDidMount",
value: function componentDidMount() {

@@ -46,3 +48,3 @@ this.renderOverlay();

}, {
key: 'componentDidUpdate',
key: "componentDidUpdate",
value: function componentDidUpdate() {

@@ -52,14 +54,15 @@ this.renderOverlay();

}, {
key: 'componentWillUnmount',
key: "componentWillUnmount",
value: function componentWillUnmount() {
_reactDom2.default.unmountComponentAtNode(this.state.node);
_reactDom["default"].unmountComponentAtNode(this.state.node);
}
}, {
key: 'renderOverlay',
key: "renderOverlay",
value: function renderOverlay() {
var child = _react2.default.Children.only(this.props.children);
_reactDom2.default.render(child, this.state.node);
var child = _react["default"].Children.only(this.props.children);
_reactDom["default"].render(child, this.state.node);
}
}, {
key: 'render',
key: "render",
value: function render() {

@@ -69,6 +72,5 @@ return null;

}]);
return OverlayWrapper;
}(_react2.default.Component);
}(_react["default"].Component);
exports.default = OverlayWrapper;
exports["default"] = OverlayWrapper;

@@ -1,47 +0,48 @@

'use strict';
"use strict";
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", {
value: true
});
exports["default"] = void 0;
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
var _react = require('react');
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
var _react2 = _interopRequireDefault(_react);
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
var _propTypes = require('prop-types');
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
var _propTypes2 = _interopRequireDefault(_propTypes);
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
var _KeyCommandController = require('./KeyCommandController');
var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
var _KeyCommandController2 = _interopRequireDefault(_KeyCommandController);
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var _react = _interopRequireDefault(require("react"));
function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; }
var _propTypes = _interopRequireDefault(require("prop-types"));
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
var _KeyCommandController = _interopRequireDefault(require("./KeyCommandController"));
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
var Toolbar =
/*#__PURE__*/
function (_React$Component) {
(0, _inherits2["default"])(Toolbar, _React$Component);
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
var Toolbar = function (_React$Component) {
_inherits(Toolbar, _React$Component);
function Toolbar(props) {
_classCallCheck(this, Toolbar);
var _this;
var _this = _possibleConstructorReturn(this, (Toolbar.__proto__ || Object.getPrototypeOf(Toolbar)).call(this, props));
_this.getEditorState = _this.getEditorState.bind(_this);
(0, _classCallCheck2["default"])(this, Toolbar);
_this = (0, _possibleConstructorReturn2["default"])(this, (0, _getPrototypeOf2["default"])(Toolbar).call(this, props));
_this.getEditorState = _this.getEditorState.bind((0, _assertThisInitialized2["default"])(_this));
return _this;
}
_createClass(Toolbar, [{
key: 'getChildContext',
(0, _createClass2["default"])(Toolbar, [{
key: "getChildContext",
value: function getChildContext() {

@@ -54,3 +55,3 @@ return {

}, {
key: 'getEditorState',
key: "getEditorState",
value: function getEditorState() {

@@ -60,15 +61,14 @@ return this.props.editorState;

}, {
key: 'renderButtons',
key: "renderButtons",
value: function renderButtons() {
var _props = this.props,
editorState = _props.editorState,
onChange = _props.onChange,
buttons = _props.buttons,
addKeyCommandListener = _props.addKeyCommandListener,
removeKeyCommandListener = _props.removeKeyCommandListener,
otherProps = _objectWithoutProperties(_props, ['editorState', 'onChange', 'buttons', 'addKeyCommandListener', 'removeKeyCommandListener']);
var _this$props = this.props,
editorState = _this$props.editorState,
onChange = _this$props.onChange,
buttons = _this$props.buttons,
addKeyCommandListener = _this$props.addKeyCommandListener,
removeKeyCommandListener = _this$props.removeKeyCommandListener,
otherProps = (0, _objectWithoutProperties2["default"])(_this$props, ["editorState", "onChange", "buttons", "addKeyCommandListener", "removeKeyCommandListener"]);
return buttons.map(function (Button, index) {
return _react2.default.createElement(Button, _extends({}, otherProps, {
key: 'button-' + index,
return _react["default"].createElement(Button, (0, _extends2["default"])({}, otherProps, {
key: "button-".concat(index),
editorState: editorState,

@@ -82,28 +82,26 @@ onChange: onChange,

}, {
key: 'render',
key: "render",
value: function render() {
return _react2.default.createElement(
'ul',
{ className: 'draft-extend-controls' },
this.renderButtons()
);
return _react["default"].createElement("ul", {
className: "draft-extend-controls"
}, this.renderButtons());
}
}]);
return Toolbar;
}(_react2.default.Component);
}(_react["default"].Component);
Toolbar.propTypes = {
editorState: _propTypes2.default.object,
onChange: _propTypes2.default.func,
buttons: _propTypes2.default.array,
addKeyCommandListener: _propTypes2.default.func.isRequired,
removeKeyCommandListener: _propTypes2.default.func.isRequired
editorState: _propTypes["default"].object,
onChange: _propTypes["default"].func,
buttons: _propTypes["default"].array,
addKeyCommandListener: _propTypes["default"].func.isRequired,
removeKeyCommandListener: _propTypes["default"].func.isRequired
};
Toolbar.childContextTypes = {
getEditorState: _propTypes2.default.func,
onChange: _propTypes2.default.func
getEditorState: _propTypes["default"].func,
onChange: _propTypes["default"].func
};
exports.default = (0, _KeyCommandController2.default)(Toolbar);
var _default = (0, _KeyCommandController["default"])(Toolbar);
exports["default"] = _default;

@@ -1,39 +0,55 @@

'use strict';
"use strict";
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.compose = exports.pluginUtils = exports.createPlugin = exports.KeyCommandController = exports.Toolbar = exports.Editor = undefined;
Object.defineProperty(exports, "Editor", {
enumerable: true,
get: function get() {
return _Editor["default"];
}
});
Object.defineProperty(exports, "Toolbar", {
enumerable: true,
get: function get() {
return _Toolbar["default"];
}
});
Object.defineProperty(exports, "KeyCommandController", {
enumerable: true,
get: function get() {
return _KeyCommandController["default"];
}
});
Object.defineProperty(exports, "createPlugin", {
enumerable: true,
get: function get() {
return _createPlugin["default"];
}
});
Object.defineProperty(exports, "pluginUtils", {
enumerable: true,
get: function get() {
return _utils["default"];
}
});
Object.defineProperty(exports, "compose", {
enumerable: true,
get: function get() {
return _compose["default"];
}
});
var _Editor = require('./components/Editor');
var _Editor = _interopRequireDefault(require("./components/Editor"));
var _Editor2 = _interopRequireDefault(_Editor);
var _Toolbar = _interopRequireDefault(require("./components/Toolbar"));
var _Toolbar = require('./components/Toolbar');
var _KeyCommandController = _interopRequireDefault(require("./components/KeyCommandController"));
var _Toolbar2 = _interopRequireDefault(_Toolbar);
var _createPlugin = _interopRequireDefault(require("./plugins/createPlugin"));
var _KeyCommandController = require('./components/KeyCommandController');
var _utils = _interopRequireDefault(require("./plugins/utils"));
var _KeyCommandController2 = _interopRequireDefault(_KeyCommandController);
var _createPlugin = require('./plugins/createPlugin');
var _createPlugin2 = _interopRequireDefault(_createPlugin);
var _utils = require('./plugins/utils');
var _utils2 = _interopRequireDefault(_utils);
var _compose = require('./util/compose');
var _compose2 = _interopRequireDefault(_compose);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
exports.Editor = _Editor2.default;
exports.Toolbar = _Toolbar2.default;
exports.KeyCommandController = _KeyCommandController2.default;
exports.createPlugin = _createPlugin2.default;
exports.pluginUtils = _utils2.default;
exports.compose = _compose2.default;
var _compose = _interopRequireDefault(require("./util/compose"));

@@ -1,46 +0,40 @@

'use strict';
"use strict";
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", {
value: true
});
exports["default"] = void 0;
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
var _react = require('react');
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
var _react2 = _interopRequireDefault(_react);
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
var _propTypes = require('prop-types');
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
var _propTypes2 = _interopRequireDefault(_propTypes);
var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
var _immutable = require('immutable');
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
var _memoize = require('../util/memoize');
var _react = _interopRequireDefault(require("react"));
var _memoize2 = _interopRequireDefault(_memoize);
var _propTypes = _interopRequireDefault(require("prop-types"));
var _compose = require('../util/compose');
var _immutable = require("immutable");
var _compose2 = _interopRequireDefault(_compose);
var _memoize = _interopRequireDefault(require("../util/memoize"));
var _accumulateFunction = require('../util/accumulateFunction');
var _compose = _interopRequireDefault(require("../util/compose"));
var _accumulateFunction2 = _interopRequireDefault(_accumulateFunction);
var _accumulateFunction = _interopRequireDefault(require("../util/accumulateFunction"));
var _middlewareAdapter = require('../util/middlewareAdapter');
var _middlewareAdapter = _interopRequireDefault(require("../util/middlewareAdapter"));
var _middlewareAdapter2 = _interopRequireDefault(_middlewareAdapter);
var emptyFunction = function emptyFunction() {};
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
var emptyFunction = function emptyFunction() {};
var emptyArray = [];

@@ -51,11 +45,11 @@ var emptyObject = {};

return function () {
return next.apply(undefined, arguments);
return next.apply(void 0, arguments);
};
};
defaultMiddlewareFunction.__isMiddleware = true;
var memoizedCompose = (0, _memoize2.default)(_compose2.default);
var memoizedAccumulateFunction = (0, _memoize2.default)(_accumulateFunction2.default);
var memoizedAssign = (0, _memoize2.default)(function () {
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
var memoizedCompose = (0, _memoize["default"])(_compose["default"]);
var memoizedAccumulateFunction = (0, _memoize["default"])(_accumulateFunction["default"]);
var memoizedAssign = (0, _memoize["default"])(function () {
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];

@@ -66,9 +60,9 @@ }

});
var memoizedConcat = (0, _memoize2.default)(function (a1, a2) {
var memoizedConcat = (0, _memoize["default"])(function (a1, a2) {
return a1.concat(a2);
});
var memoizedCoerceArray = (0, _memoize2.default)(function (arg) {
var memoizedCoerceArray = (0, _memoize["default"])(function (arg) {
return Array.isArray(arg) ? arg : [arg];
});
var memoizedPassEmptyStyles = (0, _memoize2.default)(function (func) {
var memoizedPassEmptyStyles = (0, _memoize["default"])(function (func) {
return function (nodeName, node) {

@@ -78,39 +72,39 @@ return func(nodeName, node, (0, _immutable.OrderedSet)());

});
var memoizedMiddlewareAdapter = (0, _memoize2.default)(_middlewareAdapter2.default);
var memoizedMiddlewareAdapter = (0, _memoize["default"])(_middlewareAdapter["default"]);
var createPlugin = function createPlugin(_ref) {
var _ref$displayName = _ref.displayName,
displayName = _ref$displayName === undefined ? 'Plugin' : _ref$displayName,
displayName = _ref$displayName === void 0 ? 'Plugin' : _ref$displayName,
_ref$decorators = _ref.decorators,
decorators = _ref$decorators === undefined ? emptyArray : _ref$decorators,
decorators = _ref$decorators === void 0 ? emptyArray : _ref$decorators,
_ref$buttons = _ref.buttons,
buttons = _ref$buttons === undefined ? emptyArray : _ref$buttons,
buttons = _ref$buttons === void 0 ? emptyArray : _ref$buttons,
_ref$overlays = _ref.overlays,
overlays = _ref$overlays === undefined ? emptyArray : _ref$overlays,
overlays = _ref$overlays === void 0 ? emptyArray : _ref$overlays,
_ref$styleMap = _ref.styleMap,
styleMap = _ref$styleMap === undefined ? emptyObject : _ref$styleMap,
styleMap = _ref$styleMap === void 0 ? emptyObject : _ref$styleMap,
_ref$styleFn = _ref.styleFn,
styleFn = _ref$styleFn === undefined ? emptyFunction : _ref$styleFn,
styleFn = _ref$styleFn === void 0 ? emptyFunction : _ref$styleFn,
_ref$blockRendererFn = _ref.blockRendererFn,
blockRendererFn = _ref$blockRendererFn === undefined ? emptyFunction : _ref$blockRendererFn,
blockRendererFn = _ref$blockRendererFn === void 0 ? emptyFunction : _ref$blockRendererFn,
_ref$blockStyleFn = _ref.blockStyleFn,
blockStyleFn = _ref$blockStyleFn === undefined ? emptyFunction : _ref$blockStyleFn,
blockStyleFn = _ref$blockStyleFn === void 0 ? emptyFunction : _ref$blockStyleFn,
_ref$keyBindingFn = _ref.keyBindingFn,
keyBindingFn = _ref$keyBindingFn === undefined ? emptyFunction : _ref$keyBindingFn,
keyBindingFn = _ref$keyBindingFn === void 0 ? emptyFunction : _ref$keyBindingFn,
_ref$keyCommandListen = _ref.keyCommandListener,
keyCommandListener = _ref$keyCommandListen === undefined ? emptyFunction : _ref$keyCommandListen,
keyCommandListener = _ref$keyCommandListen === void 0 ? emptyFunction : _ref$keyCommandListen,
_ref$htmlToStyle = _ref.htmlToStyle,
htmlToStyle = _ref$htmlToStyle === undefined ? defaultMiddlewareFunction : _ref$htmlToStyle,
htmlToStyle = _ref$htmlToStyle === void 0 ? defaultMiddlewareFunction : _ref$htmlToStyle,
_ref$htmlToBlock = _ref.htmlToBlock,
htmlToBlock = _ref$htmlToBlock === undefined ? defaultMiddlewareFunction : _ref$htmlToBlock,
htmlToBlock = _ref$htmlToBlock === void 0 ? defaultMiddlewareFunction : _ref$htmlToBlock,
_ref$htmlToEntity = _ref.htmlToEntity,
htmlToEntity = _ref$htmlToEntity === undefined ? defaultMiddlewareFunction : _ref$htmlToEntity,
htmlToEntity = _ref$htmlToEntity === void 0 ? defaultMiddlewareFunction : _ref$htmlToEntity,
_ref$textToEntity = _ref.textToEntity,
textToEntity = _ref$textToEntity === undefined ? defaultMiddlewareFunction : _ref$textToEntity,
textToEntity = _ref$textToEntity === void 0 ? defaultMiddlewareFunction : _ref$textToEntity,
_ref$styleToHTML = _ref.styleToHTML,
styleToHTML = _ref$styleToHTML === undefined ? defaultMiddlewareFunction : _ref$styleToHTML,
styleToHTML = _ref$styleToHTML === void 0 ? defaultMiddlewareFunction : _ref$styleToHTML,
_ref$blockToHTML = _ref.blockToHTML,
blockToHTML = _ref$blockToHTML === undefined ? defaultMiddlewareFunction : _ref$blockToHTML,
blockToHTML = _ref$blockToHTML === void 0 ? defaultMiddlewareFunction : _ref$blockToHTML,
_ref$entityToHTML = _ref.entityToHTML,
entityToHTML = _ref$entityToHTML === undefined ? defaultMiddlewareFunction : _ref$entityToHTML;
entityToHTML = _ref$entityToHTML === void 0 ? defaultMiddlewareFunction : _ref$entityToHTML;
return function (ToWrap) {

@@ -123,17 +117,19 @@ decorators = memoizedCoerceArray(decorators);

// wrapping an Editor component
var Plugin = function (_React$Component) {
_inherits(Plugin, _React$Component);
var Plugin =
/*#__PURE__*/
function (_React$Component) {
(0, _inherits2["default"])(Plugin, _React$Component);
function Plugin(props) {
_classCallCheck(this, Plugin);
var _this;
var _this = _possibleConstructorReturn(this, (Plugin.__proto__ || Object.getPrototypeOf(Plugin)).call(this, props));
_this.focus = _this.focus.bind(_this);
_this.blur = _this.blur.bind(_this);
(0, _classCallCheck2["default"])(this, Plugin);
_this = (0, _possibleConstructorReturn2["default"])(this, (0, _getPrototypeOf2["default"])(Plugin).call(this, props));
_this.focus = _this.focus.bind((0, _assertThisInitialized2["default"])(_this));
_this.blur = _this.blur.bind((0, _assertThisInitialized2["default"])(_this));
return _this;
}
_createClass(Plugin, [{
key: 'focus',
(0, _createClass2["default"])(Plugin, [{
key: "focus",
value: function focus() {

@@ -145,3 +141,3 @@ if (this.refs.child.focus) {

}, {
key: 'blur',
key: "blur",
value: function blur() {

@@ -153,3 +149,3 @@ if (this.refs.child.blur) {

}, {
key: 'render',
key: "render",
value: function render() {

@@ -165,5 +161,4 @@ var newStyleMap = memoizedAssign(this.props.styleMap, styleMap);

var newKeyCommandListeners = memoizedConcat(this.props.keyCommandListeners, memoizedCoerceArray(keyCommandListener));
return _react2.default.createElement(ToWrap, _extends({}, this.props, {
ref: 'child',
return _react["default"].createElement(ToWrap, (0, _extends2["default"])({}, this.props, {
ref: "child",
styleMap: newStyleMap,

@@ -181,20 +176,17 @@ styleFn: newStyleFn,

}]);
return Plugin;
}(_react2.default.Component);
}(_react["default"].Component);
Plugin.displayName = displayName;
Plugin.propTypes = {
styleMap: _propTypes2.default.object,
styleFn: _propTypes2.default.func,
decorators: _propTypes2.default.array,
buttons: _propTypes2.default.array,
overlays: _propTypes2.default.array,
blockRendererFn: _propTypes2.default.func,
blockStyleFn: _propTypes2.default.func,
keyBindingFn: _propTypes2.default.func,
keyCommandListeners: _propTypes2.default.arrayOf(_propTypes2.default.func)
styleMap: _propTypes["default"].object,
styleFn: _propTypes["default"].func,
decorators: _propTypes["default"].array,
buttons: _propTypes["default"].array,
overlays: _propTypes["default"].array,
blockRendererFn: _propTypes["default"].func,
blockStyleFn: _propTypes["default"].func,
keyBindingFn: _propTypes["default"].func,
keyCommandListeners: _propTypes["default"].arrayOf(_propTypes["default"].func)
};
Plugin.defaultProps = {

@@ -211,3 +203,2 @@ styleMap: emptyObject,

};
return Plugin;

@@ -217,3 +208,3 @@ } else {

return function () {
for (var _len2 = arguments.length, args = Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
args[_key2] = arguments[_key2];

@@ -232,3 +223,3 @@ }

entityToHTML: entityToHTML
}).apply(undefined, args);
}).apply(void 0, args);
} else {

@@ -238,26 +229,17 @@ // receiving a plugin to accumulate upon for a converter - accumulate

// to take either another plugin or a string/ContentState
var oldOptions = args[0];
var newHTMLToStyle = memoizedCompose(memoizedMiddlewareAdapter(memoizedPassEmptyStyles(htmlToStyle)), memoizedMiddlewareAdapter(oldOptions.htmlToStyle));
newHTMLToStyle.__isMiddleware = true;
var newHTMLToBlock = memoizedCompose(memoizedMiddlewareAdapter(htmlToBlock), memoizedMiddlewareAdapter(oldOptions.htmlToBlock));
newHTMLToBlock.__isMiddleware = true;
var newHTMLToEntity = memoizedCompose(memoizedMiddlewareAdapter(htmlToEntity), memoizedMiddlewareAdapter(oldOptions.htmlToEntity));
newHTMLToEntity.__isMiddleware = true;
var newTextToEntity = memoizedCompose(memoizedMiddlewareAdapter(textToEntity), memoizedMiddlewareAdapter(oldOptions.textToEntity));
newTextToEntity.__isMiddleware = true;
var newStyleToHTML = memoizedCompose(memoizedMiddlewareAdapter(styleToHTML), memoizedMiddlewareAdapter(oldOptions.styleToHTML));
newStyleToHTML.__isMiddleware = true;
var newBlockToHTML = memoizedCompose(memoizedMiddlewareAdapter(blockToHTML), memoizedMiddlewareAdapter(oldOptions.blockToHTML));
newBlockToHTML.__isMiddleware = true;
var newEntityToHTML = memoizedCompose(memoizedMiddlewareAdapter(entityToHTML), memoizedMiddlewareAdapter(oldOptions.entityToHTML));
newEntityToHTML.__isMiddleware = true;
return createPlugin({

@@ -278,2 +260,3 @@ htmlToStyle: newHTMLToStyle,

exports.default = createPlugin;
var _default = createPlugin;
exports["default"] = _default;

@@ -1,17 +0,16 @@

'use strict';
"use strict";
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", {
value: true
});
exports["default"] = void 0;
var _draftJs = require('draft-js');
var _draftJs = require("draft-js");
var _immutable = require('immutable');
var _immutable = require("immutable");
var _invariant = require('invariant');
var _invariant = _interopRequireDefault(require("invariant"));
var _invariant2 = _interopRequireDefault(_invariant);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var camelCaseToHyphen = function camelCaseToHyphen(camelCase) {

@@ -25,2 +24,3 @@ return camelCase.replace(/[a-z][A-Z]/g, function (str) {

var currentBlock = editorState.getCurrentContent().getBlockForKey(editorState.getSelection().getStartKey());
if (currentBlock) {

@@ -31,12 +31,9 @@ return currentBlock.getEntityAt(editorState.getSelection().getStartOffset());

exports.default = {
var _default = {
camelCaseToHyphen: camelCaseToHyphen,
styleObjectToString: function styleObjectToString(styles) {
return Object.keys(styles).map(function (styleName) {
return camelCaseToHyphen(styleName) + ': ' + styles[styleName] + ';';
return "".concat(camelCaseToHyphen(styleName), ": ").concat(styles[styleName], ";");
}).join(' ').replace(/"/g, '\\"');
},
entityStrategy: function entityStrategy(entityType) {

@@ -52,3 +49,2 @@ return function (contentBlock, callback, contentState) {

var entity = contentState && contentState.getEntity ? contentState.getEntity(entityKey) : _draftJs.Entity.get(entityKey);
return entity && entity.getType() === entityType;

@@ -58,3 +54,2 @@ }, callback);

},
getEntitySelection: function getEntitySelection(editorState, entityKey) {

@@ -74,3 +69,3 @@ var selections = [];

});
(0, _invariant2.default)(selections.length === 1, 'getEntitySelection: More than one range with the same entityKey. Please use unique entity instances');
(0, _invariant["default"])(selections.length === 1, 'getEntitySelection: More than one range with the same entityKey. Please use unique entity instances');
return selections[0];

@@ -85,3 +80,5 @@ },

var targetSelection = afterRemoval.getSelectionAfter();
var afterSplit = _draftJs.Modifier.splitBlock(afterRemoval, targetSelection);
var insertionTarget = afterSplit.getSelectionAfter();

@@ -106,3 +103,2 @@

});
return _draftJs.EditorState.push(editorState, newContent, 'insert-fragment');

@@ -113,3 +109,2 @@ },

var contentState = editorState.getCurrentContent();
var blocks = contentState.getBlockMap().skipUntil(function (value, key) {

@@ -120,3 +115,2 @@ return key === selection.getStartKey();

});
return blocks.reduce(function (styles, block) {

@@ -126,5 +120,7 @@ var blockKey = block.getKey();

var end = block.getLength() - 1;
if (blockKey === selection.getStartKey()) {
start = selection.getStartOffset();
}
if (blockKey === selection.getEndKey()) {

@@ -144,2 +140,3 @@ end = selection.getEndOffset();

var matchArray = regex.exec(string);
while (matchArray !== null) {

@@ -149,11 +146,10 @@ result.push(matchArray.concat([matchArray.index]));

}
return result;
},
getActiveEntity: getActiveEntity,
isEntityActive: function isEntityActive(editorState, entityType) {
var activeEntityKey = getActiveEntity(editorState);
var contentState = editorState.getCurrentContent();
if (activeEntityKey) {

@@ -163,4 +159,6 @@ var entity = contentState.getEntity ? contentState.getEntity(activeEntityKey) : _draftJs.Entity.get(activeEntityKey);

}
return false;
}
};
};
exports["default"] = _default;

@@ -6,13 +6,18 @@ "use strict";

});
exports["default"] = void 0;
// utility function to accumulate the common plugin option function pattern of
// handling args by returning a non-null result or delegate to other plugins
exports.default = function (newFn, acc) {
var _default = function _default(newFn, acc) {
return function () {
var result = newFn.apply(undefined, arguments);
var result = newFn.apply(void 0, arguments);
if (result === null || result === undefined) {
return acc.apply(undefined, arguments);
return acc.apply(void 0, arguments);
}
return result;
};
};
};
exports["default"] = _default;

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

'use strict';
"use strict";

@@ -6,6 +6,8 @@ Object.defineProperty(exports, "__esModule", {

});
var buildTag = exports.buildTag = function buildTag(tagName, contents) {
exports.buildTag = void 0;
var buildTag = function buildTag(tagName, contents) {
var attrs = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
var attrStr = '';
var attrStr = '';
if (Object.keys(attrs).length) {

@@ -15,10 +17,13 @@ attrStr = Object.keys(attrs).filter(function (k) {

}).map(function (k) {
return k + '="' + attrs[k] + '"';
return "".concat(k, "=\"").concat(attrs[k], "\"");
}).join(' ');
if (attrStr.length) {
attrStr = ' ' + attrStr;
attrStr = " ".concat(attrStr);
}
}
return '<' + tagName + attrStr + '>' + contents + '</' + tagName + '>';
};
return "<".concat(tagName).concat(attrStr, ">").concat(contents, "</").concat(tagName, ">");
};
exports.buildTag = buildTag;

@@ -6,5 +6,6 @@ "use strict";

});
exports["default"] = void 0;
exports.default = function () {
for (var _len = arguments.length, funcs = Array(_len), _key = 0; _key < _len; _key++) {
var _default = function _default() {
for (var _len = arguments.length, funcs = new Array(_len), _key = 0; _key < _len; _key++) {
funcs[_key] = arguments[_key];

@@ -20,7 +21,8 @@ }

var rest = funcs.slice(0, -1);
return rest.reduceRight(function (composed, f) {
return f(composed);
}, last.apply(undefined, arguments));
}, last.apply(void 0, arguments));
};
};
};
exports["default"] = _default;

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

'use strict';
"use strict";

@@ -6,9 +6,8 @@ Object.defineProperty(exports, "__esModule", {

});
exports.default = memoize;
exports["default"] = memoize;
var _immutable = require('immutable');
var _immutable = require("immutable");
// memoization higher-order function using Immutable.js.
// used to memoize accumulated options when rendering plugin wrapper components.
function memoize(func) {

@@ -19,7 +18,11 @@ var _cache = (0, _immutable.Map)();

var argList = _immutable.List.of.apply(_immutable.List, arguments);
if (!_cache.has(argList)) {
_cache = _cache.set(argList, func.apply(undefined, arguments));
_cache = _cache.set(argList, func.apply(void 0, arguments));
}
return _cache.get(argList);
};
};
}
;

@@ -1,10 +0,13 @@

'use strict';
"use strict";
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", {
value: true
});
exports["default"] = void 0;
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
var _immutable = require('immutable');
var _immutable = require("immutable");

@@ -14,3 +17,2 @@ // function to handle previous techniques to convert to HTML, including

// either a String or ReactElement
var middlewareAdapter = function middlewareAdapter(middleware) {

@@ -20,13 +22,14 @@ if (middleware && middleware.__isMiddleware) {

}
return function (next) {
return function () {
if ((typeof middleware === 'undefined' ? 'undefined' : _typeof(middleware)) === 'object') {
if ((0, _typeof2["default"])(middleware) === 'object') {
// handle old blockToHTML objects
var block = arguments.length <= 0 ? undefined : arguments[0];
var objectResult;
var objectResult = void 0;
if (typeof block === 'string') {
// handle case of inline style value
var style = block;
if (process.env.NODE_ENV === 'development') {

@@ -43,26 +46,29 @@ console.warn('styleToHTML: Use of plain objects to define HTML output is being deprecated. Please switch to using functions that return a {start, end} object or ReactElement.');

objectResult = middleware[block.type];
}
} // check for inline style value instead of a raw block
// check for inline style value instead of a raw block
if (objectResult !== null && objectResult !== undefined) {
return objectResult;
}
return next.apply(undefined, arguments);
return next.apply(void 0, arguments);
}
var returnValue = void 0;
var returnValue;
try {
// try immediately giving the function the content data in case it's a simple
// function that doesn't expect a `next` function
var nonMiddlewareResult = middleware.apply(undefined, arguments);
var nonMiddlewareResult = middleware.apply(void 0, arguments);
if (nonMiddlewareResult === null || nonMiddlewareResult === undefined) {
// the behavior for non-middleware functions is to delegate by returning
// `null` or `undefined`, so do delegation for them
returnValue = next.apply(undefined, arguments);
returnValue = next.apply(void 0, arguments);
} else if (arguments.length === 2 && typeof (arguments.length <= 1 ? undefined : arguments[1]) === 'string' && (arguments.length <= 1 ? undefined : arguments[1]) === nonMiddlewareResult) {
// entityToHTML option returned `originalText`, i.e. no change was made
returnValue = next.apply(undefined, arguments);
returnValue = next.apply(void 0, arguments);
} else if (Array.isArray(nonMiddlewareResult)) {
// returned an array from a textToEntity function, concat with next
returnValue = nonMiddlewareResult.concat(next.apply(undefined, arguments));
returnValue = nonMiddlewareResult.concat(next.apply(void 0, arguments));
} else if (_immutable.OrderedSet.isOrderedSet(nonMiddlewareResult)) {

@@ -72,8 +78,8 @@ var _ref;

// returned an OrderedSet from htmlToStyle, pass to next as third argument
var previousStyles = (_ref = arguments.length - 1, arguments.length <= _ref ? undefined : arguments[_ref]);
returnValue = previousStyles.union(nonMiddlewareResult).union(next.apply(undefined, arguments));
var previousStyles = (_ref = arguments.length - 1, _ref < 0 || arguments.length <= _ref ? undefined : arguments[_ref]);
returnValue = previousStyles.union(nonMiddlewareResult).union(next.apply(void 0, arguments));
} else if (typeof nonMiddlewareResult === 'function') {
// most middleware HOFs will return another function when invoked, so we
// can assume that it is one here
returnValue = middleware(next).apply(undefined, arguments);
returnValue = middleware(next).apply(void 0, arguments);
} else {

@@ -87,3 +93,3 @@ // the function was a simple non-middleware function and

// middleware function will throw, so try it as a middleware HOF
returnValue = middleware(next).apply(undefined, arguments);
returnValue = middleware(next).apply(void 0, arguments);
} finally {

@@ -96,2 +102,3 @@ return returnValue;

exports.default = middlewareAdapter;
var _default = middlewareAdapter;
exports["default"] = _default;
{
"name": "draft-extend",
"version": "1.6.4",
"version": "1.6.5",
"description": "Build extensible Draft.js editors with configurable plugins and integrated serialization.",
"main": "lib/index.js",
"module": "esm/index.js",
"repository": "HubSpot/draft-extend",
"scripts": {
"build": "npm run clean && npm run build:commonjs && npm run build:umd && npm run build:umd:min && npm run build:css",
"build": "npm run clean && npm run build:commonjs && npm run build:esm && npm run build:umd && npm run build:css",
"build:commonjs": "BABEL_ENV=commonjs babel src --out-dir lib",
"build:umd": "webpack --config webpack.config.development.js ./src/index.js ./dist/draft-extend.js",
"build:umd:min": "webpack --config webpack.config.production.js ./src/index.js ./dist/draft-extend.min.js",
"build:esm": "BABEL_ENV=esm babel src --out-dir esm",
"build:umd": "rollup -c",
"build:css": "cp ./src/style/*.css ./dist/",
"clean": "rm -rf ./dist && rm -rf ./lib",
"clean": "rm -rf ./dist && rm -rf ./lib && rm -rf ./esm",
"prepublish": "npm run build"

@@ -18,3 +19,4 @@ },

"dist",
"lib"
"lib",
"esm"
],

@@ -35,2 +37,3 @@ "keywords": [

"dependencies": {
"@babel/runtime": "^7.7.2",
"immutable": "^3.8.1",

@@ -41,9 +44,8 @@ "invariant": "^2.2.1",

"devDependencies": {
"babel-cli": "^6.10.1",
"babel-core": "^6.7.7",
"babel-loader": "^6.2.4",
"babel-plugin-transform-object-rest-spread": "^6.6.5",
"babel-preset-env": "^1.6.1",
"babel-preset-react": "^6.5.0",
"babel-standalone": "^6.7.7",
"@babel/cli": "^7.5.0",
"@babel/core": "^7.5.4",
"@babel/plugin-transform-runtime": "^7.5.5",
"@babel/preset-env": "^7.5.4",
"@babel/preset-react": "^7.0.0",
"@babel/standalone": "^7.7.3",
"draft-convert": "^2.1.4",

@@ -54,4 +56,8 @@ "draft-js": "^0.10.5",

"react-dom": "^16.2.0",
"webpack": "^1.13.0"
"rollup": "^1.26.3",
"rollup-plugin-commonjs": "^10.1.0",
"rollup-plugin-node-resolve": "^5.2.0",
"rollup-plugin-replace": "^2.2.0",
"rollup-plugin-terser": "^5.1.2"
}
}

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc