@ckeditor/ckeditor5-editor-classic 0.0.0-nightly-20240603.0 → 0.0.0-nightly-20240604.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -9,18 +9,12 @@ The classic editor implementation for CKEditor 5.
9
9
 
10
10
  This package contains the [`ClassicEditor`](https://ckeditor.com/docs/ckeditor5/latest/api/module_editor-classic_classiceditor-ClassicEditor.html) class. Follow there to learn more about this type of editor and how to initialize it.
11
11
 
12
- This package contains the source version of the classic editor. This kind of editor implementation is also available as a ready-to-use [classic build](https://www.npmjs.com/package/@ckeditor/ckeditor5-build-classic). Read more about [CKEditor 5 predefined builds](https://ckeditor.com/docs/ckeditor5/latest/getting-started/legacy/advanced/alternative-setups/predefined-builds.html) in the CKEditor 5 documentation.
12
+ This package contains the source version of the classic editor. This kind of editor implementation is also available as a ready-to-use [classic build](https://www.npmjs.com/package/@ckeditor/ckeditor5-build-classic). Read more about [CKEditor 5 predefined builds](https://ckeditor.com/docs/ckeditor5/latest/installation/advanced/alternative-setups/predefined-builds.html) in the CKEditor 5 documentation.
13
13
 
14
14
  ## Documentation
15
15
 
16
16
  See the [`@ckeditor/ckeditor5-editor-classic` package](https://ckeditor.com/docs/ckeditor5/latest/api/editor-classic.html) page in [CKEditor 5 documentation](https://ckeditor.com/docs/ckeditor5/latest/).
17
17
 
18
- ## Installation
19
-
20
- ```bash
21
- npm install ckeditor5
22
- ```
23
-
24
18
  ## License
25
19
 
26
20
  Licensed under the terms of [GNU General Public License Version 2 or later](http://www.gnu.org/licenses/gpl.html). For full details about the license, please check the `LICENSE.md` file or [https://ckeditor.com/legal/ckeditor-oss-license](https://ckeditor.com/legal/ckeditor-oss-license).
@@ -1,4 +1,4 @@
1
1
  /*!
2
2
  * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
3
3
  * For licensing, see LICENSE.md.
4
- */(()=>{var e={662:(e,t,i)=>{"use strict";i.d(t,{A:()=>r});var o=i(935),n=i.n(o)()((function(e){return e[1]}));n.push([e.id,".ck.ck-editor{position:relative}.ck.ck-editor .ck-editor__top .ck-sticky-panel .ck-toolbar{z-index:var(--ck-z-panel)}.ck.ck-editor__top .ck-sticky-panel .ck-sticky-panel__content{border-radius:0}.ck-rounded-corners .ck.ck-editor__top .ck-sticky-panel .ck-sticky-panel__content,.ck.ck-editor__top .ck-sticky-panel .ck-sticky-panel__content.ck-rounded-corners{border-radius:var(--ck-border-radius);border-bottom-left-radius:0;border-bottom-right-radius:0}.ck.ck-editor__top .ck-sticky-panel .ck-sticky-panel__content{border:solid var(--ck-color-base-border);border-width:1px 1px 0}.ck.ck-editor__top .ck-sticky-panel .ck-sticky-panel__content.ck-sticky-panel__content_sticky{border-bottom-width:1px}.ck.ck-editor__top .ck-sticky-panel .ck-sticky-panel__content .ck-menu-bar,.ck.ck-editor__top .ck-sticky-panel .ck-sticky-panel__content .ck-toolbar{border:0}.ck.ck-editor__main>.ck-editor__editable{background:var(--ck-color-base-background);border-radius:0}.ck-rounded-corners .ck.ck-editor__main>.ck-editor__editable,.ck.ck-editor__main>.ck-editor__editable.ck-rounded-corners{border-radius:var(--ck-border-radius);border-top-left-radius:0;border-top-right-radius:0}.ck.ck-editor__main>.ck-editor__editable:not(.ck-focused){border-color:var(--ck-color-base-border)}",""]);const r=n},935:e=>{"use strict";e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var i=e(t);return t[2]?"@media ".concat(t[2]," {").concat(i,"}"):i})).join("")},t.i=function(e,i,o){"string"==typeof e&&(e=[[null,e,""]]);var n={};if(o)for(var r=0;r<this.length;r++){var c=this[r][0];null!=c&&(n[c]=!0)}for(var a=0;a<e.length;a++){var s=[].concat(e[a]);o&&n[s[0]]||(i&&(s[2]?s[2]="".concat(i," and ").concat(s[2]):s[2]=i),t.push(s))}},t}},591:(e,t,i)=>{"use strict";var o,n=function(){return void 0===o&&(o=Boolean(window&&document&&document.all&&!window.atob)),o},r=function(){var e={};return function(t){if(void 0===e[t]){var i=document.querySelector(t);if(window.HTMLIFrameElement&&i instanceof window.HTMLIFrameElement)try{i=i.contentDocument.head}catch(e){i=null}e[t]=i}return e[t]}}(),c=[];function a(e){for(var t=-1,i=0;i<c.length;i++)if(c[i].identifier===e){t=i;break}return t}function s(e,t){for(var i={},o=[],n=0;n<e.length;n++){var r=e[n],s=t.base?r[0]+t.base:r[0],l=i[s]||0,d="".concat(s," ").concat(l);i[s]=l+1;var u=a(d),h={css:r[1],media:r[2],sourceMap:r[3]};-1!==u?(c[u].references++,c[u].updater(h)):c.push({identifier:d,updater:k(h,t),references:1}),o.push(d)}return o}function l(e){var t=document.createElement("style"),o=e.attributes||{};if(void 0===o.nonce){var n=i.nc;n&&(o.nonce=n)}if(Object.keys(o).forEach((function(e){t.setAttribute(e,o[e])})),"function"==typeof e.insert)e.insert(t);else{var c=r(e.insert||"head");if(!c)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");c.appendChild(t)}return t}var d,u=(d=[],function(e,t){return d[e]=t,d.filter(Boolean).join("\n")});function h(e,t,i,o){var n=i?"":o.media?"@media ".concat(o.media," {").concat(o.css,"}"):o.css;if(e.styleSheet)e.styleSheet.cssText=u(t,n);else{var r=document.createTextNode(n),c=e.childNodes;c[t]&&e.removeChild(c[t]),c.length?e.insertBefore(r,c[t]):e.appendChild(r)}}function p(e,t,i){var o=i.css,n=i.media,r=i.sourceMap;if(n?e.setAttribute("media",n):e.removeAttribute("media"),r&&"undefined"!=typeof btoa&&(o+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(r))))," */")),e.styleSheet)e.styleSheet.cssText=o;else{for(;e.firstChild;)e.removeChild(e.firstChild);e.appendChild(document.createTextNode(o))}}var f=null,b=0;function k(e,t){var i,o,n;if(t.singleton){var r=b++;i=f||(f=l(t)),o=h.bind(null,i,r,!1),n=h.bind(null,i,r,!0)}else i=l(t),o=p.bind(null,i,t),n=function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(i)};return o(e),function(t){if(t){if(t.css===e.css&&t.media===e.media&&t.sourceMap===e.sourceMap)return;o(e=t)}else n()}}e.exports=function(e,t){(t=t||{}).singleton||"boolean"==typeof t.singleton||(t.singleton=n());var i=s(e=e||[],t);return function(e){if(e=e||[],"[object Array]"===Object.prototype.toString.call(e)){for(var o=0;o<i.length;o++){var n=a(i[o]);c[n].references--}for(var r=s(e,t),l=0;l<i.length;l++){var d=a(i[l]);0===c[d].references&&(c[d].updater(),c.splice(d,1))}i=r}}}},782:(e,t,i)=>{e.exports=i(237)("./src/core.js")},783:(e,t,i)=>{e.exports=i(237)("./src/engine.js")},311:(e,t,i)=>{e.exports=i(237)("./src/ui.js")},584:(e,t,i)=>{e.exports=i(237)("./src/utils.js")},237:e=>{"use strict";e.exports=CKEditor5.dll}},t={};function i(o){var n=t[o];if(void 0!==n)return n.exports;var r=t[o]={id:o,exports:{}};return e[o](r,r.exports,i),r.exports}i.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return i.d(t,{a:t}),t},i.d=(e,t)=>{for(var o in t)i.o(t,o)&&!i.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},i.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),i.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},i.nc=void 0;var o={};(()=>{"use strict";i.r(o),i.d(o,{ClassicEditor:()=>D});var e=i(311),t=i(783),n=i(584);class r extends e.EditorUI{constructor(t,i){super(t),this.view=i,this._toolbarConfig=(0,e.normalizeToolbarConfig)(t.config.get("toolbar")),this._elementReplacer=new n.ElementReplacer,this.listenTo(t.editing.view,"scrollToTheSelection",this._handleScrollToTheSelectionWithStickyPanel.bind(this))}get element(){return this.view.element}init(t){const i=this.editor,o=this.view,n=i.editing.view,r=o.editable,c=n.document.getRoot();r.name=c.rootName,o.render();const a=r.element;this.setEditableElement(r.name,a),o.editable.bind("isFocused").to(this.focusTracker),n.attachDomRoot(a),t&&this._elementReplacer.replace(t,this.element),this._initPlaceholder(),this._initToolbar(),o.menuBarView&&(0,e._initMenuBar)(i,o.menuBarView),this._initDialogPluginIntegration(),this.fire("ready")}destroy(){super.destroy();const e=this.view,t=this.editor.editing.view;this._elementReplacer.restore(),t.detachDomRoot(e.editable.name),e.destroy()}_initToolbar(){const e=this.view;e.stickyPanel.bind("isActive").to(this.focusTracker,"isFocused"),e.stickyPanel.limiterElement=e.element,e.stickyPanel.bind("viewportTopOffset").to(this,"viewportOffset",(({top:e})=>e||0)),e.toolbar.fillFromConfig(this._toolbarConfig,this.componentFactory),this.addToolbar(e.toolbar)}_initPlaceholder(){const e=this.editor,i=e.editing.view,o=i.document.getRoot(),n=e.sourceElement;let r;const c=e.config.get("placeholder");c&&(r="string"==typeof c?c:c[this.view.editable.name]),!r&&n&&"textarea"===n.tagName.toLowerCase()&&(r=n.getAttribute("placeholder")),r&&(o.placeholder=r),(0,t.enablePlaceholder)({view:i,element:o,isDirectHost:!1,keepOnFocus:!0})}_handleScrollToTheSelectionWithStickyPanel(e,t,i){const o=this.view.stickyPanel;if(o.isSticky){const e=new n.Rect(o.element).height;t.viewportOffset.top+=e}else{const e=()=>{this.editor.editing.view.scrollToTheSelection(i)};this.listenTo(o,"change:isSticky",e),setTimeout((()=>{this.stopListening(o,"change:isSticky",e)}),20)}}_initDialogPluginIntegration(){if(!this.editor.plugins.has("Dialog"))return;const t=this.view.stickyPanel,i=this.editor.plugins.get("Dialog");i.on("show",(()=>{const o=i.view;o.on("moveTo",((i,r)=>{if(!t.isSticky||o.wasMoved)return;const c=new n.Rect(t.contentPanelElement);r[1]<c.bottom+e.DialogView.defaultOffset&&(r[1]=c.bottom+e.DialogView.defaultOffset)}),{priority:"high"})}),{priority:"low"})}}var c=i(591),a=i.n(c),s=i(662),l={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};a()(s.A,l);s.A.locals;class d extends e.BoxedEditorUIView{constructor(t,i,o={}){super(t),this.stickyPanel=new e.StickyPanelView(t),this.toolbar=new e.ToolbarView(t,{shouldGroupWhenFull:o.shouldToolbarGroupWhenFull}),o.useMenuBar&&(this.menuBarView=new e.MenuBarView(t)),this.editable=new e.InlineEditableUIView(t,i)}render(){super.render(),this.menuBarView?this.stickyPanel.content.addMany([this.menuBarView,this.toolbar]):this.stickyPanel.content.add(this.toolbar),this.top.add(this.stickyPanel),this.main.add(this.editable)}}var u=i(782);const h=function(e){return null!=e&&"object"==typeof e};const p="object"==typeof global&&global&&global.Object===Object&&global;var f="object"==typeof self&&self&&self.Object===Object&&self;const b=(p||f||Function("return this")()).Symbol;var k=Object.prototype,v=k.hasOwnProperty,m=k.toString,g=b?b.toStringTag:void 0;const y=function(e){var t=v.call(e,g),i=e[g];try{e[g]=void 0;var o=!0}catch(e){}var n=m.call(e);return o&&(t?e[g]=i:delete e[g]),n};var w=Object.prototype.toString;const _=function(e){return w.call(e)};var T=b?b.toStringTag:void 0;const S=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":T&&T in Object(e)?y(e):_(e)};const j=function(e,t){return function(i){return e(t(i))}}(Object.getPrototypeOf,Object);var O=Function.prototype,P=Object.prototype,E=O.toString,x=P.hasOwnProperty,C=E.call(Object);const M=function(e){if(!h(e)||"[object Object]"!=S(e))return!1;var t=j(e);if(null===t)return!0;var i=x.call(t,"constructor")&&t.constructor;return"function"==typeof i&&i instanceof i&&E.call(i)==C};const B=function(e){return h(e)&&1===e.nodeType&&!M(e)};class D extends((0,u.ElementApiMixin)(u.Editor)){constructor(e,t={}){if(!F(e)&&void 0!==t.initialData)throw new n.CKEditorError("editor-create-initial-data",null);super(t),this.config.define("menuBar.isVisible",!1),void 0===this.config.get("initialData")&&this.config.set("initialData",function(e){return F(e)?(0,n.getDataFromElement)(e):e}(e)),F(e)&&(this.sourceElement=e),this.model.document.createRoot();const i=!this.config.get("toolbar.shouldNotGroupWhenFull"),o=this.config.get("menuBar"),c=new d(this.locale,this.editing.view,{shouldToolbarGroupWhenFull:i,useMenuBar:o.isVisible});this.ui=new r(this,c),(0,u.attachToForm)(this)}destroy(){return this.sourceElement&&this.updateSourceElement(),this.ui.destroy(),super.destroy()}static create(e,t={}){return new Promise((i=>{const o=new this(e,t);i(o.initPlugins().then((()=>o.ui.init(F(e)?e:null))).then((()=>o.data.init(o.config.get("initialData")))).then((()=>o.fire("ready"))).then((()=>o)))}))}}function F(e){return B(e)}})(),(window.CKEditor5=window.CKEditor5||{}).editorClassic=o})();
4
+ */(()=>{var e={662:(e,t,o)=>{"use strict";o.d(t,{A:()=>r});var i=o(935),n=o.n(i)()((function(e){return e[1]}));n.push([e.id,".ck.ck-editor{position:relative}.ck.ck-editor .ck-editor__top .ck-sticky-panel .ck-toolbar{z-index:var(--ck-z-panel)}.ck.ck-editor__top .ck-sticky-panel .ck-sticky-panel__content{border-radius:0}.ck-rounded-corners .ck.ck-editor__top .ck-sticky-panel .ck-sticky-panel__content,.ck.ck-editor__top .ck-sticky-panel .ck-sticky-panel__content.ck-rounded-corners{border-radius:var(--ck-border-radius);border-bottom-left-radius:0;border-bottom-right-radius:0}.ck.ck-editor__top .ck-sticky-panel .ck-sticky-panel__content{border:solid var(--ck-color-base-border);border-width:1px 1px 0}.ck.ck-editor__top .ck-sticky-panel .ck-sticky-panel__content.ck-sticky-panel__content_sticky{border-bottom-width:1px}.ck.ck-editor__top .ck-sticky-panel .ck-sticky-panel__content .ck-menu-bar,.ck.ck-editor__top .ck-sticky-panel .ck-sticky-panel__content .ck-toolbar{border:0}.ck.ck-editor__main>.ck-editor__editable{background:var(--ck-color-base-background);border-radius:0}.ck-rounded-corners .ck.ck-editor__main>.ck-editor__editable,.ck.ck-editor__main>.ck-editor__editable.ck-rounded-corners{border-radius:var(--ck-border-radius);border-top-left-radius:0;border-top-right-radius:0}.ck.ck-editor__main>.ck-editor__editable:not(.ck-focused){border-color:var(--ck-color-base-border)}",""]);const r=n},935:e=>{"use strict";e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var o=e(t);return t[2]?"@media ".concat(t[2]," {").concat(o,"}"):o})).join("")},t.i=function(e,o,i){"string"==typeof e&&(e=[[null,e,""]]);var n={};if(i)for(var r=0;r<this.length;r++){var c=this[r][0];null!=c&&(n[c]=!0)}for(var a=0;a<e.length;a++){var s=[].concat(e[a]);i&&n[s[0]]||(o&&(s[2]?s[2]="".concat(o," and ").concat(s[2]):s[2]=o),t.push(s))}},t}},591:(e,t,o)=>{"use strict";var i,n=function(){return void 0===i&&(i=Boolean(window&&document&&document.all&&!window.atob)),i},r=function(){var e={};return function(t){if(void 0===e[t]){var o=document.querySelector(t);if(window.HTMLIFrameElement&&o instanceof window.HTMLIFrameElement)try{o=o.contentDocument.head}catch(e){o=null}e[t]=o}return e[t]}}(),c=[];function a(e){for(var t=-1,o=0;o<c.length;o++)if(c[o].identifier===e){t=o;break}return t}function s(e,t){for(var o={},i=[],n=0;n<e.length;n++){var r=e[n],s=t.base?r[0]+t.base:r[0],l=o[s]||0,d="".concat(s," ").concat(l);o[s]=l+1;var u=a(d),h={css:r[1],media:r[2],sourceMap:r[3]};-1!==u?(c[u].references++,c[u].updater(h)):c.push({identifier:d,updater:k(h,t),references:1}),i.push(d)}return i}function l(e){var t=document.createElement("style"),i=e.attributes||{};if(void 0===i.nonce){var n=o.nc;n&&(i.nonce=n)}if(Object.keys(i).forEach((function(e){t.setAttribute(e,i[e])})),"function"==typeof e.insert)e.insert(t);else{var c=r(e.insert||"head");if(!c)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");c.appendChild(t)}return t}var d,u=(d=[],function(e,t){return d[e]=t,d.filter(Boolean).join("\n")});function h(e,t,o,i){var n=o?"":i.media?"@media ".concat(i.media," {").concat(i.css,"}"):i.css;if(e.styleSheet)e.styleSheet.cssText=u(t,n);else{var r=document.createTextNode(n),c=e.childNodes;c[t]&&e.removeChild(c[t]),c.length?e.insertBefore(r,c[t]):e.appendChild(r)}}function p(e,t,o){var i=o.css,n=o.media,r=o.sourceMap;if(n?e.setAttribute("media",n):e.removeAttribute("media"),r&&"undefined"!=typeof btoa&&(i+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(r))))," */")),e.styleSheet)e.styleSheet.cssText=i;else{for(;e.firstChild;)e.removeChild(e.firstChild);e.appendChild(document.createTextNode(i))}}var f=null,b=0;function k(e,t){var o,i,n;if(t.singleton){var r=b++;o=f||(f=l(t)),i=h.bind(null,o,r,!1),n=h.bind(null,o,r,!0)}else o=l(t),i=p.bind(null,o,t),n=function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(o)};return i(e),function(t){if(t){if(t.css===e.css&&t.media===e.media&&t.sourceMap===e.sourceMap)return;i(e=t)}else n()}}e.exports=function(e,t){(t=t||{}).singleton||"boolean"==typeof t.singleton||(t.singleton=n());var o=s(e=e||[],t);return function(e){if(e=e||[],"[object Array]"===Object.prototype.toString.call(e)){for(var i=0;i<o.length;i++){var n=a(o[i]);c[n].references--}for(var r=s(e,t),l=0;l<o.length;l++){var d=a(o[l]);0===c[d].references&&(c[d].updater(),c.splice(d,1))}o=r}}}},782:(e,t,o)=>{e.exports=o(237)("./src/core.js")},783:(e,t,o)=>{e.exports=o(237)("./src/engine.js")},311:(e,t,o)=>{e.exports=o(237)("./src/ui.js")},584:(e,t,o)=>{e.exports=o(237)("./src/utils.js")},602:(e,t,o)=>{e.exports=o(237)("./src/watchdog.js")},237:e=>{"use strict";e.exports=CKEditor5.dll}},t={};function o(i){var n=t[i];if(void 0!==n)return n.exports;var r=t[i]={id:i,exports:{}};return e[i](r,r.exports,o),r.exports}o.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return o.d(t,{a:t}),t},o.d=(e,t)=>{for(var i in t)o.o(t,i)&&!o.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:t[i]})},o.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),o.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},o.nc=void 0;var i={};(()=>{"use strict";o.r(i),o.d(i,{ClassicEditor:()=>V});var e=o(311),t=o(783),n=o(584);class r extends e.EditorUI{constructor(t,o){super(t),this.view=o,this._toolbarConfig=(0,e.normalizeToolbarConfig)(t.config.get("toolbar")),this._elementReplacer=new n.ElementReplacer,this.listenTo(t.editing.view,"scrollToTheSelection",this._handleScrollToTheSelectionWithStickyPanel.bind(this))}get element(){return this.view.element}init(t){const o=this.editor,i=this.view,n=o.editing.view,r=i.editable,c=n.document.getRoot();r.name=c.rootName,i.render();const a=r.element;this.setEditableElement(r.name,a),i.editable.bind("isFocused").to(this.focusTracker),n.attachDomRoot(a),t&&this._elementReplacer.replace(t,this.element),this._initPlaceholder(),this._initToolbar(),i.menuBarView&&(0,e._initMenuBar)(o,i.menuBarView),this._initDialogPluginIntegration(),this.fire("ready")}destroy(){super.destroy();const e=this.view,t=this.editor.editing.view;this._elementReplacer.restore(),t.detachDomRoot(e.editable.name),e.destroy()}_initToolbar(){const e=this.view;e.stickyPanel.bind("isActive").to(this.focusTracker,"isFocused"),e.stickyPanel.limiterElement=e.element,e.stickyPanel.bind("viewportTopOffset").to(this,"viewportOffset",(({top:e})=>e||0)),e.toolbar.fillFromConfig(this._toolbarConfig,this.componentFactory),this.addToolbar(e.toolbar)}_initPlaceholder(){const e=this.editor,o=e.editing.view,i=o.document.getRoot(),n=e.sourceElement;let r;const c=e.config.get("placeholder");c&&(r="string"==typeof c?c:c[this.view.editable.name]),!r&&n&&"textarea"===n.tagName.toLowerCase()&&(r=n.getAttribute("placeholder")),r&&(i.placeholder=r),(0,t.enablePlaceholder)({view:o,element:i,isDirectHost:!1,keepOnFocus:!0})}_handleScrollToTheSelectionWithStickyPanel(e,t,o){const i=this.view.stickyPanel;if(i.isSticky){const e=new n.Rect(i.element).height;t.viewportOffset.top+=e}else{const e=()=>{this.editor.editing.view.scrollToTheSelection(o)};this.listenTo(i,"change:isSticky",e),setTimeout((()=>{this.stopListening(i,"change:isSticky",e)}),20)}}_initDialogPluginIntegration(){if(!this.editor.plugins.has("Dialog"))return;const t=this.view.stickyPanel,o=this.editor.plugins.get("Dialog");o.on("show",(()=>{const i=o.view;i.on("moveTo",((o,r)=>{if(!t.isSticky||i.wasMoved)return;const c=new n.Rect(t.contentPanelElement);r[1]<c.bottom+e.DialogView.defaultOffset&&(r[1]=c.bottom+e.DialogView.defaultOffset)}),{priority:"high"})}),{priority:"low"})}}var c=o(591),a=o.n(c),s=o(662),l={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};a()(s.A,l);s.A.locals;class d extends e.BoxedEditorUIView{constructor(t,o,i={}){super(t),this.stickyPanel=new e.StickyPanelView(t),this.toolbar=new e.ToolbarView(t,{shouldGroupWhenFull:i.shouldToolbarGroupWhenFull}),i.useMenuBar&&(this.menuBarView=new e.MenuBarView(t)),this.editable=new e.InlineEditableUIView(t,o)}render(){super.render(),this.menuBarView?this.stickyPanel.content.addMany([this.menuBarView,this.toolbar]):this.stickyPanel.content.add(this.toolbar),this.top.add(this.stickyPanel),this.main.add(this.editable)}}var u=o(782),h=o(602);const p=function(e){return null!=e&&"object"==typeof e};const f="object"==typeof global&&global&&global.Object===Object&&global;var b="object"==typeof self&&self&&self.Object===Object&&self;const k=(f||b||Function("return this")()).Symbol;var g=Object.prototype,v=g.hasOwnProperty,m=g.toString,y=k?k.toStringTag:void 0;const w=function(e){var t=v.call(e,y),o=e[y];try{e[y]=void 0;var i=!0}catch(e){}var n=m.call(e);return i&&(t?e[y]=o:delete e[y]),n};var _=Object.prototype.toString;const T=function(e){return _.call(e)};var j=k?k.toStringTag:void 0;const S=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":j&&j in Object(e)?w(e):T(e)};const x=function(e,t){return function(o){return e(t(o))}}(Object.getPrototypeOf,Object);var O=Function.prototype,E=Object.prototype,P=O.toString,C=E.hasOwnProperty,M=P.call(Object);const B=function(e){if(!p(e)||"[object Object]"!=S(e))return!1;var t=x(e);if(null===t)return!0;var o=C.call(t,"constructor")&&t.constructor;return"function"==typeof o&&o instanceof o&&P.call(o)==M};const D=function(e){return p(e)&&1===e.nodeType&&!B(e)};class F extends((0,u.ElementApiMixin)(u.Editor)){constructor(e,t={}){if(!R(e)&&void 0!==t.initialData)throw new n.CKEditorError("editor-create-initial-data",null);super(t),this.config.define("menuBar.isVisible",!1),void 0===this.config.get("initialData")&&this.config.set("initialData",function(e){return R(e)?(0,n.getDataFromElement)(e):e}(e)),R(e)&&(this.sourceElement=e),this.model.document.createRoot();const o=!this.config.get("toolbar.shouldNotGroupWhenFull"),i=this.config.get("menuBar"),c=new d(this.locale,this.editing.view,{shouldToolbarGroupWhenFull:o,useMenuBar:i.isVisible});this.ui=new r(this,c),(0,u.attachToForm)(this)}destroy(){return this.sourceElement&&this.updateSourceElement(),this.ui.destroy(),super.destroy()}static create(e,t={}){return new Promise((o=>{const i=new this(e,t);o(i.initPlugins().then((()=>i.ui.init(R(e)?e:null))).then((()=>i.data.init(i.config.get("initialData")))).then((()=>i.fire("ready"))).then((()=>i)))}))}}F.Context=u.Context,F.EditorWatchdog=h.EditorWatchdog,F.ContextWatchdog=h.ContextWatchdog;const V=F;function R(e){return D(e)}})(),(window.CKEditor5=window.CKEditor5||{}).editorClassic=i})();
package/dist/index.js CHANGED
@@ -2,46 +2,24 @@
2
2
  * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
