@ckeditor/ckeditor5-editor-multi-root 38.1.1 → 38.2.0-alpha.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/package.json +3 -2
- package/src/augmentation.d.ts +80 -80
- package/src/augmentation.js +5 -5
- package/src/index.d.ts +10 -10
- package/src/index.js +9 -9
- package/src/multirooteditor.d.ts +522 -522
- package/src/multirooteditor.js +747 -747
- package/src/multirooteditorui.d.ts +74 -74
- package/src/multirooteditorui.js +169 -169
- package/src/multirooteditoruiview.d.ts +74 -74
- package/src/multirooteditoruiview.js +106 -106
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@ckeditor/ckeditor5-editor-multi-root",
|
3
|
-
"version": "38.
|
3
|
+
"version": "38.2.0-alpha.1",
|
4
4
|
"description": "Multi-root editor implementation for CKEditor 5.",
|
5
5
|
"keywords": [
|
6
6
|
"ckeditor",
|
@@ -10,8 +10,9 @@
|
|
10
10
|
"ckeditor5-dll"
|
11
11
|
],
|
12
12
|
"main": "src/index.js",
|
13
|
+
"type": "module",
|
13
14
|
"dependencies": {
|
14
|
-
"ckeditor5": "38.
|
15
|
+
"ckeditor5": "38.2.0-alpha.1",
|
15
16
|
"lodash-es": "^4.17.15"
|
16
17
|
},
|
17
18
|
"engines": {
|
package/src/augmentation.d.ts
CHANGED
@@ -1,80 +1,80 @@
|
|
1
|
-
/**
|
2
|
-
* @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
|
3
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
4
|
-
*/
|
5
|
-
import { type RootAttributes } from './multirooteditor';
|
6
|
-
declare module '@ckeditor/ckeditor5-core' {
|
7
|
-
interface EditorConfig {
|
8
|
-
/**
|
9
|
-
* Initial roots attributes for the document roots.
|
10
|
-
*
|
11
|
-
* **Note: This configuration option is supported only by the
|
12
|
-
* {@link module:editor-multi-root/multirooteditor~MultiRootEditor multi-root} editor type.**
|
13
|
-
*
|
14
|
-
* **Note: You must provide full set of attributes for each root. If an attribute is not set on a root, set the value to `null`.
|
15
|
-
* Only provided attribute keys will be returned by
|
16
|
-
* {@link module:editor-multi-root/multirooteditor~MultiRootEditor#getRootsAttributes}.**
|
17
|
-
*
|
18
|
-
* Roots attributes hold additional data related to the document roots, in addition to the regular document data (which usually is
|
19
|
-
* HTML). In roots attributes, for each root, you can store arbitrary key-value pairs with attributes connected with that root.
|
20
|
-
* Use it to store any custom data that is specific to your integration or custom features.
|
21
|
-
*
|
22
|
-
* Currently, roots attributes are not used only by any official plugins. This is a mechanism that is prepared for custom features
|
23
|
-
* and non-standard integrations. If you do not provide any custom feature that would use root attributes, you do not need to
|
24
|
-
* handle (save and load) this property.
|
25
|
-
*
|
26
|
-
* ```ts
|
27
|
-
* MultiRootEditor.create(
|
28
|
-
* // Roots for the editor:
|
29
|
-
* {
|
30
|
-
* uid1: document.querySelector( '#uid1' ),
|
31
|
-
* uid2: document.querySelector( '#uid2' ),
|
32
|
-
* uid3: document.querySelector( '#uid3' ),
|
33
|
-
* uid4: document.querySelector( '#uid4' )
|
34
|
-
* },
|
35
|
-
* // Config:
|
36
|
-
* {
|
37
|
-
* rootsAttributes: {
|
38
|
-
* uid1: { order: 20, isLocked: false }, // Third, unlocked.
|
39
|
-
* uid2: { order: 10, isLocked: true }, // Second, locked.
|
40
|
-
* uid3: { order: 30, isLocked: true }, // Fourth, locked.
|
41
|
-
* uid4: { order: 0, isLocked: false } // First, unlocked.
|
42
|
-
* }
|
43
|
-
* }
|
44
|
-
* )
|
45
|
-
* .then( ... )
|
46
|
-
* .catch( ... );
|
47
|
-
* ```
|
48
|
-
*
|
49
|
-
* Note, that the above code snippet is only an example. You need to implement your own features that will use these attributes.
|
50
|
-
*
|
51
|
-
* Roots attributes can be changed the same way as attributes set on other model nodes:
|
52
|
-
*
|
53
|
-
* ```ts
|
54
|
-
* editor.model.change( writer => {
|
55
|
-
* const root = editor.model.getRoot( 'uid3' );
|
56
|
-
*
|
57
|
-
* writer.setAttribute( 'order', 40, root );
|
58
|
-
* } );
|
59
|
-
* ```
|
60
|
-
*
|
61
|
-
* You can react to root attributes changes by listening to
|
62
|
-
* {@link module:engine/model/document~Document#event:change:data document `change:data` event}:
|
63
|
-
*
|
64
|
-
* ```ts
|
65
|
-
* editor.model.document.on( 'change:data', () => {
|
66
|
-
* const changedRoots = editor.model.document.differ.getChangedRoots();
|
67
|
-
*
|
68
|
-
* for ( const change of changedRoots ) {
|
69
|
-
* if ( change.attributes ) {
|
70
|
-
* const root = editor.model.getRoot( change.name );
|
71
|
-
*
|
72
|
-
* // ...
|
73
|
-
* }
|
74
|
-
* }
|
75
|
-
* } );
|
76
|
-
* ```
|
77
|
-
*/
|
78
|
-
rootsAttributes?: Record<string, RootAttributes>;
|
79
|
-
}
|
80
|
-
}
|
1
|
+
/**
|
2
|
+
* @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
|
3
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
4
|
+
*/
|
5
|
+
import { type RootAttributes } from './multirooteditor.js';
|
6
|
+
declare module '@ckeditor/ckeditor5-core' {
|
7
|
+
interface EditorConfig {
|
8
|
+
/**
|
9
|
+
* Initial roots attributes for the document roots.
|
10
|
+
*
|
11
|
+
* **Note: This configuration option is supported only by the
|
12
|
+
* {@link module:editor-multi-root/multirooteditor~MultiRootEditor multi-root} editor type.**
|
13
|
+
*
|
14
|
+
* **Note: You must provide full set of attributes for each root. If an attribute is not set on a root, set the value to `null`.
|
15
|
+
* Only provided attribute keys will be returned by
|
16
|
+
* {@link module:editor-multi-root/multirooteditor~MultiRootEditor#getRootsAttributes}.**
|
17
|
+
*
|
18
|
+
* Roots attributes hold additional data related to the document roots, in addition to the regular document data (which usually is
|
19
|
+
* HTML). In roots attributes, for each root, you can store arbitrary key-value pairs with attributes connected with that root.
|
20
|
+
* Use it to store any custom data that is specific to your integration or custom features.
|
21
|
+
*
|
22
|
+
* Currently, roots attributes are not used only by any official plugins. This is a mechanism that is prepared for custom features
|
23
|
+
* and non-standard integrations. If you do not provide any custom feature that would use root attributes, you do not need to
|
24
|
+
* handle (save and load) this property.
|
25
|
+
*
|
26
|
+
* ```ts
|
27
|
+
* MultiRootEditor.create(
|
28
|
+
* // Roots for the editor:
|
29
|
+
* {
|
30
|
+
* uid1: document.querySelector( '#uid1' ),
|
31
|
+
* uid2: document.querySelector( '#uid2' ),
|
32
|
+
* uid3: document.querySelector( '#uid3' ),
|
33
|
+
* uid4: document.querySelector( '#uid4' )
|
34
|
+
* },
|
35
|
+
* // Config:
|
36
|
+
* {
|
37
|
+
* rootsAttributes: {
|
38
|
+
* uid1: { order: 20, isLocked: false }, // Third, unlocked.
|
39
|
+
* uid2: { order: 10, isLocked: true }, // Second, locked.
|
40
|
+
* uid3: { order: 30, isLocked: true }, // Fourth, locked.
|
41
|
+
* uid4: { order: 0, isLocked: false } // First, unlocked.
|
42
|
+
* }
|
43
|
+
* }
|
44
|
+
* )
|
45
|
+
* .then( ... )
|
46
|
+
* .catch( ... );
|
47
|
+
* ```
|
48
|
+
*
|
49
|
+
* Note, that the above code snippet is only an example. You need to implement your own features that will use these attributes.
|
50
|
+
*
|
51
|
+
* Roots attributes can be changed the same way as attributes set on other model nodes:
|
52
|
+
*
|
53
|
+
* ```ts
|
54
|
+
* editor.model.change( writer => {
|
55
|
+
* const root = editor.model.getRoot( 'uid3' );
|
56
|
+
*
|
57
|
+
* writer.setAttribute( 'order', 40, root );
|
58
|
+
* } );
|
59
|
+
* ```
|
60
|
+
*
|
61
|
+
* You can react to root attributes changes by listening to
|
62
|
+
* {@link module:engine/model/document~Document#event:change:data document `change:data` event}:
|
63
|
+
*
|
64
|
+
* ```ts
|
65
|
+
* editor.model.document.on( 'change:data', () => {
|
66
|
+
* const changedRoots = editor.model.document.differ.getChangedRoots();
|
67
|
+
*
|
68
|
+
* for ( const change of changedRoots ) {
|
69
|
+
* if ( change.attributes ) {
|
70
|
+
* const root = editor.model.getRoot( change.name );
|
71
|
+
*
|
72
|
+
* // ...
|
73
|
+
* }
|
74
|
+
* }
|
75
|
+
* } );
|
76
|
+
* ```
|
77
|
+
*/
|
78
|
+
rootsAttributes?: Record<string, RootAttributes>;
|
79
|
+
}
|
80
|
+
}
|
package/src/augmentation.js
CHANGED
@@ -1,5 +1,5 @@
|
|
1
|
-
/**
|
2
|
-
* @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
|
3
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
4
|
-
*/
|
5
|
-
export {};
|
1
|
+
/**
|
2
|
+
* @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
|
3
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
4
|
+
*/
|
5
|
+
export {};
|
package/src/index.d.ts
CHANGED
@@ -1,10 +1,10 @@
|
|
1
|
-
/**
|
2
|
-
* @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
|
3
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
4
|
-
*/
|
5
|
-
/**
|
6
|
-
* @module editor-multi-root
|
7
|
-
*/
|
8
|
-
export { default as MultiRootEditor } from './multirooteditor';
|
9
|
-
export type { RootAttributes } from './multirooteditor';
|
10
|
-
import './augmentation';
|
1
|
+
/**
|
2
|
+
* @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
|
3
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
4
|
+
*/
|
5
|
+
/**
|
6
|
+
* @module editor-multi-root
|
7
|
+
*/
|
8
|
+
export { default as MultiRootEditor } from './multirooteditor.js';
|
9
|
+
export type { RootAttributes } from './multirooteditor.js';
|
10
|
+
import './augmentation.js';
|
package/src/index.js
CHANGED
@@ -1,9 +1,9 @@
|
|
1
|
-
/**
|
2
|
-
* @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
|
3
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
4
|
-
*/
|
5
|
-
/**
|
6
|
-
* @module editor-multi-root
|
7
|
-
*/
|
8
|
-
export { default as MultiRootEditor } from './multirooteditor';
|
9
|
-
import './augmentation';
|
1
|
+
/**
|
2
|
+
* @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
|
3
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
4
|
+
*/
|
5
|
+
/**
|
6
|
+
* @module editor-multi-root
|
7
|
+
*/
|
8
|
+
export { default as MultiRootEditor } from './multirooteditor.js';
|
9
|
+
import './augmentation.js';
|