@ckeditor/ckeditor5-editor-multi-root 37.0.0-alpha.2 → 37.0.0-alpha.3
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/build/editor-multi-root.js +1 -1
- package/package.json +14 -13
- package/src/multirooteditor.d.ts +20 -1
- package/src/multirooteditor.js +20 -1
@@ -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")},79:t=>{"use strict";t.exports=CKEditor5.dll}},e={};function o(i){var r=e[i];if(void 0!==r)return r.exports;var n=e[i]={exports:{}};return t[i](n,n.exports,o),n.exports}o.d=(t,e)=>{for(var i in e)o.o(e,i)&&!o.o(t,i)&&Object.defineProperty(t,i,{enumerable:!0,get:e[i]})},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 i={};(()=>{"use strict";o.r(i),o.d(i,{MultiRootEditor:()=>
|
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(i){var r=e[i];if(void 0!==r)return r.exports;var n=e[i]={exports:{}};return t[i](n,n.exports,o),n.exports}o.d=(t,e)=>{for(var i in e)o.o(e,i)&&!o.o(t,i)&&Object.defineProperty(t,i,{enumerable:!0,get:e[i]})},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 i={};(()=>{"use strict";o.r(i),o.d(i,{MultiRootEditor:()=>W});var t=o(704),e=o(209),r=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.view,e=this.editor.editing.view;let o;for(const e of Object.keys(t.editables))t.editables[e].name=e;t.render(),this.focusTracker.on("change:focusedElement",((t,e,i)=>{for(const t of Object.values(this.view.editables))i===t.element&&(o=t.element)})),this.focusTracker.on("change:isFocused",((t,e,i)=>{i||(o=null)}));for(const t of Object.values(this.view.editables)){const i=t.element;this.setEditableElement(t.name,i),t.bind("isFocused").to(this.focusTracker,"isFocused",this.focusTracker,"focusedElement",((t,e)=>!!t&&(e===i||o===i))),e.attachDomRoot(i,t.name)}this._initPlaceholder(),this._initToolbar(),this.fire("ready")}destroy(){super.destroy();const t=this.view,e=this.editor.editing.view;for(const t of Object.values(this.view.editables))e.detachDomRoot(t.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=t.config.get("placeholder");if(o)for(const t of Object.values(this.view.editables)){const i=e.document.getRoot(t.name),r="string"==typeof o?o:o[t.name];r&&(0,s.enablePlaceholder)({view:e,element:i,text:r,isDirectHost:!1,keepOnFocus:!0})}}}class l extends n.EditorUIView{constructor(t,e,o,i={}){super(t);const r=t.t;this.toolbar=new n.ToolbarView(t,{shouldGroupWhenFull:i.shouldToolbarGroupWhenFull}),this.editables={};for(const s of o){const o=new n.InlineEditableUIView(t,e,i.editableElements?i.editableElements[s]:void 0,{label:t=>r("Rich Text Editor. Editing area: %0",t.name)});this.editables[s]=o}this.editable=Object.values(this.editables)[0],this.toolbar.extendTemplate({attributes:{class:["ck-reset_all","ck-rounded-corners"],dir:t.uiLanguageDirection}})}render(){super.render(),this.registerChild(Object.values(this.editables)),this.registerChild([this.toolbar])}}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 f=Object.prototype,b=f.hasOwnProperty,g=f.toString,p=h?h.toStringTag:void 0;const v=function(t){var e=b.call(t,p),o=t[p];try{t[p]=void 0;var i=!0}catch(t){}var r=g.call(t);return i&&(e?t[p]=o:delete t[p]),r};var m=Object.prototype.toString;const y=function(t){return m.call(t)};var j="[object Null]",w="[object Undefined]",E=h?h.toStringTag:void 0;const O=function(t){return null==t?void 0===t?w:j:E&&E in Object(t)?v(t):y(t)};const x=function(t,e){return function(o){return t(e(o))}}(Object.getPrototypeOf,Object);var T="[object Object]",D=Function.prototype,F=Object.prototype,S=D.toString,C=F.hasOwnProperty,P=S.call(Object);const k=function(t){if(!a(t)||O(t)!=T)return!1;var e=x(t);if(null===e)return!0;var o=C.call(e,"constructor")&&e.constructor;return"function"==typeof o&&o instanceof o&&S.call(o)==P};const R=function(t){return a(t)&&1===t.nodeType&&!k(t)};class W extends((0,t.DataApiMixin)(t.Editor)){constructor(o,i={}){const r=Object.keys(o),n=0===r.length||"string"==typeof o[r[0]];if(n&&void 0!==i.initialData)throw new e.CKEditorError("editor-create-initial-data",null);if(super(i),n||(this.sourceElements=o),void 0===this.config.get("initialData")){const t={};for(const i of r)t[i]=_(s=o[i])?(0,e.getDataFromElement)(s):s;this.config.set("initialData",t)}var s;if(!n)for(const e of r)(0,t.secureSourceElement)(this,o[e]);for(const t of r)this.model.document.createRoot("$root",t);const a={shouldToolbarGroupWhenFull:!this.config.get("toolbar.shouldNotGroupWhenFull"),editableElements:n?void 0:o},d=new l(this.locale,this.editing.view,r,a);this.ui=new c(this,d)}destroy(){const t=this.config.get("updateSourceElementOnDestroy"),o={};if(this.sourceElements)for(const e of Object.keys(this.sourceElements))o[e]=t?this.getData({rootName:e}):"";return this.ui.destroy(),super.destroy().then((()=>{if(this.sourceElements)for(const t of Object.keys(this.sourceElements))(0,e.setDataInElement)(this.sourceElements[t],o[t])}))}static create(t,o={}){return new Promise((i=>{for(const o of Object.values(t))if(_(o)&&"TEXTAREA"===o.tagName)throw new e.CKEditorError("editor-wrong-element",null);const r=new this(t,o);i(r.initPlugins().then((()=>r.ui.init())).then((()=>r.data.init(r.config.get("initialData")))).then((()=>r.fire("ready"))).then((()=>r)))}))}}function _(t){return R(t)}W.Context=t.Context,W.EditorWatchdog=r.EditorWatchdog,W.ContextWatchdog=r.ContextWatchdog})(),(window.CKEditor5=window.CKEditor5||{}).editorMultiRoot=i})();
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@ckeditor/ckeditor5-editor-multi-root",
|
3
|
-
"version": "37.0.0-alpha.
|
3
|
+
"version": "37.0.0-alpha.3",
|
4
4
|
"description": "Multi-root editor implementation for CKEditor 5.",
|
5
5
|
"keywords": [
|
6
6
|
"ckeditor",
|
@@ -11,22 +11,23 @@
|
|
11
11
|
],
|
12
12
|
"main": "src/index.js",
|
13
13
|
"dependencies": {
|
14
|
-
"ckeditor5": "^37.0.0-alpha.
|
14
|
+
"ckeditor5": "^37.0.0-alpha.3",
|
15
15
|
"lodash-es": "^4.17.15"
|
16
16
|
},
|
17
17
|
"devDependencies": {
|
18
|
-
"@ckeditor/ckeditor5-basic-styles": "^37.0.0-alpha.
|
19
|
-
"@ckeditor/ckeditor5-core": "^37.0.0-alpha.
|
18
|
+
"@ckeditor/ckeditor5-basic-styles": "^37.0.0-alpha.3",
|
19
|
+
"@ckeditor/ckeditor5-core": "^37.0.0-alpha.3",
|
20
20
|
"@ckeditor/ckeditor5-dev-utils": "^35.0.0",
|
21
|
-
"@ckeditor/ckeditor5-engine": "^37.0.0-alpha.
|
22
|
-
"@ckeditor/ckeditor5-enter": "^37.0.0-alpha.
|
23
|
-
"@ckeditor/ckeditor5-heading": "^37.0.0-alpha.
|
24
|
-
"@ckeditor/ckeditor5-paragraph": "^37.0.0-alpha.
|
25
|
-
"@ckeditor/ckeditor5-theme-lark": "^37.0.0-alpha.
|
26
|
-
"@ckeditor/ckeditor5-typing": "^37.0.0-alpha.
|
27
|
-
"@ckeditor/ckeditor5-ui": "^37.0.0-alpha.
|
28
|
-
"@ckeditor/ckeditor5-undo": "^37.0.0-alpha.
|
29
|
-
"@ckeditor/ckeditor5-utils": "^37.0.0-alpha.
|
21
|
+
"@ckeditor/ckeditor5-engine": "^37.0.0-alpha.3",
|
22
|
+
"@ckeditor/ckeditor5-enter": "^37.0.0-alpha.3",
|
23
|
+
"@ckeditor/ckeditor5-heading": "^37.0.0-alpha.3",
|
24
|
+
"@ckeditor/ckeditor5-paragraph": "^37.0.0-alpha.3",
|
25
|
+
"@ckeditor/ckeditor5-theme-lark": "^37.0.0-alpha.3",
|
26
|
+
"@ckeditor/ckeditor5-typing": "^37.0.0-alpha.3",
|
27
|
+
"@ckeditor/ckeditor5-ui": "^37.0.0-alpha.3",
|
28
|
+
"@ckeditor/ckeditor5-undo": "^37.0.0-alpha.3",
|
29
|
+
"@ckeditor/ckeditor5-utils": "^37.0.0-alpha.3",
|
30
|
+
"@ckeditor/ckeditor5-watchdog": "^37.0.0-alpha.3",
|
30
31
|
"typescript": "^4.8.4",
|
31
32
|
"webpack": "^5.58.1",
|
32
33
|
"webpack-cli": "^4.9.0"
|
package/src/multirooteditor.d.ts
CHANGED
@@ -5,7 +5,8 @@
|
|
5
5
|
/**
|
6
6
|
* @module editor-multi-root/multirooteditor
|
7
7
|
*/
|
8
|
-
import { Editor, type EditorConfig } from 'ckeditor5/src/core';
|
8
|
+
import { Editor, Context, type EditorConfig } from 'ckeditor5/src/core';
|
9
|
+
import { ContextWatchdog, EditorWatchdog } from 'ckeditor5/src/watchdog';
|
9
10
|
import MultiRootEditorUI from './multirooteditorui';
|
10
11
|
declare const MultiRootEditor_base: import("ckeditor5/src/utils").Mixed<typeof Editor, import("ckeditor5/src/core").DataApi>;
|
11
12
|
/**
|
@@ -219,5 +220,23 @@ export default class MultiRootEditor extends MultiRootEditor_base {
|
|
219
220
|
* @returns A promise resolved once the editor is ready. The promise resolves with the created editor instance.
|
220
221
|
*/
|
221
222
|
static create(sourceElementsOrData: Record<string, HTMLElement> | Record<string, string>, config?: EditorConfig): Promise<MultiRootEditor>;
|
223
|
+
/**
|
224
|
+
* The {@link module:core/context~Context} class.
|
225
|
+
*
|
226
|
+
* Exposed as static editor field for easier access in editor builds.
|
227
|
+
*/
|
228
|
+
static Context: typeof Context;
|
229
|
+
/**
|
230
|
+
* The {@link module:watchdog/editorwatchdog~EditorWatchdog} class.
|
231
|
+
*
|
232
|
+
* Exposed as static editor field for easier access in editor builds.
|
233
|
+
*/
|
234
|
+
static EditorWatchdog: typeof EditorWatchdog;
|
235
|
+
/**
|
236
|
+
* The {@link module:watchdog/contextwatchdog~ContextWatchdog} class.
|
237
|
+
*
|
238
|
+
* Exposed as static editor field for easier access in editor builds.
|
239
|
+
*/
|
240
|
+
static ContextWatchdog: typeof ContextWatchdog;
|
222
241
|
}
|
223
242
|
export {};
|
package/src/multirooteditor.js
CHANGED
@@ -5,8 +5,9 @@
|
|
5
5
|
/**
|
6
6
|
* @module editor-multi-root/multirooteditor
|
7
7
|
*/
|
8
|
-
import { Editor, DataApiMixin, secureSourceElement } from 'ckeditor5/src/core';
|
8
|
+
import { Editor, Context, DataApiMixin, secureSourceElement } from 'ckeditor5/src/core';
|
9
9
|
import { CKEditorError, getDataFromElement, setDataInElement } from 'ckeditor5/src/utils';
|
10
|
+
import { ContextWatchdog, EditorWatchdog } from 'ckeditor5/src/watchdog';
|
10
11
|
import MultiRootEditorUI from './multirooteditorui';
|
11
12
|
import MultiRootEditorUIView from './multirooteditoruiview';
|
12
13
|
import { isElement as _isElement } from 'lodash-es';
|
@@ -285,6 +286,24 @@ export default class MultiRootEditor extends DataApiMixin(Editor) {
|
|
285
286
|
});
|
286
287
|
}
|
287
288
|
}
|
289
|
+
/**
|
290
|
+
* The {@link module:core/context~Context} class.
|
291
|
+
*
|
292
|
+
* Exposed as static editor field for easier access in editor builds.
|
293
|
+
*/
|
294
|
+
MultiRootEditor.Context = Context;
|
295
|
+
/**
|
296
|
+
* The {@link module:watchdog/editorwatchdog~EditorWatchdog} class.
|
297
|
+
*
|
298
|
+
* Exposed as static editor field for easier access in editor builds.
|
299
|
+
*/
|
300
|
+
MultiRootEditor.EditorWatchdog = EditorWatchdog;
|
301
|
+
/**
|
302
|
+
* The {@link module:watchdog/contextwatchdog~ContextWatchdog} class.
|
303
|
+
*
|
304
|
+
* Exposed as static editor field for easier access in editor builds.
|
305
|
+
*/
|
306
|
+
MultiRootEditor.ContextWatchdog = ContextWatchdog;
|
288
307
|
function getInitialData(sourceElementOrData) {
|
289
308
|
return isElement(sourceElementOrData) ? getDataFromElement(sourceElementOrData) : sourceElementOrData;
|
290
309
|
}
|