@ckeditor/ckeditor5-editor-multi-root 0.0.0-nightly-20240602.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 +2 -8
- package/build/editor-multi-root.js +1 -1
- package/dist/index.js +724 -715
- package/dist/index.js.map +1 -1
- package/dist/types/multirooteditor.d.ts +49 -2
- package/package.json +2 -2
- package/src/multirooteditor.d.ts +49 -2
- package/src/multirooteditor.js +51 -3
@@ -9,12 +9,13 @@
|
|
9
9
|
/**
|
10
10
|
* @module editor-multi-root/multirooteditor
|
11
11
|
*/
|
12
|
-
import { Editor, type EditorConfig } from 'ckeditor5/src/core.js';
|
12
|
+
import { Editor, Context, type EditorConfig } from 'ckeditor5/src/core.js';
|
13
13
|
import { type DecoratedMethodEvent } from 'ckeditor5/src/utils.js';
|
14
|
+
import { ContextWatchdog, EditorWatchdog } from 'ckeditor5/src/watchdog.js';
|
14
15
|
import MultiRootEditorUI from './multirooteditorui.js';
|
15
16
|
import { type RootElement } from 'ckeditor5/src/engine.js';
|
16
17
|
/**
|
17
|
-
* The multi-root editor implementation.
|
18
|
+
* The {@glink installation/getting-started/predefined-builds#multi-root-editor multi-root editor} implementation.
|
18
19
|
*
|
19
20
|
* The multi-root editor provides multiple inline editable elements and a toolbar. All editable areas are controlled by one editor
|
20
21
|
* instance, which means that they share common configuration, document ID, or undo stack.
|
@@ -26,6 +27,22 @@ import { type RootElement } from 'ckeditor5/src/engine.js';
|
|
26
27
|
* {@link module:editor-multi-root/multirooteditor~MultiRootEditor.create `MultiRootEditor.create()`} method.
|
27
28
|
*
|
28
29
|
* Note that you will need to attach the editor toolbar to your web page manually, in a desired place, after the editor is initialized.
|
30
|
+
*
|
31
|
+
* # Multi-root editor and multi-root editor build
|
32
|
+
*
|
33
|
+
* The multi-root editor can be used directly from source (if you installed the
|
34
|
+
* [`@ckeditor/ckeditor5-editor-multi-root`](https://www.npmjs.com/package/@ckeditor/ckeditor5-editor-multi-root) package)
|
35
|
+
* but it is also available in the
|
36
|
+
* {@glink installation/getting-started/predefined-builds#multi-root-editor multi-root editor build}.
|
37
|
+
*
|
38
|
+
* {@glink installation/getting-started/predefined-builds Builds} are ready-to-use editors with plugins bundled in.
|
39
|
+
*
|
40
|
+
* When using the editor from source you need to take care of loading all plugins by yourself
|
41
|
+
* (through the {@link module:core/editor/editorconfig~EditorConfig#plugins `config.plugins`} option).
|
42
|
+
* Using the editor from source gives much better flexibility and allows for easier customization.
|
43
|
+
*
|
44
|
+
* Read more about initializing the editor from source or as a build in
|
45
|
+
* {@link module:editor-multi-root/multirooteditor~MultiRootEditor.create `MultiRootEditor.create()`}.
|
29
46
|
*/
|
30
47
|
export default class MultiRootEditor extends Editor {
|
31
48
|
/**
|
@@ -449,6 +466,18 @@ export default class MultiRootEditor extends Editor {
|
|
449
466
|
* See the {@link module:core/editor/editorconfig~EditorConfig editor configuration documentation} to learn more about
|
450
467
|
* customizing plugins, toolbar and more.
|
451
468
|
*
|
469
|
+
* # Using the editor from source
|
470
|
+
*
|
471
|
+
* The code samples listed in the previous sections of this documentation assume that you are using an
|
472
|
+
* {@glink installation/getting-started/predefined-builds editor build}
|
473
|
+
* (for example – `@ckeditor/ckeditor5-build-multi-root`).
|
474
|
+
*
|
475
|
+
* If you want to use the multi-root editor from source (`@ckeditor/ckeditor5-editor-multi-root-editor/src/multirooteditor`),
|
476
|
+
* you need to define the list of
|
477
|
+
* {@link module:core/editor/editorconfig~EditorConfig#plugins plugins to be initialized} and
|
478
|
+
* {@link module:core/editor/editorconfig~EditorConfig#toolbar toolbar items}. Read more about using the editor from
|
479
|
+
* source in the {@glink installation/advanced/alternative-setups/integrating-from-source-webpack dedicated guide}.
|
480
|
+
*
|
452
481
|
* @param sourceElementsOrData The DOM elements that will be the source for the created editor
|
453
482
|
* or the editor's initial data. The editor will initialize multiple roots with names according to the keys in the passed object.
|
454
483
|
*
|
@@ -465,6 +494,24 @@ export default class MultiRootEditor extends Editor {
|
|
465
494
|
* @returns A promise resolved once the editor is ready. The promise resolves with the created editor instance.
|
466
495
|
*/
|
467
496
|
static create(sourceElementsOrData: Record<string, HTMLElement> | Record<string, string>, config?: EditorConfig): Promise<MultiRootEditor>;
|
497
|
+
/**
|
498
|
+
* The {@link module:core/context~Context} class.
|
499
|
+
*
|
500
|
+
* Exposed as static editor field for easier access in editor builds.
|
501
|
+
*/
|
502
|
+
static Context: typeof Context;
|
503
|
+
/**
|
504
|
+
* The {@link module:watchdog/editorwatchdog~EditorWatchdog} class.
|
505
|
+
*
|
506
|
+
* Exposed as static editor field for easier access in editor builds.
|
507
|
+
*/
|
508
|
+
static EditorWatchdog: typeof EditorWatchdog;
|
509
|
+
/**
|
510
|
+
* The {@link module:watchdog/contextwatchdog~ContextWatchdog} class.
|
511
|
+
*
|
512
|
+
* Exposed as static editor field for easier access in editor builds.
|
513
|
+
*/
|
514
|
+
static ContextWatchdog: typeof ContextWatchdog;
|
468
515
|
/**
|
469
516
|
* @internal
|
470
517
|
*/
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@ckeditor/ckeditor5-editor-multi-root",
|
3
|
-
"version": "0.0.0-nightly-
|
3
|
+
"version": "0.0.0-nightly-20240604.0",
|
4
4
|
"description": "Multi-root editor implementation for CKEditor 5.",
|
5
5
|
"keywords": [
|
6
6
|
"ckeditor",
|
@@ -12,7 +12,7 @@
|
|
12
12
|
"type": "module",
|
13
13
|
"main": "src/index.js",
|
14
14
|
"dependencies": {
|
15
|
-
"ckeditor5": "0.0.0-nightly-
|
15
|
+
"ckeditor5": "0.0.0-nightly-20240604.0",
|
16
16
|
"lodash-es": "4.17.21"
|
17
17
|
},
|
18
18
|
"author": "CKSource (http://cksource.com/)",
|
package/src/multirooteditor.d.ts
CHANGED
@@ -5,12 +5,13 @@
|
|
5
5
|
/**
|
6
6
|
* @module editor-multi-root/multirooteditor
|
7
7
|
*/
|
8
|
-
import { Editor, type EditorConfig } from 'ckeditor5/src/core.js';
|
8
|
+
import { Editor, Context, type EditorConfig } from 'ckeditor5/src/core.js';
|
9
9
|
import { type DecoratedMethodEvent } from 'ckeditor5/src/utils.js';
|
10
|
+
import { ContextWatchdog, EditorWatchdog } from 'ckeditor5/src/watchdog.js';
|
10
11
|
import MultiRootEditorUI from './multirooteditorui.js';
|
11
12
|
import { type RootElement } from 'ckeditor5/src/engine.js';
|
12
13
|
/**
|
13
|
-
* The multi-root editor implementation.
|
14
|
+
* The {@glink installation/getting-started/predefined-builds#multi-root-editor multi-root editor} implementation.
|
14
15
|
*
|
15
16
|
* The multi-root editor provides multiple inline editable elements and a toolbar. All editable areas are controlled by one editor
|
16
17
|
* instance, which means that they share common configuration, document ID, or undo stack.
|
@@ -22,6 +23,22 @@ import { type RootElement } from 'ckeditor5/src/engine.js';
|
|
22
23
|
* {@link module:editor-multi-root/multirooteditor~MultiRootEditor.create `MultiRootEditor.create()`} method.
|
23
24
|
*
|
24
25
|
* Note that you will need to attach the editor toolbar to your web page manually, in a desired place, after the editor is initialized.
|
26
|
+
*
|
27
|
+
* # Multi-root editor and multi-root editor build
|
28
|
+
*
|
29
|
+
* The multi-root editor can be used directly from source (if you installed the
|
30
|
+
* [`@ckeditor/ckeditor5-editor-multi-root`](https://www.npmjs.com/package/@ckeditor/ckeditor5-editor-multi-root) package)
|
31
|
+
* but it is also available in the
|
32
|
+
* {@glink installation/getting-started/predefined-builds#multi-root-editor multi-root editor build}.
|
33
|
+
*
|
34
|
+
* {@glink installation/getting-started/predefined-builds Builds} are ready-to-use editors with plugins bundled in.
|
35
|
+
*
|
36
|
+
* When using the editor from source you need to take care of loading all plugins by yourself
|
37
|
+
* (through the {@link module:core/editor/editorconfig~EditorConfig#plugins `config.plugins`} option).
|
38
|
+
* Using the editor from source gives much better flexibility and allows for easier customization.
|
39
|
+
*
|
40
|
+
* Read more about initializing the editor from source or as a build in
|
41
|
+
* {@link module:editor-multi-root/multirooteditor~MultiRootEditor.create `MultiRootEditor.create()`}.
|
25
42
|
*/
|
26
43
|
export default class MultiRootEditor extends Editor {
|
27
44
|
/**
|
@@ -445,6 +462,18 @@ export default class MultiRootEditor extends Editor {
|
|
445
462
|
* See the {@link module:core/editor/editorconfig~EditorConfig editor configuration documentation} to learn more about
|
446
463
|
* customizing plugins, toolbar and more.
|
447
464
|
*
|
465
|
+
* # Using the editor from source
|
466
|
+
*
|
467
|
+
* The code samples listed in the previous sections of this documentation assume that you are using an
|
468
|
+
* {@glink installation/getting-started/predefined-builds editor build}
|
469
|
+
* (for example – `@ckeditor/ckeditor5-build-multi-root`).
|
470
|
+
*
|
471
|
+
* If you want to use the multi-root editor from source (`@ckeditor/ckeditor5-editor-multi-root-editor/src/multirooteditor`),
|
472
|
+
* you need to define the list of
|
473
|
+
* {@link module:core/editor/editorconfig~EditorConfig#plugins plugins to be initialized} and
|
474
|
+
* {@link module:core/editor/editorconfig~EditorConfig#toolbar toolbar items}. Read more about using the editor from
|
475
|
+
* source in the {@glink installation/advanced/alternative-setups/integrating-from-source-webpack dedicated guide}.
|
476
|
+
*
|
448
477
|
* @param sourceElementsOrData The DOM elements that will be the source for the created editor
|
449
478
|
* or the editor's initial data. The editor will initialize multiple roots with names according to the keys in the passed object.
|
450
479
|
*
|
@@ -461,6 +490,24 @@ export default class MultiRootEditor extends Editor {
|
|
461
490
|
* @returns A promise resolved once the editor is ready. The promise resolves with the created editor instance.
|
462
491
|
*/
|
463
492
|
static create(sourceElementsOrData: Record<string, HTMLElement> | Record<string, string>, config?: EditorConfig): Promise<MultiRootEditor>;
|
493
|
+
/**
|
494
|
+
* The {@link module:core/context~Context} class.
|
495
|
+
*
|
496
|
+
* Exposed as static editor field for easier access in editor builds.
|
497
|
+
*/
|
498
|
+
static Context: typeof Context;
|
499
|
+
/**
|
500
|
+
* The {@link module:watchdog/editorwatchdog~EditorWatchdog} class.
|
501
|
+
*
|
502
|
+
* Exposed as static editor field for easier access in editor builds.
|
503
|
+
*/
|
504
|
+
static EditorWatchdog: typeof EditorWatchdog;
|
505
|
+
/**
|
506
|
+
* The {@link module:watchdog/contextwatchdog~ContextWatchdog} class.
|
507
|
+
*
|
508
|
+
* Exposed as static editor field for easier access in editor builds.
|
509
|
+
*/
|
510
|
+
static ContextWatchdog: typeof ContextWatchdog;
|
464
511
|
/**
|
465
512
|
* @internal
|
466
513
|
*/
|
package/src/multirooteditor.js
CHANGED
@@ -5,13 +5,14 @@
|
|
5
5
|
/**
|
6
6
|
* @module editor-multi-root/multirooteditor
|
7
7
|
*/
|
8
|
-
import { Editor, secureSourceElement } from 'ckeditor5/src/core.js';
|
8
|
+
import { Editor, Context, secureSourceElement } from 'ckeditor5/src/core.js';
|
9
9
|
import { CKEditorError, getDataFromElement, setDataInElement, logWarning } from 'ckeditor5/src/utils.js';
|
10
|
+
import { ContextWatchdog, EditorWatchdog } from 'ckeditor5/src/watchdog.js';
|
10
11
|
import MultiRootEditorUI from './multirooteditorui.js';
|
11
12
|
import MultiRootEditorUIView from './multirooteditoruiview.js';
|
12
13
|
import { isElement as _isElement } from 'lodash-es';
|
13
14
|
/**
|
14
|
-
* The multi-root editor implementation.
|
15
|
+
* The {@glink installation/getting-started/predefined-builds#multi-root-editor multi-root editor} implementation.
|
15
16
|
*
|
16
17
|
* The multi-root editor provides multiple inline editable elements and a toolbar. All editable areas are controlled by one editor
|
17
18
|
* instance, which means that they share common configuration, document ID, or undo stack.
|
@@ -23,8 +24,24 @@ import { isElement as _isElement } from 'lodash-es';
|
|
23
24
|
* {@link module:editor-multi-root/multirooteditor~MultiRootEditor.create `MultiRootEditor.create()`} method.
|
24
25
|
*
|
25
26
|
* Note that you will need to attach the editor toolbar to your web page manually, in a desired place, after the editor is initialized.
|
27
|
+
*
|
28
|
+
* # Multi-root editor and multi-root editor build
|
29
|
+
*
|
30
|
+
* The multi-root editor can be used directly from source (if you installed the
|
31
|
+
* [`@ckeditor/ckeditor5-editor-multi-root`](https://www.npmjs.com/package/@ckeditor/ckeditor5-editor-multi-root) package)
|
32
|
+
* but it is also available in the
|
33
|
+
* {@glink installation/getting-started/predefined-builds#multi-root-editor multi-root editor build}.
|
34
|
+
*
|
35
|
+
* {@glink installation/getting-started/predefined-builds Builds} are ready-to-use editors with plugins bundled in.
|
36
|
+
*
|
37
|
+
* When using the editor from source you need to take care of loading all plugins by yourself
|
38
|
+
* (through the {@link module:core/editor/editorconfig~EditorConfig#plugins `config.plugins`} option).
|
39
|
+
* Using the editor from source gives much better flexibility and allows for easier customization.
|
40
|
+
*
|
41
|
+
* Read more about initializing the editor from source or as a build in
|
42
|
+
* {@link module:editor-multi-root/multirooteditor~MultiRootEditor.create `MultiRootEditor.create()`}.
|
26
43
|
*/
|
27
|
-
|
44
|
+
class MultiRootEditor extends Editor {
|
28
45
|
/**
|
29
46
|
* Creates an instance of the multi-root editor.
|
30
47
|
*
|
@@ -718,6 +735,18 @@ export default class MultiRootEditor extends Editor {
|
|
718
735
|
* See the {@link module:core/editor/editorconfig~EditorConfig editor configuration documentation} to learn more about
|
719
736
|
* customizing plugins, toolbar and more.
|
720
737
|
*
|
738
|
+
* # Using the editor from source
|
739
|
+
*
|
740
|
+
* The code samples listed in the previous sections of this documentation assume that you are using an
|
741
|
+
* {@glink installation/getting-started/predefined-builds editor build}
|
742
|
+
* (for example – `@ckeditor/ckeditor5-build-multi-root`).
|
743
|
+
*
|
744
|
+
* If you want to use the multi-root editor from source (`@ckeditor/ckeditor5-editor-multi-root-editor/src/multirooteditor`),
|
745
|
+
* you need to define the list of
|
746
|
+
* {@link module:core/editor/editorconfig~EditorConfig#plugins plugins to be initialized} and
|
747
|
+
* {@link module:core/editor/editorconfig~EditorConfig#toolbar toolbar items}. Read more about using the editor from
|
748
|
+
* source in the {@glink installation/advanced/alternative-setups/integrating-from-source-webpack dedicated guide}.
|
749
|
+
*
|
721
750
|
* @param sourceElementsOrData The DOM elements that will be the source for the created editor
|
722
751
|
* or the editor's initial data. The editor will initialize multiple roots with names according to the keys in the passed object.
|
723
752
|
*
|
@@ -790,6 +819,25 @@ export default class MultiRootEditor extends Editor {
|
|
790
819
|
}
|
791
820
|
}
|
792
821
|
}
|
822
|
+
/**
|
823
|
+
* The {@link module:core/context~Context} class.
|
824
|
+
*
|
825
|
+
* Exposed as static editor field for easier access in editor builds.
|
826
|
+
*/
|
827
|
+
MultiRootEditor.Context = Context;
|
828
|
+
/**
|
829
|
+
* The {@link module:watchdog/editorwatchdog~EditorWatchdog} class.
|
830
|
+
*
|
831
|
+
* Exposed as static editor field for easier access in editor builds.
|
832
|
+
*/
|
833
|
+
MultiRootEditor.EditorWatchdog = EditorWatchdog;
|
834
|
+
/**
|
835
|
+
* The {@link module:watchdog/contextwatchdog~ContextWatchdog} class.
|
836
|
+
*
|
837
|
+
* Exposed as static editor field for easier access in editor builds.
|
838
|
+
*/
|
839
|
+
MultiRootEditor.ContextWatchdog = ContextWatchdog;
|
840
|
+
export default MultiRootEditor;
|
793
841
|
function getInitialData(sourceElementOrData) {
|
794
842
|
return isElement(sourceElementOrData) ? getDataFromElement(sourceElementOrData) : sourceElementOrData;
|
795
843
|
}
|