@ckeditor/ckeditor5-editor-multi-root 48.0.0-alpha.8 → 48.0.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/dist/augmentation.d.ts +7 -8
- package/dist/index.js +31 -13
- package/dist/index.js.map +1 -1
- package/package.json +5 -5
package/dist/augmentation.d.ts
CHANGED
|
@@ -19,7 +19,7 @@ declare module '@ckeditor/ckeditor5-core' {
|
|
|
19
19
|
* HTML). In roots attributes, for each root, you can store arbitrary key-value pairs with attributes connected with that root.
|
|
20
20
|
* Use it to store any custom data that is specific to your integration or custom features.
|
|
21
21
|
*
|
|
22
|
-
* Currently,
|
|
22
|
+
* Currently, any official plugins do not use root attributes. This is a mechanism that is prepared for custom features
|
|
23
23
|
* and non-standard integrations. If you do not provide any custom feature that would use root attributes, you do not need to
|
|
24
24
|
* handle (save and load) this property.
|
|
25
25
|
*
|
|
@@ -87,8 +87,12 @@ declare module '@ckeditor/ckeditor5-core' {
|
|
|
87
87
|
/**
|
|
88
88
|
* Flag for the root that exist in the document but is not initially loaded by the editor.
|
|
89
89
|
*
|
|
90
|
-
* **
|
|
91
|
-
*
|
|
90
|
+
* **This property has been deprecated and will be removed in the future versions of CKEditor.**
|
|
91
|
+
*
|
|
92
|
+
* **Note: This configuration option is supported only by the
|
|
93
|
+
* {@link module:editor-multi-root/multirooteditor~MultiRootEditor multi-root} editor type.**
|
|
94
|
+
*
|
|
95
|
+
* **Important! Lazy roots loading is an experimental feature. Be advised of the following known limitations:**
|
|
92
96
|
*
|
|
93
97
|
* * **Real-time collaboration integrations that use
|
|
94
98
|
* [uploaded editor bundles](https://ckeditor.com/docs/cs/latest/guides/collaboration/editor-bundle.html) are not supported. Using
|
|
@@ -106,11 +110,6 @@ declare module '@ckeditor/ckeditor5-core' {
|
|
|
106
110
|
* This is useful for handling big documents that contain hundreds of roots, or contain very large roots, which may have
|
|
107
111
|
* impact editor performance if loaded all at once.
|
|
108
112
|
*
|
|
109
|
-
* **Note: This configuration option is supported only by the
|
|
110
|
-
* {@link module:editor-multi-root/multirooteditor~MultiRootEditor multi-root} editor type.**
|
|
111
|
-
*
|
|
112
|
-
* **Note: This property has been deprecated and will be removed in the future versions of CKEditor.**
|
|
113
|
-
*
|
|
114
113
|
* @deprecated
|
|
115
114
|
*/
|
|
116
115
|
lazyLoad?: boolean;
|
package/dist/index.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
|
4
4
|
*/
|
|
5
5
|
import { Editor, normalizeMultiRootEditorConstructorParams, normalizeRootsConfig, secureSourceElement } from '@ckeditor/ckeditor5-core/dist/index.js';
|
|
6
|
-
import {
|
|
6
|
+
import { CKEditorError, logWarning, decodeLicenseKey, isFeatureBlockedByLicenseKey, setDataInElement } from '@ckeditor/ckeditor5-utils/dist/index.js';
|
|
7
7
|
import { EditorUI, EditorUIView, ToolbarView, MenuBarView, InlineEditableUIView } from '@ckeditor/ckeditor5-ui/dist/index.js';
|
|
8
8
|
import { enableViewPlaceholder } from '@ckeditor/ckeditor5-engine/dist/index.js';
|
|
9
9
|
import { isElement as isElement$1 } from 'es-toolkit/compat';
|
|
@@ -322,10 +322,7 @@ import { isElement as isElement$1 } from 'es-toolkit/compat';
|
|
|
322
322
|
const { sourceElementsOrData, editorConfig } = normalizeMultiRootEditorConstructorParams(sourceElementsOrDataOrConfig, config);
|
|
323
323
|
super(editorConfig);
|
|
324
324
|
normalizeRootsConfig(sourceElementsOrData, this.config, false);
|
|
325
|
-
|
|
326
|
-
// Documented in core/editor/editorconfig.ts.
|
|
327
|
-
logWarning('editor-create-attachto-ignored');
|
|
328
|
-
}
|
|
325
|
+
normalizeRootsAttributesConfig(this.config);
|
|
329
326
|
if (this.config.get('lazyRoots')) {
|
|
330
327
|
/**
|
|
331
328
|
* Using deprecated `config.lazyRoots` configuration option.
|
|
@@ -334,14 +331,6 @@ import { isElement as isElement$1 } from 'es-toolkit/compat';
|
|
|
334
331
|
* @error multi-root-editor-root-deprecated-config-lazy-roots
|
|
335
332
|
*/ throw new CKEditorError('multi-root-editor-root-deprecated-config-lazy-roots', null);
|
|
336
333
|
}
|
|
337
|
-
if (this.config.get('rootsAttributes')) {
|
|
338
|
-
/**
|
|
339
|
-
* Using deprecated `config.rootsAttributes` configuration option.
|
|
340
|
-
* Use `config.roots.<rootName>.modelAttributes` instead.
|
|
341
|
-
*
|
|
342
|
-
* @error multi-root-editor-root-deprecated-config-roots-attributes
|
|
343
|
-
*/ throw new CKEditorError('multi-root-editor-root-deprecated-config-roots-attributes', null);
|
|
344
|
-
}
|
|
345
334
|
// From this point use only normalized `roots.<rootName>.element`, etc.
|
|
346
335
|
const rootsConfig = Object.entries(this.config.get('roots'));
|
|
347
336
|
this.sourceElements = {};
|
|
@@ -929,6 +918,35 @@ import { isElement as isElement$1 } from 'es-toolkit/compat';
|
|
|
929
918
|
config[key]
|
|
930
919
|
]).filter(([, value])=>value !== undefined));
|
|
931
920
|
}
|
|
921
|
+
/**
|
|
922
|
+
* Normalize legacy `config.rootsAttributes` config option to `config.roots.<rootName>.modelAttributes`.
|
|
923
|
+
*/ function normalizeRootsAttributesConfig(config) {
|
|
924
|
+
if (config.get('rootsAttributes')) {
|
|
925
|
+
const rootsAttributes = config.get('rootsAttributes');
|
|
926
|
+
const rootsConfig = config.get('roots');
|
|
927
|
+
for (const [rootName, attributes] of Object.entries(rootsAttributes)){
|
|
928
|
+
const rootConfig = rootsConfig[rootName];
|
|
929
|
+
if (!rootConfig) {
|
|
930
|
+
/**
|
|
931
|
+
* Trying to set attributes on a non-existing root.
|
|
932
|
+
*
|
|
933
|
+
* Roots specified in `config.rootsAttributes` do not match initial editor roots.
|
|
934
|
+
*
|
|
935
|
+
* @error multi-root-editor-root-attributes-no-root
|
|
936
|
+
*/ throw new CKEditorError('multi-root-editor-root-attributes-no-root', null);
|
|
937
|
+
}
|
|
938
|
+
if (Object.keys(rootConfig.modelAttributes || {}).length) {
|
|
939
|
+
/**
|
|
940
|
+
* Trying to set attributes using deprecated `config.rootsAttributes` on a root that has already
|
|
941
|
+
* defined attributes using `config.roots.<rootName>.modelAttributes`.
|
|
942
|
+
*
|
|
943
|
+
* @error multi-root-editor-root-attributes-conflict
|
|
944
|
+
*/ throw new CKEditorError('multi-root-editor-root-attributes-conflict', null);
|
|
945
|
+
}
|
|
946
|
+
config.set(`roots.${rootName}.modelAttributes`, attributes);
|
|
947
|
+
}
|
|
948
|
+
}
|
|
949
|
+
}
|
|
932
950
|
function isElement(value) {
|
|
933
951
|
return isElement$1(value);
|
|
934
952
|
}
|