@ckeditor/ckeditor5-editor-decoupled 38.2.0-alpha.1 → 39.0.1

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
@@ -4,7 +4,6 @@ CKEditor 5 decoupled editor implementation
4
4
  [![npm version](https://badge.fury.io/js/%40ckeditor%2Fckeditor5-editor-decoupled.svg)](https://www.npmjs.com/package/@ckeditor/ckeditor5-editor-decoupled)
5
5
  [![Coverage Status](https://coveralls.io/repos/github/ckeditor/ckeditor5/badge.svg?branch=master)](https://coveralls.io/github/ckeditor/ckeditor5?branch=master)
6
6
  [![Build Status](https://travis-ci.com/ckeditor/ckeditor5.svg?branch=master)](https://app.travis-ci.com/github/ckeditor/ckeditor5)
7
- ![Dependency Status](https://img.shields.io/librariesio/release/npm/@ckeditor/ckeditor5-editor-decoupled)
8
7
 
9
8
  The decoupled editor implementation for CKEditor 5.
10
9
 
@@ -1,4 +1,4 @@
1
1
  /*!
2
2
  * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
3
3
  * For licensing, see LICENSE.md.
4
- */(()=>{var t={704:(t,e,o)=>{t.exports=o(79)("./src/core.js")},492:(t,e,o)=>{t.exports=o(79)("./src/engine.js")},273:(t,e,o)=>{t.exports=o(79)("./src/ui.js")},209:(t,e,o)=>{t.exports=o(79)("./src/utils.js")},434:(t,e,o)=>{t.exports=o(79)("./src/watchdog.js")},79:t=>{"use strict";t.exports=CKEditor5.dll}},e={};function o(r){var i=e[r];if(void 0!==i)return i.exports;var n=e[r]={exports:{}};return t[r](n,n.exports,o),n.exports}o.d=(t,e)=>{for(var r in e)o.o(e,r)&&!o.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:e[r]})},o.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),o.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var r={};(()=>{"use strict";o.r(r),o.d(r,{DecoupledEditor:()=>F});var t=o(704),e=o(209),i=o(434),n=o(273),s=o(492);class c extends n.EditorUI{constructor(t,e){super(t),this.view=e}init(){const t=this.editor,e=this.view,o=t.editing.view,r=e.editable,i=o.document.getRoot();r.name=i.rootName,e.render();const n=r.element;this.setEditableElement(r.name,n),e.editable.bind("isFocused").to(this.focusTracker),o.attachDomRoot(n),this._initPlaceholder(),this._initToolbar(),this.fire("ready")}destroy(){super.destroy();const t=this.view;this.editor.editing.view.detachDomRoot(t.editable.name),t.destroy()}_initToolbar(){const t=this.editor,e=this.view;e.toolbar.fillFromConfig(t.config.get("toolbar"),this.componentFactory),this.addToolbar(e.toolbar)}_initPlaceholder(){const t=this.editor,e=t.editing.view,o=e.document.getRoot(),r=(t.sourceElement,t.config.get("placeholder"));if(r){const t="string"==typeof r?r:r[o.rootName];t&&(0,s.enablePlaceholder)({view:e,element:o,text:t,isDirectHost:!1,keepOnFocus:!0})}}}class l extends n.EditorUIView{constructor(t,e,o={}){super(t);const r=t.t;this.toolbar=new n.ToolbarView(t,{shouldGroupWhenFull:o.shouldToolbarGroupWhenFull}),this.editable=new n.InlineEditableUIView(t,e,o.editableElement,{label:t=>r("Rich Text Editor. Editing area: %0",t.name)}),this.toolbar.extendTemplate({attributes:{class:["ck-reset_all","ck-rounded-corners"],dir:t.uiLanguageDirection}})}render(){super.render(),this.registerChild([this.toolbar,this.editable])}}const a=function(t){return null!=t&&"object"==typeof t};const d="object"==typeof global&&global&&global.Object===Object&&global;var u="object"==typeof self&&self&&self.Object===Object&&self;const h=(d||u||Function("return this")()).Symbol;var b=Object.prototype,p=b.hasOwnProperty,g=b.toString,f=h?h.toStringTag:void 0;const m=function(t){var e=p.call(t,f),o=t[f];try{t[f]=void 0;var r=!0}catch(t){}var i=g.call(t);return r&&(e?t[f]=o:delete t[f]),i};var v=Object.prototype.toString;const y=function(t){return v.call(t)};var w=h?h.toStringTag:void 0;const E=function(t){return null==t?void 0===t?"[object Undefined]":"[object Null]":w&&w in Object(t)?m(t):y(t)};const j=function(t,e){return function(o){return t(e(o))}}(Object.getPrototypeOf,Object);var x=Function.prototype,O=Object.prototype,T=x.toString,D=O.hasOwnProperty,S=T.call(Object);const P=function(t){if(!a(t)||"[object Object]"!=E(t))return!1;var e=j(t);if(null===e)return!0;var o=D.call(e,"constructor")&&e.constructor;return"function"==typeof o&&o instanceof o&&T.call(o)==S};const C=function(t){return a(t)&&1===t.nodeType&&!P(t)};class F extends((0,t.DataApiMixin)((0,t.ElementApiMixin)(t.Editor))){constructor(o,r={}){if(!W(o)&&void 0!==r.initialData)throw new e.CKEditorError("editor-create-initial-data",null);super(r),void 0===this.config.get("initialData")&&this.config.set("initialData",function(t){return W(t)?(0,e.getDataFromElement)(t):t}(o)),W(o)&&(this.sourceElement=o,(0,t.secureSourceElement)(this,o)),this.model.document.createRoot();const i=!this.config.get("toolbar.shouldNotGroupWhenFull"),n=new l(this.locale,this.editing.view,{editableElement:this.sourceElement,shouldToolbarGroupWhenFull:i});this.ui=new c(this,n)}destroy(){const t=this.getData();return this.ui.destroy(),super.destroy().then((()=>{this.sourceElement&&this.updateSourceElement(t)}))}static create(t,o={}){return new Promise((r=>{if(W(t)&&"TEXTAREA"===t.tagName)throw new e.CKEditorError("editor-wrong-element",null);const i=new this(t,o);r(i.initPlugins().then((()=>i.ui.init())).then((()=>i.data.init(i.config.get("initialData")))).then((()=>i.fire("ready"))).then((()=>i)))}))}}function W(t){return C(t)}F.Context=t.Context,F.EditorWatchdog=i.EditorWatchdog,F.ContextWatchdog=i.ContextWatchdog})(),(window.CKEditor5=window.CKEditor5||{}).editorDecoupled=r})();
4
+ */(()=>{var t={704:(t,e,o)=>{t.exports=o(79)("./src/core.js")},492:(t,e,o)=>{t.exports=o(79)("./src/engine.js")},273:(t,e,o)=>{t.exports=o(79)("./src/ui.js")},209:(t,e,o)=>{t.exports=o(79)("./src/utils.js")},434:(t,e,o)=>{t.exports=o(79)("./src/watchdog.js")},79:t=>{"use strict";t.exports=CKEditor5.dll}},e={};function o(r){var i=e[r];if(void 0!==i)return i.exports;var n=e[r]={exports:{}};return t[r](n,n.exports,o),n.exports}o.d=(t,e)=>{for(var r in e)o.o(e,r)&&!o.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:e[r]})},o.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),o.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var r={};(()=>{"use strict";o.r(r),o.d(r,{DecoupledEditor:()=>F});var t=o(704),e=o(209),i=o(434),n=o(273),s=o(492);class c extends n.EditorUI{constructor(t,e){super(t),this.view=e}init(){const t=this.editor,e=this.view,o=t.editing.view,r=e.editable,i=o.document.getRoot();r.name=i.rootName,e.render();const n=r.element;this.setEditableElement(r.name,n),e.editable.bind("isFocused").to(this.focusTracker),o.attachDomRoot(n),this._initPlaceholder(),this._initToolbar(),this.fire("ready")}destroy(){super.destroy();const t=this.view;this.editor.editing.view.detachDomRoot(t.editable.name),t.destroy()}_initToolbar(){const t=this.editor,e=this.view;e.toolbar.fillFromConfig(t.config.get("toolbar"),this.componentFactory),this.addToolbar(e.toolbar)}_initPlaceholder(){const t=this.editor,e=t.editing.view,o=e.document.getRoot(),r=t.config.get("placeholder");if(r){const t="string"==typeof r?r:r[o.rootName];t&&(o.placeholder=t)}(0,s.enablePlaceholder)({view:e,element:o,isDirectHost:!1,keepOnFocus:!0})}}class l extends n.EditorUIView{constructor(t,e,o={}){super(t);const r=t.t;this.toolbar=new n.ToolbarView(t,{shouldGroupWhenFull:o.shouldToolbarGroupWhenFull}),this.editable=new n.InlineEditableUIView(t,e,o.editableElement,{label:t=>r("Rich Text Editor. Editing area: %0",t.name)}),this.toolbar.extendTemplate({attributes:{class:["ck-reset_all","ck-rounded-corners"],dir:t.uiLanguageDirection}})}render(){super.render(),this.registerChild([this.toolbar,this.editable])}}const a=function(t){return null!=t&&"object"==typeof t};const d="object"==typeof global&&global&&global.Object===Object&&global;var u="object"==typeof self&&self&&self.Object===Object&&self;const h=(d||u||Function("return this")()).Symbol;var b=Object.prototype,p=b.hasOwnProperty,g=b.toString,f=h?h.toStringTag:void 0;const m=function(t){var e=p.call(t,f),o=t[f];try{t[f]=void 0;var r=!0}catch(t){}var i=g.call(t);return r&&(e?t[f]=o:delete t[f]),i};var v=Object.prototype.toString;const y=function(t){return v.call(t)};var w=h?h.toStringTag:void 0;const E=function(t){return null==t?void 0===t?"[object Undefined]":"[object Null]":w&&w in Object(t)?m(t):y(t)};const j=function(t,e){return function(o){return t(e(o))}}(Object.getPrototypeOf,Object);var x=Function.prototype,O=Object.prototype,T=x.toString,D=O.hasOwnProperty,S=T.call(Object);const P=function(t){if(!a(t)||"[object Object]"!=E(t))return!1;var e=j(t);if(null===e)return!0;var o=D.call(e,"constructor")&&e.constructor;return"function"==typeof o&&o instanceof o&&T.call(o)==S};const C=function(t){return a(t)&&1===t.nodeType&&!P(t)};class F extends((0,t.DataApiMixin)((0,t.ElementApiMixin)(t.Editor))){constructor(o,r={}){if(!W(o)&&void 0!==r.initialData)throw new e.CKEditorError("editor-create-initial-data",null);super(r),void 0===this.config.get("initialData")&&this.config.set("initialData",function(t){return W(t)?(0,e.getDataFromElement)(t):t}(o)),W(o)&&(this.sourceElement=o,(0,t.secureSourceElement)(this,o)),this.model.document.createRoot();const i=!this.config.get("toolbar.shouldNotGroupWhenFull"),n=new l(this.locale,this.editing.view,{editableElement:this.sourceElement,shouldToolbarGroupWhenFull:i});this.ui=new c(this,n)}destroy(){const t=this.getData();return this.ui.destroy(),super.destroy().then((()=>{this.sourceElement&&this.updateSourceElement(t)}))}static create(t,o={}){return new Promise((r=>{if(W(t)&&"TEXTAREA"===t.tagName)throw new e.CKEditorError("editor-wrong-element",null);const i=new this(t,o);r(i.initPlugins().then((()=>i.ui.init())).then((()=>i.data.init(i.config.get("initialData")))).then((()=>i.fire("ready"))).then((()=>i)))}))}}function W(t){return C(t)}F.Context=t.Context,F.EditorWatchdog=i.EditorWatchdog,F.ContextWatchdog=i.ContextWatchdog})(),(window.CKEditor5=window.CKEditor5||{}).editorDecoupled=r})();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ckeditor/ckeditor5-editor-decoupled",
3
- "version": "38.2.0-alpha.1",
3
+ "version": "39.0.1",
4
4
  "description": "Decoupled editor implementation for CKEditor 5.",
5
5
  "keywords": [
6
6
  "ckeditor",
@@ -10,10 +10,9 @@
10
10
  "ckeditor5-dll"
11
11
  ],
12
12
  "main": "src/index.js",
13
- "type": "module",
14
13
  "dependencies": {
15
- "ckeditor5": "38.2.0-alpha.1",
16
- "lodash-es": "^4.17.15"
14
+ "ckeditor5": "39.0.1",
15
+ "lodash-es": "4.17.21"
17
16
  },
18
17
  "engines": {
19
18
  "node": ">=16.0.0",
@@ -5,10 +5,10 @@
5
5
  /**
6
6
  * @module editor-decoupled/decouplededitor
7
7
  */
8
- import { Editor, Context, type EditorConfig } from 'ckeditor5/src/core.js';
9
- import { ContextWatchdog, EditorWatchdog } from 'ckeditor5/src/watchdog.js';
10
- import DecoupledEditorUI from './decouplededitorui.js';
11
- declare const DecoupledEditor_base: import("ckeditor5/src/utils.js").Mixed<import("ckeditor5/src/utils.js").Mixed<typeof Editor, import("ckeditor5/src/core.js").ElementApi>, import("ckeditor5/src/core.js").DataApi>;
8
+ import { Editor, Context, type EditorConfig } from 'ckeditor5/src/core';
9
+ import { ContextWatchdog, EditorWatchdog } from 'ckeditor5/src/watchdog';
10
+ import DecoupledEditorUI from './decouplededitorui';
11
+ declare const DecoupledEditor_base: import("ckeditor5/src/utils").Mixed<import("ckeditor5/src/utils").Mixed<typeof Editor, import("ckeditor5/src/core").ElementApi>, import("ckeditor5/src/core").DataApi>;
12
12
  /**
13
13
  * The {@glink installation/getting-started/predefined-builds#document-editor decoupled editor} implementation.
14
14
  * It provides an inline editable and a toolbar. However, unlike other editors,
@@ -5,11 +5,11 @@
5
5
  /**
6
6
  * @module editor-decoupled/decouplededitor
7
7
  */
8
- import { Editor, Context, ElementApiMixin, DataApiMixin, secureSourceElement } from 'ckeditor5/src/core.js';
9
- import { CKEditorError, getDataFromElement } from 'ckeditor5/src/utils.js';
10
- import { ContextWatchdog, EditorWatchdog } from 'ckeditor5/src/watchdog.js';
11
- import DecoupledEditorUI from './decouplededitorui.js';
12
- import DecoupledEditorUIView from './decouplededitoruiview.js';
8
+ import { Editor, Context, ElementApiMixin, DataApiMixin, secureSourceElement } from 'ckeditor5/src/core';
9
+ import { CKEditorError, getDataFromElement } from 'ckeditor5/src/utils';
10
+ import { ContextWatchdog, EditorWatchdog } from 'ckeditor5/src/watchdog';
11
+ import DecoupledEditorUI from './decouplededitorui';
12
+ import DecoupledEditorUIView from './decouplededitoruiview';
13
13
  import { isElement as _isElement } from 'lodash-es';
14
14
  /**
15
15
  * The {@glink installation/getting-started/predefined-builds#document-editor decoupled editor} implementation.
@@ -5,9 +5,9 @@
5
5
  /**
6
6
  * @module editor-decoupled/decouplededitorui
7
7
  */
8
- import { type Editor } from 'ckeditor5/src/core.js';
9
- import { EditorUI } from 'ckeditor5/src/ui.js';
10
- import type DecoupledEditorUIView from './decouplededitoruiview.js';
8
+ import { type Editor } from 'ckeditor5/src/core';
9
+ import { EditorUI } from 'ckeditor5/src/ui';
10
+ import type DecoupledEditorUIView from './decouplededitoruiview';
11
11
  /**
12
12
  * The decoupled editor UI class.
13
13
  */
@@ -36,7 +36,7 @@ export default class DecoupledEditorUI extends EditorUI {
36
36
  */
37
37
  private _initToolbar;
38
38
  /**
39
- * Enable the placeholder text on the editing root, if any was configured.
39
+ * Enable the placeholder text on the editing root.
40
40
  */
41
41
  private _initPlaceholder;
42
42
  }
@@ -2,8 +2,8 @@
2
2
  * @license Copyright (c) 2003-2023, 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 } from 'ckeditor5/src/ui.js';
6
- import { enablePlaceholder } from 'ckeditor5/src/engine.js';
5
+ import { EditorUI } from 'ckeditor5/src/ui';
6
+ import { enablePlaceholder } from 'ckeditor5/src/engine';
7
7
  /**
8
8
  * The decoupled editor UI class.
9
9
  */
@@ -74,25 +74,24 @@ export default class DecoupledEditorUI extends EditorUI {
74
74
  this.addToolbar(view.toolbar);
75
75
  }
76
76
  /**
77
- * Enable the placeholder text on the editing root, if any was configured.
77
+ * Enable the placeholder text on the editing root.
78
78
  */
79
79
  _initPlaceholder() {
80
80
  const editor = this.editor;
81
81
  const editingView = editor.editing.view;
82
82
  const editingRoot = editingView.document.getRoot();
83
- const sourceElement = editor.sourceElement;
84
83
  const placeholder = editor.config.get('placeholder');
85
84
  if (placeholder) {
86
85
  const placeholderText = typeof placeholder === 'string' ? placeholder : placeholder[editingRoot.rootName];
87
86
  if (placeholderText) {
88
- enablePlaceholder({
89
- view: editingView,
90
- element: editingRoot,
91
- text: placeholderText,
92
- isDirectHost: false,
93
- keepOnFocus: true
94
- });
87
+ editingRoot.placeholder = placeholderText;
95
88
  }
96
89
  }
90
+ enablePlaceholder({
91
+ view: editingView,
92
+ element: editingRoot,
93
+ isDirectHost: false,
94
+ keepOnFocus: true
95
+ });
97
96
  }
98
97
  }
