diff --git a/dist/ckeditor.js b/dist/ckeditor.js index c37f757..a46c447 100644 --- a/dist/ckeditor.js +++ b/dist/ckeditor.js @@ -2,5 +2,5 @@ * @license Copyright (c) 2003-2019, CKSource - Frederico Knabben. All rights reserved. * For licensing, see LICENSE.md. */ -!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.CKEditor=e():t.CKEditor=e()}(window,function(){return function(t){var e={};function n(i){if(e[i])return e[i].exports;var o=e[i]={i:i,l:!1,exports:{}};return t[i].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=t,n.c=e,n.d=function(t,e,i){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:i})},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 i=Object.create(null);if(n.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)n.d(i,o,function(e){return t[e]}.bind(null,o));return i},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=0)}([function(t,e,n){"use strict";n.r(e);var i={name:"ckeditor",render(t){return t(this.tagName)},props:{editor:{type:Function,default:null},value:{type:String,default:""},config:{type:Object,default:()=>({})},tagName:{type:String,default:"div"},disabled:{type:Boolean,default:!1}},data:()=>({instance:null}),mounted(){this.editor.create(this.$el,this.config).then(t=>{this.instance=t,t.setData(this.value),t.isReadOnly=this.disabled,this.$_setUpEditorEvents(),this.$emit("ready",t)}).catch(t=>{console.error(t)})},beforeDestroy(){this.instance&&(this.instance.destroy(),this.instance=null),this.$emit("destroy",this.instance)},watch:{value(t){this.instance.getData()!==t&&this.instance.setData(t)},disabled(t){this.instance.isReadOnly=t}},methods:{$_setUpEditorEvents(){const t=this.instance;t.model.document.on("change:data",e=>{const n=t.getData();this.$emit("input",n,e,t)}),t.editing.view.document.on("focus",e=>{this.$emit("focus",e,t)}),t.editing.view.document.on("blur",e=>{this.$emit("blur",e,t)})}}};const o={install(t){t.component("ckeditor",i)},component:i};e.default=o}]).default}); +!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.CKEditor=e():t.CKEditor=e()}(window,function(){return function(t){var e={};function n(r){if(e[r])return e[r].exports;var i=e[r]={i:r,l:!1,exports:{}};return t[r].call(i.exports,i,i.exports,n),i.l=!0,i.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 i in t)n.d(r,i,function(e){return t[e]}.bind(null,i));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=2)}([function(t,e,n){"use strict";(function(t){var n="object"==typeof t&&t&&t.Object===Object&&t;e.a=n}).call(this,n(1))},function(t,e){var n;n=function(){return this}();try{n=n||new Function("return this")()}catch(t){"object"==typeof window&&(n=window)}t.exports=n},function(t,e,n){"use strict";n.r(e);var r=function(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)},i=n(0),o="object"==typeof self&&self&&self.Object===Object&&self,u=i.a||o||Function("return this")(),a=function(){return u.Date.now()},c=u.Symbol,f=Object.prototype,s=f.hasOwnProperty,l=f.toString,d=c?c.toStringTag:void 0;var p=function(t){var e=s.call(t,d),n=t[d];try{t[d]=void 0;var r=!0}catch(t){}var i=l.call(t);return r&&(e?t[d]=n:delete t[d]),i},v=Object.prototype.toString;var y=function(t){return v.call(t)},b="[object Null]",h="[object Undefined]",m=c?c.toStringTag:void 0;var g=function(t){return null==t?void 0===t?h:b:m&&m in Object(t)?p(t):y(t)};var j=function(t){return null!=t&&"object"==typeof t},O="[object Symbol]";var w=function(t){return"symbol"==typeof t||j(t)&&g(t)==O},x=NaN,$=/^\s+|\s+$/g,S=/^[-+]0x[0-9a-f]+$/i,E=/^0b[01]+$/i,_=/^0o[0-7]+$/i,T=parseInt;var D=function(t){if("number"==typeof t)return t;if(w(t))return x;if(r(t)){var e="function"==typeof t.valueOf?t.valueOf():t;t=r(e)?e+"":e}if("string"!=typeof t)return 0===t?t:+t;t=t.replace($,"");var n=E.test(t);return n||_.test(t)?T(t.slice(2),n?2:8):S.test(t)?x:+t},M="Expected a function",P=Math.max,N=Math.min;var F=function(t,e,n){var i,o,u,c,f,s,l=0,d=!1,p=!1,v=!0;if("function"!=typeof t)throw new TypeError(M);function y(e){var n=i,r=o;return i=o=void 0,l=e,c=t.apply(r,n)}function b(t){var n=t-s;return void 0===s||n>=e||n<0||p&&t-l>=u}function h(){var t=a();if(b(t))return m(t);f=setTimeout(h,function(t){var n=e-(t-s);return p?N(n,u-(t-l)):n}(t))}function m(t){return f=void 0,v&&i?y(t):(i=o=void 0,c)}function g(){var t=a(),n=b(t);if(i=arguments,o=this,s=t,n){if(void 0===f)return function(t){return l=t,f=setTimeout(h,e),d?y(t):c}(s);if(p)return f=setTimeout(h,e),y(s)}return void 0===f&&(f=setTimeout(h,e)),c}return e=D(e)||0,r(n)&&(d=!!n.leading,u=(p="maxWait"in n)?P(D(n.maxWait)||0,e):u,v="trailing"in n?!!n.trailing:v),g.cancel=function(){void 0!==f&&clearTimeout(f),l=0,i=s=o=f=void 0},g.flush=function(){return void 0===f?c:m(a())},g};var U={name:"ckeditor",render(t){return t(this.tagName)},props:{editor:{type:Function,default:null},value:{type:String,default:""},config:{type:Object,default:()=>({})},tagName:{type:String,default:"div"},disabled:{type:Boolean,default:!1}},data:()=>({instance:null,$_lastEditorData:{type:String,default:""}}),mounted(){this.editor.create(this.$el,this.config).then(t=>{this.instance=t,t.setData(this.value),t.isReadOnly=this.disabled,this.$_setUpEditorEvents(),this.$emit("ready",t)}).catch(t=>{console.error(t)})},beforeDestroy(){this.instance&&(this.instance.destroy(),this.instance=null),this.$emit("destroy",this.instance)},watch:{value(t,e){t!==e&&t!==this.$_lastEditorData&&this.instance.setData(t)},disabled(t){this.instance.isReadOnly=t}},methods:{$_setUpEditorEvents(){const t=this.instance;t.model.document.on("change:data",F(e=>{const n=this.$_lastEditorData=t.getData();this.$emit("input",n,e,t)},300)),t.editing.view.document.on("focus",e=>{this.$emit("focus",e,t)}),t.editing.view.document.on("blur",e=>{this.$emit("blur",e,t)})}}};const k={install(t){t.component("ckeditor",U)},component:U};e.default=k}]).default}); //# sourceMappingURL=ckeditor.js.map \ No newline at end of file diff --git a/dist/ckeditor.js.map b/dist/ckeditor.js.map index 6e3b502..7dbf557 100644 --- a/dist/ckeditor.js.map +++ b/dist/ckeditor.js.map @@ -1 +1 @@ -{"version":3,"sources":["webpack://CKEditor/webpack/universalModuleDefinition","webpack://CKEditor/webpack/bootstrap","webpack://CKEditor/./src/ckeditor.js","webpack://CKEditor/./src/plugin.js"],"names":["root","factory","exports","module","define","amd","window","installedModules","__webpack_require__","moduleId","i","l","modules","call","m","c","d","name","getter","o","Object","defineProperty","enumerable","get","r","Symbol","toStringTag","value","t","mode","__esModule","ns","create","key","bind","n","object","property","prototype","hasOwnProperty","p","s","ckeditor","render","createElement","this","tagName","props","editor","type","Function","default","String","config","disabled","Boolean","data","instance","mounted","$el","then","setData","isReadOnly","$_setUpEditorEvents","$emit","catch","error","console","beforeDestroy","destroy","watch","val","getData","methods","model","document","on","evt","editing","view","CKEditor","install","Vue","component","CKEditorComponent"],"mappings":";;;;CAAA,SAAAA,EAAAC,GACA,iBAAAC,SAAA,iBAAAC,OACAA,OAAAD,QAAAD,IACA,mBAAAG,eAAAC,IACAD,UAAAH,GACA,iBAAAC,QACAA,QAAA,SAAAD,IAEAD,EAAA,SAAAC,IARA,CASCK,OAAA,WACD,mBCTA,IAAAC,KAGA,SAAAC,EAAAC,GAGA,GAAAF,EAAAE,GACA,OAAAF,EAAAE,GAAAP,QAGA,IAAAC,EAAAI,EAAAE,IACAC,EAAAD,EACAE,GAAA,EACAT,YAUA,OANAU,EAAAH,GAAAI,KAAAV,EAAAD,QAAAC,IAAAD,QAAAM,GAGAL,EAAAQ,GAAA,EAGAR,EAAAD,QA0DA,OArDAM,EAAAM,EAAAF,EAGAJ,EAAAO,EAAAR,EAGAC,EAAAQ,EAAA,SAAAd,EAAAe,EAAAC,GACAV,EAAAW,EAAAjB,EAAAe,IACAG,OAAAC,eAAAnB,EAAAe,GAA0CK,YAAA,EAAAC,IAAAL,KAK1CV,EAAAgB,EAAA,SAAAtB,GACA,oBAAAuB,eAAAC,aACAN,OAAAC,eAAAnB,EAAAuB,OAAAC,aAAwDC,MAAA,WAExDP,OAAAC,eAAAnB,EAAA,cAAiDyB,OAAA,KAQjDnB,EAAAoB,EAAA,SAAAD,EAAAE,GAEA,GADA,EAAAA,IAAAF,EAAAnB,EAAAmB,IACA,EAAAE,EAAA,OAAAF,EACA,KAAAE,GAAA,iBAAAF,QAAAG,WAAA,OAAAH,EACA,IAAAI,EAAAX,OAAAY,OAAA,MAGA,GAFAxB,EAAAgB,EAAAO,GACAX,OAAAC,eAAAU,EAAA,WAAyCT,YAAA,EAAAK,UACzC,EAAAE,GAAA,iBAAAF,EAAA,QAAAM,KAAAN,EAAAnB,EAAAQ,EAAAe,EAAAE,EAAA,SAAAA,GAAgH,OAAAN,EAAAM,IAAqBC,KAAA,KAAAD,IACrI,OAA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AAKJ,SAASC,GAAI,QAASC,IACzChC,KAAKmB,MAAO,QAASa,EAAK7B,KAG3BA,EAAO8B,QAAQC,KAAKJ,SAASC,GAAI,OAAQC,IACxChC,KAAKmB,MAAO,OAAQa,EAAK7B,QCzG7B,MAAMgC,GAMLC,QAASC,GACRA,EAAIC,UAAW,WAAYC,IAE5BD,UAAWC,GAGGJ","file":"ckeditor.js","sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"CKEditor\"] = factory();\n\telse\n\t\troot[\"CKEditor\"] = factory();\n})(window, function() {\nreturn "," \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 0);\n","/**\n * @license Copyright (c) 2003-2019, CKSource - Frederico Knabben. All rights reserved.\n * For licensing, see LICENSE.md.\n */\n\n/* global console */\n\nexport default {\n\tname: 'ckeditor',\n\n\trender( createElement ) {\n\t\treturn createElement( this.tagName );\n\t},\n\n\tprops: {\n\t\teditor: {\n\t\t\ttype: Function,\n\t\t\tdefault: null\n\t\t},\n\t\tvalue: {\n\t\t\ttype: String,\n\t\t\tdefault: ''\n\t\t},\n\t\tconfig: {\n\t\t\ttype: Object,\n\t\t\tdefault: () => ( {} )\n\t\t},\n\t\ttagName: {\n\t\t\ttype: String,\n\t\t\tdefault: 'div'\n\t\t},\n\t\tdisabled: {\n\t\t\ttype: Boolean,\n\t\t\tdefault: false\n\t\t}\n\t},\n\n\tdata() {\n\t\treturn {\n\t\t\t// Don't define it in #props because it produces a warning.\n\t\t\t// https://vuejs.org/v2/guide/components-props.html#One-Way-Data-Flow\n\t\t\tinstance: null\n\t\t};\n\t},\n\n\tmounted() {\n\t\tthis.editor.create( this.$el, this.config )\n\t\t\t.then( editor => {\n\t\t\t\t// Save the reference to the instance for further use.\n\t\t\t\tthis.instance = editor;\n\n\t\t\t\t// Set the initial data of the editor.\n\t\t\t\teditor.setData( this.value );\n\n\t\t\t\t// Set initial disabled state.\n\t\t\t\teditor.isReadOnly = this.disabled;\n\n\t\t\t\tthis.$_setUpEditorEvents();\n\n\t\t\t\t// Let the world know the editor is ready.\n\t\t\t\tthis.$emit( 'ready', editor );\n\t\t\t} )\n\t\t\t.catch( error => {\n\t\t\t\tconsole.error( error );\n\t\t\t} );\n\t},\n\n\tbeforeDestroy() {\n\t\tif ( this.instance ) {\n\t\t\tthis.instance.destroy();\n\t\t\tthis.instance = null;\n\t\t}\n\n\t\t// Note: By the time the editor is destroyed (promise resolved, editor#destroy fired)\n\t\t// the Vue component will not be able to emit any longer. So emitting #destroy a bit earlier.\n\t\tthis.$emit( 'destroy', this.instance );\n\t},\n\n\twatch: {\n\t\t// Synchronize changes of #value.\n\t\tvalue( val ) {\n\t\t\t// If the change is the result of typing, the #value is the same as instance.getData().\n\t\t\t// In that case, the change has been triggered by instance.model.document#change:data\n\t\t\t// so #value and instance.getData() are already in sync. Executing instance#setData()\n\t\t\t// would demolish the selection.\n\t\t\tif ( this.instance.getData() !== val ) {\n\t\t\t\tthis.instance.setData( val );\n\t\t\t}\n\t\t},\n\n\t\t// Synchronize changes of #disabled.\n\t\tdisabled( val ) {\n\t\t\tthis.instance.isReadOnly = val;\n\t\t}\n\t},\n\n\tmethods: {\n\t\t$_setUpEditorEvents() {\n\t\t\tconst editor = this.instance;\n\n\t\t\teditor.model.document.on( 'change:data', evt => {\n\t\t\t\tconst data = editor.getData();\n\n\t\t\t\t// The compatibility with the v-model and general Vue.js concept of input–like components.\n\t\t\t\tthis.$emit( 'input', data, evt, editor );\n\t\t\t} );\n\n\t\t\teditor.editing.view.document.on( 'focus', evt => {\n\t\t\t\tthis.$emit( 'focus', evt, editor );\n\t\t\t} );\n\n\t\t\teditor.editing.view.document.on( 'blur', evt => {\n\t\t\t\tthis.$emit( 'blur', evt, editor );\n\t\t\t} );\n\t\t}\n\t}\n};\n","/**\n * @license Copyright (c) 2003-2019, CKSource - Frederico Knabben. All rights reserved.\n * For licensing, see LICENSE.md.\n */\n\nimport CKEditorComponent from './ckeditor.js';\n\nconst CKEditor = {\n\t/**\n\t * Instals the plugin, registering the `` component.\n\t *\n\t * @param {Vue} Vue The Vue object.\n\t */\n\tinstall( Vue ) {\n\t\tVue.component( 'ckeditor', CKEditorComponent );\n\t},\n\tcomponent: CKEditorComponent\n};\n\nexport default CKEditor;\n"],"sourceRoot":""} \ No newline at end of file +{"version":3,"sources":["webpack://CKEditor/webpack/universalModuleDefinition","webpack://CKEditor/webpack/bootstrap","webpack://CKEditor/./node_modules/lodash-es/_freeGlobal.js","webpack://CKEditor/(webpack)/buildin/global.js","webpack://CKEditor/./node_modules/lodash-es/isObject.js","webpack://CKEditor/./node_modules/lodash-es/_root.js","webpack://CKEditor/./node_modules/lodash-es/now.js","webpack://CKEditor/./node_modules/lodash-es/_Symbol.js","webpack://CKEditor/./node_modules/lodash-es/_getRawTag.js","webpack://CKEditor/./node_modules/lodash-es/_objectToString.js","webpack://CKEditor/./node_modules/lodash-es/_baseGetTag.js","webpack://CKEditor/./node_modules/lodash-es/isObjectLike.js","webpack://CKEditor/./node_modules/lodash-es/isSymbol.js","webpack://CKEditor/./node_modules/lodash-es/toNumber.js","webpack://CKEditor/./node_modules/lodash-es/debounce.js","webpack://CKEditor/./src/ckeditor.js","webpack://CKEditor/./src/plugin.js"],"names":["root","factory","exports","module","define","amd","window","installedModules","__webpack_require__","moduleId","i","l","modules","call","m","c","d","name","getter","o","Object","defineProperty","enumerable","get","r","Symbol","toStringTag","value","t","mode","__esModule","ns","create","key","bind","n","object","property","prototype","hasOwnProperty","p","s","global","freeGlobal","__webpack_exports__","g","this","Function","e","lodash_es_isObject","type","freeSelf","self","_root","_freeGlobal","lodash_es_now","Date","now","_Symbol","objectProto","_getRawTag_hasOwnProperty","nativeObjectToString","toString","symToStringTag","undefined","_getRawTag","isOwn","tag","unmasked","result","_objectToString_nativeObjectToString","_objectToString","nullTag","undefinedTag","_baseGetTag_symToStringTag","_baseGetTag","lodash_es_isObjectLike","symbolTag","lodash_es_isSymbol","NAN","reTrim","reIsBadHex","reIsBinary","reIsOctal","freeParseInt","parseInt","lodash_es_toNumber","other","valueOf","replace","isBinary","test","slice","FUNC_ERROR_TEXT","nativeMax","Math","max","nativeMin","min","lodash_es_debounce","func","wait","options","lastArgs","lastThis","maxWait","timerId","lastCallTime","lastInvokeTime","leading","maxing","trailing","TypeError","invokeFunc","time","args","thisArg","apply","shouldInvoke","timeSinceLastCall","timerExpired","trailingEdge","setTimeout","timeWaiting","remainingWait","debounced","isInvoking","arguments","leadingEdge","cancel","clearTimeout","flush","ckeditor","render","createElement","tagName","props","editor","default","String","config","disabled","Boolean","data","instance","$_lastEditorData","mounted","$el","then","setData","isReadOnly","$_setUpEditorEvents","$emit","catch","error","console","beforeDestroy","destroy","watch","newValue","oldValue","val","methods","model","document","on","debounce","evt","getData","editing","view","CKEditor","install","Vue","component","CKEditorComponent"],"mappings":";;;;CAAA,SAAAA,EAAAC,GACA,iBAAAC,SAAA,iBAAAC,OACAA,OAAAD,QAAAD,IACA,mBAAAG,eAAAC,IACAD,UAAAH,GACA,iBAAAC,QACAA,QAAA,SAAAD,IAEAD,EAAA,SAAAC,IARA,CASCK,OAAA,WACD,mBCTA,IAAAC,KAGA,SAAAC,EAAAC,GAGA,GAAAF,EAAAE,GACA,OAAAF,EAAAE,GAAAP,QAGA,IAAAC,EAAAI,EAAAE,IACA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IAEN3F,KAAKkG,SAAWP,EAGhBA,EAAOY,QAASvG,KAAKnB,OAGrB8G,EAAOa,WAAaxG,KAAK+F,SAEzB/F,KAAKyG,sBAGLzG,KAAK0G,MAAO,QAASf,KAErBgB,MAAOC,IACPC,QAAQD,MAAOA,MAIlBE,gBACM9G,KAAKkG,WACTlG,KAAKkG,SAASa,UACd/G,KAAKkG,SAAW,MAKjBlG,KAAK0G,MAAO,UAAW1G,KAAKkG,WAG7Bc,OACCnI,MAAOoI,EAAUC,GAuBXD,IAAaC,GAAYD,IAAajH,KAAKmG,kBAC/CnG,KAAKkG,SAASK,QAASU,IAKzBlB,SAAUoB,GACTnH,KAAKkG,SAASM,WAAaW,IAI7BC,SACCX,sBACC,MAAMd,EAAS3F,KAAKkG,SAepBP,EAAO0B,MAAMC,SAASC,GAAI,cAAeC,EAdlBC,IAItB,MAAMxB,EAAOjG,KAAKmG,iBAAmBR,EAAO+B,UAG5C1H,KAAK0G,MAAO,QAAST,EAAMwB,EAAK9B,IA3HF,MAoI/BA,EAAOgC,QAAQC,KAAKN,SAASC,GAAI,QAASE,IACzCzH,KAAK0G,MAAO,QAASe,EAAK9B,KAG3BA,EAAOgC,QAAQC,KAAKN,SAASC,GAAI,OAAQE,IACxCzH,KAAK0G,MAAO,OAAQe,EAAK9B,QC3I7B,MAAMkC,GAMLC,QAASC,GACRA,EAAIC,UAAW,WAAYC,IAE5BD,UAAWC,GAGGJ","file":"ckeditor.js","sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"CKEditor\"] = factory();\n\telse\n\t\troot[\"CKEditor\"] = factory();\n})(window, function() {\nreturn "," \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 2);\n","/** Detect free variable `global` from Node.js. */\nvar freeGlobal = typeof global == 'object' && global && global.Object === Object && global;\n\nexport default freeGlobal;\n","var g;\n\n// This works in non-strict mode\ng = (function() {\n\treturn this;\n})();\n\ntry {\n\t// This works if eval is allowed (see CSP)\n\tg = g || new Function(\"return this\")();\n} catch (e) {\n\t// This works if the window reference is available\n\tif (typeof window === \"object\") g = window;\n}\n\n// g can still be undefined, but nothing to do about it...\n// We return undefined, instead of nothing here, so it's\n// easier to handle this case. if(!global) { ...}\n\nmodule.exports = g;\n","/**\n * Checks if `value` is the\n * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)\n * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an object, else `false`.\n * @example\n *\n * _.isObject({});\n * // => true\n *\n * _.isObject([1, 2, 3]);\n * // => true\n *\n * _.isObject(_.noop);\n * // => true\n *\n * _.isObject(null);\n * // => false\n */\nfunction isObject(value) {\n var type = typeof value;\n return value != null && (type == 'object' || type == 'function');\n}\n\nexport default isObject;\n","import freeGlobal from './_freeGlobal.js';\n\n/** Detect free variable `self`. */\nvar freeSelf = typeof self == 'object' && self && self.Object === Object && self;\n\n/** Used as a reference to the global object. */\nvar root = freeGlobal || freeSelf || Function('return this')();\n\nexport default root;\n","import root from './_root.js';\n\n/**\n * Gets the timestamp of the number of milliseconds that have elapsed since\n * the Unix epoch (1 January 1970 00:00:00 UTC).\n *\n * @static\n * @memberOf _\n * @since 2.4.0\n * @category Date\n * @returns {number} Returns the timestamp.\n * @example\n *\n * _.defer(function(stamp) {\n * console.log(_.now() - stamp);\n * }, _.now());\n * // => Logs the number of milliseconds it took for the deferred invocation.\n */\nvar now = function() {\n return root.Date.now();\n};\n\nexport default now;\n","import root from './_root.js';\n\n/** Built-in value references. */\nvar Symbol = root.Symbol;\n\nexport default Symbol;\n","import Symbol from './_Symbol.js';\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/**\n * Used to resolve the\n * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)\n * of values.\n */\nvar nativeObjectToString = objectProto.toString;\n\n/** Built-in value references. */\nvar symToStringTag = Symbol ? Symbol.toStringTag : undefined;\n\n/**\n * A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.\n *\n * @private\n * @param {*} value The value to query.\n * @returns {string} Returns the raw `toStringTag`.\n */\nfunction getRawTag(value) {\n var isOwn = hasOwnProperty.call(value, symToStringTag),\n tag = value[symToStringTag];\n\n try {\n value[symToStringTag] = undefined;\n var unmasked = true;\n } catch (e) {}\n\n var result = nativeObjectToString.call(value);\n if (unmasked) {\n if (isOwn) {\n value[symToStringTag] = tag;\n } else {\n delete value[symToStringTag];\n }\n }\n return result;\n}\n\nexport default getRawTag;\n","/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/**\n * Used to resolve the\n * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)\n * of values.\n */\nvar nativeObjectToString = objectProto.toString;\n\n/**\n * Converts `value` to a string using `Object.prototype.toString`.\n *\n * @private\n * @param {*} value The value to convert.\n * @returns {string} Returns the converted string.\n */\nfunction objectToString(value) {\n return nativeObjectToString.call(value);\n}\n\nexport default objectToString;\n","import Symbol from './_Symbol.js';\nimport getRawTag from './_getRawTag.js';\nimport objectToString from './_objectToString.js';\n\n/** `Object#toString` result references. */\nvar nullTag = '[object Null]',\n undefinedTag = '[object Undefined]';\n\n/** Built-in value references. */\nvar symToStringTag = Symbol ? Symbol.toStringTag : undefined;\n\n/**\n * The base implementation of `getTag` without fallbacks for buggy environments.\n *\n * @private\n * @param {*} value The value to query.\n * @returns {string} Returns the `toStringTag`.\n */\nfunction baseGetTag(value) {\n if (value == null) {\n return value === undefined ? undefinedTag : nullTag;\n }\n return (symToStringTag && symToStringTag in Object(value))\n ? getRawTag(value)\n : objectToString(value);\n}\n\nexport default baseGetTag;\n","/**\n * Checks if `value` is object-like. A value is object-like if it's not `null`\n * and has a `typeof` result of \"object\".\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is object-like, else `false`.\n * @example\n *\n * _.isObjectLike({});\n * // => true\n *\n * _.isObjectLike([1, 2, 3]);\n * // => true\n *\n * _.isObjectLike(_.noop);\n * // => false\n *\n * _.isObjectLike(null);\n * // => false\n */\nfunction isObjectLike(value) {\n return value != null && typeof value == 'object';\n}\n\nexport default isObjectLike;\n","import baseGetTag from './_baseGetTag.js';\nimport isObjectLike from './isObjectLike.js';\n\n/** `Object#toString` result references. */\nvar symbolTag = '[object Symbol]';\n\n/**\n * Checks if `value` is classified as a `Symbol` primitive or object.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a symbol, else `false`.\n * @example\n *\n * _.isSymbol(Symbol.iterator);\n * // => true\n *\n * _.isSymbol('abc');\n * // => false\n */\nfunction isSymbol(value) {\n return typeof value == 'symbol' ||\n (isObjectLike(value) && baseGetTag(value) == symbolTag);\n}\n\nexport default isSymbol;\n","import isObject from './isObject.js';\nimport isSymbol from './isSymbol.js';\n\n/** Used as references for various `Number` constants. */\nvar NAN = 0 / 0;\n\n/** Used to match leading and trailing whitespace. */\nvar reTrim = /^\\s+|\\s+$/g;\n\n/** Used to detect bad signed hexadecimal string values. */\nvar reIsBadHex = /^[-+]0x[0-9a-f]+$/i;\n\n/** Used to detect binary string values. */\nvar reIsBinary = /^0b[01]+$/i;\n\n/** Used to detect octal string values. */\nvar reIsOctal = /^0o[0-7]+$/i;\n\n/** Built-in method references without a dependency on `root`. */\nvar freeParseInt = parseInt;\n\n/**\n * Converts `value` to a number.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to process.\n * @returns {number} Returns the number.\n * @example\n *\n * _.toNumber(3.2);\n * // => 3.2\n *\n * _.toNumber(Number.MIN_VALUE);\n * // => 5e-324\n *\n * _.toNumber(Infinity);\n * // => Infinity\n *\n * _.toNumber('3.2');\n * // => 3.2\n */\nfunction toNumber(value) {\n if (typeof value == 'number') {\n return value;\n }\n if (isSymbol(value)) {\n return NAN;\n }\n if (isObject(value)) {\n var other = typeof value.valueOf == 'function' ? value.valueOf() : value;\n value = isObject(other) ? (other + '') : other;\n }\n if (typeof value != 'string') {\n return value === 0 ? value : +value;\n }\n value = value.replace(reTrim, '');\n var isBinary = reIsBinary.test(value);\n return (isBinary || reIsOctal.test(value))\n ? freeParseInt(value.slice(2), isBinary ? 2 : 8)\n : (reIsBadHex.test(value) ? NAN : +value);\n}\n\nexport default toNumber;\n","import isObject from './isObject.js';\nimport now from './now.js';\nimport toNumber from './toNumber.js';\n\n/** Error message constants. */\nvar FUNC_ERROR_TEXT = 'Expected a function';\n\n/* Built-in method references for those with the same name as other `lodash` methods. */\nvar nativeMax = Math.max,\n nativeMin = Math.min;\n\n/**\n * Creates a debounced function that delays invoking `func` until after `wait`\n * milliseconds have elapsed since the last time the debounced function was\n * invoked. The debounced function comes with a `cancel` method to cancel\n * delayed `func` invocations and a `flush` method to immediately invoke them.\n * Provide `options` to indicate whether `func` should be invoked on the\n * leading and/or trailing edge of the `wait` timeout. The `func` is invoked\n * with the last arguments provided to the debounced function. Subsequent\n * calls to the debounced function return the result of the last `func`\n * invocation.\n *\n * **Note:** If `leading` and `trailing` options are `true`, `func` is\n * invoked on the trailing edge of the timeout only if the debounced function\n * is invoked more than once during the `wait` timeout.\n *\n * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred\n * until to the next tick, similar to `setTimeout` with a timeout of `0`.\n *\n * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)\n * for details over the differences between `_.debounce` and `_.throttle`.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Function\n * @param {Function} func The function to debounce.\n * @param {number} [wait=0] The number of milliseconds to delay.\n * @param {Object} [options={}] The options object.\n * @param {boolean} [options.leading=false]\n * Specify invoking on the leading edge of the timeout.\n * @param {number} [options.maxWait]\n * The maximum time `func` is allowed to be delayed before it's invoked.\n * @param {boolean} [options.trailing=true]\n * Specify invoking on the trailing edge of the timeout.\n * @returns {Function} Returns the new debounced function.\n * @example\n *\n * // Avoid costly calculations while the window size is in flux.\n * jQuery(window).on('resize', _.debounce(calculateLayout, 150));\n *\n * // Invoke `sendMail` when clicked, debouncing subsequent calls.\n * jQuery(element).on('click', _.debounce(sendMail, 300, {\n * 'leading': true,\n * 'trailing': false\n * }));\n *\n * // Ensure `batchLog` is invoked once after 1 second of debounced calls.\n * var debounced = _.debounce(batchLog, 250, { 'maxWait': 1000 });\n * var source = new EventSource('/stream');\n * jQuery(source).on('message', debounced);\n *\n * // Cancel the trailing debounced invocation.\n * jQuery(window).on('popstate', debounced.cancel);\n */\nfunction debounce(func, wait, options) {\n var lastArgs,\n lastThis,\n maxWait,\n result,\n timerId,\n lastCallTime,\n lastInvokeTime = 0,\n leading = false,\n maxing = false,\n trailing = true;\n\n if (typeof func != 'function') {\n throw new TypeError(FUNC_ERROR_TEXT);\n }\n wait = toNumber(wait) || 0;\n if (isObject(options)) {\n leading = !!options.leading;\n maxing = 'maxWait' in options;\n maxWait = maxing ? nativeMax(toNumber(options.maxWait) || 0, wait) : maxWait;\n trailing = 'trailing' in options ? !!options.trailing : trailing;\n }\n\n function invokeFunc(time) {\n var args = lastArgs,\n thisArg = lastThis;\n\n lastArgs = lastThis = undefined;\n lastInvokeTime = time;\n result = func.apply(thisArg, args);\n return result;\n }\n\n function leadingEdge(time) {\n // Reset any `maxWait` timer.\n lastInvokeTime = time;\n // Start the timer for the trailing edge.\n timerId = setTimeout(timerExpired, wait);\n // Invoke the leading edge.\n return leading ? invokeFunc(time) : result;\n }\n\n function remainingWait(time) {\n var timeSinceLastCall = time - lastCallTime,\n timeSinceLastInvoke = time - lastInvokeTime,\n timeWaiting = wait - timeSinceLastCall;\n\n return maxing\n ? nativeMin(timeWaiting, maxWait - timeSinceLastInvoke)\n : timeWaiting;\n }\n\n function shouldInvoke(time) {\n var timeSinceLastCall = time - lastCallTime,\n timeSinceLastInvoke = time - lastInvokeTime;\n\n // Either this is the first call, activity has stopped and we're at the\n // trailing edge, the system time has gone backwards and we're treating\n // it as the trailing edge, or we've hit the `maxWait` limit.\n return (lastCallTime === undefined || (timeSinceLastCall >= wait) ||\n (timeSinceLastCall < 0) || (maxing && timeSinceLastInvoke >= maxWait));\n }\n\n function timerExpired() {\n var time = now();\n if (shouldInvoke(time)) {\n return trailingEdge(time);\n }\n // Restart the timer.\n timerId = setTimeout(timerExpired, remainingWait(time));\n }\n\n function trailingEdge(time) {\n timerId = undefined;\n\n // Only invoke if we have `lastArgs` which means `func` has been\n // debounced at least once.\n if (trailing && lastArgs) {\n return invokeFunc(time);\n }\n lastArgs = lastThis = undefined;\n return result;\n }\n\n function cancel() {\n if (timerId !== undefined) {\n clearTimeout(timerId);\n }\n lastInvokeTime = 0;\n lastArgs = lastCallTime = lastThis = timerId = undefined;\n }\n\n function flush() {\n return timerId === undefined ? result : trailingEdge(now());\n }\n\n function debounced() {\n var time = now(),\n isInvoking = shouldInvoke(time);\n\n lastArgs = arguments;\n lastThis = this;\n lastCallTime = time;\n\n if (isInvoking) {\n if (timerId === undefined) {\n return leadingEdge(lastCallTime);\n }\n if (maxing) {\n // Handle invocations in a tight loop.\n timerId = setTimeout(timerExpired, wait);\n return invokeFunc(lastCallTime);\n }\n }\n if (timerId === undefined) {\n timerId = setTimeout(timerExpired, wait);\n }\n return result;\n }\n debounced.cancel = cancel;\n debounced.flush = flush;\n return debounced;\n}\n\nexport default debounce;\n","/**\n * @license Copyright (c) 2003-2019, CKSource - Frederico Knabben. All rights reserved.\n * For licensing, see LICENSE.md.\n */\n\n/* global console */\n\nimport { debounce } from 'lodash-es';\n\nconst INPUT_EVENT_DEBOUNCE_WAIT = 300;\n\nexport default {\n\tname: 'ckeditor',\n\n\trender( createElement ) {\n\t\treturn createElement( this.tagName );\n\t},\n\n\tprops: {\n\t\teditor: {\n\t\t\ttype: Function,\n\t\t\tdefault: null\n\t\t},\n\t\tvalue: {\n\t\t\ttype: String,\n\t\t\tdefault: ''\n\t\t},\n\t\tconfig: {\n\t\t\ttype: Object,\n\t\t\tdefault: () => ( {} )\n\t\t},\n\t\ttagName: {\n\t\t\ttype: String,\n\t\t\tdefault: 'div'\n\t\t},\n\t\tdisabled: {\n\t\t\ttype: Boolean,\n\t\t\tdefault: false\n\t\t}\n\t},\n\n\tdata() {\n\t\treturn {\n\t\t\t// Don't define it in #props because it produces a warning.\n\t\t\t// https://vuejs.org/v2/guide/components-props.html#One-Way-Data-Flow\n\t\t\tinstance: null,\n\n\t\t\t$_lastEditorData: {\n\t\t\t\ttype: String,\n\t\t\t\tdefault: ''\n\t\t\t}\n\t\t};\n\t},\n\n\tmounted() {\n\t\tthis.editor.create( this.$el, this.config )\n\t\t\t.then( editor => {\n\t\t\t\t// Save the reference to the instance for further use.\n\t\t\t\tthis.instance = editor;\n\n\t\t\t\t// Set the initial data of the editor.\n\t\t\t\teditor.setData( this.value );\n\n\t\t\t\t// Set initial disabled state.\n\t\t\t\teditor.isReadOnly = this.disabled;\n\n\t\t\t\tthis.$_setUpEditorEvents();\n\n\t\t\t\t// Let the world know the editor is ready.\n\t\t\t\tthis.$emit( 'ready', editor );\n\t\t\t} )\n\t\t\t.catch( error => {\n\t\t\t\tconsole.error( error );\n\t\t\t} );\n\t},\n\n\tbeforeDestroy() {\n\t\tif ( this.instance ) {\n\t\t\tthis.instance.destroy();\n\t\t\tthis.instance = null;\n\t\t}\n\n\t\t// Note: By the time the editor is destroyed (promise resolved, editor#destroy fired)\n\t\t// the Vue component will not be able to emit any longer. So emitting #destroy a bit earlier.\n\t\tthis.$emit( 'destroy', this.instance );\n\t},\n\n\twatch: {\n\t\tvalue( newValue, oldValue ) {\n\t\t\t// Synchronize changes of instance#value. There are two sources of changes:\n\t\t\t//\n\t\t\t// External value change ------\\\n\t\t\t// -----> +-----------+\n\t\t\t// | Component |\n\t\t\t// -----> +-----------+\n\t\t\t// Internal data change ------/\n\t\t\t// (typing, commands, collaboration)\n\t\t\t//\n\t\t\t// Case 1: If the change was external (via props), the editor data must be synced with\n\t\t\t// the component using instance#setData() and it is OK to destroy the selection.\n\t\t\t//\n\t\t\t// Case 2: If the change is the result of internal data change, the #value is the same as\n\t\t\t// instance#$_lastEditorData, which has been cached on instance#change:data. If we called\n\t\t\t// instance#setData() at this point, that would demolish the selection.\n\t\t\t//\n\t\t\t// To limit the number of instance#setData() which is time-consuming when there is a\n\t\t\t// lot of data we make sure:\n\t\t\t// * the new value is at least different than the old value (Case 1.)\n\t\t\t// * the new value is different than the last internal instance state (Case 2.)\n\t\t\t//\n\t\t\t// See: https://github.com/ckeditor/ckeditor5-vue/issues/42.\n\t\t\tif ( newValue !== oldValue && newValue !== this.$_lastEditorData ) {\n\t\t\t\tthis.instance.setData( newValue );\n\t\t\t}\n\t\t},\n\n\t\t// Synchronize changes of #disabled.\n\t\tdisabled( val ) {\n\t\t\tthis.instance.isReadOnly = val;\n\t\t}\n\t},\n\n\tmethods: {\n\t\t$_setUpEditorEvents() {\n\t\t\tconst editor = this.instance;\n\t\t\tconst emitInputEvent = evt => {\n\t\t\t\t// Cache the last editor data. This kind of data is a result of typing,\n\t\t\t\t// editor command execution, collaborative changes to the document, etc.\n\t\t\t\t// This data is compared when the component value changes in a 2-way binding.\n\t\t\t\tconst data = this.$_lastEditorData = editor.getData();\n\n\t\t\t\t// The compatibility with the v-model and general Vue.js concept of input–like components.\n\t\t\t\tthis.$emit( 'input', data, evt, editor );\n\t\t\t};\n\n\t\t\t// Debounce emitting the #input event. When data is huge, instance#getData()\n\t\t\t// takes a lot of time to execute on every single key press and ruins the UX.\n\t\t\t//\n\t\t\t// See: https://github.com/ckeditor/ckeditor5-vue/issues/42\n\t\t\teditor.model.document.on( 'change:data', debounce( emitInputEvent, INPUT_EVENT_DEBOUNCE_WAIT ) );\n\n\t\t\teditor.editing.view.document.on( 'focus', evt => {\n\t\t\t\tthis.$emit( 'focus', evt, editor );\n\t\t\t} );\n\n\t\t\teditor.editing.view.document.on( 'blur', evt => {\n\t\t\t\tthis.$emit( 'blur', evt, editor );\n\t\t\t} );\n\t\t}\n\t}\n};\n","/**\n * @license Copyright (c) 2003-2019, CKSource - Frederico Knabben. All rights reserved.\n * For licensing, see LICENSE.md.\n */\n\nimport CKEditorComponent from './ckeditor.js';\n\nconst CKEditor = {\n\t/**\n\t * Instals the plugin, registering the `` component.\n\t *\n\t * @param {Vue} Vue The Vue object.\n\t */\n\tinstall( Vue ) {\n\t\tVue.component( 'ckeditor', CKEditorComponent );\n\t},\n\tcomponent: CKEditorComponent\n};\n\nexport default CKEditor;\n"],"sourceRoot":""} \ No newline at end of file diff --git a/package.json b/package.json index f5afc1b..cb2b6ef 100644 --- a/package.json +++ b/package.json @@ -42,6 +42,7 @@ "karma-sinon": "^1.0.5", "karma-sourcemap-loader": "^0.3.7", "karma-webpack": "^3.0.0", + "lodash-es": "^4.17.11", "minimist": "^1.2.0", "mocha": "^5.2.0", "sinon": "^7.2.3", diff --git a/src/ckeditor.js b/src/ckeditor.js index 3b4c372..fe2cbe8 100644 --- a/src/ckeditor.js +++ b/src/ckeditor.js @@ -5,6 +5,10 @@ /* global console */ +import { debounce } from 'lodash-es'; + +const INPUT_EVENT_DEBOUNCE_WAIT = 300; + export default { name: 'ckeditor', @@ -39,7 +43,12 @@ export default { return { // Don't define it in #props because it produces a warning. // https://vuejs.org/v2/guide/components-props.html#One-Way-Data-Flow - instance: null + instance: null, + + $_lastEditorData: { + type: String, + default: '' + } }; }, @@ -77,14 +86,31 @@ export default { }, watch: { - // Synchronize changes of #value. - value( val ) { - // If the change is the result of typing, the #value is the same as instance.getData(). - // In that case, the change has been triggered by instance.model.document#change:data - // so #value and instance.getData() are already in sync. Executing instance#setData() - // would demolish the selection. - if ( this.instance.getData() !== val ) { - this.instance.setData( val ); + value( newValue, oldValue ) { + // Synchronize changes of instance#value. There are two sources of changes: + // + // External value change ------\ + // -----> +-----------+ + // | Component | + // -----> +-----------+ + // Internal data change ------/ + // (typing, commands, collaboration) + // + // Case 1: If the change was external (via props), the editor data must be synced with + // the component using instance#setData() and it is OK to destroy the selection. + // + // Case 2: If the change is the result of internal data change, the #value is the same as + // instance#$_lastEditorData, which has been cached on instance#change:data. If we called + // instance#setData() at this point, that would demolish the selection. + // + // To limit the number of instance#setData() which is time-consuming when there is a + // lot of data we make sure: + // * the new value is at least different than the old value (Case 1.) + // * the new value is different than the last internal instance state (Case 2.) + // + // See: https://github.com/ckeditor/ckeditor5-vue/issues/42. + if ( newValue !== oldValue && newValue !== this.$_lastEditorData ) { + this.instance.setData( newValue ); } }, @@ -97,13 +123,21 @@ export default { methods: { $_setUpEditorEvents() { const editor = this.instance; - - editor.model.document.on( 'change:data', evt => { - const data = editor.getData(); + const emitInputEvent = evt => { + // Cache the last editor data. This kind of data is a result of typing, + // editor command execution, collaborative changes to the document, etc. + // This data is compared when the component value changes in a 2-way binding. + const data = this.$_lastEditorData = editor.getData(); // The compatibility with the v-model and general Vue.js concept of input–like components. this.$emit( 'input', data, evt, editor ); - } ); + }; + + // Debounce emitting the #input event. When data is huge, instance#getData() + // takes a lot of time to execute on every single key press and ruins the UX. + // + // See: https://github.com/ckeditor/ckeditor5-vue/issues/42 + editor.model.document.on( 'change:data', debounce( emitInputEvent, INPUT_EVENT_DEBOUNCE_WAIT ) ); editor.editing.view.document.on( 'focus', evt => { this.$emit( 'focus', evt, editor ); diff --git a/tests/ckeditor.js b/tests/ckeditor.js index 9bf9172..5f6917c 100644 --- a/tests/ckeditor.js +++ b/tests/ckeditor.js @@ -30,6 +30,8 @@ describe( 'CKEditor Component', () => { } ); it( 'calls editor#create when initializing', done => { + Vue.config.errorHandler = done; + const stub = sandbox.stub( MockEditor, 'create' ).resolves( new MockEditor() ); const { wrapper } = createComponent(); @@ -42,6 +44,8 @@ describe( 'CKEditor Component', () => { } ); it( 'calls editor#destroy when destroying', done => { + Vue.config.errorHandler = done; + const stub = sandbox.stub( MockEditor.prototype, 'destroy' ).resolves(); const { wrapper, vm } = createComponent(); @@ -55,6 +59,8 @@ describe( 'CKEditor Component', () => { } ); it( 'passes editor promise rejection error to console.error', done => { + Vue.config.errorHandler = done; + const error = new Error( 'Something went wrong.' ); const consoleErrorStub = sandbox.stub( console, 'error' ); @@ -75,6 +81,8 @@ describe( 'CKEditor Component', () => { describe( 'properties', () => { it( '#editor', () => { it( 'accepts a string', done => { + Vue.config.errorHandler = done; + expect( vm.editor ).to.equal( 'classic' ); Vue.nextTick( () => { @@ -85,6 +93,8 @@ describe( 'CKEditor Component', () => { } ); it( 'accepts an editor constructor', done => { + Vue.config.errorHandler = done; + const { wrapper, vm } = createComponent( { editor: MockEditor } ); @@ -105,6 +115,8 @@ describe( 'CKEditor Component', () => { } ); it( 'should set the initial data', done => { + Vue.config.errorHandler = done; + const setDataStub = sandbox.stub( MockEditor.prototype, 'setData' ); const { wrapper } = createComponent( { value: 'foo' @@ -141,6 +153,8 @@ describe( 'CKEditor Component', () => { } ); it( 'should set the initial editor#isReadOnly', done => { + Vue.config.errorHandler = done; + const { wrapper, vm } = createComponent( { disabled: true } ); @@ -159,6 +173,8 @@ describe( 'CKEditor Component', () => { } ); it( 'should set the initial editor#config', done => { + Vue.config.errorHandler = done; + const { wrapper, vm } = createComponent( { config: { foo: 'bar' } } ); @@ -172,6 +188,8 @@ describe( 'CKEditor Component', () => { } ); it( '#instance should be defined', done => { + Vue.config.errorHandler = done; + Vue.nextTick( () => { expect( vm.instance ).to.be.instanceOf( MockEditor ); @@ -182,6 +200,8 @@ describe( 'CKEditor Component', () => { describe( 'bindings', () => { it( '#disabled should control editor#isReadOnly', done => { + Vue.config.errorHandler = done; + const { wrapper, vm } = createComponent( { disabled: true } ); @@ -198,6 +218,8 @@ describe( 'CKEditor Component', () => { } ); it( '#value should trigger editor#setData', done => { + Vue.config.errorHandler = done; + Vue.nextTick( () => { const spy = sandbox.spy( vm.instance, 'setData' ); @@ -205,11 +227,13 @@ describe( 'CKEditor Component', () => { wrapper.setProps( { value: 'bar' } ); wrapper.setProps( { value: 'bar' } ); + sinon.assert.calledTwice( spy ); + // Simulate typing: The #value changes but at the same time, the instance update // its own data so instance.getData() and #value are immediately the same. // Make sure instance.setData() is not called in this situation because it would destroy // the selection. - sandbox.stub( vm.instance, 'getData' ).returns( 'barq' ); + wrapper.vm.$_lastEditorData = 'barq'; wrapper.setProps( { value: 'barq' } ); sinon.assert.calledTwice( spy ); @@ -223,6 +247,8 @@ describe( 'CKEditor Component', () => { describe( 'events', () => { it( 'emits #ready when editor is created', done => { + Vue.config.errorHandler = done; + Vue.nextTick( () => { expect( wrapper.emitted().ready.length ).to.equal( 1 ); expect( wrapper.emitted().ready[ 0 ] ).to.deep.equal( [ vm.instance ] ); @@ -232,6 +258,8 @@ describe( 'CKEditor Component', () => { } ); it( 'emits #destroy when editor is destroyed', done => { + Vue.config.errorHandler = done; + const { wrapper, vm } = createComponent(); Vue.nextTick( () => { @@ -244,7 +272,9 @@ describe( 'CKEditor Component', () => { } ); } ); - it( 'emits #input when editor data changes', done => { + it( 'emits debounced #input when editor data changes', done => { + Vue.config.errorHandler = done; + sandbox.stub( ModelDocument.prototype, 'on' ); sandbox.stub( MockEditor.prototype, 'getData' ).returns( 'foo' ); @@ -260,16 +290,20 @@ describe( 'CKEditor Component', () => { on.firstCall.args[ 1 ]( evtStub ); - expect( wrapper.emitted().input.length ).to.equal( 1 ); - expect( wrapper.emitted().input[ 0 ] ).to.deep.equal( [ - 'foo', evtStub, vm.instance - ] ); + setTimeout( () => { + expect( wrapper.emitted().input.length ).to.equal( 1 ); + expect( wrapper.emitted().input[ 0 ] ).to.deep.equal( [ + 'foo', evtStub, vm.instance + ] ); - done(); + done(); + }, 350 ); } ); } ); it( 'emits #focus when editor editable is focused', done => { + Vue.config.errorHandler = done; + sandbox.stub( ViewlDocument.prototype, 'on' ); Vue.nextTick( () => { @@ -294,6 +328,8 @@ describe( 'CKEditor Component', () => { } ); it( 'emits #blur when editor editable is focused', done => { + Vue.config.errorHandler = done; + sandbox.stub( ViewlDocument.prototype, 'on' ); Vue.nextTick( () => {