3
3
  * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4
4
  */
5
- import { EditorUI, normalizeToolbarConfig, _initMenuBar, DialogView, BoxedEditorUIView, StickyPanelView, ToolbarView, MenuBarView, InlineEditableUIView } from '@ckeditor/ckeditor5-ui/dist/index.js';
5
+ import { EditorUI, _initMenuBar, DialogView, normalizeToolbarConfig, BoxedEditorUIView, StickyPanelView, ToolbarView, MenuBarView, InlineEditableUIView } from '@ckeditor/ckeditor5-ui/dist/index.js';
6
6
  import { enablePlaceholder } from '@ckeditor/ckeditor5-engine/dist/index.js';
7
- import { ElementReplacer, Rect, CKEditorError, getDataFromElement } from '@ckeditor/ckeditor5-utils/dist/index.js';
8
- import { ElementApiMixin, Editor, attachToForm } from '@ckeditor/ckeditor5-core/dist/index.js';
7
+ import { Rect, ElementReplacer, CKEditorError, getDataFromElement } from '@ckeditor/ckeditor5-utils/dist/index.js';
8
+ import { ElementApiMixin, Editor, attachToForm, Context } from '@ckeditor/ckeditor5-core/dist/index.js';
9
+ import { EditorWatchdog, ContextWatchdog } from '@ckeditor/ckeditor5-watchdog/dist/index.js';
9
10
  import { isElement as isElement$1 } from 'lodash-es';