@@ -5,9 +5,9 @@
5
5
  /**
6
6
  * @module editor-decoupled/decouplededitoruiview
7
7
  */
8
- import { EditorUIView, InlineEditableUIView, ToolbarView } from 'ckeditor5/src/ui.js';
9
- import type { Locale } from 'ckeditor5/src/utils.js';
10
- import type { View } from 'ckeditor5/src/engine.js';
8
+ import { EditorUIView, InlineEditableUIView, ToolbarView } from 'ckeditor5/src/ui';
9
+ import type { Locale } from 'ckeditor5/src/utils';
10
+ import type { View } from 'ckeditor5/src/engine';
11
11
  /**
12
12
  * The decoupled editor UI view. It is a virtual view providing an inline
13
13
  * {@link module:editor-decoupled/decouplededitoruiview~DecoupledEditorUIView#editable} and a
@@ -5,7 +5,7 @@
5
5
  /**
6
6
  * @module editor-decoupled/decouplededitoruiview
7
7
  */
8
- import { EditorUIView, InlineEditableUIView, ToolbarView } from 'ckeditor5/src/ui.js';
8
+ import { EditorUIView, InlineEditableUIView, ToolbarView } from 'ckeditor5/src/ui';
9
9
  /**
10
10
  * The decoupled editor UI view. It is a virtual view providing an inline
11
11
  * {@link module:editor-decoupled/decouplededitoruiview~DecoupledEditorUIView#editable} and a
package/src/index.d.ts CHANGED
@@ -5,4 +5,4 @@
5
5
  /**
6
6
  * @module editor-decoupled
7
7
  */
8
- export { default as DecoupledEditor } from './decouplededitor.js';
8
+ export { default as DecoupledEditor } from './decouplededitor';
package/src/index.js CHANGED
@@ -5,4 +5,4 @@
5
5
  /**
6
6
  * @module editor-decoupled
7
7
  */
8
- export { default as DecoupledEditor } from './decouplededitor.js';
8
+ export { default as DecoupledEditor } from './decouplededitor';