react-froala-wysiwyg
Advanced tools
Comparing version 4.0.19 to 4.1.0
@@ -5,3 +5,3 @@ // Note that Froala Editor has to be required separately | ||
import 'file-loader?name=[name].[ext]!./init_on_button.html'; | ||
import 'froala-editor/js/plugins.pkgd.min.js'; | ||
import FroalaEditorButton from 'react-froala-wysiwyg/FroalaEditorButton'; | ||
@@ -8,0 +8,0 @@ import React from 'react'; |
@@ -5,2 +5,3 @@ // Note that Froala Editor has to be required separately | ||
import 'froala-editor/css/froala_style.css'; | ||
import 'froala-editor/js/plugins.pkgd.min.js'; | ||
import 'file-loader?name=[name].[ext]!./init_on_image.html'; | ||
@@ -7,0 +8,0 @@ |
// Note that Froala Editor has to be required separately | ||
import 'froala-editor/css/froala_editor.pkgd.min.css'; | ||
import 'froala-editor/js/plugins.pkgd.min.js'; | ||
import 'froala-editor/css/froala_style.css'; | ||
@@ -5,0 +5,0 @@ import 'file-loader?name=[name].[ext]!./init_on_input.html'; |
@@ -5,5 +5,5 @@ // Note that Froala Editor has to be required separately | ||
import 'froala-editor/css/froala_style.css'; | ||
import 'froala-editor/js/plugins.pkgd.min.js'; | ||
import FroalaEditorA from 'react-froala-wysiwyg/FroalaEditorA'; | ||
@@ -10,0 +10,0 @@ import React from 'react'; |
@@ -1,1 +0,1 @@ | ||
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("react"),require("froala-editor")):"function"==typeof define&&define.amd?define(["react","froala-editor"],e):"object"==typeof exports?exports.FroalaEditorA=e(require("react"),require("froala-editor")):t.FroalaEditorA=e(t.React,t["froala-editor"])}(window,(function(t,e){return function(t){var e={};function n(r){if(e[r])return e[r].exports;var o=e[r]={i:r,l:!1,exports:{}};return t[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)n.d(r,o,function(e){return t[e]}.bind(null,o));return r},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=5)}([function(e,n){e.exports=t},function(t,e,n){"use strict";n.d(e,"a",(function(){return h}));var r=n(2),o=n.n(r),i=n(0);function c(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function u(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function s(t){return(s="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function a(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function f(t,e){return(f=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t})(t,e)}function l(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,r=d(t);if(e){var o=d(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return p(this,n)}}function p(t,e){if(e&&("object"===s(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}function d(t){return(d=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var h=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&f(t,e)}(p,t);var e,n,r,i=l(p);function p(t){var e;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,p),(e=i.call(this,t)).defaultTag="div",e.tag=t.tag||e.defaultTag,e.listeningEvents=[],e.element=null,e.editor=null,e.config={immediateReactModelUpdate:!1,reactIgnoreAttrs:null},e.editorInitialized=!1,e.SPECIAL_TAGS=["img","button","input","a"],e.INNER_HTML_ATTR="innerHTML",e.hasSpecialTag=!1,e.oldModel=null,e}return e=p,(n=[{key:"componentDidMount",value:function(){var t=this.el.tagName.toLowerCase();-1!=this.SPECIAL_TAGS.indexOf(t)&&(this.tag=t,this.hasSpecialTag=!0),this.props.onManualControllerReady?this.generateManualController():this.createEditor()}},{key:"componentWillUnmount",value:function(){this.destroyEditor()}},{key:"componentDidUpdate",value:function(){JSON.stringify(this.oldModel)!=JSON.stringify(this.props.model)&&this.setContent()}},{key:"clone",value:function(t){var e,n=this;if(!t)return t;if([Number,String,Boolean].forEach((function(n){t instanceof n&&(e=n(t))})),void 0===e)if("[object Array]"===Object.prototype.toString.call(t))e=[],t.forEach((function(t,r,o){e[r]=n.clone(t)}));else if("object"==s(t))if(t.nodeType&&"function"==typeof t.cloneNode)e=t.cloneNode(!0);else if(t.prototype)e=t;else if(t instanceof Date)e=new Date(t);else for(var r in e={},t)e[r]=n.clone(t[r]);else e=t;return e}},{key:"createEditor",value:function(){var t=this;this.editorInitialized||(this.config=this.clone(this.props.config||this.config),this.config=function(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?c(Object(n),!0).forEach((function(e){u(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):c(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}({},this.config),this.element=this.el,this.setContent(!0),this.registerEvent("initialized",this.config.events&&this.config.events.initialized),this.config.events||(this.config.events={}),this.config.events.initialized=function(){return t.initListeners()},this.editor=new o.a(this.element,this.config))}},{key:"setContent",value:function(t){(this.props.model||""==this.props.model)&&(this.oldModel=this.props.model,this.hasSpecialTag?this.setSpecialTagContent():this.setNormalTagContent(t))}},{key:"setNormalTagContent",value:function(t){var e=this,n=this;function r(){n.editor.html&&n.editor.html.set(n.props.model||""),n.editorInitialized&&n.editor.undo&&(n.props.skipReset||n.editor.undo.reset(),n.editor.undo.saveStep())}t?this.config.initOnClick?(this.registerEvent("initializationDelayed",(function(){r()})),this.registerEvent("initialized",(function(){e.editorInitialized=!0}))):this.registerEvent("initialized",(function(){e.editorInitialized=!0,r()})):r()}},{key:"setSpecialTagContent",value:function(){var t=this.props.model;if(t){for(var e in t)t.hasOwnProperty(e)&&e!=this.INNER_HTML_ATTR&&this.element.setAttribute(e,t[e]);t.hasOwnProperty(this.INNER_HTML_ATTR)&&(this.element.innerHTML=t[this.INNER_HTML_ATTR])}}},{key:"destroyEditor",value:function(){this.element&&(this.editor.destroy&&this.editor.destroy(),this.listeningEvents.length=0,this.element=null,this.editorInitialized=!1)}},{key:"getEditor",value:function(){return this.element?this.editor:null}},{key:"generateManualController",value:function(){var t=this,e={initialize:function(){return t.createEditor.call(t)},destroy:function(){return t.destroyEditor.call(t)},getEditor:function(){return t.getEditor.call(t)}};this.props.onManualControllerReady(e)}},{key:"updateModel",value:function(){if(this.props.onModelChange){var t="";if(this.hasSpecialTag){for(var e=this.element.attributes,n={},r=0;r<e.length;r++){var o=e[r].name;this.config.reactIgnoreAttrs&&-1!=this.config.reactIgnoreAttrs.indexOf(o)||(n[o]=e[r].value)}this.element.innerHTML&&(n[this.INNER_HTML_ATTR]=this.element.innerHTML),t=n}else{var i=this.editor.html.get();"string"==typeof i&&(t=i)}this.oldModel=t,this.props.onModelChange(t)}}},{key:"initListeners",value:function(){var t=this;if(this.editor.events.on("contentChanged",(function(){t.updateModel()})),this.config.immediateReactModelUpdate&&this.editor.events.on("keyup",(function(){t.updateModel()})),this._initEvents)for(var e=0;e<this._initEvents.length;e++)this._initEvents[e].call(this.editor)}},{key:"registerEvent",value:function(t,e){t&&e&&("initialized"==t?(this._initEvents||(this._initEvents=[]),this._initEvents.push(e)):(this.config.events||(this.config.events={}),this.config.events[t]=e))}}])&&a(e.prototype,n),r&&a(e,r),Object.defineProperty(e,"prototype",{writable:!1}),p}(n.n(i).a.Component)},function(t,n){t.exports=e},,,function(t,e,n){t.exports=n(6)},function(t,e,n){"use strict";n.r(e),n.d(e,"default",(function(){return d}));var r=n(1),o=n(0),i=n.n(o);function c(t){return(c="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function u(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function s(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function a(t,e){return(a=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t})(t,e)}function f(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,r=p(t);if(e){var o=p(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return l(this,n)}}function l(t,e){if(e&&("object"===c(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}function p(t){return(p=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var d=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&a(t,e)}(c,t);var e,n,r,o=f(c);function c(){return u(this,c),o.apply(this,arguments)}return e=c,(n=[{key:"render",value:function(){var t=this;return i.a.createElement("a",{ref:function(e){return t.el=e}},this.props.children)}}])&&s(e.prototype,n),r&&s(e,r),Object.defineProperty(e,"prototype",{writable:!1}),c}(r.a)}])})); | ||
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("react"),require("froala-editor")):"function"==typeof define&&define.amd?define(["react","froala-editor"],e):"object"==typeof exports?exports.FroalaEditorA=e(require("react"),require("froala-editor")):t.FroalaEditorA=e(t.React,t["froala-editor"])}(window,(function(t,e){return function(t){var e={};function n(r){if(e[r])return e[r].exports;var o=e[r]={i:r,l:!1,exports:{}};return t[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)n.d(r,o,function(e){return t[e]}.bind(null,o));return r},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=5)}([function(e,n){e.exports=t},function(t,e,n){"use strict";n.d(e,"a",(function(){return h}));var r=n(2),o=n.n(r),i=n(0);function c(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function u(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function s(t){return(s="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function a(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function l(t,e){return(l=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t})(t,e)}function f(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,r=d(t);if(e){var o=d(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return p(this,n)}}function p(t,e){if(e&&("object"===s(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}function d(t){return(d=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var h=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&l(t,e)}(p,t);var e,n,r,i=f(p);function p(t){var e;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,p),(e=i.call(this,t)).defaultTag="div",e.tag=t.tag||e.defaultTag,e.listeningEvents=[],e.element=null,e.editor=null,e.config={immediateReactModelUpdate:!1,reactIgnoreAttrs:null},e.editorInitialized=!1,e.SPECIAL_TAGS=["img","button","input","a"],e.INNER_HTML_ATTR="innerHTML",e.hasSpecialTag=!1,e.oldModel=null,e}return e=p,(n=[{key:"componentDidMount",value:function(){var t=this.el.tagName.toLowerCase();-1!=this.SPECIAL_TAGS.indexOf(t)&&(this.tag=t,this.hasSpecialTag=!0),this.props.onManualControllerReady?this.generateManualController():this.createEditor()}},{key:"componentWillUnmount",value:function(){this.destroyEditor()}},{key:"componentDidUpdate",value:function(){JSON.stringify(this.oldModel)!=JSON.stringify(this.props.model)&&this.setContent()}},{key:"clone",value:function(t){var e,n=this;if(!t)return t;if([Number,String,Boolean].forEach((function(n){t instanceof n&&(e=n(t))})),void 0===e)if("[object Array]"===Object.prototype.toString.call(t))e=[],t.forEach((function(t,r,o){e[r]=n.clone(t)}));else if("object"==s(t))if(t.nodeType&&"function"==typeof t.cloneNode)e=t.cloneNode(!0);else if(t.prototype)e=t;else if(t instanceof Date)e=new Date(t);else for(var r in e={},t)e[r]=n.clone(t[r]);else e=t;return e}},{key:"createEditor",value:function(){var t=this;this.editorInitialized||(this.config=this.clone(this.props.config||this.config),this.config=function(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?c(Object(n),!0).forEach((function(e){u(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):c(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}({},this.config),this.element=this.el,this.setContent(!0),this.registerEvent("initialized",this.config.events&&this.config.events.initialized),this.config.events||(this.config.events={}),this.config.events.initialized=function(){return t.initListeners()},this.editor=new o.a(this.element,this.config))}},{key:"setContent",value:function(t){(this.props.model||""==this.props.model)&&(this.oldModel=this.props.model,this.hasSpecialTag?this.setSpecialTagContent():this.setNormalTagContent(t))}},{key:"setNormalTagContent",value:function(t){var e=this,n=this;function r(){n.editor.html&&n.editor.html.set(n.props.model||""),n.editorInitialized&&n.editor.undo&&(n.props.skipReset||n.editor.undo.reset(),n.editor.undo.saveStep())}t?this.config.initOnClick?(this.registerEvent("initializationDelayed",(function(){r()})),this.registerEvent("initialized",(function(){e.editorInitialized=!0}))):this.registerEvent("initialized",(function(){e.editorInitialized=!0,r()})):r()}},{key:"setSpecialTagContent",value:function(){var t=this.props.model;if(t){for(var e in t)t.hasOwnProperty(e)&&e!=this.INNER_HTML_ATTR&&this.element.setAttribute(e,t[e]);t.hasOwnProperty(this.INNER_HTML_ATTR)&&(this.element.innerHTML=t[this.INNER_HTML_ATTR])}}},{key:"destroyEditor",value:function(){if(this.element){this.editor.destroy&&this.editor.destroy(),this.listeningEvents.length=0,this.element=null,this.editorInitialized=!1,this.config={immediateReactModelUpdate:!1,reactIgnoreAttrs:null};var t=this.el.tagName.toLowerCase();-1==this.SPECIAL_TAGS.indexOf(t)&&this.editor&&this.editor.destrying&&!this.props.onManualControllerReady&&"textarea"==this.tag&&this.editor.$box.remove(),"textarea"!=this.tag&&(this.editor.$wp="")}}},{key:"getEditor",value:function(){return this.element?this.editor:null}},{key:"generateManualController",value:function(){var t=this,e={initialize:function(){return t.createEditor.call(t)},destroy:function(){return t.destroyEditor.call(t)},getEditor:function(){return t.getEditor.call(t)}};this.props.onManualControllerReady(e)}},{key:"updateModel",value:function(){if(this.props.onModelChange){var t="";if(this.hasSpecialTag){for(var e=this.element.attributes,n={},r=0;r<e.length;r++){var o=e[r].name;this.config.reactIgnoreAttrs&&-1!=this.config.reactIgnoreAttrs.indexOf(o)||(n[o]=e[r].value)}this.element.innerHTML&&(n[this.INNER_HTML_ATTR]=this.element.innerHTML),t=n}else{var i=this.editor.html.get();"string"==typeof i&&(t=i)}this.oldModel=t,this.props.onModelChange(t)}}},{key:"initListeners",value:function(){var t=this;if(this.editor&&this.editor.events&&this.editor.events.on("contentChanged",(function(){t.updateModel()})),this.config.immediateReactModelUpdate&&this.editor.events.on("keyup",(function(){t.updateModel()})),this._initEvents)for(var e=0;e<this._initEvents.length;e++)this._initEvents[e].call(this.editor)}},{key:"registerEvent",value:function(t,e){t&&e&&("initialized"==t?(this._initEvents||(this._initEvents=[]),this._initEvents.push(e)):(this.config.events||(this.config.events={}),this.config.events[t]=e))}}])&&a(e.prototype,n),r&&a(e,r),Object.defineProperty(e,"prototype",{writable:!1}),p}(n.n(i).a.Component)},function(t,n){t.exports=e},,,function(t,e,n){t.exports=n(6)},function(t,e,n){"use strict";n.r(e),n.d(e,"default",(function(){return d}));var r=n(1),o=n(0),i=n.n(o);function c(t){return(c="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function u(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function s(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function a(t,e){return(a=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t})(t,e)}function l(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,r=p(t);if(e){var o=p(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return f(this,n)}}function f(t,e){if(e&&("object"===c(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}function p(t){return(p=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var d=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&a(t,e)}(c,t);var e,n,r,o=l(c);function c(){return u(this,c),o.apply(this,arguments)}return e=c,(n=[{key:"render",value:function(){var t=this;return i.a.createElement("a",{ref:function(e){return t.el=e}},this.props.children)}}])&&s(e.prototype,n),r&&s(e,r),Object.defineProperty(e,"prototype",{writable:!1}),c}(r.a)}])})); |
@@ -1,1 +0,1 @@ | ||
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("react"),require("froala-editor")):"function"==typeof define&&define.amd?define(["react","froala-editor"],e):"object"==typeof exports?exports.FroalaEditorA=e(require("react"),require("froala-editor")):t.FroalaEditorA=e(t.React,t["froala-editor"])}(window,(function(t,e){return function(t){var e={};function n(r){if(e[r])return e[r].exports;var o=e[r]={i:r,l:!1,exports:{}};return t[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)n.d(r,o,function(e){return t[e]}.bind(null,o));return r},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=5)}([function(e,n){e.exports=t},function(t,e,n){"use strict";n.d(e,"a",(function(){return h}));var r=n(2),o=n.n(r),i=n(0);function c(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function u(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function s(t){return(s="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function a(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function f(t,e){return(f=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t})(t,e)}function l(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,r=d(t);if(e){var o=d(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return p(this,n)}}function p(t,e){if(e&&("object"===s(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}function d(t){return(d=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var h=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&f(t,e)}(p,t);var e,n,r,i=l(p);function p(t){var e;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,p),(e=i.call(this,t)).defaultTag="div",e.tag=t.tag||e.defaultTag,e.listeningEvents=[],e.element=null,e.editor=null,e.config={immediateReactModelUpdate:!1,reactIgnoreAttrs:null},e.editorInitialized=!1,e.SPECIAL_TAGS=["img","button","input","a"],e.INNER_HTML_ATTR="innerHTML",e.hasSpecialTag=!1,e.oldModel=null,e}return e=p,(n=[{key:"componentDidMount",value:function(){var t=this.el.tagName.toLowerCase();-1!=this.SPECIAL_TAGS.indexOf(t)&&(this.tag=t,this.hasSpecialTag=!0),this.props.onManualControllerReady?this.generateManualController():this.createEditor()}},{key:"componentWillUnmount",value:function(){this.destroyEditor()}},{key:"componentDidUpdate",value:function(){JSON.stringify(this.oldModel)!=JSON.stringify(this.props.model)&&this.setContent()}},{key:"clone",value:function(t){var e,n=this;if(!t)return t;if([Number,String,Boolean].forEach((function(n){t instanceof n&&(e=n(t))})),void 0===e)if("[object Array]"===Object.prototype.toString.call(t))e=[],t.forEach((function(t,r,o){e[r]=n.clone(t)}));else if("object"==s(t))if(t.nodeType&&"function"==typeof t.cloneNode)e=t.cloneNode(!0);else if(t.prototype)e=t;else if(t instanceof Date)e=new Date(t);else for(var r in e={},t)e[r]=n.clone(t[r]);else e=t;return e}},{key:"createEditor",value:function(){var t=this;this.editorInitialized||(this.config=this.clone(this.props.config||this.config),this.config=function(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?c(Object(n),!0).forEach((function(e){u(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):c(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}({},this.config),this.element=this.el,this.setContent(!0),this.registerEvent("initialized",this.config.events&&this.config.events.initialized),this.config.events||(this.config.events={}),this.config.events.initialized=function(){return t.initListeners()},this.editor=new o.a(this.element,this.config))}},{key:"setContent",value:function(t){(this.props.model||""==this.props.model)&&(this.oldModel=this.props.model,this.hasSpecialTag?this.setSpecialTagContent():this.setNormalTagContent(t))}},{key:"setNormalTagContent",value:function(t){var e=this,n=this;function r(){n.editor.html&&n.editor.html.set(n.props.model||""),n.editorInitialized&&n.editor.undo&&(n.props.skipReset||n.editor.undo.reset(),n.editor.undo.saveStep())}t?this.config.initOnClick?(this.registerEvent("initializationDelayed",(function(){r()})),this.registerEvent("initialized",(function(){e.editorInitialized=!0}))):this.registerEvent("initialized",(function(){e.editorInitialized=!0,r()})):r()}},{key:"setSpecialTagContent",value:function(){var t=this.props.model;if(t){for(var e in t)t.hasOwnProperty(e)&&e!=this.INNER_HTML_ATTR&&this.element.setAttribute(e,t[e]);t.hasOwnProperty(this.INNER_HTML_ATTR)&&(this.element.innerHTML=t[this.INNER_HTML_ATTR])}}},{key:"destroyEditor",value:function(){this.element&&(this.editor.destroy&&this.editor.destroy(),this.listeningEvents.length=0,this.element=null,this.editorInitialized=!1)}},{key:"getEditor",value:function(){return this.element?this.editor:null}},{key:"generateManualController",value:function(){var t=this,e={initialize:function(){return t.createEditor.call(t)},destroy:function(){return t.destroyEditor.call(t)},getEditor:function(){return t.getEditor.call(t)}};this.props.onManualControllerReady(e)}},{key:"updateModel",value:function(){if(this.props.onModelChange){var t="";if(this.hasSpecialTag){for(var e=this.element.attributes,n={},r=0;r<e.length;r++){var o=e[r].name;this.config.reactIgnoreAttrs&&-1!=this.config.reactIgnoreAttrs.indexOf(o)||(n[o]=e[r].value)}this.element.innerHTML&&(n[this.INNER_HTML_ATTR]=this.element.innerHTML),t=n}else{var i=this.editor.html.get();"string"==typeof i&&(t=i)}this.oldModel=t,this.props.onModelChange(t)}}},{key:"initListeners",value:function(){var t=this;if(this.editor.events.on("contentChanged",(function(){t.updateModel()})),this.config.immediateReactModelUpdate&&this.editor.events.on("keyup",(function(){t.updateModel()})),this._initEvents)for(var e=0;e<this._initEvents.length;e++)this._initEvents[e].call(this.editor)}},{key:"registerEvent",value:function(t,e){t&&e&&("initialized"==t?(this._initEvents||(this._initEvents=[]),this._initEvents.push(e)):(this.config.events||(this.config.events={}),this.config.events[t]=e))}}])&&a(e.prototype,n),r&&a(e,r),Object.defineProperty(e,"prototype",{writable:!1}),p}(n.n(i).a.Component)},function(t,n){t.exports=e},,,function(t,e,n){t.exports=n(6)},function(t,e,n){"use strict";n.r(e),n.d(e,"default",(function(){return d}));var r=n(1),o=n(0),i=n.n(o);function c(t){return(c="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function u(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function s(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function a(t,e){return(a=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t})(t,e)}function f(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,r=p(t);if(e){var o=p(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return l(this,n)}}function l(t,e){if(e&&("object"===c(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}function p(t){return(p=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var d=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&a(t,e)}(c,t);var e,n,r,o=f(c);function c(){return u(this,c),o.apply(this,arguments)}return e=c,(n=[{key:"render",value:function(){var t=this;return i.a.createElement("a",{ref:function(e){return t.el=e}},this.props.children)}}])&&s(e.prototype,n),r&&s(e,r),Object.defineProperty(e,"prototype",{writable:!1}),c}(r.a)}])})); | ||
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("react"),require("froala-editor")):"function"==typeof define&&define.amd?define(["react","froala-editor"],e):"object"==typeof exports?exports.FroalaEditorA=e(require("react"),require("froala-editor")):t.FroalaEditorA=e(t.React,t["froala-editor"])}(window,(function(t,e){return function(t){var e={};function n(r){if(e[r])return e[r].exports;var o=e[r]={i:r,l:!1,exports:{}};return t[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)n.d(r,o,function(e){return t[e]}.bind(null,o));return r},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=5)}([function(e,n){e.exports=t},function(t,e,n){"use strict";n.d(e,"a",(function(){return h}));var r=n(2),o=n.n(r),i=n(0);function c(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function u(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function s(t){return(s="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function a(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function l(t,e){return(l=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t})(t,e)}function f(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,r=d(t);if(e){var o=d(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return p(this,n)}}function p(t,e){if(e&&("object"===s(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}function d(t){return(d=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var h=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&l(t,e)}(p,t);var e,n,r,i=f(p);function p(t){var e;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,p),(e=i.call(this,t)).defaultTag="div",e.tag=t.tag||e.defaultTag,e.listeningEvents=[],e.element=null,e.editor=null,e.config={immediateReactModelUpdate:!1,reactIgnoreAttrs:null},e.editorInitialized=!1,e.SPECIAL_TAGS=["img","button","input","a"],e.INNER_HTML_ATTR="innerHTML",e.hasSpecialTag=!1,e.oldModel=null,e}return e=p,(n=[{key:"componentDidMount",value:function(){var t=this.el.tagName.toLowerCase();-1!=this.SPECIAL_TAGS.indexOf(t)&&(this.tag=t,this.hasSpecialTag=!0),this.props.onManualControllerReady?this.generateManualController():this.createEditor()}},{key:"componentWillUnmount",value:function(){this.destroyEditor()}},{key:"componentDidUpdate",value:function(){JSON.stringify(this.oldModel)!=JSON.stringify(this.props.model)&&this.setContent()}},{key:"clone",value:function(t){var e,n=this;if(!t)return t;if([Number,String,Boolean].forEach((function(n){t instanceof n&&(e=n(t))})),void 0===e)if("[object Array]"===Object.prototype.toString.call(t))e=[],t.forEach((function(t,r,o){e[r]=n.clone(t)}));else if("object"==s(t))if(t.nodeType&&"function"==typeof t.cloneNode)e=t.cloneNode(!0);else if(t.prototype)e=t;else if(t instanceof Date)e=new Date(t);else for(var r in e={},t)e[r]=n.clone(t[r]);else e=t;return e}},{key:"createEditor",value:function(){var t=this;this.editorInitialized||(this.config=this.clone(this.props.config||this.config),this.config=function(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?c(Object(n),!0).forEach((function(e){u(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):c(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}({},this.config),this.element=this.el,this.setContent(!0),this.registerEvent("initialized",this.config.events&&this.config.events.initialized),this.config.events||(this.config.events={}),this.config.events.initialized=function(){return t.initListeners()},this.editor=new o.a(this.element,this.config))}},{key:"setContent",value:function(t){(this.props.model||""==this.props.model)&&(this.oldModel=this.props.model,this.hasSpecialTag?this.setSpecialTagContent():this.setNormalTagContent(t))}},{key:"setNormalTagContent",value:function(t){var e=this,n=this;function r(){n.editor.html&&n.editor.html.set(n.props.model||""),n.editorInitialized&&n.editor.undo&&(n.props.skipReset||n.editor.undo.reset(),n.editor.undo.saveStep())}t?this.config.initOnClick?(this.registerEvent("initializationDelayed",(function(){r()})),this.registerEvent("initialized",(function(){e.editorInitialized=!0}))):this.registerEvent("initialized",(function(){e.editorInitialized=!0,r()})):r()}},{key:"setSpecialTagContent",value:function(){var t=this.props.model;if(t){for(var e in t)t.hasOwnProperty(e)&&e!=this.INNER_HTML_ATTR&&this.element.setAttribute(e,t[e]);t.hasOwnProperty(this.INNER_HTML_ATTR)&&(this.element.innerHTML=t[this.INNER_HTML_ATTR])}}},{key:"destroyEditor",value:function(){if(this.element){this.editor.destroy&&this.editor.destroy(),this.listeningEvents.length=0,this.element=null,this.editorInitialized=!1,this.config={immediateReactModelUpdate:!1,reactIgnoreAttrs:null};var t=this.el.tagName.toLowerCase();-1==this.SPECIAL_TAGS.indexOf(t)&&this.editor&&this.editor.destrying&&!this.props.onManualControllerReady&&"textarea"==this.tag&&this.editor.$box.remove(),"textarea"!=this.tag&&(this.editor.$wp="")}}},{key:"getEditor",value:function(){return this.element?this.editor:null}},{key:"generateManualController",value:function(){var t=this,e={initialize:function(){return t.createEditor.call(t)},destroy:function(){return t.destroyEditor.call(t)},getEditor:function(){return t.getEditor.call(t)}};this.props.onManualControllerReady(e)}},{key:"updateModel",value:function(){if(this.props.onModelChange){var t="";if(this.hasSpecialTag){for(var e=this.element.attributes,n={},r=0;r<e.length;r++){var o=e[r].name;this.config.reactIgnoreAttrs&&-1!=this.config.reactIgnoreAttrs.indexOf(o)||(n[o]=e[r].value)}this.element.innerHTML&&(n[this.INNER_HTML_ATTR]=this.element.innerHTML),t=n}else{var i=this.editor.html.get();"string"==typeof i&&(t=i)}this.oldModel=t,this.props.onModelChange(t)}}},{key:"initListeners",value:function(){var t=this;if(this.editor&&this.editor.events&&this.editor.events.on("contentChanged",(function(){t.updateModel()})),this.config.immediateReactModelUpdate&&this.editor.events.on("keyup",(function(){t.updateModel()})),this._initEvents)for(var e=0;e<this._initEvents.length;e++)this._initEvents[e].call(this.editor)}},{key:"registerEvent",value:function(t,e){t&&e&&("initialized"==t?(this._initEvents||(this._initEvents=[]),this._initEvents.push(e)):(this.config.events||(this.config.events={}),this.config.events[t]=e))}}])&&a(e.prototype,n),r&&a(e,r),Object.defineProperty(e,"prototype",{writable:!1}),p}(n.n(i).a.Component)},function(t,n){t.exports=e},,,function(t,e,n){t.exports=n(6)},function(t,e,n){"use strict";n.r(e),n.d(e,"default",(function(){return d}));var r=n(1),o=n(0),i=n.n(o);function c(t){return(c="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function u(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function s(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function a(t,e){return(a=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t})(t,e)}function l(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,r=p(t);if(e){var o=p(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return f(this,n)}}function f(t,e){if(e&&("object"===c(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}function p(t){return(p=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var d=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&a(t,e)}(c,t);var e,n,r,o=l(c);function c(){return u(this,c),o.apply(this,arguments)}return e=c,(n=[{key:"render",value:function(){var t=this;return i.a.createElement("a",{ref:function(e){return t.el=e}},this.props.children)}}])&&s(e.prototype,n),r&&s(e,r),Object.defineProperty(e,"prototype",{writable:!1}),c}(r.a)}])})); |
@@ -1,1 +0,1 @@ | ||
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("react"),require("froala-editor")):"function"==typeof define&&define.amd?define(["react","froala-editor"],e):"object"==typeof exports?exports.FroalaEditorButton=e(require("react"),require("froala-editor")):t.FroalaEditorButton=e(t.React,t["froala-editor"])}(window,(function(t,e){return function(t){var e={};function n(r){if(e[r])return e[r].exports;var o=e[r]={i:r,l:!1,exports:{}};return t[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)n.d(r,o,function(e){return t[e]}.bind(null,o));return r},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=7)}([function(e,n){e.exports=t},function(t,e,n){"use strict";n.d(e,"a",(function(){return h}));var r=n(2),o=n.n(r),i=n(0);function u(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function c(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function s(t){return(s="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function f(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function l(t,e){return(l=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t})(t,e)}function a(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,r=d(t);if(e){var o=d(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return p(this,n)}}function p(t,e){if(e&&("object"===s(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}function d(t){return(d=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var h=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&l(t,e)}(p,t);var e,n,r,i=a(p);function p(t){var e;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,p),(e=i.call(this,t)).defaultTag="div",e.tag=t.tag||e.defaultTag,e.listeningEvents=[],e.element=null,e.editor=null,e.config={immediateReactModelUpdate:!1,reactIgnoreAttrs:null},e.editorInitialized=!1,e.SPECIAL_TAGS=["img","button","input","a"],e.INNER_HTML_ATTR="innerHTML",e.hasSpecialTag=!1,e.oldModel=null,e}return e=p,(n=[{key:"componentDidMount",value:function(){var t=this.el.tagName.toLowerCase();-1!=this.SPECIAL_TAGS.indexOf(t)&&(this.tag=t,this.hasSpecialTag=!0),this.props.onManualControllerReady?this.generateManualController():this.createEditor()}},{key:"componentWillUnmount",value:function(){this.destroyEditor()}},{key:"componentDidUpdate",value:function(){JSON.stringify(this.oldModel)!=JSON.stringify(this.props.model)&&this.setContent()}},{key:"clone",value:function(t){var e,n=this;if(!t)return t;if([Number,String,Boolean].forEach((function(n){t instanceof n&&(e=n(t))})),void 0===e)if("[object Array]"===Object.prototype.toString.call(t))e=[],t.forEach((function(t,r,o){e[r]=n.clone(t)}));else if("object"==s(t))if(t.nodeType&&"function"==typeof t.cloneNode)e=t.cloneNode(!0);else if(t.prototype)e=t;else if(t instanceof Date)e=new Date(t);else for(var r in e={},t)e[r]=n.clone(t[r]);else e=t;return e}},{key:"createEditor",value:function(){var t=this;this.editorInitialized||(this.config=this.clone(this.props.config||this.config),this.config=function(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?u(Object(n),!0).forEach((function(e){c(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):u(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}({},this.config),this.element=this.el,this.setContent(!0),this.registerEvent("initialized",this.config.events&&this.config.events.initialized),this.config.events||(this.config.events={}),this.config.events.initialized=function(){return t.initListeners()},this.editor=new o.a(this.element,this.config))}},{key:"setContent",value:function(t){(this.props.model||""==this.props.model)&&(this.oldModel=this.props.model,this.hasSpecialTag?this.setSpecialTagContent():this.setNormalTagContent(t))}},{key:"setNormalTagContent",value:function(t){var e=this,n=this;function r(){n.editor.html&&n.editor.html.set(n.props.model||""),n.editorInitialized&&n.editor.undo&&(n.props.skipReset||n.editor.undo.reset(),n.editor.undo.saveStep())}t?this.config.initOnClick?(this.registerEvent("initializationDelayed",(function(){r()})),this.registerEvent("initialized",(function(){e.editorInitialized=!0}))):this.registerEvent("initialized",(function(){e.editorInitialized=!0,r()})):r()}},{key:"setSpecialTagContent",value:function(){var t=this.props.model;if(t){for(var e in t)t.hasOwnProperty(e)&&e!=this.INNER_HTML_ATTR&&this.element.setAttribute(e,t[e]);t.hasOwnProperty(this.INNER_HTML_ATTR)&&(this.element.innerHTML=t[this.INNER_HTML_ATTR])}}},{key:"destroyEditor",value:function(){this.element&&(this.editor.destroy&&this.editor.destroy(),this.listeningEvents.length=0,this.element=null,this.editorInitialized=!1)}},{key:"getEditor",value:function(){return this.element?this.editor:null}},{key:"generateManualController",value:function(){var t=this,e={initialize:function(){return t.createEditor.call(t)},destroy:function(){return t.destroyEditor.call(t)},getEditor:function(){return t.getEditor.call(t)}};this.props.onManualControllerReady(e)}},{key:"updateModel",value:function(){if(this.props.onModelChange){var t="";if(this.hasSpecialTag){for(var e=this.element.attributes,n={},r=0;r<e.length;r++){var o=e[r].name;this.config.reactIgnoreAttrs&&-1!=this.config.reactIgnoreAttrs.indexOf(o)||(n[o]=e[r].value)}this.element.innerHTML&&(n[this.INNER_HTML_ATTR]=this.element.innerHTML),t=n}else{var i=this.editor.html.get();"string"==typeof i&&(t=i)}this.oldModel=t,this.props.onModelChange(t)}}},{key:"initListeners",value:function(){var t=this;if(this.editor.events.on("contentChanged",(function(){t.updateModel()})),this.config.immediateReactModelUpdate&&this.editor.events.on("keyup",(function(){t.updateModel()})),this._initEvents)for(var e=0;e<this._initEvents.length;e++)this._initEvents[e].call(this.editor)}},{key:"registerEvent",value:function(t,e){t&&e&&("initialized"==t?(this._initEvents||(this._initEvents=[]),this._initEvents.push(e)):(this.config.events||(this.config.events={}),this.config.events[t]=e))}}])&&f(e.prototype,n),r&&f(e,r),Object.defineProperty(e,"prototype",{writable:!1}),p}(n.n(i).a.Component)},function(t,n){t.exports=e},,,,,function(t,e,n){t.exports=n(8)},function(t,e,n){"use strict";n.r(e),n.d(e,"default",(function(){return d}));var r=n(1),o=n(0),i=n.n(o);function u(t){return(u="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function c(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function s(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function f(t,e){return(f=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t})(t,e)}function l(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,r=p(t);if(e){var o=p(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return a(this,n)}}function a(t,e){if(e&&("object"===u(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}function p(t){return(p=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var d=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&f(t,e)}(u,t);var e,n,r,o=l(u);function u(){return c(this,u),o.apply(this,arguments)}return e=u,(n=[{key:"render",value:function(){var t=this;return i.a.createElement("button",{ref:function(e){return t.el=e}},this.props.children)}}])&&s(e.prototype,n),r&&s(e,r),Object.defineProperty(e,"prototype",{writable:!1}),u}(r.a)}])})); | ||
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("react"),require("froala-editor")):"function"==typeof define&&define.amd?define(["react","froala-editor"],e):"object"==typeof exports?exports.FroalaEditorButton=e(require("react"),require("froala-editor")):t.FroalaEditorButton=e(t.React,t["froala-editor"])}(window,(function(t,e){return function(t){var e={};function n(r){if(e[r])return e[r].exports;var o=e[r]={i:r,l:!1,exports:{}};return t[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)n.d(r,o,function(e){return t[e]}.bind(null,o));return r},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=7)}([function(e,n){e.exports=t},function(t,e,n){"use strict";n.d(e,"a",(function(){return h}));var r=n(2),o=n.n(r),i=n(0);function u(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function c(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function s(t){return(s="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function a(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function l(t,e){return(l=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t})(t,e)}function f(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,r=d(t);if(e){var o=d(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return p(this,n)}}function p(t,e){if(e&&("object"===s(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}function d(t){return(d=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var h=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&l(t,e)}(p,t);var e,n,r,i=f(p);function p(t){var e;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,p),(e=i.call(this,t)).defaultTag="div",e.tag=t.tag||e.defaultTag,e.listeningEvents=[],e.element=null,e.editor=null,e.config={immediateReactModelUpdate:!1,reactIgnoreAttrs:null},e.editorInitialized=!1,e.SPECIAL_TAGS=["img","button","input","a"],e.INNER_HTML_ATTR="innerHTML",e.hasSpecialTag=!1,e.oldModel=null,e}return e=p,(n=[{key:"componentDidMount",value:function(){var t=this.el.tagName.toLowerCase();-1!=this.SPECIAL_TAGS.indexOf(t)&&(this.tag=t,this.hasSpecialTag=!0),this.props.onManualControllerReady?this.generateManualController():this.createEditor()}},{key:"componentWillUnmount",value:function(){this.destroyEditor()}},{key:"componentDidUpdate",value:function(){JSON.stringify(this.oldModel)!=JSON.stringify(this.props.model)&&this.setContent()}},{key:"clone",value:function(t){var e,n=this;if(!t)return t;if([Number,String,Boolean].forEach((function(n){t instanceof n&&(e=n(t))})),void 0===e)if("[object Array]"===Object.prototype.toString.call(t))e=[],t.forEach((function(t,r,o){e[r]=n.clone(t)}));else if("object"==s(t))if(t.nodeType&&"function"==typeof t.cloneNode)e=t.cloneNode(!0);else if(t.prototype)e=t;else if(t instanceof Date)e=new Date(t);else for(var r in e={},t)e[r]=n.clone(t[r]);else e=t;return e}},{key:"createEditor",value:function(){var t=this;this.editorInitialized||(this.config=this.clone(this.props.config||this.config),this.config=function(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?u(Object(n),!0).forEach((function(e){c(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):u(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}({},this.config),this.element=this.el,this.setContent(!0),this.registerEvent("initialized",this.config.events&&this.config.events.initialized),this.config.events||(this.config.events={}),this.config.events.initialized=function(){return t.initListeners()},this.editor=new o.a(this.element,this.config))}},{key:"setContent",value:function(t){(this.props.model||""==this.props.model)&&(this.oldModel=this.props.model,this.hasSpecialTag?this.setSpecialTagContent():this.setNormalTagContent(t))}},{key:"setNormalTagContent",value:function(t){var e=this,n=this;function r(){n.editor.html&&n.editor.html.set(n.props.model||""),n.editorInitialized&&n.editor.undo&&(n.props.skipReset||n.editor.undo.reset(),n.editor.undo.saveStep())}t?this.config.initOnClick?(this.registerEvent("initializationDelayed",(function(){r()})),this.registerEvent("initialized",(function(){e.editorInitialized=!0}))):this.registerEvent("initialized",(function(){e.editorInitialized=!0,r()})):r()}},{key:"setSpecialTagContent",value:function(){var t=this.props.model;if(t){for(var e in t)t.hasOwnProperty(e)&&e!=this.INNER_HTML_ATTR&&this.element.setAttribute(e,t[e]);t.hasOwnProperty(this.INNER_HTML_ATTR)&&(this.element.innerHTML=t[this.INNER_HTML_ATTR])}}},{key:"destroyEditor",value:function(){if(this.element){this.editor.destroy&&this.editor.destroy(),this.listeningEvents.length=0,this.element=null,this.editorInitialized=!1,this.config={immediateReactModelUpdate:!1,reactIgnoreAttrs:null};var t=this.el.tagName.toLowerCase();-1==this.SPECIAL_TAGS.indexOf(t)&&this.editor&&this.editor.destrying&&!this.props.onManualControllerReady&&"textarea"==this.tag&&this.editor.$box.remove(),"textarea"!=this.tag&&(this.editor.$wp="")}}},{key:"getEditor",value:function(){return this.element?this.editor:null}},{key:"generateManualController",value:function(){var t=this,e={initialize:function(){return t.createEditor.call(t)},destroy:function(){return t.destroyEditor.call(t)},getEditor:function(){return t.getEditor.call(t)}};this.props.onManualControllerReady(e)}},{key:"updateModel",value:function(){if(this.props.onModelChange){var t="";if(this.hasSpecialTag){for(var e=this.element.attributes,n={},r=0;r<e.length;r++){var o=e[r].name;this.config.reactIgnoreAttrs&&-1!=this.config.reactIgnoreAttrs.indexOf(o)||(n[o]=e[r].value)}this.element.innerHTML&&(n[this.INNER_HTML_ATTR]=this.element.innerHTML),t=n}else{var i=this.editor.html.get();"string"==typeof i&&(t=i)}this.oldModel=t,this.props.onModelChange(t)}}},{key:"initListeners",value:function(){var t=this;if(this.editor&&this.editor.events&&this.editor.events.on("contentChanged",(function(){t.updateModel()})),this.config.immediateReactModelUpdate&&this.editor.events.on("keyup",(function(){t.updateModel()})),this._initEvents)for(var e=0;e<this._initEvents.length;e++)this._initEvents[e].call(this.editor)}},{key:"registerEvent",value:function(t,e){t&&e&&("initialized"==t?(this._initEvents||(this._initEvents=[]),this._initEvents.push(e)):(this.config.events||(this.config.events={}),this.config.events[t]=e))}}])&&a(e.prototype,n),r&&a(e,r),Object.defineProperty(e,"prototype",{writable:!1}),p}(n.n(i).a.Component)},function(t,n){t.exports=e},,,,,function(t,e,n){t.exports=n(8)},function(t,e,n){"use strict";n.r(e),n.d(e,"default",(function(){return d}));var r=n(1),o=n(0),i=n.n(o);function u(t){return(u="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function c(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function s(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function a(t,e){return(a=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t})(t,e)}function l(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,r=p(t);if(e){var o=p(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return f(this,n)}}function f(t,e){if(e&&("object"===u(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}function p(t){return(p=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var d=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&a(t,e)}(u,t);var e,n,r,o=l(u);function u(){return c(this,u),o.apply(this,arguments)}return e=u,(n=[{key:"render",value:function(){var t=this;return i.a.createElement("button",{ref:function(e){return t.el=e}},this.props.children)}}])&&s(e.prototype,n),r&&s(e,r),Object.defineProperty(e,"prototype",{writable:!1}),u}(r.a)}])})); |
@@ -1,1 +0,1 @@ | ||
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("react"),require("froala-editor")):"function"==typeof define&&define.amd?define(["react","froala-editor"],e):"object"==typeof exports?exports.FroalaEditorButton=e(require("react"),require("froala-editor")):t.FroalaEditorButton=e(t.React,t["froala-editor"])}(window,(function(t,e){return function(t){var e={};function n(r){if(e[r])return e[r].exports;var o=e[r]={i:r,l:!1,exports:{}};return t[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)n.d(r,o,function(e){return t[e]}.bind(null,o));return r},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=7)}([function(e,n){e.exports=t},function(t,e,n){"use strict";n.d(e,"a",(function(){return h}));var r=n(2),o=n.n(r),i=n(0);function u(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function c(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function s(t){return(s="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function f(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function l(t,e){return(l=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t})(t,e)}function a(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,r=d(t);if(e){var o=d(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return p(this,n)}}function p(t,e){if(e&&("object"===s(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}function d(t){return(d=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var h=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&l(t,e)}(p,t);var e,n,r,i=a(p);function p(t){var e;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,p),(e=i.call(this,t)).defaultTag="div",e.tag=t.tag||e.defaultTag,e.listeningEvents=[],e.element=null,e.editor=null,e.config={immediateReactModelUpdate:!1,reactIgnoreAttrs:null},e.editorInitialized=!1,e.SPECIAL_TAGS=["img","button","input","a"],e.INNER_HTML_ATTR="innerHTML",e.hasSpecialTag=!1,e.oldModel=null,e}return e=p,(n=[{key:"componentDidMount",value:function(){var t=this.el.tagName.toLowerCase();-1!=this.SPECIAL_TAGS.indexOf(t)&&(this.tag=t,this.hasSpecialTag=!0),this.props.onManualControllerReady?this.generateManualController():this.createEditor()}},{key:"componentWillUnmount",value:function(){this.destroyEditor()}},{key:"componentDidUpdate",value:function(){JSON.stringify(this.oldModel)!=JSON.stringify(this.props.model)&&this.setContent()}},{key:"clone",value:function(t){var e,n=this;if(!t)return t;if([Number,String,Boolean].forEach((function(n){t instanceof n&&(e=n(t))})),void 0===e)if("[object Array]"===Object.prototype.toString.call(t))e=[],t.forEach((function(t,r,o){e[r]=n.clone(t)}));else if("object"==s(t))if(t.nodeType&&"function"==typeof t.cloneNode)e=t.cloneNode(!0);else if(t.prototype)e=t;else if(t instanceof Date)e=new Date(t);else for(var r in e={},t)e[r]=n.clone(t[r]);else e=t;return e}},{key:"createEditor",value:function(){var t=this;this.editorInitialized||(this.config=this.clone(this.props.config||this.config),this.config=function(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?u(Object(n),!0).forEach((function(e){c(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):u(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}({},this.config),this.element=this.el,this.setContent(!0),this.registerEvent("initialized",this.config.events&&this.config.events.initialized),this.config.events||(this.config.events={}),this.config.events.initialized=function(){return t.initListeners()},this.editor=new o.a(this.element,this.config))}},{key:"setContent",value:function(t){(this.props.model||""==this.props.model)&&(this.oldModel=this.props.model,this.hasSpecialTag?this.setSpecialTagContent():this.setNormalTagContent(t))}},{key:"setNormalTagContent",value:function(t){var e=this,n=this;function r(){n.editor.html&&n.editor.html.set(n.props.model||""),n.editorInitialized&&n.editor.undo&&(n.props.skipReset||n.editor.undo.reset(),n.editor.undo.saveStep())}t?this.config.initOnClick?(this.registerEvent("initializationDelayed",(function(){r()})),this.registerEvent("initialized",(function(){e.editorInitialized=!0}))):this.registerEvent("initialized",(function(){e.editorInitialized=!0,r()})):r()}},{key:"setSpecialTagContent",value:function(){var t=this.props.model;if(t){for(var e in t)t.hasOwnProperty(e)&&e!=this.INNER_HTML_ATTR&&this.element.setAttribute(e,t[e]);t.hasOwnProperty(this.INNER_HTML_ATTR)&&(this.element.innerHTML=t[this.INNER_HTML_ATTR])}}},{key:"destroyEditor",value:function(){this.element&&(this.editor.destroy&&this.editor.destroy(),this.listeningEvents.length=0,this.element=null,this.editorInitialized=!1)}},{key:"getEditor",value:function(){return this.element?this.editor:null}},{key:"generateManualController",value:function(){var t=this,e={initialize:function(){return t.createEditor.call(t)},destroy:function(){return t.destroyEditor.call(t)},getEditor:function(){return t.getEditor.call(t)}};this.props.onManualControllerReady(e)}},{key:"updateModel",value:function(){if(this.props.onModelChange){var t="";if(this.hasSpecialTag){for(var e=this.element.attributes,n={},r=0;r<e.length;r++){var o=e[r].name;this.config.reactIgnoreAttrs&&-1!=this.config.reactIgnoreAttrs.indexOf(o)||(n[o]=e[r].value)}this.element.innerHTML&&(n[this.INNER_HTML_ATTR]=this.element.innerHTML),t=n}else{var i=this.editor.html.get();"string"==typeof i&&(t=i)}this.oldModel=t,this.props.onModelChange(t)}}},{key:"initListeners",value:function(){var t=this;if(this.editor.events.on("contentChanged",(function(){t.updateModel()})),this.config.immediateReactModelUpdate&&this.editor.events.on("keyup",(function(){t.updateModel()})),this._initEvents)for(var e=0;e<this._initEvents.length;e++)this._initEvents[e].call(this.editor)}},{key:"registerEvent",value:function(t,e){t&&e&&("initialized"==t?(this._initEvents||(this._initEvents=[]),this._initEvents.push(e)):(this.config.events||(this.config.events={}),this.config.events[t]=e))}}])&&f(e.prototype,n),r&&f(e,r),Object.defineProperty(e,"prototype",{writable:!1}),p}(n.n(i).a.Component)},function(t,n){t.exports=e},,,,,function(t,e,n){t.exports=n(8)},function(t,e,n){"use strict";n.r(e),n.d(e,"default",(function(){return d}));var r=n(1),o=n(0),i=n.n(o);function u(t){return(u="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function c(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function s(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function f(t,e){return(f=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t})(t,e)}function l(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,r=p(t);if(e){var o=p(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return a(this,n)}}function a(t,e){if(e&&("object"===u(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}function p(t){return(p=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var d=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&f(t,e)}(u,t);var e,n,r,o=l(u);function u(){return c(this,u),o.apply(this,arguments)}return e=u,(n=[{key:"render",value:function(){var t=this;return i.a.createElement("button",{ref:function(e){return t.el=e}},this.props.children)}}])&&s(e.prototype,n),r&&s(e,r),Object.defineProperty(e,"prototype",{writable:!1}),u}(r.a)}])})); | ||
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("react"),require("froala-editor")):"function"==typeof define&&define.amd?define(["react","froala-editor"],e):"object"==typeof exports?exports.FroalaEditorButton=e(require("react"),require("froala-editor")):t.FroalaEditorButton=e(t.React,t["froala-editor"])}(window,(function(t,e){return function(t){var e={};function n(r){if(e[r])return e[r].exports;var o=e[r]={i:r,l:!1,exports:{}};return t[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)n.d(r,o,function(e){return t[e]}.bind(null,o));return r},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=7)}([function(e,n){e.exports=t},function(t,e,n){"use strict";n.d(e,"a",(function(){return h}));var r=n(2),o=n.n(r),i=n(0);function u(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function c(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function s(t){return(s="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function a(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function l(t,e){return(l=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t})(t,e)}function f(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,r=d(t);if(e){var o=d(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return p(this,n)}}function p(t,e){if(e&&("object"===s(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}function d(t){return(d=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var h=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&l(t,e)}(p,t);var e,n,r,i=f(p);function p(t){var e;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,p),(e=i.call(this,t)).defaultTag="div",e.tag=t.tag||e.defaultTag,e.listeningEvents=[],e.element=null,e.editor=null,e.config={immediateReactModelUpdate:!1,reactIgnoreAttrs:null},e.editorInitialized=!1,e.SPECIAL_TAGS=["img","button","input","a"],e.INNER_HTML_ATTR="innerHTML",e.hasSpecialTag=!1,e.oldModel=null,e}return e=p,(n=[{key:"componentDidMount",value:function(){var t=this.el.tagName.toLowerCase();-1!=this.SPECIAL_TAGS.indexOf(t)&&(this.tag=t,this.hasSpecialTag=!0),this.props.onManualControllerReady?this.generateManualController():this.createEditor()}},{key:"componentWillUnmount",value:function(){this.destroyEditor()}},{key:"componentDidUpdate",value:function(){JSON.stringify(this.oldModel)!=JSON.stringify(this.props.model)&&this.setContent()}},{key:"clone",value:function(t){var e,n=this;if(!t)return t;if([Number,String,Boolean].forEach((function(n){t instanceof n&&(e=n(t))})),void 0===e)if("[object Array]"===Object.prototype.toString.call(t))e=[],t.forEach((function(t,r,o){e[r]=n.clone(t)}));else if("object"==s(t))if(t.nodeType&&"function"==typeof t.cloneNode)e=t.cloneNode(!0);else if(t.prototype)e=t;else if(t instanceof Date)e=new Date(t);else for(var r in e={},t)e[r]=n.clone(t[r]);else e=t;return e}},{key:"createEditor",value:function(){var t=this;this.editorInitialized||(this.config=this.clone(this.props.config||this.config),this.config=function(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?u(Object(n),!0).forEach((function(e){c(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):u(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}({},this.config),this.element=this.el,this.setContent(!0),this.registerEvent("initialized",this.config.events&&this.config.events.initialized),this.config.events||(this.config.events={}),this.config.events.initialized=function(){return t.initListeners()},this.editor=new o.a(this.element,this.config))}},{key:"setContent",value:function(t){(this.props.model||""==this.props.model)&&(this.oldModel=this.props.model,this.hasSpecialTag?this.setSpecialTagContent():this.setNormalTagContent(t))}},{key:"setNormalTagContent",value:function(t){var e=this,n=this;function r(){n.editor.html&&n.editor.html.set(n.props.model||""),n.editorInitialized&&n.editor.undo&&(n.props.skipReset||n.editor.undo.reset(),n.editor.undo.saveStep())}t?this.config.initOnClick?(this.registerEvent("initializationDelayed",(function(){r()})),this.registerEvent("initialized",(function(){e.editorInitialized=!0}))):this.registerEvent("initialized",(function(){e.editorInitialized=!0,r()})):r()}},{key:"setSpecialTagContent",value:function(){var t=this.props.model;if(t){for(var e in t)t.hasOwnProperty(e)&&e!=this.INNER_HTML_ATTR&&this.element.setAttribute(e,t[e]);t.hasOwnProperty(this.INNER_HTML_ATTR)&&(this.element.innerHTML=t[this.INNER_HTML_ATTR])}}},{key:"destroyEditor",value:function(){if(this.element){this.editor.destroy&&this.editor.destroy(),this.listeningEvents.length=0,this.element=null,this.editorInitialized=!1,this.config={immediateReactModelUpdate:!1,reactIgnoreAttrs:null};var t=this.el.tagName.toLowerCase();-1==this.SPECIAL_TAGS.indexOf(t)&&this.editor&&this.editor.destrying&&!this.props.onManualControllerReady&&"textarea"==this.tag&&this.editor.$box.remove(),"textarea"!=this.tag&&(this.editor.$wp="")}}},{key:"getEditor",value:function(){return this.element?this.editor:null}},{key:"generateManualController",value:function(){var t=this,e={initialize:function(){return t.createEditor.call(t)},destroy:function(){return t.destroyEditor.call(t)},getEditor:function(){return t.getEditor.call(t)}};this.props.onManualControllerReady(e)}},{key:"updateModel",value:function(){if(this.props.onModelChange){var t="";if(this.hasSpecialTag){for(var e=this.element.attributes,n={},r=0;r<e.length;r++){var o=e[r].name;this.config.reactIgnoreAttrs&&-1!=this.config.reactIgnoreAttrs.indexOf(o)||(n[o]=e[r].value)}this.element.innerHTML&&(n[this.INNER_HTML_ATTR]=this.element.innerHTML),t=n}else{var i=this.editor.html.get();"string"==typeof i&&(t=i)}this.oldModel=t,this.props.onModelChange(t)}}},{key:"initListeners",value:function(){var t=this;if(this.editor&&this.editor.events&&this.editor.events.on("contentChanged",(function(){t.updateModel()})),this.config.immediateReactModelUpdate&&this.editor.events.on("keyup",(function(){t.updateModel()})),this._initEvents)for(var e=0;e<this._initEvents.length;e++)this._initEvents[e].call(this.editor)}},{key:"registerEvent",value:function(t,e){t&&e&&("initialized"==t?(this._initEvents||(this._initEvents=[]),this._initEvents.push(e)):(this.config.events||(this.config.events={}),this.config.events[t]=e))}}])&&a(e.prototype,n),r&&a(e,r),Object.defineProperty(e,"prototype",{writable:!1}),p}(n.n(i).a.Component)},function(t,n){t.exports=e},,,,,function(t,e,n){t.exports=n(8)},function(t,e,n){"use strict";n.r(e),n.d(e,"default",(function(){return d}));var r=n(1),o=n(0),i=n.n(o);function u(t){return(u="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function c(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function s(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function a(t,e){return(a=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t})(t,e)}function l(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,r=p(t);if(e){var o=p(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return f(this,n)}}function f(t,e){if(e&&("object"===u(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}function p(t){return(p=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var d=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&a(t,e)}(u,t);var e,n,r,o=l(u);function u(){return c(this,u),o.apply(this,arguments)}return e=u,(n=[{key:"render",value:function(){var t=this;return i.a.createElement("button",{ref:function(e){return t.el=e}},this.props.children)}}])&&s(e.prototype,n),r&&s(e,r),Object.defineProperty(e,"prototype",{writable:!1}),u}(r.a)}])})); |
@@ -1,1 +0,1 @@ | ||
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("react"),require("froala-editor")):"function"==typeof define&&define.amd?define(["react","froala-editor"],e):"object"==typeof exports?exports.FroalaEditorImg=e(require("react"),require("froala-editor")):t.FroalaEditorImg=e(t.React,t["froala-editor"])}(window,(function(t,e){return function(t){var e={};function n(r){if(e[r])return e[r].exports;var o=e[r]={i:r,l:!1,exports:{}};return t[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)n.d(r,o,function(e){return t[e]}.bind(null,o));return r},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=9)}([function(e,n){e.exports=t},function(t,e,n){"use strict";n.d(e,"a",(function(){return y}));var r=n(2),o=n.n(r),i=n(0);function c(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function u(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function s(t){return(s="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function f(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function a(t,e){return(a=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t})(t,e)}function l(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,r=d(t);if(e){var o=d(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return p(this,n)}}function p(t,e){if(e&&("object"===s(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}function d(t){return(d=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var y=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&a(t,e)}(p,t);var e,n,r,i=l(p);function p(t){var e;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,p),(e=i.call(this,t)).defaultTag="div",e.tag=t.tag||e.defaultTag,e.listeningEvents=[],e.element=null,e.editor=null,e.config={immediateReactModelUpdate:!1,reactIgnoreAttrs:null},e.editorInitialized=!1,e.SPECIAL_TAGS=["img","button","input","a"],e.INNER_HTML_ATTR="innerHTML",e.hasSpecialTag=!1,e.oldModel=null,e}return e=p,(n=[{key:"componentDidMount",value:function(){var t=this.el.tagName.toLowerCase();-1!=this.SPECIAL_TAGS.indexOf(t)&&(this.tag=t,this.hasSpecialTag=!0),this.props.onManualControllerReady?this.generateManualController():this.createEditor()}},{key:"componentWillUnmount",value:function(){this.destroyEditor()}},{key:"componentDidUpdate",value:function(){JSON.stringify(this.oldModel)!=JSON.stringify(this.props.model)&&this.setContent()}},{key:"clone",value:function(t){var e,n=this;if(!t)return t;if([Number,String,Boolean].forEach((function(n){t instanceof n&&(e=n(t))})),void 0===e)if("[object Array]"===Object.prototype.toString.call(t))e=[],t.forEach((function(t,r,o){e[r]=n.clone(t)}));else if("object"==s(t))if(t.nodeType&&"function"==typeof t.cloneNode)e=t.cloneNode(!0);else if(t.prototype)e=t;else if(t instanceof Date)e=new Date(t);else for(var r in e={},t)e[r]=n.clone(t[r]);else e=t;return e}},{key:"createEditor",value:function(){var t=this;this.editorInitialized||(this.config=this.clone(this.props.config||this.config),this.config=function(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?c(Object(n),!0).forEach((function(e){u(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):c(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}({},this.config),this.element=this.el,this.setContent(!0),this.registerEvent("initialized",this.config.events&&this.config.events.initialized),this.config.events||(this.config.events={}),this.config.events.initialized=function(){return t.initListeners()},this.editor=new o.a(this.element,this.config))}},{key:"setContent",value:function(t){(this.props.model||""==this.props.model)&&(this.oldModel=this.props.model,this.hasSpecialTag?this.setSpecialTagContent():this.setNormalTagContent(t))}},{key:"setNormalTagContent",value:function(t){var e=this,n=this;function r(){n.editor.html&&n.editor.html.set(n.props.model||""),n.editorInitialized&&n.editor.undo&&(n.props.skipReset||n.editor.undo.reset(),n.editor.undo.saveStep())}t?this.config.initOnClick?(this.registerEvent("initializationDelayed",(function(){r()})),this.registerEvent("initialized",(function(){e.editorInitialized=!0}))):this.registerEvent("initialized",(function(){e.editorInitialized=!0,r()})):r()}},{key:"setSpecialTagContent",value:function(){var t=this.props.model;if(t){for(var e in t)t.hasOwnProperty(e)&&e!=this.INNER_HTML_ATTR&&this.element.setAttribute(e,t[e]);t.hasOwnProperty(this.INNER_HTML_ATTR)&&(this.element.innerHTML=t[this.INNER_HTML_ATTR])}}},{key:"destroyEditor",value:function(){this.element&&(this.editor.destroy&&this.editor.destroy(),this.listeningEvents.length=0,this.element=null,this.editorInitialized=!1)}},{key:"getEditor",value:function(){return this.element?this.editor:null}},{key:"generateManualController",value:function(){var t=this,e={initialize:function(){return t.createEditor.call(t)},destroy:function(){return t.destroyEditor.call(t)},getEditor:function(){return t.getEditor.call(t)}};this.props.onManualControllerReady(e)}},{key:"updateModel",value:function(){if(this.props.onModelChange){var t="";if(this.hasSpecialTag){for(var e=this.element.attributes,n={},r=0;r<e.length;r++){var o=e[r].name;this.config.reactIgnoreAttrs&&-1!=this.config.reactIgnoreAttrs.indexOf(o)||(n[o]=e[r].value)}this.element.innerHTML&&(n[this.INNER_HTML_ATTR]=this.element.innerHTML),t=n}else{var i=this.editor.html.get();"string"==typeof i&&(t=i)}this.oldModel=t,this.props.onModelChange(t)}}},{key:"initListeners",value:function(){var t=this;if(this.editor.events.on("contentChanged",(function(){t.updateModel()})),this.config.immediateReactModelUpdate&&this.editor.events.on("keyup",(function(){t.updateModel()})),this._initEvents)for(var e=0;e<this._initEvents.length;e++)this._initEvents[e].call(this.editor)}},{key:"registerEvent",value:function(t,e){t&&e&&("initialized"==t?(this._initEvents||(this._initEvents=[]),this._initEvents.push(e)):(this.config.events||(this.config.events={}),this.config.events[t]=e))}}])&&f(e.prototype,n),r&&f(e,r),Object.defineProperty(e,"prototype",{writable:!1}),p}(n.n(i).a.Component)},function(t,n){t.exports=e},,,,,,,function(t,e,n){t.exports=n(10)},function(t,e,n){"use strict";n.r(e),n.d(e,"default",(function(){return d}));var r=n(1),o=n(0),i=n.n(o);function c(t){return(c="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function u(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function s(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function f(t,e){return(f=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t})(t,e)}function a(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,r=p(t);if(e){var o=p(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return l(this,n)}}function l(t,e){if(e&&("object"===c(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}function p(t){return(p=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var d=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&f(t,e)}(c,t);var e,n,r,o=a(c);function c(){return u(this,c),o.apply(this,arguments)}return e=c,(n=[{key:"render",value:function(){var t=this;return i.a.createElement("img",{ref:function(e){return t.el=e}})}}])&&s(e.prototype,n),r&&s(e,r),Object.defineProperty(e,"prototype",{writable:!1}),c}(r.a)}])})); | ||
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("react"),require("froala-editor")):"function"==typeof define&&define.amd?define(["react","froala-editor"],e):"object"==typeof exports?exports.FroalaEditorImg=e(require("react"),require("froala-editor")):t.FroalaEditorImg=e(t.React,t["froala-editor"])}(window,(function(t,e){return function(t){var e={};function n(r){if(e[r])return e[r].exports;var o=e[r]={i:r,l:!1,exports:{}};return t[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)n.d(r,o,function(e){return t[e]}.bind(null,o));return r},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=9)}([function(e,n){e.exports=t},function(t,e,n){"use strict";n.d(e,"a",(function(){return h}));var r=n(2),o=n.n(r),i=n(0);function c(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function u(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function s(t){return(s="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function a(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function l(t,e){return(l=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t})(t,e)}function f(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,r=d(t);if(e){var o=d(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return p(this,n)}}function p(t,e){if(e&&("object"===s(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}function d(t){return(d=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var h=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&l(t,e)}(p,t);var e,n,r,i=f(p);function p(t){var e;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,p),(e=i.call(this,t)).defaultTag="div",e.tag=t.tag||e.defaultTag,e.listeningEvents=[],e.element=null,e.editor=null,e.config={immediateReactModelUpdate:!1,reactIgnoreAttrs:null},e.editorInitialized=!1,e.SPECIAL_TAGS=["img","button","input","a"],e.INNER_HTML_ATTR="innerHTML",e.hasSpecialTag=!1,e.oldModel=null,e}return e=p,(n=[{key:"componentDidMount",value:function(){var t=this.el.tagName.toLowerCase();-1!=this.SPECIAL_TAGS.indexOf(t)&&(this.tag=t,this.hasSpecialTag=!0),this.props.onManualControllerReady?this.generateManualController():this.createEditor()}},{key:"componentWillUnmount",value:function(){this.destroyEditor()}},{key:"componentDidUpdate",value:function(){JSON.stringify(this.oldModel)!=JSON.stringify(this.props.model)&&this.setContent()}},{key:"clone",value:function(t){var e,n=this;if(!t)return t;if([Number,String,Boolean].forEach((function(n){t instanceof n&&(e=n(t))})),void 0===e)if("[object Array]"===Object.prototype.toString.call(t))e=[],t.forEach((function(t,r,o){e[r]=n.clone(t)}));else if("object"==s(t))if(t.nodeType&&"function"==typeof t.cloneNode)e=t.cloneNode(!0);else if(t.prototype)e=t;else if(t instanceof Date)e=new Date(t);else for(var r in e={},t)e[r]=n.clone(t[r]);else e=t;return e}},{key:"createEditor",value:function(){var t=this;this.editorInitialized||(this.config=this.clone(this.props.config||this.config),this.config=function(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?c(Object(n),!0).forEach((function(e){u(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):c(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}({},this.config),this.element=this.el,this.setContent(!0),this.registerEvent("initialized",this.config.events&&this.config.events.initialized),this.config.events||(this.config.events={}),this.config.events.initialized=function(){return t.initListeners()},this.editor=new o.a(this.element,this.config))}},{key:"setContent",value:function(t){(this.props.model||""==this.props.model)&&(this.oldModel=this.props.model,this.hasSpecialTag?this.setSpecialTagContent():this.setNormalTagContent(t))}},{key:"setNormalTagContent",value:function(t){var e=this,n=this;function r(){n.editor.html&&n.editor.html.set(n.props.model||""),n.editorInitialized&&n.editor.undo&&(n.props.skipReset||n.editor.undo.reset(),n.editor.undo.saveStep())}t?this.config.initOnClick?(this.registerEvent("initializationDelayed",(function(){r()})),this.registerEvent("initialized",(function(){e.editorInitialized=!0}))):this.registerEvent("initialized",(function(){e.editorInitialized=!0,r()})):r()}},{key:"setSpecialTagContent",value:function(){var t=this.props.model;if(t){for(var e in t)t.hasOwnProperty(e)&&e!=this.INNER_HTML_ATTR&&this.element.setAttribute(e,t[e]);t.hasOwnProperty(this.INNER_HTML_ATTR)&&(this.element.innerHTML=t[this.INNER_HTML_ATTR])}}},{key:"destroyEditor",value:function(){if(this.element){this.editor.destroy&&this.editor.destroy(),this.listeningEvents.length=0,this.element=null,this.editorInitialized=!1,this.config={immediateReactModelUpdate:!1,reactIgnoreAttrs:null};var t=this.el.tagName.toLowerCase();-1==this.SPECIAL_TAGS.indexOf(t)&&this.editor&&this.editor.destrying&&!this.props.onManualControllerReady&&"textarea"==this.tag&&this.editor.$box.remove(),"textarea"!=this.tag&&(this.editor.$wp="")}}},{key:"getEditor",value:function(){return this.element?this.editor:null}},{key:"generateManualController",value:function(){var t=this,e={initialize:function(){return t.createEditor.call(t)},destroy:function(){return t.destroyEditor.call(t)},getEditor:function(){return t.getEditor.call(t)}};this.props.onManualControllerReady(e)}},{key:"updateModel",value:function(){if(this.props.onModelChange){var t="";if(this.hasSpecialTag){for(var e=this.element.attributes,n={},r=0;r<e.length;r++){var o=e[r].name;this.config.reactIgnoreAttrs&&-1!=this.config.reactIgnoreAttrs.indexOf(o)||(n[o]=e[r].value)}this.element.innerHTML&&(n[this.INNER_HTML_ATTR]=this.element.innerHTML),t=n}else{var i=this.editor.html.get();"string"==typeof i&&(t=i)}this.oldModel=t,this.props.onModelChange(t)}}},{key:"initListeners",value:function(){var t=this;if(this.editor&&this.editor.events&&this.editor.events.on("contentChanged",(function(){t.updateModel()})),this.config.immediateReactModelUpdate&&this.editor.events.on("keyup",(function(){t.updateModel()})),this._initEvents)for(var e=0;e<this._initEvents.length;e++)this._initEvents[e].call(this.editor)}},{key:"registerEvent",value:function(t,e){t&&e&&("initialized"==t?(this._initEvents||(this._initEvents=[]),this._initEvents.push(e)):(this.config.events||(this.config.events={}),this.config.events[t]=e))}}])&&a(e.prototype,n),r&&a(e,r),Object.defineProperty(e,"prototype",{writable:!1}),p}(n.n(i).a.Component)},function(t,n){t.exports=e},,,,,,,function(t,e,n){t.exports=n(10)},function(t,e,n){"use strict";n.r(e),n.d(e,"default",(function(){return d}));var r=n(1),o=n(0),i=n.n(o);function c(t){return(c="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function u(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function s(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function a(t,e){return(a=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t})(t,e)}function l(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,r=p(t);if(e){var o=p(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return f(this,n)}}function f(t,e){if(e&&("object"===c(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}function p(t){return(p=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var d=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&a(t,e)}(c,t);var e,n,r,o=l(c);function c(){return u(this,c),o.apply(this,arguments)}return e=c,(n=[{key:"render",value:function(){var t=this;return i.a.createElement("img",{ref:function(e){return t.el=e}})}}])&&s(e.prototype,n),r&&s(e,r),Object.defineProperty(e,"prototype",{writable:!1}),c}(r.a)}])})); |
@@ -1,1 +0,1 @@ | ||
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("react"),require("froala-editor")):"function"==typeof define&&define.amd?define(["react","froala-editor"],e):"object"==typeof exports?exports.FroalaEditorImg=e(require("react"),require("froala-editor")):t.FroalaEditorImg=e(t.React,t["froala-editor"])}(window,(function(t,e){return function(t){var e={};function n(r){if(e[r])return e[r].exports;var o=e[r]={i:r,l:!1,exports:{}};return t[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)n.d(r,o,function(e){return t[e]}.bind(null,o));return r},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=9)}([function(e,n){e.exports=t},function(t,e,n){"use strict";n.d(e,"a",(function(){return y}));var r=n(2),o=n.n(r),i=n(0);function c(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function u(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function s(t){return(s="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function f(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function a(t,e){return(a=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t})(t,e)}function l(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,r=d(t);if(e){var o=d(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return p(this,n)}}function p(t,e){if(e&&("object"===s(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}function d(t){return(d=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var y=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&a(t,e)}(p,t);var e,n,r,i=l(p);function p(t){var e;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,p),(e=i.call(this,t)).defaultTag="div",e.tag=t.tag||e.defaultTag,e.listeningEvents=[],e.element=null,e.editor=null,e.config={immediateReactModelUpdate:!1,reactIgnoreAttrs:null},e.editorInitialized=!1,e.SPECIAL_TAGS=["img","button","input","a"],e.INNER_HTML_ATTR="innerHTML",e.hasSpecialTag=!1,e.oldModel=null,e}return e=p,(n=[{key:"componentDidMount",value:function(){var t=this.el.tagName.toLowerCase();-1!=this.SPECIAL_TAGS.indexOf(t)&&(this.tag=t,this.hasSpecialTag=!0),this.props.onManualControllerReady?this.generateManualController():this.createEditor()}},{key:"componentWillUnmount",value:function(){this.destroyEditor()}},{key:"componentDidUpdate",value:function(){JSON.stringify(this.oldModel)!=JSON.stringify(this.props.model)&&this.setContent()}},{key:"clone",value:function(t){var e,n=this;if(!t)return t;if([Number,String,Boolean].forEach((function(n){t instanceof n&&(e=n(t))})),void 0===e)if("[object Array]"===Object.prototype.toString.call(t))e=[],t.forEach((function(t,r,o){e[r]=n.clone(t)}));else if("object"==s(t))if(t.nodeType&&"function"==typeof t.cloneNode)e=t.cloneNode(!0);else if(t.prototype)e=t;else if(t instanceof Date)e=new Date(t);else for(var r in e={},t)e[r]=n.clone(t[r]);else e=t;return e}},{key:"createEditor",value:function(){var t=this;this.editorInitialized||(this.config=this.clone(this.props.config||this.config),this.config=function(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?c(Object(n),!0).forEach((function(e){u(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):c(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}({},this.config),this.element=this.el,this.setContent(!0),this.registerEvent("initialized",this.config.events&&this.config.events.initialized),this.config.events||(this.config.events={}),this.config.events.initialized=function(){return t.initListeners()},this.editor=new o.a(this.element,this.config))}},{key:"setContent",value:function(t){(this.props.model||""==this.props.model)&&(this.oldModel=this.props.model,this.hasSpecialTag?this.setSpecialTagContent():this.setNormalTagContent(t))}},{key:"setNormalTagContent",value:function(t){var e=this,n=this;function r(){n.editor.html&&n.editor.html.set(n.props.model||""),n.editorInitialized&&n.editor.undo&&(n.props.skipReset||n.editor.undo.reset(),n.editor.undo.saveStep())}t?this.config.initOnClick?(this.registerEvent("initializationDelayed",(function(){r()})),this.registerEvent("initialized",(function(){e.editorInitialized=!0}))):this.registerEvent("initialized",(function(){e.editorInitialized=!0,r()})):r()}},{key:"setSpecialTagContent",value:function(){var t=this.props.model;if(t){for(var e in t)t.hasOwnProperty(e)&&e!=this.INNER_HTML_ATTR&&this.element.setAttribute(e,t[e]);t.hasOwnProperty(this.INNER_HTML_ATTR)&&(this.element.innerHTML=t[this.INNER_HTML_ATTR])}}},{key:"destroyEditor",value:function(){this.element&&(this.editor.destroy&&this.editor.destroy(),this.listeningEvents.length=0,this.element=null,this.editorInitialized=!1)}},{key:"getEditor",value:function(){return this.element?this.editor:null}},{key:"generateManualController",value:function(){var t=this,e={initialize:function(){return t.createEditor.call(t)},destroy:function(){return t.destroyEditor.call(t)},getEditor:function(){return t.getEditor.call(t)}};this.props.onManualControllerReady(e)}},{key:"updateModel",value:function(){if(this.props.onModelChange){var t="";if(this.hasSpecialTag){for(var e=this.element.attributes,n={},r=0;r<e.length;r++){var o=e[r].name;this.config.reactIgnoreAttrs&&-1!=this.config.reactIgnoreAttrs.indexOf(o)||(n[o]=e[r].value)}this.element.innerHTML&&(n[this.INNER_HTML_ATTR]=this.element.innerHTML),t=n}else{var i=this.editor.html.get();"string"==typeof i&&(t=i)}this.oldModel=t,this.props.onModelChange(t)}}},{key:"initListeners",value:function(){var t=this;if(this.editor.events.on("contentChanged",(function(){t.updateModel()})),this.config.immediateReactModelUpdate&&this.editor.events.on("keyup",(function(){t.updateModel()})),this._initEvents)for(var e=0;e<this._initEvents.length;e++)this._initEvents[e].call(this.editor)}},{key:"registerEvent",value:function(t,e){t&&e&&("initialized"==t?(this._initEvents||(this._initEvents=[]),this._initEvents.push(e)):(this.config.events||(this.config.events={}),this.config.events[t]=e))}}])&&f(e.prototype,n),r&&f(e,r),Object.defineProperty(e,"prototype",{writable:!1}),p}(n.n(i).a.Component)},function(t,n){t.exports=e},,,,,,,function(t,e,n){t.exports=n(10)},function(t,e,n){"use strict";n.r(e),n.d(e,"default",(function(){return d}));var r=n(1),o=n(0),i=n.n(o);function c(t){return(c="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function u(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function s(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function f(t,e){return(f=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t})(t,e)}function a(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,r=p(t);if(e){var o=p(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return l(this,n)}}function l(t,e){if(e&&("object"===c(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}function p(t){return(p=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var d=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&f(t,e)}(c,t);var e,n,r,o=a(c);function c(){return u(this,c),o.apply(this,arguments)}return e=c,(n=[{key:"render",value:function(){var t=this;return i.a.createElement("img",{ref:function(e){return t.el=e}})}}])&&s(e.prototype,n),r&&s(e,r),Object.defineProperty(e,"prototype",{writable:!1}),c}(r.a)}])})); | ||
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("react"),require("froala-editor")):"function"==typeof define&&define.amd?define(["react","froala-editor"],e):"object"==typeof exports?exports.FroalaEditorImg=e(require("react"),require("froala-editor")):t.FroalaEditorImg=e(t.React,t["froala-editor"])}(window,(function(t,e){return function(t){var e={};function n(r){if(e[r])return e[r].exports;var o=e[r]={i:r,l:!1,exports:{}};return t[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)n.d(r,o,function(e){return t[e]}.bind(null,o));return r},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=9)}([function(e,n){e.exports=t},function(t,e,n){"use strict";n.d(e,"a",(function(){return h}));var r=n(2),o=n.n(r),i=n(0);function c(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function u(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function s(t){return(s="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function a(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function l(t,e){return(l=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t})(t,e)}function f(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,r=d(t);if(e){var o=d(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return p(this,n)}}function p(t,e){if(e&&("object"===s(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}function d(t){return(d=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var h=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&l(t,e)}(p,t);var e,n,r,i=f(p);function p(t){var e;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,p),(e=i.call(this,t)).defaultTag="div",e.tag=t.tag||e.defaultTag,e.listeningEvents=[],e.element=null,e.editor=null,e.config={immediateReactModelUpdate:!1,reactIgnoreAttrs:null},e.editorInitialized=!1,e.SPECIAL_TAGS=["img","button","input","a"],e.INNER_HTML_ATTR="innerHTML",e.hasSpecialTag=!1,e.oldModel=null,e}return e=p,(n=[{key:"componentDidMount",value:function(){var t=this.el.tagName.toLowerCase();-1!=this.SPECIAL_TAGS.indexOf(t)&&(this.tag=t,this.hasSpecialTag=!0),this.props.onManualControllerReady?this.generateManualController():this.createEditor()}},{key:"componentWillUnmount",value:function(){this.destroyEditor()}},{key:"componentDidUpdate",value:function(){JSON.stringify(this.oldModel)!=JSON.stringify(this.props.model)&&this.setContent()}},{key:"clone",value:function(t){var e,n=this;if(!t)return t;if([Number,String,Boolean].forEach((function(n){t instanceof n&&(e=n(t))})),void 0===e)if("[object Array]"===Object.prototype.toString.call(t))e=[],t.forEach((function(t,r,o){e[r]=n.clone(t)}));else if("object"==s(t))if(t.nodeType&&"function"==typeof t.cloneNode)e=t.cloneNode(!0);else if(t.prototype)e=t;else if(t instanceof Date)e=new Date(t);else for(var r in e={},t)e[r]=n.clone(t[r]);else e=t;return e}},{key:"createEditor",value:function(){var t=this;this.editorInitialized||(this.config=this.clone(this.props.config||this.config),this.config=function(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?c(Object(n),!0).forEach((function(e){u(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):c(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}({},this.config),this.element=this.el,this.setContent(!0),this.registerEvent("initialized",this.config.events&&this.config.events.initialized),this.config.events||(this.config.events={}),this.config.events.initialized=function(){return t.initListeners()},this.editor=new o.a(this.element,this.config))}},{key:"setContent",value:function(t){(this.props.model||""==this.props.model)&&(this.oldModel=this.props.model,this.hasSpecialTag?this.setSpecialTagContent():this.setNormalTagContent(t))}},{key:"setNormalTagContent",value:function(t){var e=this,n=this;function r(){n.editor.html&&n.editor.html.set(n.props.model||""),n.editorInitialized&&n.editor.undo&&(n.props.skipReset||n.editor.undo.reset(),n.editor.undo.saveStep())}t?this.config.initOnClick?(this.registerEvent("initializationDelayed",(function(){r()})),this.registerEvent("initialized",(function(){e.editorInitialized=!0}))):this.registerEvent("initialized",(function(){e.editorInitialized=!0,r()})):r()}},{key:"setSpecialTagContent",value:function(){var t=this.props.model;if(t){for(var e in t)t.hasOwnProperty(e)&&e!=this.INNER_HTML_ATTR&&this.element.setAttribute(e,t[e]);t.hasOwnProperty(this.INNER_HTML_ATTR)&&(this.element.innerHTML=t[this.INNER_HTML_ATTR])}}},{key:"destroyEditor",value:function(){if(this.element){this.editor.destroy&&this.editor.destroy(),this.listeningEvents.length=0,this.element=null,this.editorInitialized=!1,this.config={immediateReactModelUpdate:!1,reactIgnoreAttrs:null};var t=this.el.tagName.toLowerCase();-1==this.SPECIAL_TAGS.indexOf(t)&&this.editor&&this.editor.destrying&&!this.props.onManualControllerReady&&"textarea"==this.tag&&this.editor.$box.remove(),"textarea"!=this.tag&&(this.editor.$wp="")}}},{key:"getEditor",value:function(){return this.element?this.editor:null}},{key:"generateManualController",value:function(){var t=this,e={initialize:function(){return t.createEditor.call(t)},destroy:function(){return t.destroyEditor.call(t)},getEditor:function(){return t.getEditor.call(t)}};this.props.onManualControllerReady(e)}},{key:"updateModel",value:function(){if(this.props.onModelChange){var t="";if(this.hasSpecialTag){for(var e=this.element.attributes,n={},r=0;r<e.length;r++){var o=e[r].name;this.config.reactIgnoreAttrs&&-1!=this.config.reactIgnoreAttrs.indexOf(o)||(n[o]=e[r].value)}this.element.innerHTML&&(n[this.INNER_HTML_ATTR]=this.element.innerHTML),t=n}else{var i=this.editor.html.get();"string"==typeof i&&(t=i)}this.oldModel=t,this.props.onModelChange(t)}}},{key:"initListeners",value:function(){var t=this;if(this.editor&&this.editor.events&&this.editor.events.on("contentChanged",(function(){t.updateModel()})),this.config.immediateReactModelUpdate&&this.editor.events.on("keyup",(function(){t.updateModel()})),this._initEvents)for(var e=0;e<this._initEvents.length;e++)this._initEvents[e].call(this.editor)}},{key:"registerEvent",value:function(t,e){t&&e&&("initialized"==t?(this._initEvents||(this._initEvents=[]),this._initEvents.push(e)):(this.config.events||(this.config.events={}),this.config.events[t]=e))}}])&&a(e.prototype,n),r&&a(e,r),Object.defineProperty(e,"prototype",{writable:!1}),p}(n.n(i).a.Component)},function(t,n){t.exports=e},,,,,,,function(t,e,n){t.exports=n(10)},function(t,e,n){"use strict";n.r(e),n.d(e,"default",(function(){return d}));var r=n(1),o=n(0),i=n.n(o);function c(t){return(c="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function u(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function s(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function a(t,e){return(a=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t})(t,e)}function l(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,r=p(t);if(e){var o=p(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return f(this,n)}}function f(t,e){if(e&&("object"===c(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}function p(t){return(p=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var d=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&a(t,e)}(c,t);var e,n,r,o=l(c);function c(){return u(this,c),o.apply(this,arguments)}return e=c,(n=[{key:"render",value:function(){var t=this;return i.a.createElement("img",{ref:function(e){return t.el=e}})}}])&&s(e.prototype,n),r&&s(e,r),Object.defineProperty(e,"prototype",{writable:!1}),c}(r.a)}])})); |
@@ -1,1 +0,1 @@ | ||
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("react"),require("froala-editor")):"function"==typeof define&&define.amd?define(["react","froala-editor"],e):"object"==typeof exports?exports.FroalaEditorInput=e(require("react"),require("froala-editor")):t.FroalaEditorInput=e(t.React,t["froala-editor"])}(window,(function(t,e){return function(t){var e={};function n(r){if(e[r])return e[r].exports;var o=e[r]={i:r,l:!1,exports:{}};return t[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)n.d(r,o,function(e){return t[e]}.bind(null,o));return r},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=11)}([function(e,n){e.exports=t},function(t,e,n){"use strict";n.d(e,"a",(function(){return y}));var r=n(2),o=n.n(r),i=n(0);function u(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function c(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function s(t){return(s="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function f(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function a(t,e){return(a=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t})(t,e)}function l(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,r=d(t);if(e){var o=d(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return p(this,n)}}function p(t,e){if(e&&("object"===s(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}function d(t){return(d=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var y=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&a(t,e)}(p,t);var e,n,r,i=l(p);function p(t){var e;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,p),(e=i.call(this,t)).defaultTag="div",e.tag=t.tag||e.defaultTag,e.listeningEvents=[],e.element=null,e.editor=null,e.config={immediateReactModelUpdate:!1,reactIgnoreAttrs:null},e.editorInitialized=!1,e.SPECIAL_TAGS=["img","button","input","a"],e.INNER_HTML_ATTR="innerHTML",e.hasSpecialTag=!1,e.oldModel=null,e}return e=p,(n=[{key:"componentDidMount",value:function(){var t=this.el.tagName.toLowerCase();-1!=this.SPECIAL_TAGS.indexOf(t)&&(this.tag=t,this.hasSpecialTag=!0),this.props.onManualControllerReady?this.generateManualController():this.createEditor()}},{key:"componentWillUnmount",value:function(){this.destroyEditor()}},{key:"componentDidUpdate",value:function(){JSON.stringify(this.oldModel)!=JSON.stringify(this.props.model)&&this.setContent()}},{key:"clone",value:function(t){var e,n=this;if(!t)return t;if([Number,String,Boolean].forEach((function(n){t instanceof n&&(e=n(t))})),void 0===e)if("[object Array]"===Object.prototype.toString.call(t))e=[],t.forEach((function(t,r,o){e[r]=n.clone(t)}));else if("object"==s(t))if(t.nodeType&&"function"==typeof t.cloneNode)e=t.cloneNode(!0);else if(t.prototype)e=t;else if(t instanceof Date)e=new Date(t);else for(var r in e={},t)e[r]=n.clone(t[r]);else e=t;return e}},{key:"createEditor",value:function(){var t=this;this.editorInitialized||(this.config=this.clone(this.props.config||this.config),this.config=function(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?u(Object(n),!0).forEach((function(e){c(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):u(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}({},this.config),this.element=this.el,this.setContent(!0),this.registerEvent("initialized",this.config.events&&this.config.events.initialized),this.config.events||(this.config.events={}),this.config.events.initialized=function(){return t.initListeners()},this.editor=new o.a(this.element,this.config))}},{key:"setContent",value:function(t){(this.props.model||""==this.props.model)&&(this.oldModel=this.props.model,this.hasSpecialTag?this.setSpecialTagContent():this.setNormalTagContent(t))}},{key:"setNormalTagContent",value:function(t){var e=this,n=this;function r(){n.editor.html&&n.editor.html.set(n.props.model||""),n.editorInitialized&&n.editor.undo&&(n.props.skipReset||n.editor.undo.reset(),n.editor.undo.saveStep())}t?this.config.initOnClick?(this.registerEvent("initializationDelayed",(function(){r()})),this.registerEvent("initialized",(function(){e.editorInitialized=!0}))):this.registerEvent("initialized",(function(){e.editorInitialized=!0,r()})):r()}},{key:"setSpecialTagContent",value:function(){var t=this.props.model;if(t){for(var e in t)t.hasOwnProperty(e)&&e!=this.INNER_HTML_ATTR&&this.element.setAttribute(e,t[e]);t.hasOwnProperty(this.INNER_HTML_ATTR)&&(this.element.innerHTML=t[this.INNER_HTML_ATTR])}}},{key:"destroyEditor",value:function(){this.element&&(this.editor.destroy&&this.editor.destroy(),this.listeningEvents.length=0,this.element=null,this.editorInitialized=!1)}},{key:"getEditor",value:function(){return this.element?this.editor:null}},{key:"generateManualController",value:function(){var t=this,e={initialize:function(){return t.createEditor.call(t)},destroy:function(){return t.destroyEditor.call(t)},getEditor:function(){return t.getEditor.call(t)}};this.props.onManualControllerReady(e)}},{key:"updateModel",value:function(){if(this.props.onModelChange){var t="";if(this.hasSpecialTag){for(var e=this.element.attributes,n={},r=0;r<e.length;r++){var o=e[r].name;this.config.reactIgnoreAttrs&&-1!=this.config.reactIgnoreAttrs.indexOf(o)||(n[o]=e[r].value)}this.element.innerHTML&&(n[this.INNER_HTML_ATTR]=this.element.innerHTML),t=n}else{var i=this.editor.html.get();"string"==typeof i&&(t=i)}this.oldModel=t,this.props.onModelChange(t)}}},{key:"initListeners",value:function(){var t=this;if(this.editor.events.on("contentChanged",(function(){t.updateModel()})),this.config.immediateReactModelUpdate&&this.editor.events.on("keyup",(function(){t.updateModel()})),this._initEvents)for(var e=0;e<this._initEvents.length;e++)this._initEvents[e].call(this.editor)}},{key:"registerEvent",value:function(t,e){t&&e&&("initialized"==t?(this._initEvents||(this._initEvents=[]),this._initEvents.push(e)):(this.config.events||(this.config.events={}),this.config.events[t]=e))}}])&&f(e.prototype,n),r&&f(e,r),Object.defineProperty(e,"prototype",{writable:!1}),p}(n.n(i).a.Component)},function(t,n){t.exports=e},,,,,,,,,function(t,e,n){t.exports=n(12)},function(t,e,n){"use strict";n.r(e),n.d(e,"default",(function(){return d}));var r=n(1),o=n(0),i=n.n(o);function u(t){return(u="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function c(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function s(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function f(t,e){return(f=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t})(t,e)}function a(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,r=p(t);if(e){var o=p(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return l(this,n)}}function l(t,e){if(e&&("object"===u(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}function p(t){return(p=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var d=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&f(t,e)}(u,t);var e,n,r,o=a(u);function u(){return c(this,u),o.apply(this,arguments)}return e=u,(n=[{key:"render",value:function(){var t=this;return i.a.createElement("input",{ref:function(e){return t.el=e}})}}])&&s(e.prototype,n),r&&s(e,r),Object.defineProperty(e,"prototype",{writable:!1}),u}(r.a)}])})); | ||
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("react"),require("froala-editor")):"function"==typeof define&&define.amd?define(["react","froala-editor"],e):"object"==typeof exports?exports.FroalaEditorInput=e(require("react"),require("froala-editor")):t.FroalaEditorInput=e(t.React,t["froala-editor"])}(window,(function(t,e){return function(t){var e={};function n(r){if(e[r])return e[r].exports;var o=e[r]={i:r,l:!1,exports:{}};return t[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)n.d(r,o,function(e){return t[e]}.bind(null,o));return r},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=11)}([function(e,n){e.exports=t},function(t,e,n){"use strict";n.d(e,"a",(function(){return h}));var r=n(2),o=n.n(r),i=n(0);function u(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function c(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function s(t){return(s="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function a(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function l(t,e){return(l=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t})(t,e)}function f(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,r=d(t);if(e){var o=d(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return p(this,n)}}function p(t,e){if(e&&("object"===s(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}function d(t){return(d=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var h=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&l(t,e)}(p,t);var e,n,r,i=f(p);function p(t){var e;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,p),(e=i.call(this,t)).defaultTag="div",e.tag=t.tag||e.defaultTag,e.listeningEvents=[],e.element=null,e.editor=null,e.config={immediateReactModelUpdate:!1,reactIgnoreAttrs:null},e.editorInitialized=!1,e.SPECIAL_TAGS=["img","button","input","a"],e.INNER_HTML_ATTR="innerHTML",e.hasSpecialTag=!1,e.oldModel=null,e}return e=p,(n=[{key:"componentDidMount",value:function(){var t=this.el.tagName.toLowerCase();-1!=this.SPECIAL_TAGS.indexOf(t)&&(this.tag=t,this.hasSpecialTag=!0),this.props.onManualControllerReady?this.generateManualController():this.createEditor()}},{key:"componentWillUnmount",value:function(){this.destroyEditor()}},{key:"componentDidUpdate",value:function(){JSON.stringify(this.oldModel)!=JSON.stringify(this.props.model)&&this.setContent()}},{key:"clone",value:function(t){var e,n=this;if(!t)return t;if([Number,String,Boolean].forEach((function(n){t instanceof n&&(e=n(t))})),void 0===e)if("[object Array]"===Object.prototype.toString.call(t))e=[],t.forEach((function(t,r,o){e[r]=n.clone(t)}));else if("object"==s(t))if(t.nodeType&&"function"==typeof t.cloneNode)e=t.cloneNode(!0);else if(t.prototype)e=t;else if(t instanceof Date)e=new Date(t);else for(var r in e={},t)e[r]=n.clone(t[r]);else e=t;return e}},{key:"createEditor",value:function(){var t=this;this.editorInitialized||(this.config=this.clone(this.props.config||this.config),this.config=function(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?u(Object(n),!0).forEach((function(e){c(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):u(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}({},this.config),this.element=this.el,this.setContent(!0),this.registerEvent("initialized",this.config.events&&this.config.events.initialized),this.config.events||(this.config.events={}),this.config.events.initialized=function(){return t.initListeners()},this.editor=new o.a(this.element,this.config))}},{key:"setContent",value:function(t){(this.props.model||""==this.props.model)&&(this.oldModel=this.props.model,this.hasSpecialTag?this.setSpecialTagContent():this.setNormalTagContent(t))}},{key:"setNormalTagContent",value:function(t){var e=this,n=this;function r(){n.editor.html&&n.editor.html.set(n.props.model||""),n.editorInitialized&&n.editor.undo&&(n.props.skipReset||n.editor.undo.reset(),n.editor.undo.saveStep())}t?this.config.initOnClick?(this.registerEvent("initializationDelayed",(function(){r()})),this.registerEvent("initialized",(function(){e.editorInitialized=!0}))):this.registerEvent("initialized",(function(){e.editorInitialized=!0,r()})):r()}},{key:"setSpecialTagContent",value:function(){var t=this.props.model;if(t){for(var e in t)t.hasOwnProperty(e)&&e!=this.INNER_HTML_ATTR&&this.element.setAttribute(e,t[e]);t.hasOwnProperty(this.INNER_HTML_ATTR)&&(this.element.innerHTML=t[this.INNER_HTML_ATTR])}}},{key:"destroyEditor",value:function(){if(this.element){this.editor.destroy&&this.editor.destroy(),this.listeningEvents.length=0,this.element=null,this.editorInitialized=!1,this.config={immediateReactModelUpdate:!1,reactIgnoreAttrs:null};var t=this.el.tagName.toLowerCase();-1==this.SPECIAL_TAGS.indexOf(t)&&this.editor&&this.editor.destrying&&!this.props.onManualControllerReady&&"textarea"==this.tag&&this.editor.$box.remove(),"textarea"!=this.tag&&(this.editor.$wp="")}}},{key:"getEditor",value:function(){return this.element?this.editor:null}},{key:"generateManualController",value:function(){var t=this,e={initialize:function(){return t.createEditor.call(t)},destroy:function(){return t.destroyEditor.call(t)},getEditor:function(){return t.getEditor.call(t)}};this.props.onManualControllerReady(e)}},{key:"updateModel",value:function(){if(this.props.onModelChange){var t="";if(this.hasSpecialTag){for(var e=this.element.attributes,n={},r=0;r<e.length;r++){var o=e[r].name;this.config.reactIgnoreAttrs&&-1!=this.config.reactIgnoreAttrs.indexOf(o)||(n[o]=e[r].value)}this.element.innerHTML&&(n[this.INNER_HTML_ATTR]=this.element.innerHTML),t=n}else{var i=this.editor.html.get();"string"==typeof i&&(t=i)}this.oldModel=t,this.props.onModelChange(t)}}},{key:"initListeners",value:function(){var t=this;if(this.editor&&this.editor.events&&this.editor.events.on("contentChanged",(function(){t.updateModel()})),this.config.immediateReactModelUpdate&&this.editor.events.on("keyup",(function(){t.updateModel()})),this._initEvents)for(var e=0;e<this._initEvents.length;e++)this._initEvents[e].call(this.editor)}},{key:"registerEvent",value:function(t,e){t&&e&&("initialized"==t?(this._initEvents||(this._initEvents=[]),this._initEvents.push(e)):(this.config.events||(this.config.events={}),this.config.events[t]=e))}}])&&a(e.prototype,n),r&&a(e,r),Object.defineProperty(e,"prototype",{writable:!1}),p}(n.n(i).a.Component)},function(t,n){t.exports=e},,,,,,,,,function(t,e,n){t.exports=n(12)},function(t,e,n){"use strict";n.r(e),n.d(e,"default",(function(){return d}));var r=n(1),o=n(0),i=n.n(o);function u(t){return(u="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function c(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function s(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function a(t,e){return(a=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t})(t,e)}function l(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,r=p(t);if(e){var o=p(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return f(this,n)}}function f(t,e){if(e&&("object"===u(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}function p(t){return(p=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var d=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&a(t,e)}(u,t);var e,n,r,o=l(u);function u(){return c(this,u),o.apply(this,arguments)}return e=u,(n=[{key:"render",value:function(){var t=this;return i.a.createElement("input",{ref:function(e){return t.el=e}})}}])&&s(e.prototype,n),r&&s(e,r),Object.defineProperty(e,"prototype",{writable:!1}),u}(r.a)}])})); |
@@ -1,1 +0,1 @@ | ||
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("react"),require("froala-editor")):"function"==typeof define&&define.amd?define(["react","froala-editor"],e):"object"==typeof exports?exports.FroalaEditorInput=e(require("react"),require("froala-editor")):t.FroalaEditorInput=e(t.React,t["froala-editor"])}(window,(function(t,e){return function(t){var e={};function n(r){if(e[r])return e[r].exports;var o=e[r]={i:r,l:!1,exports:{}};return t[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)n.d(r,o,function(e){return t[e]}.bind(null,o));return r},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=11)}([function(e,n){e.exports=t},function(t,e,n){"use strict";n.d(e,"a",(function(){return y}));var r=n(2),o=n.n(r),i=n(0);function u(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function c(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function s(t){return(s="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function f(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function a(t,e){return(a=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t})(t,e)}function l(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,r=d(t);if(e){var o=d(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return p(this,n)}}function p(t,e){if(e&&("object"===s(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}function d(t){return(d=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var y=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&a(t,e)}(p,t);var e,n,r,i=l(p);function p(t){var e;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,p),(e=i.call(this,t)).defaultTag="div",e.tag=t.tag||e.defaultTag,e.listeningEvents=[],e.element=null,e.editor=null,e.config={immediateReactModelUpdate:!1,reactIgnoreAttrs:null},e.editorInitialized=!1,e.SPECIAL_TAGS=["img","button","input","a"],e.INNER_HTML_ATTR="innerHTML",e.hasSpecialTag=!1,e.oldModel=null,e}return e=p,(n=[{key:"componentDidMount",value:function(){var t=this.el.tagName.toLowerCase();-1!=this.SPECIAL_TAGS.indexOf(t)&&(this.tag=t,this.hasSpecialTag=!0),this.props.onManualControllerReady?this.generateManualController():this.createEditor()}},{key:"componentWillUnmount",value:function(){this.destroyEditor()}},{key:"componentDidUpdate",value:function(){JSON.stringify(this.oldModel)!=JSON.stringify(this.props.model)&&this.setContent()}},{key:"clone",value:function(t){var e,n=this;if(!t)return t;if([Number,String,Boolean].forEach((function(n){t instanceof n&&(e=n(t))})),void 0===e)if("[object Array]"===Object.prototype.toString.call(t))e=[],t.forEach((function(t,r,o){e[r]=n.clone(t)}));else if("object"==s(t))if(t.nodeType&&"function"==typeof t.cloneNode)e=t.cloneNode(!0);else if(t.prototype)e=t;else if(t instanceof Date)e=new Date(t);else for(var r in e={},t)e[r]=n.clone(t[r]);else e=t;return e}},{key:"createEditor",value:function(){var t=this;this.editorInitialized||(this.config=this.clone(this.props.config||this.config),this.config=function(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?u(Object(n),!0).forEach((function(e){c(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):u(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}({},this.config),this.element=this.el,this.setContent(!0),this.registerEvent("initialized",this.config.events&&this.config.events.initialized),this.config.events||(this.config.events={}),this.config.events.initialized=function(){return t.initListeners()},this.editor=new o.a(this.element,this.config))}},{key:"setContent",value:function(t){(this.props.model||""==this.props.model)&&(this.oldModel=this.props.model,this.hasSpecialTag?this.setSpecialTagContent():this.setNormalTagContent(t))}},{key:"setNormalTagContent",value:function(t){var e=this,n=this;function r(){n.editor.html&&n.editor.html.set(n.props.model||""),n.editorInitialized&&n.editor.undo&&(n.props.skipReset||n.editor.undo.reset(),n.editor.undo.saveStep())}t?this.config.initOnClick?(this.registerEvent("initializationDelayed",(function(){r()})),this.registerEvent("initialized",(function(){e.editorInitialized=!0}))):this.registerEvent("initialized",(function(){e.editorInitialized=!0,r()})):r()}},{key:"setSpecialTagContent",value:function(){var t=this.props.model;if(t){for(var e in t)t.hasOwnProperty(e)&&e!=this.INNER_HTML_ATTR&&this.element.setAttribute(e,t[e]);t.hasOwnProperty(this.INNER_HTML_ATTR)&&(this.element.innerHTML=t[this.INNER_HTML_ATTR])}}},{key:"destroyEditor",value:function(){this.element&&(this.editor.destroy&&this.editor.destroy(),this.listeningEvents.length=0,this.element=null,this.editorInitialized=!1)}},{key:"getEditor",value:function(){return this.element?this.editor:null}},{key:"generateManualController",value:function(){var t=this,e={initialize:function(){return t.createEditor.call(t)},destroy:function(){return t.destroyEditor.call(t)},getEditor:function(){return t.getEditor.call(t)}};this.props.onManualControllerReady(e)}},{key:"updateModel",value:function(){if(this.props.onModelChange){var t="";if(this.hasSpecialTag){for(var e=this.element.attributes,n={},r=0;r<e.length;r++){var o=e[r].name;this.config.reactIgnoreAttrs&&-1!=this.config.reactIgnoreAttrs.indexOf(o)||(n[o]=e[r].value)}this.element.innerHTML&&(n[this.INNER_HTML_ATTR]=this.element.innerHTML),t=n}else{var i=this.editor.html.get();"string"==typeof i&&(t=i)}this.oldModel=t,this.props.onModelChange(t)}}},{key:"initListeners",value:function(){var t=this;if(this.editor.events.on("contentChanged",(function(){t.updateModel()})),this.config.immediateReactModelUpdate&&this.editor.events.on("keyup",(function(){t.updateModel()})),this._initEvents)for(var e=0;e<this._initEvents.length;e++)this._initEvents[e].call(this.editor)}},{key:"registerEvent",value:function(t,e){t&&e&&("initialized"==t?(this._initEvents||(this._initEvents=[]),this._initEvents.push(e)):(this.config.events||(this.config.events={}),this.config.events[t]=e))}}])&&f(e.prototype,n),r&&f(e,r),Object.defineProperty(e,"prototype",{writable:!1}),p}(n.n(i).a.Component)},function(t,n){t.exports=e},,,,,,,,,function(t,e,n){t.exports=n(12)},function(t,e,n){"use strict";n.r(e),n.d(e,"default",(function(){return d}));var r=n(1),o=n(0),i=n.n(o);function u(t){return(u="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function c(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function s(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function f(t,e){return(f=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t})(t,e)}function a(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,r=p(t);if(e){var o=p(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return l(this,n)}}function l(t,e){if(e&&("object"===u(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}function p(t){return(p=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var d=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&f(t,e)}(u,t);var e,n,r,o=a(u);function u(){return c(this,u),o.apply(this,arguments)}return e=u,(n=[{key:"render",value:function(){var t=this;return i.a.createElement("input",{ref:function(e){return t.el=e}})}}])&&s(e.prototype,n),r&&s(e,r),Object.defineProperty(e,"prototype",{writable:!1}),u}(r.a)}])})); | ||
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("react"),require("froala-editor")):"function"==typeof define&&define.amd?define(["react","froala-editor"],e):"object"==typeof exports?exports.FroalaEditorInput=e(require("react"),require("froala-editor")):t.FroalaEditorInput=e(t.React,t["froala-editor"])}(window,(function(t,e){return function(t){var e={};function n(r){if(e[r])return e[r].exports;var o=e[r]={i:r,l:!1,exports:{}};return t[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)n.d(r,o,function(e){return t[e]}.bind(null,o));return r},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=11)}([function(e,n){e.exports=t},function(t,e,n){"use strict";n.d(e,"a",(function(){return h}));var r=n(2),o=n.n(r),i=n(0);function u(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function c(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function s(t){return(s="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function a(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function l(t,e){return(l=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t})(t,e)}function f(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,r=d(t);if(e){var o=d(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return p(this,n)}}function p(t,e){if(e&&("object"===s(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}function d(t){return(d=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var h=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&l(t,e)}(p,t);var e,n,r,i=f(p);function p(t){var e;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,p),(e=i.call(this,t)).defaultTag="div",e.tag=t.tag||e.defaultTag,e.listeningEvents=[],e.element=null,e.editor=null,e.config={immediateReactModelUpdate:!1,reactIgnoreAttrs:null},e.editorInitialized=!1,e.SPECIAL_TAGS=["img","button","input","a"],e.INNER_HTML_ATTR="innerHTML",e.hasSpecialTag=!1,e.oldModel=null,e}return e=p,(n=[{key:"componentDidMount",value:function(){var t=this.el.tagName.toLowerCase();-1!=this.SPECIAL_TAGS.indexOf(t)&&(this.tag=t,this.hasSpecialTag=!0),this.props.onManualControllerReady?this.generateManualController():this.createEditor()}},{key:"componentWillUnmount",value:function(){this.destroyEditor()}},{key:"componentDidUpdate",value:function(){JSON.stringify(this.oldModel)!=JSON.stringify(this.props.model)&&this.setContent()}},{key:"clone",value:function(t){var e,n=this;if(!t)return t;if([Number,String,Boolean].forEach((function(n){t instanceof n&&(e=n(t))})),void 0===e)if("[object Array]"===Object.prototype.toString.call(t))e=[],t.forEach((function(t,r,o){e[r]=n.clone(t)}));else if("object"==s(t))if(t.nodeType&&"function"==typeof t.cloneNode)e=t.cloneNode(!0);else if(t.prototype)e=t;else if(t instanceof Date)e=new Date(t);else for(var r in e={},t)e[r]=n.clone(t[r]);else e=t;return e}},{key:"createEditor",value:function(){var t=this;this.editorInitialized||(this.config=this.clone(this.props.config||this.config),this.config=function(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?u(Object(n),!0).forEach((function(e){c(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):u(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}({},this.config),this.element=this.el,this.setContent(!0),this.registerEvent("initialized",this.config.events&&this.config.events.initialized),this.config.events||(this.config.events={}),this.config.events.initialized=function(){return t.initListeners()},this.editor=new o.a(this.element,this.config))}},{key:"setContent",value:function(t){(this.props.model||""==this.props.model)&&(this.oldModel=this.props.model,this.hasSpecialTag?this.setSpecialTagContent():this.setNormalTagContent(t))}},{key:"setNormalTagContent",value:function(t){var e=this,n=this;function r(){n.editor.html&&n.editor.html.set(n.props.model||""),n.editorInitialized&&n.editor.undo&&(n.props.skipReset||n.editor.undo.reset(),n.editor.undo.saveStep())}t?this.config.initOnClick?(this.registerEvent("initializationDelayed",(function(){r()})),this.registerEvent("initialized",(function(){e.editorInitialized=!0}))):this.registerEvent("initialized",(function(){e.editorInitialized=!0,r()})):r()}},{key:"setSpecialTagContent",value:function(){var t=this.props.model;if(t){for(var e in t)t.hasOwnProperty(e)&&e!=this.INNER_HTML_ATTR&&this.element.setAttribute(e,t[e]);t.hasOwnProperty(this.INNER_HTML_ATTR)&&(this.element.innerHTML=t[this.INNER_HTML_ATTR])}}},{key:"destroyEditor",value:function(){if(this.element){this.editor.destroy&&this.editor.destroy(),this.listeningEvents.length=0,this.element=null,this.editorInitialized=!1,this.config={immediateReactModelUpdate:!1,reactIgnoreAttrs:null};var t=this.el.tagName.toLowerCase();-1==this.SPECIAL_TAGS.indexOf(t)&&this.editor&&this.editor.destrying&&!this.props.onManualControllerReady&&"textarea"==this.tag&&this.editor.$box.remove(),"textarea"!=this.tag&&(this.editor.$wp="")}}},{key:"getEditor",value:function(){return this.element?this.editor:null}},{key:"generateManualController",value:function(){var t=this,e={initialize:function(){return t.createEditor.call(t)},destroy:function(){return t.destroyEditor.call(t)},getEditor:function(){return t.getEditor.call(t)}};this.props.onManualControllerReady(e)}},{key:"updateModel",value:function(){if(this.props.onModelChange){var t="";if(this.hasSpecialTag){for(var e=this.element.attributes,n={},r=0;r<e.length;r++){var o=e[r].name;this.config.reactIgnoreAttrs&&-1!=this.config.reactIgnoreAttrs.indexOf(o)||(n[o]=e[r].value)}this.element.innerHTML&&(n[this.INNER_HTML_ATTR]=this.element.innerHTML),t=n}else{var i=this.editor.html.get();"string"==typeof i&&(t=i)}this.oldModel=t,this.props.onModelChange(t)}}},{key:"initListeners",value:function(){var t=this;if(this.editor&&this.editor.events&&this.editor.events.on("contentChanged",(function(){t.updateModel()})),this.config.immediateReactModelUpdate&&this.editor.events.on("keyup",(function(){t.updateModel()})),this._initEvents)for(var e=0;e<this._initEvents.length;e++)this._initEvents[e].call(this.editor)}},{key:"registerEvent",value:function(t,e){t&&e&&("initialized"==t?(this._initEvents||(this._initEvents=[]),this._initEvents.push(e)):(this.config.events||(this.config.events={}),this.config.events[t]=e))}}])&&a(e.prototype,n),r&&a(e,r),Object.defineProperty(e,"prototype",{writable:!1}),p}(n.n(i).a.Component)},function(t,n){t.exports=e},,,,,,,,,function(t,e,n){t.exports=n(12)},function(t,e,n){"use strict";n.r(e),n.d(e,"default",(function(){return d}));var r=n(1),o=n(0),i=n.n(o);function u(t){return(u="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function c(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function s(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function a(t,e){return(a=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t})(t,e)}function l(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,r=p(t);if(e){var o=p(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return f(this,n)}}function f(t,e){if(e&&("object"===u(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}function p(t){return(p=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var d=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&a(t,e)}(u,t);var e,n,r,o=l(u);function u(){return c(this,u),o.apply(this,arguments)}return e=u,(n=[{key:"render",value:function(){var t=this;return i.a.createElement("input",{ref:function(e){return t.el=e}})}}])&&s(e.prototype,n),r&&s(e,r),Object.defineProperty(e,"prototype",{writable:!1}),u}(r.a)}])})); |
@@ -1,1 +0,1 @@ | ||
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("react"),require("froala-editor")):"function"==typeof define&&define.amd?define(["react","froala-editor"],e):"object"==typeof exports?exports.index=e(require("react"),require("froala-editor")):t.index=e(t.React,t["froala-editor"])}(window,(function(t,e){return function(t){var e={};function n(r){if(e[r])return e[r].exports;var o=e[r]={i:r,l:!1,exports:{}};return t[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)n.d(r,o,function(e){return t[e]}.bind(null,o));return r},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=3)}([function(e,n){e.exports=t},function(t,e,n){"use strict";n.d(e,"a",(function(){return h}));var r=n(2),o=n.n(r),i=n(0);function c(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function u(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function s(t){return(s="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function f(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function l(t,e){return(l=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t})(t,e)}function a(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,r=d(t);if(e){var o=d(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return p(this,n)}}function p(t,e){if(e&&("object"===s(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}function d(t){return(d=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var h=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&l(t,e)}(p,t);var e,n,r,i=a(p);function p(t){var e;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,p),(e=i.call(this,t)).defaultTag="div",e.tag=t.tag||e.defaultTag,e.listeningEvents=[],e.element=null,e.editor=null,e.config={immediateReactModelUpdate:!1,reactIgnoreAttrs:null},e.editorInitialized=!1,e.SPECIAL_TAGS=["img","button","input","a"],e.INNER_HTML_ATTR="innerHTML",e.hasSpecialTag=!1,e.oldModel=null,e}return e=p,(n=[{key:"componentDidMount",value:function(){var t=this.el.tagName.toLowerCase();-1!=this.SPECIAL_TAGS.indexOf(t)&&(this.tag=t,this.hasSpecialTag=!0),this.props.onManualControllerReady?this.generateManualController():this.createEditor()}},{key:"componentWillUnmount",value:function(){this.destroyEditor()}},{key:"componentDidUpdate",value:function(){JSON.stringify(this.oldModel)!=JSON.stringify(this.props.model)&&this.setContent()}},{key:"clone",value:function(t){var e,n=this;if(!t)return t;if([Number,String,Boolean].forEach((function(n){t instanceof n&&(e=n(t))})),void 0===e)if("[object Array]"===Object.prototype.toString.call(t))e=[],t.forEach((function(t,r,o){e[r]=n.clone(t)}));else if("object"==s(t))if(t.nodeType&&"function"==typeof t.cloneNode)e=t.cloneNode(!0);else if(t.prototype)e=t;else if(t instanceof Date)e=new Date(t);else for(var r in e={},t)e[r]=n.clone(t[r]);else e=t;return e}},{key:"createEditor",value:function(){var t=this;this.editorInitialized||(this.config=this.clone(this.props.config||this.config),this.config=function(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?c(Object(n),!0).forEach((function(e){u(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):c(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}({},this.config),this.element=this.el,this.setContent(!0),this.registerEvent("initialized",this.config.events&&this.config.events.initialized),this.config.events||(this.config.events={}),this.config.events.initialized=function(){return t.initListeners()},this.editor=new o.a(this.element,this.config))}},{key:"setContent",value:function(t){(this.props.model||""==this.props.model)&&(this.oldModel=this.props.model,this.hasSpecialTag?this.setSpecialTagContent():this.setNormalTagContent(t))}},{key:"setNormalTagContent",value:function(t){var e=this,n=this;function r(){n.editor.html&&n.editor.html.set(n.props.model||""),n.editorInitialized&&n.editor.undo&&(n.props.skipReset||n.editor.undo.reset(),n.editor.undo.saveStep())}t?this.config.initOnClick?(this.registerEvent("initializationDelayed",(function(){r()})),this.registerEvent("initialized",(function(){e.editorInitialized=!0}))):this.registerEvent("initialized",(function(){e.editorInitialized=!0,r()})):r()}},{key:"setSpecialTagContent",value:function(){var t=this.props.model;if(t){for(var e in t)t.hasOwnProperty(e)&&e!=this.INNER_HTML_ATTR&&this.element.setAttribute(e,t[e]);t.hasOwnProperty(this.INNER_HTML_ATTR)&&(this.element.innerHTML=t[this.INNER_HTML_ATTR])}}},{key:"destroyEditor",value:function(){this.element&&(this.editor.destroy&&this.editor.destroy(),this.listeningEvents.length=0,this.element=null,this.editorInitialized=!1)}},{key:"getEditor",value:function(){return this.element?this.editor:null}},{key:"generateManualController",value:function(){var t=this,e={initialize:function(){return t.createEditor.call(t)},destroy:function(){return t.destroyEditor.call(t)},getEditor:function(){return t.getEditor.call(t)}};this.props.onManualControllerReady(e)}},{key:"updateModel",value:function(){if(this.props.onModelChange){var t="";if(this.hasSpecialTag){for(var e=this.element.attributes,n={},r=0;r<e.length;r++){var o=e[r].name;this.config.reactIgnoreAttrs&&-1!=this.config.reactIgnoreAttrs.indexOf(o)||(n[o]=e[r].value)}this.element.innerHTML&&(n[this.INNER_HTML_ATTR]=this.element.innerHTML),t=n}else{var i=this.editor.html.get();"string"==typeof i&&(t=i)}this.oldModel=t,this.props.onModelChange(t)}}},{key:"initListeners",value:function(){var t=this;if(this.editor.events.on("contentChanged",(function(){t.updateModel()})),this.config.immediateReactModelUpdate&&this.editor.events.on("keyup",(function(){t.updateModel()})),this._initEvents)for(var e=0;e<this._initEvents.length;e++)this._initEvents[e].call(this.editor)}},{key:"registerEvent",value:function(t,e){t&&e&&("initialized"==t?(this._initEvents||(this._initEvents=[]),this._initEvents.push(e)):(this.config.events||(this.config.events={}),this.config.events[t]=e))}}])&&f(e.prototype,n),r&&f(e,r),Object.defineProperty(e,"prototype",{writable:!1}),p}(n.n(i).a.Component)},function(t,n){t.exports=e},function(t,e,n){t.exports=n(4)},function(t,e,n){"use strict";n.r(e),n.d(e,"default",(function(){return d}));var r=n(1),o=n(0),i=n.n(o);function c(t){return(c="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function u(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function s(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function f(t,e){return(f=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t})(t,e)}function l(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,r=p(t);if(e){var o=p(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return a(this,n)}}function a(t,e){if(e&&("object"===c(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}function p(t){return(p=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var d=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&f(t,e)}(c,t);var e,n,r,o=l(c);function c(){return u(this,c),o.apply(this,arguments)}return e=c,(n=[{key:"render",value:function(){var t=this;return i.a.createElement(this.tag,{ref:function(e){return t.el=e}},this.props.children)}}])&&s(e.prototype,n),r&&s(e,r),Object.defineProperty(e,"prototype",{writable:!1}),c}(r.a)}])})); | ||
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("react"),require("froala-editor")):"function"==typeof define&&define.amd?define(["react","froala-editor"],e):"object"==typeof exports?exports.index=e(require("react"),require("froala-editor")):t.index=e(t.React,t["froala-editor"])}(window,(function(t,e){return function(t){var e={};function n(r){if(e[r])return e[r].exports;var o=e[r]={i:r,l:!1,exports:{}};return t[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)n.d(r,o,function(e){return t[e]}.bind(null,o));return r},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=3)}([function(e,n){e.exports=t},function(t,e,n){"use strict";n.d(e,"a",(function(){return h}));var r=n(2),o=n.n(r),i=n(0);function c(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function u(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function s(t){return(s="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function a(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function l(t,e){return(l=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t})(t,e)}function f(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,r=d(t);if(e){var o=d(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return p(this,n)}}function p(t,e){if(e&&("object"===s(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}function d(t){return(d=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var h=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&l(t,e)}(p,t);var e,n,r,i=f(p);function p(t){var e;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,p),(e=i.call(this,t)).defaultTag="div",e.tag=t.tag||e.defaultTag,e.listeningEvents=[],e.element=null,e.editor=null,e.config={immediateReactModelUpdate:!1,reactIgnoreAttrs:null},e.editorInitialized=!1,e.SPECIAL_TAGS=["img","button","input","a"],e.INNER_HTML_ATTR="innerHTML",e.hasSpecialTag=!1,e.oldModel=null,e}return e=p,(n=[{key:"componentDidMount",value:function(){var t=this.el.tagName.toLowerCase();-1!=this.SPECIAL_TAGS.indexOf(t)&&(this.tag=t,this.hasSpecialTag=!0),this.props.onManualControllerReady?this.generateManualController():this.createEditor()}},{key:"componentWillUnmount",value:function(){this.destroyEditor()}},{key:"componentDidUpdate",value:function(){JSON.stringify(this.oldModel)!=JSON.stringify(this.props.model)&&this.setContent()}},{key:"clone",value:function(t){var e,n=this;if(!t)return t;if([Number,String,Boolean].forEach((function(n){t instanceof n&&(e=n(t))})),void 0===e)if("[object Array]"===Object.prototype.toString.call(t))e=[],t.forEach((function(t,r,o){e[r]=n.clone(t)}));else if("object"==s(t))if(t.nodeType&&"function"==typeof t.cloneNode)e=t.cloneNode(!0);else if(t.prototype)e=t;else if(t instanceof Date)e=new Date(t);else for(var r in e={},t)e[r]=n.clone(t[r]);else e=t;return e}},{key:"createEditor",value:function(){var t=this;this.editorInitialized||(this.config=this.clone(this.props.config||this.config),this.config=function(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?c(Object(n),!0).forEach((function(e){u(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):c(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}({},this.config),this.element=this.el,this.setContent(!0),this.registerEvent("initialized",this.config.events&&this.config.events.initialized),this.config.events||(this.config.events={}),this.config.events.initialized=function(){return t.initListeners()},this.editor=new o.a(this.element,this.config))}},{key:"setContent",value:function(t){(this.props.model||""==this.props.model)&&(this.oldModel=this.props.model,this.hasSpecialTag?this.setSpecialTagContent():this.setNormalTagContent(t))}},{key:"setNormalTagContent",value:function(t){var e=this,n=this;function r(){n.editor.html&&n.editor.html.set(n.props.model||""),n.editorInitialized&&n.editor.undo&&(n.props.skipReset||n.editor.undo.reset(),n.editor.undo.saveStep())}t?this.config.initOnClick?(this.registerEvent("initializationDelayed",(function(){r()})),this.registerEvent("initialized",(function(){e.editorInitialized=!0}))):this.registerEvent("initialized",(function(){e.editorInitialized=!0,r()})):r()}},{key:"setSpecialTagContent",value:function(){var t=this.props.model;if(t){for(var e in t)t.hasOwnProperty(e)&&e!=this.INNER_HTML_ATTR&&this.element.setAttribute(e,t[e]);t.hasOwnProperty(this.INNER_HTML_ATTR)&&(this.element.innerHTML=t[this.INNER_HTML_ATTR])}}},{key:"destroyEditor",value:function(){if(this.element){this.editor.destroy&&this.editor.destroy(),this.listeningEvents.length=0,this.element=null,this.editorInitialized=!1,this.config={immediateReactModelUpdate:!1,reactIgnoreAttrs:null};var t=this.el.tagName.toLowerCase();-1==this.SPECIAL_TAGS.indexOf(t)&&this.editor&&this.editor.destrying&&!this.props.onManualControllerReady&&"textarea"==this.tag&&this.editor.$box.remove(),"textarea"!=this.tag&&(this.editor.$wp="")}}},{key:"getEditor",value:function(){return this.element?this.editor:null}},{key:"generateManualController",value:function(){var t=this,e={initialize:function(){return t.createEditor.call(t)},destroy:function(){return t.destroyEditor.call(t)},getEditor:function(){return t.getEditor.call(t)}};this.props.onManualControllerReady(e)}},{key:"updateModel",value:function(){if(this.props.onModelChange){var t="";if(this.hasSpecialTag){for(var e=this.element.attributes,n={},r=0;r<e.length;r++){var o=e[r].name;this.config.reactIgnoreAttrs&&-1!=this.config.reactIgnoreAttrs.indexOf(o)||(n[o]=e[r].value)}this.element.innerHTML&&(n[this.INNER_HTML_ATTR]=this.element.innerHTML),t=n}else{var i=this.editor.html.get();"string"==typeof i&&(t=i)}this.oldModel=t,this.props.onModelChange(t)}}},{key:"initListeners",value:function(){var t=this;if(this.editor&&this.editor.events&&this.editor.events.on("contentChanged",(function(){t.updateModel()})),this.config.immediateReactModelUpdate&&this.editor.events.on("keyup",(function(){t.updateModel()})),this._initEvents)for(var e=0;e<this._initEvents.length;e++)this._initEvents[e].call(this.editor)}},{key:"registerEvent",value:function(t,e){t&&e&&("initialized"==t?(this._initEvents||(this._initEvents=[]),this._initEvents.push(e)):(this.config.events||(this.config.events={}),this.config.events[t]=e))}}])&&a(e.prototype,n),r&&a(e,r),Object.defineProperty(e,"prototype",{writable:!1}),p}(n.n(i).a.Component)},function(t,n){t.exports=e},function(t,e,n){t.exports=n(4)},function(t,e,n){"use strict";n.r(e),n.d(e,"default",(function(){return d}));var r=n(1),o=n(0),i=n.n(o);function c(t){return(c="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function u(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function s(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function a(t,e){return(a=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t})(t,e)}function l(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,r=p(t);if(e){var o=p(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return f(this,n)}}function f(t,e){if(e&&("object"===c(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}function p(t){return(p=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var d=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&a(t,e)}(c,t);var e,n,r,o=l(c);function c(){return u(this,c),o.apply(this,arguments)}return e=c,(n=[{key:"render",value:function(){var t=this;return i.a.createElement(this.tag,{ref:function(e){return t.el=e}},this.props.children)}}])&&s(e.prototype,n),r&&s(e,r),Object.defineProperty(e,"prototype",{writable:!1}),c}(r.a)}])})); |
@@ -1,1 +0,1 @@ | ||
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("react"),require("froala-editor")):"function"==typeof define&&define.amd?define(["react","froala-editor"],e):"object"==typeof exports?exports.index=e(require("react"),require("froala-editor")):t.index=e(t.React,t["froala-editor"])}(window,(function(t,e){return function(t){var e={};function n(r){if(e[r])return e[r].exports;var o=e[r]={i:r,l:!1,exports:{}};return t[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)n.d(r,o,function(e){return t[e]}.bind(null,o));return r},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=3)}([function(e,n){e.exports=t},function(t,e,n){"use strict";n.d(e,"a",(function(){return h}));var r=n(2),o=n.n(r),i=n(0);function c(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function u(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function s(t){return(s="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function f(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function l(t,e){return(l=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t})(t,e)}function a(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,r=d(t);if(e){var o=d(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return p(this,n)}}function p(t,e){if(e&&("object"===s(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}function d(t){return(d=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var h=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&l(t,e)}(p,t);var e,n,r,i=a(p);function p(t){var e;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,p),(e=i.call(this,t)).defaultTag="div",e.tag=t.tag||e.defaultTag,e.listeningEvents=[],e.element=null,e.editor=null,e.config={immediateReactModelUpdate:!1,reactIgnoreAttrs:null},e.editorInitialized=!1,e.SPECIAL_TAGS=["img","button","input","a"],e.INNER_HTML_ATTR="innerHTML",e.hasSpecialTag=!1,e.oldModel=null,e}return e=p,(n=[{key:"componentDidMount",value:function(){var t=this.el.tagName.toLowerCase();-1!=this.SPECIAL_TAGS.indexOf(t)&&(this.tag=t,this.hasSpecialTag=!0),this.props.onManualControllerReady?this.generateManualController():this.createEditor()}},{key:"componentWillUnmount",value:function(){this.destroyEditor()}},{key:"componentDidUpdate",value:function(){JSON.stringify(this.oldModel)!=JSON.stringify(this.props.model)&&this.setContent()}},{key:"clone",value:function(t){var e,n=this;if(!t)return t;if([Number,String,Boolean].forEach((function(n){t instanceof n&&(e=n(t))})),void 0===e)if("[object Array]"===Object.prototype.toString.call(t))e=[],t.forEach((function(t,r,o){e[r]=n.clone(t)}));else if("object"==s(t))if(t.nodeType&&"function"==typeof t.cloneNode)e=t.cloneNode(!0);else if(t.prototype)e=t;else if(t instanceof Date)e=new Date(t);else for(var r in e={},t)e[r]=n.clone(t[r]);else e=t;return e}},{key:"createEditor",value:function(){var t=this;this.editorInitialized||(this.config=this.clone(this.props.config||this.config),this.config=function(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?c(Object(n),!0).forEach((function(e){u(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):c(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}({},this.config),this.element=this.el,this.setContent(!0),this.registerEvent("initialized",this.config.events&&this.config.events.initialized),this.config.events||(this.config.events={}),this.config.events.initialized=function(){return t.initListeners()},this.editor=new o.a(this.element,this.config))}},{key:"setContent",value:function(t){(this.props.model||""==this.props.model)&&(this.oldModel=this.props.model,this.hasSpecialTag?this.setSpecialTagContent():this.setNormalTagContent(t))}},{key:"setNormalTagContent",value:function(t){var e=this,n=this;function r(){n.editor.html&&n.editor.html.set(n.props.model||""),n.editorInitialized&&n.editor.undo&&(n.props.skipReset||n.editor.undo.reset(),n.editor.undo.saveStep())}t?this.config.initOnClick?(this.registerEvent("initializationDelayed",(function(){r()})),this.registerEvent("initialized",(function(){e.editorInitialized=!0}))):this.registerEvent("initialized",(function(){e.editorInitialized=!0,r()})):r()}},{key:"setSpecialTagContent",value:function(){var t=this.props.model;if(t){for(var e in t)t.hasOwnProperty(e)&&e!=this.INNER_HTML_ATTR&&this.element.setAttribute(e,t[e]);t.hasOwnProperty(this.INNER_HTML_ATTR)&&(this.element.innerHTML=t[this.INNER_HTML_ATTR])}}},{key:"destroyEditor",value:function(){this.element&&(this.editor.destroy&&this.editor.destroy(),this.listeningEvents.length=0,this.element=null,this.editorInitialized=!1)}},{key:"getEditor",value:function(){return this.element?this.editor:null}},{key:"generateManualController",value:function(){var t=this,e={initialize:function(){return t.createEditor.call(t)},destroy:function(){return t.destroyEditor.call(t)},getEditor:function(){return t.getEditor.call(t)}};this.props.onManualControllerReady(e)}},{key:"updateModel",value:function(){if(this.props.onModelChange){var t="";if(this.hasSpecialTag){for(var e=this.element.attributes,n={},r=0;r<e.length;r++){var o=e[r].name;this.config.reactIgnoreAttrs&&-1!=this.config.reactIgnoreAttrs.indexOf(o)||(n[o]=e[r].value)}this.element.innerHTML&&(n[this.INNER_HTML_ATTR]=this.element.innerHTML),t=n}else{var i=this.editor.html.get();"string"==typeof i&&(t=i)}this.oldModel=t,this.props.onModelChange(t)}}},{key:"initListeners",value:function(){var t=this;if(this.editor.events.on("contentChanged",(function(){t.updateModel()})),this.config.immediateReactModelUpdate&&this.editor.events.on("keyup",(function(){t.updateModel()})),this._initEvents)for(var e=0;e<this._initEvents.length;e++)this._initEvents[e].call(this.editor)}},{key:"registerEvent",value:function(t,e){t&&e&&("initialized"==t?(this._initEvents||(this._initEvents=[]),this._initEvents.push(e)):(this.config.events||(this.config.events={}),this.config.events[t]=e))}}])&&f(e.prototype,n),r&&f(e,r),Object.defineProperty(e,"prototype",{writable:!1}),p}(n.n(i).a.Component)},function(t,n){t.exports=e},function(t,e,n){t.exports=n(4)},function(t,e,n){"use strict";n.r(e),n.d(e,"default",(function(){return d}));var r=n(1),o=n(0),i=n.n(o);function c(t){return(c="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function u(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function s(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function f(t,e){return(f=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t})(t,e)}function l(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,r=p(t);if(e){var o=p(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return a(this,n)}}function a(t,e){if(e&&("object"===c(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}function p(t){return(p=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var d=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&f(t,e)}(c,t);var e,n,r,o=l(c);function c(){return u(this,c),o.apply(this,arguments)}return e=c,(n=[{key:"render",value:function(){var t=this;return i.a.createElement(this.tag,{ref:function(e){return t.el=e}},this.props.children)}}])&&s(e.prototype,n),r&&s(e,r),Object.defineProperty(e,"prototype",{writable:!1}),c}(r.a)}])})); | ||
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("react"),require("froala-editor")):"function"==typeof define&&define.amd?define(["react","froala-editor"],e):"object"==typeof exports?exports.index=e(require("react"),require("froala-editor")):t.index=e(t.React,t["froala-editor"])}(window,(function(t,e){return function(t){var e={};function n(r){if(e[r])return e[r].exports;var o=e[r]={i:r,l:!1,exports:{}};return t[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)n.d(r,o,function(e){return t[e]}.bind(null,o));return r},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=3)}([function(e,n){e.exports=t},function(t,e,n){"use strict";n.d(e,"a",(function(){return h}));var r=n(2),o=n.n(r),i=n(0);function c(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function u(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function s(t){return(s="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function a(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function l(t,e){return(l=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t})(t,e)}function f(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,r=d(t);if(e){var o=d(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return p(this,n)}}function p(t,e){if(e&&("object"===s(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}function d(t){return(d=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var h=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&l(t,e)}(p,t);var e,n,r,i=f(p);function p(t){var e;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,p),(e=i.call(this,t)).defaultTag="div",e.tag=t.tag||e.defaultTag,e.listeningEvents=[],e.element=null,e.editor=null,e.config={immediateReactModelUpdate:!1,reactIgnoreAttrs:null},e.editorInitialized=!1,e.SPECIAL_TAGS=["img","button","input","a"],e.INNER_HTML_ATTR="innerHTML",e.hasSpecialTag=!1,e.oldModel=null,e}return e=p,(n=[{key:"componentDidMount",value:function(){var t=this.el.tagName.toLowerCase();-1!=this.SPECIAL_TAGS.indexOf(t)&&(this.tag=t,this.hasSpecialTag=!0),this.props.onManualControllerReady?this.generateManualController():this.createEditor()}},{key:"componentWillUnmount",value:function(){this.destroyEditor()}},{key:"componentDidUpdate",value:function(){JSON.stringify(this.oldModel)!=JSON.stringify(this.props.model)&&this.setContent()}},{key:"clone",value:function(t){var e,n=this;if(!t)return t;if([Number,String,Boolean].forEach((function(n){t instanceof n&&(e=n(t))})),void 0===e)if("[object Array]"===Object.prototype.toString.call(t))e=[],t.forEach((function(t,r,o){e[r]=n.clone(t)}));else if("object"==s(t))if(t.nodeType&&"function"==typeof t.cloneNode)e=t.cloneNode(!0);else if(t.prototype)e=t;else if(t instanceof Date)e=new Date(t);else for(var r in e={},t)e[r]=n.clone(t[r]);else e=t;return e}},{key:"createEditor",value:function(){var t=this;this.editorInitialized||(this.config=this.clone(this.props.config||this.config),this.config=function(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?c(Object(n),!0).forEach((function(e){u(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):c(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}({},this.config),this.element=this.el,this.setContent(!0),this.registerEvent("initialized",this.config.events&&this.config.events.initialized),this.config.events||(this.config.events={}),this.config.events.initialized=function(){return t.initListeners()},this.editor=new o.a(this.element,this.config))}},{key:"setContent",value:function(t){(this.props.model||""==this.props.model)&&(this.oldModel=this.props.model,this.hasSpecialTag?this.setSpecialTagContent():this.setNormalTagContent(t))}},{key:"setNormalTagContent",value:function(t){var e=this,n=this;function r(){n.editor.html&&n.editor.html.set(n.props.model||""),n.editorInitialized&&n.editor.undo&&(n.props.skipReset||n.editor.undo.reset(),n.editor.undo.saveStep())}t?this.config.initOnClick?(this.registerEvent("initializationDelayed",(function(){r()})),this.registerEvent("initialized",(function(){e.editorInitialized=!0}))):this.registerEvent("initialized",(function(){e.editorInitialized=!0,r()})):r()}},{key:"setSpecialTagContent",value:function(){var t=this.props.model;if(t){for(var e in t)t.hasOwnProperty(e)&&e!=this.INNER_HTML_ATTR&&this.element.setAttribute(e,t[e]);t.hasOwnProperty(this.INNER_HTML_ATTR)&&(this.element.innerHTML=t[this.INNER_HTML_ATTR])}}},{key:"destroyEditor",value:function(){if(this.element){this.editor.destroy&&this.editor.destroy(),this.listeningEvents.length=0,this.element=null,this.editorInitialized=!1,this.config={immediateReactModelUpdate:!1,reactIgnoreAttrs:null};var t=this.el.tagName.toLowerCase();-1==this.SPECIAL_TAGS.indexOf(t)&&this.editor&&this.editor.destrying&&!this.props.onManualControllerReady&&"textarea"==this.tag&&this.editor.$box.remove(),"textarea"!=this.tag&&(this.editor.$wp="")}}},{key:"getEditor",value:function(){return this.element?this.editor:null}},{key:"generateManualController",value:function(){var t=this,e={initialize:function(){return t.createEditor.call(t)},destroy:function(){return t.destroyEditor.call(t)},getEditor:function(){return t.getEditor.call(t)}};this.props.onManualControllerReady(e)}},{key:"updateModel",value:function(){if(this.props.onModelChange){var t="";if(this.hasSpecialTag){for(var e=this.element.attributes,n={},r=0;r<e.length;r++){var o=e[r].name;this.config.reactIgnoreAttrs&&-1!=this.config.reactIgnoreAttrs.indexOf(o)||(n[o]=e[r].value)}this.element.innerHTML&&(n[this.INNER_HTML_ATTR]=this.element.innerHTML),t=n}else{var i=this.editor.html.get();"string"==typeof i&&(t=i)}this.oldModel=t,this.props.onModelChange(t)}}},{key:"initListeners",value:function(){var t=this;if(this.editor&&this.editor.events&&this.editor.events.on("contentChanged",(function(){t.updateModel()})),this.config.immediateReactModelUpdate&&this.editor.events.on("keyup",(function(){t.updateModel()})),this._initEvents)for(var e=0;e<this._initEvents.length;e++)this._initEvents[e].call(this.editor)}},{key:"registerEvent",value:function(t,e){t&&e&&("initialized"==t?(this._initEvents||(this._initEvents=[]),this._initEvents.push(e)):(this.config.events||(this.config.events={}),this.config.events[t]=e))}}])&&a(e.prototype,n),r&&a(e,r),Object.defineProperty(e,"prototype",{writable:!1}),p}(n.n(i).a.Component)},function(t,n){t.exports=e},function(t,e,n){t.exports=n(4)},function(t,e,n){"use strict";n.r(e),n.d(e,"default",(function(){return d}));var r=n(1),o=n(0),i=n.n(o);function c(t){return(c="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function u(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function s(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function a(t,e){return(a=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t})(t,e)}function l(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,r=p(t);if(e){var o=p(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return f(this,n)}}function f(t,e){if(e&&("object"===c(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}function p(t){return(p=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var d=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&a(t,e)}(c,t);var e,n,r,o=l(c);function c(){return u(this,c),o.apply(this,arguments)}return e=c,(n=[{key:"render",value:function(){var t=this;return i.a.createElement(this.tag,{ref:function(e){return t.el=e}},this.props.children)}}])&&s(e.prototype,n),r&&s(e,r),Object.defineProperty(e,"prototype",{writable:!1}),c}(r.a)}])})); |
@@ -203,2 +203,15 @@ import FroalaEditor from 'froala-editor'; | ||
this.editorInitialized = false; | ||
this.config = { | ||
immediateReactModelUpdate: false, | ||
reactIgnoreAttrs: null | ||
}; | ||
let tagName = this.el.tagName.toLowerCase(); | ||
if (this.SPECIAL_TAGS.indexOf(tagName) == -1) { | ||
if(this.editor && this.editor.destrying && !this.props.onManualControllerReady && this.tag == 'textarea'){ | ||
this.editor.$box.remove() | ||
} | ||
} | ||
if(this.tag != 'textarea'){ | ||
this.editor.$wp = ''; | ||
} | ||
} | ||
@@ -266,5 +279,8 @@ } | ||
// bind contentChange and keyup event to froalaModel | ||
this.editor.events.on('contentChanged', function () { | ||
self.updateModel(); | ||
}); | ||
if(this.editor && this.editor.events){ | ||
this.editor.events.on('contentChanged', function () { | ||
self.updateModel(); | ||
}); | ||
} | ||
if (this.config.immediateReactModelUpdate) { | ||
@@ -271,0 +287,0 @@ this.editor.events.on('keyup', function () { |
{ | ||
"name": "react-froala-wysiwyg", | ||
"version": "4.0.19", | ||
"version": "4.1.0", | ||
"description": "React component for Froala WYSIWYG HTML rich text editor.", | ||
@@ -26,3 +26,3 @@ "main": "index.js", | ||
"create-react-class": "^15.5.2", | ||
"froala-editor": "4.0.19" | ||
"froala-editor": "4.1.0" | ||
}, | ||
@@ -29,0 +29,0 @@ "devDependencies": { |
458
Readme.md
@@ -19,4 +19,8 @@ # React JS Froala WYSIWYG Editor | ||
``` | ||
## Install font-awesome | ||
```bash | ||
npm install font-awesome --save | ||
``` | ||
## Usage | ||
## Usage with Class Component | ||
@@ -69,100 +73,5 @@ #### 1. Require and use Froala Editor component inside your application. | ||
``` | ||
<div id="editor"> | ||
<div id="editor"> | ||
</div> | ||
``` | ||
#### 2. Make sure you have the right Webpack settings for loading the CSS files. | ||
#### Webpack <= 3 | ||
```js | ||
var webpack = require("webpack"); | ||
module.exports = { | ||
module: { | ||
loaders: [ | ||
{ | ||
test: /\.jsx$/, | ||
loader: 'babel', | ||
query: { | ||
cacheDirectory: true, | ||
presets: ['react','es2015', 'stage-2'] | ||
} | ||
}, { | ||
test: /\.css$/, | ||
loader: "style-loader!css-loader?root=." | ||
}, | ||
{ | ||
test: /\.woff(\?v=\d+\.\d+\.\d+)?$/, | ||
loader: "url?limit=10000&mimetype=application/font-woff" | ||
}, { | ||
test: /\.woff2(\?v=\d+\.\d+\.\d+)?$/, | ||
loader: "url?limit=10000&mimetype=application/font-woff" | ||
}, { | ||
test: /\.ttf(\?v=\d+\.\d+\.\d+)?$/, | ||
loader: "url?limit=10000&mimetype=application/octet-stream" | ||
}, { | ||
test: /\.eot(\?v=\d+\.\d+\.\d+)?$/, | ||
loader: "file" | ||
}, { | ||
test: /\.svg(\?v=\d+\.\d+\.\d+)?$/, | ||
loader: "url?limit=10000&mimetype=image/svg+xml" | ||
} | ||
] | ||
}, | ||
resolve: { | ||
modulesDirectories: ['node_modules'] | ||
} | ||
}; | ||
``` | ||
#### Webpack 4 | ||
```js | ||
var webpack = require("webpack"); | ||
module.exports = { | ||
module: { | ||
rules: [ | ||
{ | ||
test: /\.jsx$/, | ||
use: { | ||
loader: 'babel-loader', | ||
options: { | ||
cacheDirectory: true, | ||
presets: ['react','es2015', 'stage-2'] | ||
} | ||
} | ||
}, { | ||
test: /\.css$/, | ||
use: [ | ||
'style-loader', | ||
'css-loader' | ||
] | ||
}, | ||
{ | ||
test: /\.woff(\?v=\d+\.\d+\.\d+)?$/, | ||
use: "url-loader?limit=10000&mimetype=application/font-woff" | ||
}, { | ||
test: /\.woff2(\?v=\d+\.\d+\.\d+)?$/, | ||
use: "url-loader?limit=10000&mimetype=application/font-woff" | ||
}, { | ||
test: /\.ttf(\?v=\d+\.\d+\.\d+)?$/, | ||
use: "url-loader?limit=10000&mimetype=application/octet-stream" | ||
}, { | ||
test: /\.eot(\?v=\d+\.\d+\.\d+)?$/, | ||
use: "file-loader" | ||
}, { | ||
test: /\.svg(\?v=\d+\.\d+\.\d+)?$/, | ||
use: "url-loader?limit=10000&mimetype=image/svg+xml" | ||
} | ||
] | ||
}, | ||
resolve: { | ||
modules: ['node_modules'] | ||
} | ||
}; | ||
``` | ||
#### Pass properties to the wrapping DOM element | ||
@@ -221,51 +130,3 @@ | ||
### Custom Buttons | ||
You can pass the custom buttons to the editor by following way: | ||
```javascript | ||
<script> | ||
import Froalaeditor from 'froala-editor'; | ||
Froalaeditor.DefineIcon('alert', {NAME: 'info', SVG_KEY: 'help'}); | ||
Froalaeditor.RegisterCommand('alert', { | ||
title: 'Hello', | ||
focus: false, | ||
undo: false, | ||
refreshAfterCallback: false, | ||
callback: function () { | ||
alert('Hello!'); | ||
} | ||
}); | ||
Froalaeditor.DefineIcon('clear', {NAME: 'remove', SVG_KEY: 'remove'}); | ||
Froalaeditor.RegisterCommand('clear', { | ||
title: 'Clear HTML', | ||
focus: false, | ||
undo: true, | ||
refreshAfterCallback: true, | ||
callback: function () { | ||
this.html.set(''); | ||
this.events.focus(); | ||
} | ||
}); | ||
Froalaeditor.DefineIcon('insert', {NAME: 'plus', SVG_KEY: 'add'}); | ||
Froalaeditor.RegisterCommand('insert', { | ||
title: 'Insert HTML', | ||
focus: true, | ||
undo: true, | ||
refreshAfterCallback: true, | ||
callback: function () { | ||
this.html.insert('My New HTML'); | ||
} | ||
}); | ||
</script> | ||
``` | ||
Now you can use these buttons in options: | ||
```javascript | ||
toolbarButtons: [['undo', 'redo' , 'bold'], ['alert', 'clear', 'insert']], | ||
``` | ||
### Model | ||
@@ -301,5 +162,5 @@ | ||
return <FroalaEditor | ||
model={this.state.model} | ||
onModelChange={this.handleModelChange} | ||
/> | ||
model={this.state.model} | ||
onModelChange={this.handleModelChange} | ||
/> | ||
} | ||
@@ -358,12 +219,2 @@ } | ||
#### Specific option for special tags | ||
* **reactIgnoreAttrs**: (default: null) This option is an array of attributes that you want to ignore when the editor updates the froalaModel: | ||
```js | ||
config: { | ||
reactIgnoreAttrs: ['class', 'id'] | ||
}, | ||
``` | ||
## Manual Instantiation | ||
@@ -380,3 +231,2 @@ | ||
``` | ||
The object received by the function will contain the following methods: | ||
@@ -388,9 +238,2 @@ | ||
## Using type definition file | ||
`index.d.ts` file is the type definition file for this repository. It is placed inside lib folder.In order to use it in your code , use the following line: | ||
``` | ||
///<reference path= "index.d.ts" /> | ||
``` | ||
where path is the location of index.d.ts file. | ||
## Displaying HTML | ||
@@ -411,2 +254,285 @@ | ||
## Usage with Functional Component | ||
#### 1. Require and use Froala Editor component inside your application. | ||
```jsx | ||
import React from 'react'; | ||
import ReactDOM from 'react-dom'; | ||
// Require Editor CSS files. | ||
import 'froala-editor/css/froala_style.min.css'; | ||
import 'froala-editor/css/froala_editor.pkgd.min.css'; | ||
import FroalaEditorComponent from 'react-froala-wysiwyg'; | ||
// Import all Froala Editor plugins; | ||
// import 'froala-editor/js/plugins.pkgd.min.js'; | ||
// Import a single Froala Editor plugin. | ||
// import 'froala-editor/js/plugins/align.min.js'; | ||
// Import a language file. | ||
// import 'froala-editor/js/languages/de.js'; | ||
// Import a third-party plugin. | ||
// import 'froala-editor/js/third_party/image_tui.min.js'; | ||
// import 'froala-editor/js/third_party/embedly.min.js'; | ||
// import 'froala-editor/js/third_party/spell_checker.min.js'; | ||
// Include font-awesome css if required. | ||
// install using "npm install font-awesome --save" | ||
// import 'font-awesome/css/font-awesome.css'; | ||
// import 'froala-editor/js/third_party/font_awesome.min.js'; | ||
// Include special components if required. | ||
// import FroalaEditorView from 'react-froala-wysiwyg/FroalaEditorView'; | ||
// import FroalaEditorA from 'react-froala-wysiwyg/FroalaEditorA'; | ||
// import FroalaEditorButton from 'react-froala-wysiwyg/FroalaEditorButton'; | ||
// import FroalaEditorImg from 'react-froala-wysiwyg/FroalaEditorImg'; | ||
// import FroalaEditorInput from 'react-froala-wysiwyg/FroalaEditorInput'; | ||
// Render Froala Editor component. | ||
const root = ReactDOM.createRoot(document.getElementById('editor')); | ||
root.render( | ||
<FroalaEditorComponent tag='textarea'/> | ||
) | ||
``` | ||
#### Add editor to UI by passing id to html element | ||
``` | ||
<div id="editor"> | ||
</div> | ||
``` | ||
#### Pass properties to the wrapping DOM element | ||
```js | ||
<FroalaEditor | ||
tag='textarea' | ||
config={config} | ||
model={model} | ||
onModelChange={handleModelChange} | ||
/> | ||
``` | ||
**tag** attr is used to tell on which tag the editor is initialized. | ||
There are special tags: **a**, **button**, **img**, **input**. Do not use them in FroalaEditor component. To initialize the editor on a special tag, use `FroalaEditorA`, `FroalaEditorButton`, `FroalaEditorImg` and `FroalaEditorInput` components. | ||
### Config | ||
You can pass editor options as component attribute (optional). | ||
`config={config}` | ||
You can pass any existing Froala option. Consult the [Froala documentation](https://www.froala.com/wysiwyg-editor/docs/options) to view the list of all the available options: | ||
```js | ||
config={{ | ||
placeholderText: 'Edit Your Content Here!', | ||
charCounterCount: false | ||
}} | ||
``` | ||
Aditional option is used: | ||
* **immediateReactModelUpdate**: (default: false) This option updates the React model as soon as a key is released in the editor. Note that it may affect performances. | ||
### Events and Methods | ||
Events can be passed in with the options, with a key events and object where the key is the event name and the value is the callback function. | ||
```js | ||
config={{ | ||
placeholder: "Edit Me", | ||
events : { | ||
'focus' : function(e, editor) { | ||
console.log(editor.selection.get()); | ||
} | ||
} | ||
}} | ||
``` | ||
Using the editor instance from the arguments of the callback you can call editor methods as described in the [method docs](http://froala.com/wysiwyg-editor/docs/methods). | ||
Froala events are described in the [events docs](https://froala.com/wysiwyg-editor/docs/events). | ||
Now you can use these buttons in options: | ||
```javascript | ||
toolbarButtons: [['undo', 'redo' , 'bold'], ['alert', 'clear', 'insert']], | ||
``` | ||
### Model | ||
The WYSIWYG HTML editor content model. | ||
`model = {model}` | ||
Two way binding: | ||
```jsx | ||
import React,{ useState } from 'react'; | ||
const App=()=> { | ||
const [model,setModel] = useState("Example Set"); | ||
const handleModelChange= (event)=>{ | ||
setModel(event) | ||
} | ||
return ( | ||
<div className="App"> | ||
<FroalaEditorComponent | ||
tag='textarea' | ||
onModelChange={handleModelChange} | ||
/> | ||
<FroalaEditorView | ||
model={model} | ||
/> | ||
</div> | ||
); | ||
} | ||
``` | ||
To achieve one way binding and pass only the initial editor content, simply do not pass `onModelChange` attribute. | ||
Use the content in other places: | ||
```js | ||
<input value={model}/> | ||
``` | ||
### Special tags | ||
You can also use the editor on **img**, **button**, **input** and **a** tags: | ||
```js | ||
<FroalaEditorImg | ||
model={model} | ||
/> | ||
<FroalaEditorButton | ||
model={model} | ||
/> | ||
<FroalaEditorInput | ||
model={model} | ||
/> | ||
<FroalaEditorA | ||
model={model} | ||
/> | ||
``` | ||
The model must be an object containing the attributes for your special tags. Example: | ||
```js | ||
model={{src: 'path/to/image.jpg', | ||
width:"300px", | ||
alt:"Old Clock" | ||
}} | ||
``` | ||
* The model can contain a special attribute named **innerHTML** which inserts innerHTML in the element: If you are using 'button' tag, you can specify the button text like this: | ||
```js | ||
model={{innerHTML: 'Click Me'}} | ||
``` | ||
As the button text is modified by the editor, the **innerHTML** attribute from buttonModel model will be modified too. | ||
## Manual Instantiation | ||
Gets the functionality to operate on the editor: create, destroy and get editor instance. Use it if you want to manually initialize the editor. | ||
`onManualControllerReady={handleManualController}` | ||
```js | ||
handleManualController =(initControls) =>{ | ||
//... | ||
} | ||
``` | ||
The object received by the function will contain the following methods: | ||
- **initialize**: Call this method to initialize the Froala Editor | ||
- **destroy**: Call this method to destroy the Froala Editor | ||
- **getEditor**: Call this method to retrieve the editor that was created. This method will return *null* if the editor was not yet created | ||
## Displaying HTML | ||
To display content created with the froala editor use the `FroalaEditorView` component. | ||
```js | ||
<FroalaEditor | ||
model={content} | ||
onModelChange={handleModelChange} | ||
/> | ||
<FroalaEditorView | ||
model={content} | ||
/> | ||
``` | ||
#### Specific option for special tags | ||
* **reactIgnoreAttrs**: (default: null) This option is an array of attributes that you want to ignore when the editor updates the froalaModel: | ||
```js | ||
config: { | ||
reactIgnoreAttrs: ['class', 'id'] | ||
}, | ||
``` | ||
## Using type definition file | ||
`index.d.ts` file is the type definition file for this repository. It is placed inside lib folder.In order to use it in your code , use the following line: | ||
``` | ||
///<reference path= "index.d.ts" /> | ||
``` | ||
where path is the location of index.d.ts file. | ||
### Custom Buttons | ||
You can pass the custom buttons to the editor by following way: | ||
```javascript | ||
<script> | ||
import Froalaeditor from 'froala-editor'; | ||
Froalaeditor.DefineIcon('alert', {NAME: 'info', SVG_KEY: 'help'}); | ||
Froalaeditor.RegisterCommand('alert', { | ||
title: 'Hello', | ||
focus: false, | ||
undo: false, | ||
refreshAfterCallback: false, | ||
callback: function () { | ||
alert('Hello!'); | ||
} | ||
}); | ||
Froalaeditor.DefineIcon('clear', {NAME: 'remove', SVG_KEY: 'remove'}); | ||
Froalaeditor.RegisterCommand('clear', { | ||
title: 'Clear HTML', | ||
focus: false, | ||
undo: true, | ||
refreshAfterCallback: true, | ||
callback: function () { | ||
this.html.set(''); | ||
this.events.focus(); | ||
} | ||
}); | ||
Froalaeditor.DefineIcon('insert', {NAME: 'plus', SVG_KEY: 'add'}); | ||
Froalaeditor.RegisterCommand('insert', { | ||
title: 'Insert HTML', | ||
focus: true, | ||
undo: true, | ||
refreshAfterCallback: true, | ||
callback: function () { | ||
this.html.insert('My New HTML'); | ||
} | ||
}); | ||
</script> | ||
``` | ||
Now you can use these buttons in options: | ||
```javascript | ||
toolbarButtons: [['undo', 'redo' , 'bold'], ['alert', 'clear', 'insert']], | ||
``` | ||
## License | ||
@@ -413,0 +539,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
179599
983
557
0
+ Addedfroala-editor@4.1.0(transitive)
- Removedfroala-editor@4.0.19(transitive)
Updatedfroala-editor@4.1.0