10
11
 
11
- /**
12
- * The classic editor UI class.
13
- */ class ClassicEditorUI extends EditorUI {
14
- /**
15
- * The main (top–most) view of the editor UI.
16
- */ view;
17
- /**
18
- * A normalized `config.toolbar` object.
19
- */ _toolbarConfig;
20
- /**
21
- * The element replacer instance used to hide the editor's source element.
22
- */ _elementReplacer;
23
- /**
24
- * Creates an instance of the classic editor UI class.
25
- *
26
- * @param editor The editor instance.
27
- * @param view The view of the UI.
28
- */ constructor(editor, view){
29
- super(editor);
30
- this.view = view;
31
- this._toolbarConfig = normalizeToolbarConfig(editor.config.get('toolbar'));
32
- this._elementReplacer = new ElementReplacer();
33
- this.listenTo(editor.editing.view, 'scrollToTheSelection', this._handleScrollToTheSelectionWithStickyPanel.bind(this));
34
- }
12
+ class ClassicEditorUI extends EditorUI {
35
13
  /**
36
- * @inheritDoc
37
- */ get element() {
14
+ * @inheritDoc
15
+ */ get element() {
38
16
  return this.view.element;
39
17
  }
40
18
  /**
41
- * Initializes the UI.
42
- *
43
- * @param replacementElement The DOM element that will be the source for the created editor.
44
- */ init(replacementElement) {
19
+ * Initializes the UI.
20
+ *
21
+ * @param replacementElement The DOM element that will be the source for the created editor.
22
+ */ init(replacementElement) {
45
23
  const editor = this.editor;
46
24
  const view = this.view;
47
25
  const editingView = editor.editing.view;
@@ -83,8 +61,8 @@ import { isElement as isElement$1 } from 'lodash-es';
83
61
  this.fire('ready');
84
62
  }
85
63
  /**
86
- * @inheritDoc
87
- */ destroy() {
64
+ * @inheritDoc
65
+ */ destroy() {
88
66
  super.destroy();
89
67
  const view = this.view;
90
68
  const editingView = this.editor.editing.view;
@@ -93,8 +71,8 @@ import { isElement as isElement$1 } from 'lodash-es';
93
71
  view.destroy();
94
72
  }
95
73
  /**
96
- * Initializes the editor toolbar.
97
- */ _initToolbar() {
74
+ * Initializes the editor toolbar.
75
+ */ _initToolbar() {
98
76
  const view = this.view;
99
77
  // Set–up the sticky panel with toolbar.
100
78
  view.stickyPanel.bind('isActive').to(this.focusTracker, 'isFocused');
@@ -105,8 +83,8 @@ import { isElement as isElement$1 } from 'lodash-es';
105
83
  this.addToolbar(view.toolbar);
106
84
  }
107
85
  /**
108
- * Enable the placeholder text on the editing root.
109
- */ _initPlaceholder() {
86
+ * Enable the placeholder text on the editing root.
87
+ */ _initPlaceholder() {
110
88
  const editor = this.editor;
111
89
  const editingView = editor.editing.view;
112
90
  const editingRoot = editingView.document.getRoot();
@@ -130,15 +108,15 @@ import { isElement as isElement$1 } from 'lodash-es';
130
108
  });
131
109
  }
132
110
  /**
133
- * Provides an integration between the sticky toolbar and {@link module:utils/dom/scroll~scrollViewportToShowTarget}.
134
- * It allows the UI-agnostic engine method to consider the geometry of the
135
- * {@link module:editor-classic/classiceditoruiview~ClassicEditorUIView#stickyPanel} that pins to the
136
- * edge of the viewport and can obscure the user caret after scrolling the window.
137
- *
138
- * @param evt The `scrollToTheSelection` event info.
139
- * @param data The payload carried by the `scrollToTheSelection` event.
140
- * @param originalArgs The original arguments passed to `scrollViewportToShowTarget()` method (see implementation to learn more).
141
- */ _handleScrollToTheSelectionWithStickyPanel(evt, data, originalArgs) {
111
+ * Provides an integration between the sticky toolbar and {@link module:utils/dom/scroll~scrollViewportToShowTarget}.
112
+ * It allows the UI-agnostic engine method to consider the geometry of the
113
+ * {@link module:editor-classic/classiceditoruiview~ClassicEditorUIView#stickyPanel} that pins to the
114
+ * edge of the viewport and can obscure the user caret after scrolling the window.
115
+ *
116
+ * @param evt The `scrollToTheSelection` event info.
117
+ * @param data The payload carried by the `scrollToTheSelection` event.
118
+ * @param originalArgs The original arguments passed to `scrollViewportToShowTarget()` method (see implementation to learn more).
119
+ */ _handleScrollToTheSelectionWithStickyPanel(evt, data, originalArgs) {
142
120
  const stickyPanel = this.view.stickyPanel;
143
121
  if (stickyPanel.isSticky) {
144
122
  const stickyPanelHeight = new Rect(stickyPanel.element).height;
@@ -156,12 +134,12 @@ import { isElement as isElement$1 } from 'lodash-es';
156
134
  }
157
135
  }
158
136
  /**
159
- * Provides an integration between the sticky toolbar and {@link module:ui/dialog/dialog the Dialog plugin}.
160
- *
161
- * It moves the dialog down to ensure that the
162
- * {@link module:editor-classic/classiceditoruiview~ClassicEditorUIView#stickyPanel sticky panel}
163
- * used by the editor UI will not get obscured by the dialog when the dialog uses one of its automatic positions.
164
- */ _initDialogPluginIntegration() {
137
+ * Provides an integration between the sticky toolbar and {@link module:ui/dialog/dialog the Dialog plugin}.
138
+ *
139
+ * It moves the dialog down to ensure that the
140
+ * {@link module:editor-classic/classiceditoruiview~ClassicEditorUIView#stickyPanel sticky panel}
141
+ * used by the editor UI will not get obscured by the dialog when the dialog uses one of its automatic positions.
142
+ */ _initDialogPluginIntegration() {
165
143
  if (!this.editor.plugins.has('Dialog')) {
166
144
  return;
167
145
  }
@@ -185,48 +163,24 @@ import { isElement as isElement$1 } from 'lodash-es';
185
163
  priority: 'low'
186
164
  });
187
165
  }
188
- }
189
-
190
- /**
191
- * Classic editor UI view. Uses an inline editable and a sticky toolbar, all
192
- * enclosed in a boxed UI view.
193
- */ class ClassicEditorUIView extends BoxedEditorUIView {
194
- /**
195
- * Sticky panel view instance. This is a parent view of a {@link #toolbar}
196
- * that makes toolbar sticky.
197
- */ stickyPanel;
198
166
  /**
199
- * Toolbar view instance.
200
- */ toolbar;
201
- /**
202
- * Menu bar view instance.
203
- */ menuBarView;
204
- /**
205
- * Editable UI view.
206
- */ editable;
207
- /**
208
- * Creates an instance of the classic editor UI view.
209
- *
210
- * @param locale The {@link module:core/editor/editor~Editor#locale} instance.
211
- * @param editingView The editing view instance this view is related to.
212
- * @param options Configuration options for the view instance.
213
- * @param options.shouldToolbarGroupWhenFull When set `true` enables automatic items grouping
214
- * in the main {@link module:editor-classic/classiceditoruiview~ClassicEditorUIView#toolbar toolbar}.
215
- * See {@link module:ui/toolbar/toolbarview~ToolbarOptions#shouldGroupWhenFull} to learn more.
216
- */ constructor(locale, editingView, options = {}){
217
- super(locale);
218
- this.stickyPanel = new StickyPanelView(locale);
219
- this.toolbar = new ToolbarView(locale, {
220
- shouldGroupWhenFull: options.shouldToolbarGroupWhenFull
221
- });
222
- if (options.useMenuBar) {
223
- this.menuBarView = new MenuBarView(locale);
224
- }
225
- this.editable = new InlineEditableUIView(locale, editingView);
167
+ * Creates an instance of the classic editor UI class.
168
+ *
169
+ * @param editor The editor instance.
170
+ * @param view The view of the UI.
171
+ */ constructor(editor, view){
172
+ super(editor);
173
+ this.view = view;
174
+ this._toolbarConfig = normalizeToolbarConfig(editor.config.get('toolbar'));
175
+ this._elementReplacer = new ElementReplacer();
176
+ this.listenTo(editor.editing.view, 'scrollToTheSelection', this._handleScrollToTheSelectionWithStickyPanel.bind(this));
226
177
  }
178
+ }
179
+
180
+ class ClassicEditorUIView extends BoxedEditorUIView {
227
181
  /**
228
- * @inheritDoc
229
- */ render() {
182
+ * @inheritDoc
183
+ */ render() {
230
184
  super.render();
231
185
  if (this.menuBarView) {
232
186
  // Set toolbar as a child of a stickyPanel and makes toolbar sticky.
@@ -240,29 +194,180 @@ import { isElement as isElement$1 } from 'lodash-es';
240
194
  this.top.add(this.stickyPanel);
241
195
  this.main.add(this.editable);
242
196
  }
197
+ /**
198
+ * Creates an instance of the classic editor UI view.
199
+ *
200
+ * @param locale The {@link module:core/editor/editor~Editor#locale} instance.
201
+ * @param editingView The editing view instance this view is related to.
202
+ * @param options Configuration options for the view instance.
203
+ * @param options.shouldToolbarGroupWhenFull When set `true` enables automatic items grouping
204
+ * in the main {@link module:editor-classic/classiceditoruiview~ClassicEditorUIView#toolbar toolbar}.
205
+ * See {@link module:ui/toolbar/toolbarview~ToolbarOptions#shouldGroupWhenFull} to learn more.
206
+ */ constructor(locale, editingView, options = {}){
207
+ super(locale);
208
+ this.stickyPanel = new StickyPanelView(locale);
209
+ this.toolbar = new ToolbarView(locale, {
210
+ shouldGroupWhenFull: options.shouldToolbarGroupWhenFull
211
+ });
212
+ if (options.useMenuBar) {
213
+ this.menuBarView = new MenuBarView(locale);
214
+ }
215
+ this.editable = new InlineEditableUIView(locale, editingView);
216
+ }
243
217
  }
244
218
 
245
219
  /**
246
- * The classic editor implementation. It uses an inline editable and a sticky toolbar, all enclosed in a boxed UI.
220
+ * The {@glink installation/getting-started/predefined-builds#classic-editor classic editor} implementation.
221
+ * It uses an inline editable and a sticky toolbar, all enclosed in a boxed UI.
247
222
  * See the {@glink examples/builds/classic-editor demo}.
248
223
  *
249
224
  * In order to create a classic editor instance, use the static
250
225
  * {@link module:editor-classic/classiceditor~ClassicEditor.create `ClassicEditor.create()`} method.
251
- */ class ClassicEditor extends /* #__PURE__ */ ElementApiMixin(Editor) {
226
+ *
227
+ * # Classic editor and classic build
228
+ *
229
+ * The classic editor can be used directly from source (if you installed the
230
+ * [`@ckeditor/ckeditor5-editor-classic`](https://www.npmjs.com/package/@ckeditor/ckeditor5-editor-classic) package)
231
+ * but it is also available in the {@glink installation/getting-started/predefined-builds#classic-editor classic build}.
232
+ *
233
+ * {@glink installation/getting-started/predefined-builds Builds}
234
+ * are ready-to-use editors with plugins bundled in. When using the editor from
235
+ * source you need to take care of loading all plugins by yourself
236
+ * (through the {@link module:core/editor/editorconfig~EditorConfig#plugins `config.plugins`} option).
237
+ * Using the editor from source gives much better flexibility and allows easier customization.
238
+ *
239
+ * Read more about initializing the editor from source or as a build in
240
+ * {@link module:editor-classic/classiceditor~ClassicEditor.create `ClassicEditor.create()`}.
241
+ */ class ClassicEditor extends ElementApiMixin(Editor) {
242
+ /**
243
+ * Destroys the editor instance, releasing all resources used by it.
244
+ *
245
+ * Updates the original editor element with the data if the
246
+ * {@link module:core/editor/editorconfig~EditorConfig#updateSourceElementOnDestroy `updateSourceElementOnDestroy`}
247
+ * configuration option is set to `true`.
248
+ */ destroy() {
249
+ if (this.sourceElement) {
250
+ this.updateSourceElement();
251
+ }
252
+ this.ui.destroy();
253
+ return super.destroy();
254
+ }
252
255
  /**
253
- * @inheritDoc
254
- */ ui;
256
+ * Creates a new classic editor instance.
257
+ *
258
+ * There are three ways how the editor can be initialized.
259
+ *
260
+ * # Replacing a DOM element (and loading data from it)
261
+ *
262
+ * You can initialize the editor using an existing DOM element:
263
+ *
264
+ * ```ts
265
+ * ClassicEditor
266
+ * .create( document.querySelector( '#editor' ) )
267
+ * .then( editor => {
268
+ * console.log( 'Editor was initialized', editor );
269
+ * } )
270
+ * .catch( err => {
271
+ * console.error( err.stack );
272
+ * } );
273
+ * ```
274
+ *
275
+ * The element's content will be used as the editor data and the element will be replaced by the editor UI.
276
+ *
277
+ * # Creating a detached editor
278
+ *
279
+ * Alternatively, you can initialize the editor by passing the initial data directly as a string.
280
+ * In this case, the editor will render an element that must be inserted into the DOM:
281
+ *
282
+ * ```ts
283
+ * ClassicEditor
284
+ * .create( '<p>Hello world!</p>' )
285
+ * .then( editor => {
286
+ * console.log( 'Editor was initialized', editor );
287
+ *
288
+ * // Initial data was provided so the editor UI element needs to be added manually to the DOM.
289
+ * document.body.appendChild( editor.ui.element );
290
+ * } )
291
+ * .catch( err => {
292
+ * console.error( err.stack );
293
+ * } );
294
+ * ```
295
+ *
296
+ * This lets you dynamically append the editor to your web page whenever it is convenient for you. You may use this method if your
297
+ * web page content is generated on the client side and the DOM structure is not ready at the moment when you initialize the editor.
298
+ *
299
+ * # Replacing a DOM element (and data provided in `config.initialData`)
300
+ *
301
+ * You can also mix these two ways by providing a DOM element to be used and passing the initial data through the configuration:
302
+ *
303
+ * ```ts
304
+ * ClassicEditor
305
+ * .create( document.querySelector( '#editor' ), {
306
+ * initialData: '<h2>Initial data</h2><p>Foo bar.</p>'
307
+ * } )
308
+ * .then( editor => {
309
+ * console.log( 'Editor was initialized', editor );
310
+ * } )
311
+ * .catch( err => {
312
+ * console.error( err.stack );
313
+ * } );
314
+ * ```
315
+ *
316
+ * This method can be used to initialize the editor on an existing element with the specified content in case if your integration
317
+ * makes it difficult to set the content of the source element.
318
+ *
319
+ * Note that an error will be thrown if you pass the initial data both as the first parameter and also in the configuration.
320
+ *
321
+ * # Configuring the editor
322
+ *
323
+ * See the {@link module:core/editor/editorconfig~EditorConfig editor configuration documentation} to learn more about
324
+ * customizing plugins, toolbar and more.
325
+ *
326
+ * # Using the editor from source
327
+ *
328
+ * The code samples listed in the previous sections of this documentation assume that you are using an
329
+ * {@glink installation/getting-started/predefined-builds editor build} (for example – `@ckeditor/ckeditor5-build-classic`).
330
+ *
331
+ * If you want to use the classic editor from source (`@ckeditor/ckeditor5-editor-classic/src/classiceditor`),
332
+ * you need to define the list of
333
+ * {@link module:core/editor/editorconfig~EditorConfig#plugins plugins to be initialized} and
334
+ * {@link module:core/editor/editorconfig~EditorConfig#toolbar toolbar items}. Read more about using the editor from
335
+ * source in the {@glink installation/advanced/alternative-setups/integrating-from-source-webpack dedicated guide}.
336
+ *
337
+ * @param sourceElementOrData The DOM element that will be the source for the created editor
338
+ * or the editor's initial data.
339
+ *
340
+ * If a DOM element is passed, its content will be automatically loaded to the editor upon initialization
341
+ * and the {@link module:editor-classic/classiceditorui~ClassicEditorUI#element editor element} will replace the passed element
342
+ * in the DOM (the original one will be hidden and the editor will be injected next to it).
343
+ *
344
+ * If the {@link module:core/editor/editorconfig~EditorConfig#updateSourceElementOnDestroy updateSourceElementOnDestroy}
345
+ * option is set to `true`, the editor data will be set back to the original element once the editor is destroyed and when a form,
346
+ * in which this element is contained, is submitted (if the original element is a `<textarea>`). This ensures seamless integration
347
+ * with native web forms.
348
+ *
349
+ * If the initial data is passed, a detached editor will be created. In this case you need to insert it into the DOM manually.
350
+ * It is available under the {@link module:editor-classic/classiceditorui~ClassicEditorUI#element `editor.ui.element`} property.
351
+ *
352
+ * @param config The editor configuration.
353
+ * @returns A promise resolved once the editor is ready. The promise resolves with the created editor instance.
354
+ */ static create(sourceElementOrData, config = {}) {
355
+ return new Promise((resolve)=>{
356
+ const editor = new this(sourceElementOrData, config);
357
+ resolve(editor.initPlugins().then(()=>editor.ui.init(isElement(sourceElementOrData) ? sourceElementOrData : null)).then(()=>editor.data.init(editor.config.get('initialData'))).then(()=>editor.fire('ready')).then(()=>editor));
358
+ });
359
+ }
255
360
  /**
256
- * Creates an instance of the classic editor.
257
- *
258
- * **Note:** do not use the constructor to create editor instances. Use the static
259
- * {@link module:editor-classic/classiceditor~ClassicEditor.create `ClassicEditor.create()`} method instead.
260
- *
261
- * @param sourceElementOrData The DOM element that will be the source for the created editor
262
- * or the editor's initial data. For more information see
263
- * {@link module:editor-classic/classiceditor~ClassicEditor.create `ClassicEditor.create()`}.
264
- * @param config The editor configuration.
265
- */ constructor(sourceElementOrData, config = {}){
361
+ * Creates an instance of the classic editor.
362
+ *
363
+ * **Note:** do not use the constructor to create editor instances. Use the static
364
+ * {@link module:editor-classic/classiceditor~ClassicEditor.create `ClassicEditor.create()`} method instead.
365
+ *
366
+ * @param sourceElementOrData The DOM element that will be the source for the created editor
367
+ * or the editor's initial data. For more information see
368
+ * {@link module:editor-classic/classiceditor~ClassicEditor.create `ClassicEditor.create()`}.
369
+ * @param config The editor configuration.
370
+ */ constructor(sourceElementOrData, config = {}){
266
371
  // If both `config.initialData` is set and initial data is passed as the constructor parameter, then throw.
267
372
  if (!isElement(sourceElementOrData) && config.initialData !== undefined) {
268
373
  // Documented in core/editor/editorconfig.jsdoc.
@@ -287,114 +392,22 @@ import { isElement as isElement$1 } from 'lodash-es';
287
392
  this.ui = new ClassicEditorUI(this, view);
288
393
  attachToForm(this);
289
394
  }
290
- /**
291
- * Destroys the editor instance, releasing all resources used by it.
292
- *
293
- * Updates the original editor element with the data if the
294
- * {@link module:core/editor/editorconfig~EditorConfig#updateSourceElementOnDestroy `updateSourceElementOnDestroy`}
295
- * configuration option is set to `true`.
296
- */ destroy() {
297
- if (this.sourceElement) {
298
- this.updateSourceElement();
299
- }
300
- this.ui.destroy();
301
- return super.destroy();
302
- }
303
- /**
304
- * Creates a new classic editor instance.
305
- *
306
- * There are three ways how the editor can be initialized.
307
- *
308
- * # Replacing a DOM element (and loading data from it)
309
- *
310
- * You can initialize the editor using an existing DOM element:
311
- *
312
- * ```ts
313
- * ClassicEditor
314
- * .create( document.querySelector( '#editor' ) )
315
- * .then( editor => {
316
- * console.log( 'Editor was initialized', editor );
317
- * } )
318
- * .catch( err => {
319
- * console.error( err.stack );
320
- * } );
321
- * ```
322
- *
323
- * The element's content will be used as the editor data and the element will be replaced by the editor UI.
324
- *
325
- * # Creating a detached editor
326
- *
327
- * Alternatively, you can initialize the editor by passing the initial data directly as a string.
328
- * In this case, the editor will render an element that must be inserted into the DOM:
329
- *
330
- * ```ts
331
- * ClassicEditor
332
- * .create( '<p>Hello world!</p>' )
333
- * .then( editor => {
334
- * console.log( 'Editor was initialized', editor );
335
- *
336
- * // Initial data was provided so the editor UI element needs to be added manually to the DOM.
337
- * document.body.appendChild( editor.ui.element );
338
- * } )
339
- * .catch( err => {
340
- * console.error( err.stack );
341
- * } );
342
- * ```
343
- *
344
- * This lets you dynamically append the editor to your web page whenever it is convenient for you. You may use this method if your
345
- * web page content is generated on the client side and the DOM structure is not ready at the moment when you initialize the editor.
346
- *
347
- * # Replacing a DOM element (and data provided in `config.initialData`)
348
- *
349
- * You can also mix these two ways by providing a DOM element to be used and passing the initial data through the configuration:
350
- *
351
- * ```ts
352
- * ClassicEditor
353
- * .create( document.querySelector( '#editor' ), {
354
- * initialData: '<h2>Initial data</h2><p>Foo bar.</p>'
355
- * } )
356
- * .then( editor => {
357
- * console.log( 'Editor was initialized', editor );
358
- * } )
359
- * .catch( err => {
360
- * console.error( err.stack );
361
- * } );
362
- * ```
363
- *
364
- * This method can be used to initialize the editor on an existing element with the specified content in case if your integration
365
- * makes it difficult to set the content of the source element.
366
- *
367
- * Note that an error will be thrown if you pass the initial data both as the first parameter and also in the configuration.
368
- *
369
- * # Configuring the editor
370
- *
371
- * See the {@link module:core/editor/editorconfig~EditorConfig editor configuration documentation} to learn more about
372
- * customizing plugins, toolbar and more.
373
- *
374
- * @param sourceElementOrData The DOM element that will be the source for the created editor
375
- * or the editor's initial data.
376
- *
377
- * If a DOM element is passed, its content will be automatically loaded to the editor upon initialization
378
- * and the {@link module:editor-classic/classiceditorui~ClassicEditorUI#element editor element} will replace the passed element
379
- * in the DOM (the original one will be hidden and the editor will be injected next to it).
380
- *
381
- * If the {@link module:core/editor/editorconfig~EditorConfig#updateSourceElementOnDestroy updateSourceElementOnDestroy}
382
- * option is set to `true`, the editor data will be set back to the original element once the editor is destroyed and when a form,
383
- * in which this element is contained, is submitted (if the original element is a `<textarea>`). This ensures seamless integration
384
- * with native web forms.
385
- *
386
- * If the initial data is passed, a detached editor will be created. In this case you need to insert it into the DOM manually.
387
- * It is available under the {@link module:editor-classic/classiceditorui~ClassicEditorUI#element `editor.ui.element`} property.
388
- *
389
- * @param config The editor configuration.
390
- * @returns A promise resolved once the editor is ready. The promise resolves with the created editor instance.
391
- */ static create(sourceElementOrData, config = {}) {
392
- return new Promise((resolve)=>{
393
- const editor = new this(sourceElementOrData, config);
394
- resolve(editor.initPlugins().then(()=>editor.ui.init(isElement(sourceElementOrData) ? sourceElementOrData : null)).then(()=>editor.data.init(editor.config.get('initialData'))).then(()=>editor.fire('ready')).then(()=>editor));
395
- });
396
- }
397
395
  }
396
+ /**
397
+ * The {@link module:core/context~Context} class.
398
+ *
399
+ * Exposed as static editor field for easier access in editor builds.
400
+ */ ClassicEditor.Context = Context;
401
+ /**
402
+ * The {@link module:watchdog/editorwatchdog~EditorWatchdog} class.
403
+ *
404
+ * Exposed as static editor field for easier access in editor builds.
405
+ */ ClassicEditor.EditorWatchdog = EditorWatchdog;
406
+ /**
407
+ * The {@link module:watchdog/contextwatchdog~ContextWatchdog} class.
408
+ *
409
+ * Exposed as static editor field for easier access in editor builds.
410
+ */ ClassicEditor.ContextWatchdog = ContextWatchdog;
398
411
  function getInitialData(sourceElementOrData) {
399
412
  return isElement(sourceElementOrData) ? getDataFromElement(sourceElementOrData) : sourceElementOrData;
400
413
  }