@ckeditor/ckeditor5-core 48.0.0-alpha.1 → 48.0.0-alpha.10

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.
@@ -126,8 +126,9 @@ export interface EditorConfig extends EngineConfig {
126
126
  * plugins can read and/or modify it during initialization.
127
127
  *
128
128
  * **This property has been deprecated and will be removed in the future versions of CKEditor. Please use
129
- * {@link module:core/editor/editorconfig~EditorConfig#root `root.initialData`} or
130
- * {@link module:core/editor/editorconfig~EditorConfig#roots `roots.<rootName>.initialData`} instead.**
129
+ * {@link module:core/editor/editorconfig~EditorConfig#root `config.root.initialData`} instead.
130
+ * For the {@link module:editor-multi-root/multirooteditor~MultiRootEditor multi-root editor}, use
131
+ * {@link module:core/editor/editorconfig~EditorConfig#roots `config.roots.<rootName>.initialData`}.**
131
132
  *
132
133
  * @deprecated
133
134
  */
@@ -571,8 +572,9 @@ export interface EditorConfig extends EngineConfig {
571
572
  * See the {@glink features/editor-placeholder "Editor placeholder"} guide for more information and live examples.
572
573
  *
573
574
  * **This property has been deprecated and will be removed in the future versions of CKEditor. Please use
574
- * {@link module:core/editor/editorconfig~EditorConfig#root `root.placeholder`} or
575
- * {@link module:core/editor/editorconfig~EditorConfig#roots `roots.<rootName>.placeholder`} instead.**
575
+ * {@link module:core/editor/editorconfig~EditorConfig#root `config.root.placeholder`} instead.
576
+ * For the {@link module:editor-multi-root/multirooteditor~MultiRootEditor multi-root editor}, use
577
+ * {@link module:core/editor/editorconfig~EditorConfig#roots `config.roots.<rootName>.placeholder`}.**
576
578
  *
577
579
  * @deprecated
578
580
  */
@@ -856,14 +858,16 @@ export interface EditorConfig extends EngineConfig {
856
858
  */
857
859
  translations?: ArrayOrItem<Translations>;
858
860
  /**
859
- * Label text for the `aria-label` attribute set on editor editing area. Used by assistive technologies
860
- * to tell apart multiple editor instances (editing areas) on the page. If not set, a default
861
- * "Rich Text Editor. Editing area [name of the area]" is used instead.
861
+ * Label which briefly describes the editing area. Used for the `aria-label` attribute set on the editor editing area,
862
+ * helping assistive technologies to tell apart multiple editor instances (editing areas) on the page. If not set,
863
+ * a default "Rich Text Editor. Editing area [name of the area]" is used instead.
864
+ *
865
+ * It can also be used by other features when referring to this editing area (e.g. AI features).
862
866
  *
863
867
  * ```ts
864
868
  * ClassicEditor
865
869
  * .create( document.querySelector( '#editor' ), {
866
- * label: 'My editor'
870
+ * label: 'Article main content'
867
871
  * } )
868
872
  * .then( ... )
869
873
  * .catch( ... );
@@ -878,16 +882,16 @@ export interface EditorConfig extends EngineConfig {
878
882
  * {
879
883
  * header: document.querySelector( '#header' ),
880
884
  * content: document.querySelector( '#content' ),
881
- * leftSide: document.querySelector( '#left-side' ),
882
- * rightSide: document.querySelector( '#right-side' )
885
+ * sideQuote: document.querySelector( '#side-quote' ),
886
+ * relatedLinks: document.querySelector( '#related-links' )
883
887
  * },
884
888
  * // Config:
885
889
  * {
886
890
  * label: {
887
- * header: 'Header label',
888
- * content: 'Content label',
889
- * leftSide: 'Left side label',
890
- * rightSide: 'Right side label'
891
+ * header: 'Article header',
892
+ * content: 'Article main content',
893
+ * sideQuote: 'Side-quote',
894
+ * relatedLinks: 'Related links'
891
895
  * }
892
896
  * }
893
897
  * )
@@ -896,43 +900,192 @@ export interface EditorConfig extends EngineConfig {
896
900
  * ```
897
901
  *
898
902
  * **This property has been deprecated and will be removed in the future versions of CKEditor. Please use
899
- * {@link module:core/editor/editorconfig~EditorConfig#root `root.label`} or
900
- * {@link module:core/editor/editorconfig~EditorConfig#roots `roots.<rootName>.label`} instead.**
903
+ * {@link module:core/editor/editorconfig~EditorConfig#root `config.root.label`} instead.
904
+ * For the {@link module:editor-multi-root/multirooteditor~MultiRootEditor multi-root editor}, use
905
+ * {@link module:core/editor/editorconfig~EditorConfig#roots `config.roots.<rootName>.label`}.**
901
906
  *
902
907
  * @deprecated
903
908
  */
904
909
  label?: string | Record<string, string>;
905
910
  /**
906
- * The root configuration options for the default `main` root.
911
+ * The root configuration for the default `main` root. Use this option to configure the initial data,
912
+ * placeholder, label, and source element for a single-root editor.
907
913
  *
908
- * This option is an alias for `config.roots.main`.
909
- */
910
- root?: RootConfig;
911
- /**
912
- * The root configuration options grouped by the root name.
914
+ * This is the recommended way to configure a single-root editor:
913
915
  *
914
916
  * ```ts
917
+ * // Classic editor – uses `attachTo` for the source element.
915
918
  * ClassicEditor
916
919
  * .create( {
917
920
  * attachTo: document.querySelector( '#editor' ),
918
- * roots: {
919
- * main: {
920
- * initialData: '<p>Hello world!</p>',
921
- * placeholder: 'Type some text...',
922
- * label: 'Main content'
923
- * }
921
+ * root: {
922
+ * initialData: '<p>Hello world!</p>',
923
+ * placeholder: 'Type some text...'
924
924
  * }
925
- * } );
925
+ * } )
926
+ * .then( ... )
927
+ * .catch( ... );
928
+ * ```
929
+ *
930
+ * ```ts
931
+ * // Inline editor – uses `root.element` for the source element.
932
+ * InlineEditor
933
+ * .create( {
934
+ * root: {
935
+ * element: document.querySelector( '#editor' ),
936
+ * initialData: '<p>Hello world!</p>',
937
+ * placeholder: 'Type some text...'
938
+ * }
939
+ * } )
940
+ * .then( ... )
941
+ * .catch( ... );
942
+ * ```
943
+ *
944
+ * ```ts
945
+ * // Balloon editor – uses `root.element` for the source element.
946
+ * BalloonEditor
947
+ * .create( {
948
+ * root: {
949
+ * element: document.querySelector( '#editor' ),
950
+ * placeholder: 'Type some text...'
951
+ * }
952
+ * } )
953
+ * .then( ... )
954
+ * .catch( ... );
955
+ * ```
956
+ *
957
+ * ```ts
958
+ * // Decoupled editor – uses `root.element` for the source element.
959
+ * // The toolbar and editable area must be manually added to the DOM.
960
+ * DecoupledEditor
961
+ * .create( {
962
+ * root: {
963
+ * element: document.querySelector( '#editor' ),
964
+ * initialData: '<p>Hello world!</p>'
965
+ * }
966
+ * } )
967
+ * .then( editor => {
968
+ * document.querySelector( '#toolbar' ).appendChild( editor.ui.view.toolbar.element );
969
+ * } )
970
+ * .catch( ... );
971
+ * ```
972
+ *
973
+ * Internally, this option is an alias for `config.roots.main`. If both `config.root` and `config.roots.main`
974
+ * are set, an error will be thrown.
975
+ *
976
+ * For the {@link module:editor-multi-root/multirooteditor~MultiRootEditor multi-root editor}, use the
977
+ * {@link module:core/editor/editorconfig~EditorConfig#roots `config.roots`} option instead to define
978
+ * configuration for each root individually.
979
+ */
980
+ root?: RootConfig;
981
+ /**
982
+ * The root configuration options grouped by the root name. This option is used primarily by the
983
+ * {@link module:editor-multi-root/multirooteditor~MultiRootEditor multi-root editor} to define
984
+ * configuration for each root individually.
985
+ *
986
+ * For a typical single-root editor, use the simpler {@link module:core/editor/editorconfig~EditorConfig#root `config.root`}
987
+ * option instead.
988
+ *
989
+ * ```ts
990
+ * // Using existing DOM elements as source for each root.
991
+ * MultiRootEditor.create( {
992
+ * roots: {
993
+ * header: {
994
+ * element: document.querySelector( '#header' ),
995
+ * placeholder: 'Type header...',
996
+ * label: 'Article header'
997
+ * },
998
+ * content: {
999
+ * element: document.querySelector( '#content' ),
1000
+ * placeholder: 'Type content...',
1001
+ * label: 'Article main content'
1002
+ * }
1003
+ * }
1004
+ * } )
1005
+ * .then( editor => {
1006
+ * document.querySelector( '#toolbar' ).appendChild( editor.ui.view.toolbar.element );
1007
+ * } )
1008
+ * .catch( ... );
1009
+ * ```
1010
+ *
1011
+ * ```ts
1012
+ * // Creating a detached editor with initial data for each root.
1013
+ * MultiRootEditor.create( {
1014
+ * roots: {
1015
+ * header: {
1016
+ * initialData: '<h2>Article title</h2>',
1017
+ * placeholder: 'Type header...',
1018
+ * label: 'Article header'
1019
+ * },
1020
+ * content: {
1021
+ * initialData: '<p>Article body...</p>',
1022
+ * placeholder: 'Type content...',
1023
+ * label: 'Article main content'
1024
+ * }
1025
+ * }
1026
+ * } )
1027
+ * .then( editor => {
1028
+ * document.querySelector( '#toolbar' ).appendChild( editor.ui.view.toolbar.element );
1029
+ *
1030
+ * for ( const rootName of editor.ui.getEditableElementsNames() ) {
1031
+ * document.querySelector( '#editables' ).appendChild( editor.ui.view.getEditable( rootName ).element );
1032
+ * }
1033
+ * } )
1034
+ * .catch( ... );
926
1035
  * ```
927
1036
  */
928
1037
  roots?: Record<string, RootConfig>;
929
1038
  }
930
1039
  /**
931
- * Configuration for a an editor root. It is used in {@link module:core/editor/editorconfig~EditorConfig#root `EditorConfig#root`} and
1040
+ * Configuration for an editor root. It is used in {@link module:core/editor/editorconfig~EditorConfig#root `EditorConfig#root`} and
932
1041
  * {@link module:core/editor/editorconfig~EditorConfig#roots `EditorConfig#roots.<rootName>`}.
933
1042
  *
934
- * **Note**: If your editor implementation uses only a single root, you can use `config.root` to set the root configuration instead of
935
- * `config.roots.main`.
1043
+ * For a typical single-root editor (Classic, Inline, Balloon, Decoupled), use
1044
+ * {@link module:core/editor/editorconfig~EditorConfig#root `config.root`} to set the root configuration.
1045
+ * For the {@link module:editor-multi-root/multirooteditor~MultiRootEditor multi-root editor}, use
1046
+ * {@link module:core/editor/editorconfig~EditorConfig#roots `config.roots`} to define configuration for each root.
1047
+ *
1048
+ * ```ts
1049
+ * // Classic editor – the source element is set via `config.attachTo`.
1050
+ * ClassicEditor.create( {
1051
+ * attachTo: document.querySelector( '#editor' ),
1052
+ * root: {
1053
+ * initialData: '<p>Hello world!</p>',
1054
+ * placeholder: 'Type some text...',
1055
+ * label: 'Article main content'
1056
+ * }
1057
+ * } );
1058
+ * ```
1059
+ *
1060
+ * ```ts
1061
+ * // Inline editor – the source element is set via `root.element`.
1062
+ * InlineEditor.create( {
1063
+ * root: {
1064
+ * element: document.querySelector( '#editor' ),
1065
+ * initialData: '<p>Hello world!</p>',
1066
+ * placeholder: 'Type some text...',
1067
+ * label: 'Article main content'
1068
+ * }
1069
+ * } );
1070
+ * ```
1071
+ *
1072
+ * ```ts
1073
+ * // Multi-root editor – each root is configured separately via `config.roots`.
1074
+ * MultiRootEditor.create( {
1075
+ * roots: {
1076
+ * header: {
1077
+ * element: document.querySelector( '#header' ),
1078
+ * placeholder: 'Type header...',
1079
+ * label: 'Article header'
1080
+ * },
1081
+ * content: {
1082
+ * element: document.querySelector( '#content' ),
1083
+ * placeholder: 'Type content...',
1084
+ * label: 'Article main content'
1085
+ * }
1086
+ * }
1087
+ * } );
1088
+ * ```
936
1089
  */
937
1090
  export interface RootConfig {
938
1091
  /**
@@ -949,7 +1102,8 @@ export interface RootConfig {
949
1102
  */
950
1103
  element?: HTMLElement;
951
1104
  /**
952
- * The initial editor data to be used instead of the provided element's HTML content.
1105
+ * The initial editor data to be used instead of the HTML content of the
1106
+ * {@link module:core/editor/editorconfig~RootConfig#element source element}.
953
1107
  *
954
1108
  * ```ts
955
1109
  * ClassicEditor
@@ -963,7 +1117,7 @@ export interface RootConfig {
963
1117
  * .catch( ... );
964
1118
  * ```
965
1119
  *
966
- * By default, the editor is initialized with the content of the element on which this editor is initialized.
1120
+ * By default, the editor is initialized with the content of the source element on which this editor root is initialized.
967
1121
  * This configuration option lets you override this behavior and pass different initial data.
968
1122
  * It is especially useful if it is difficult for your integration to put the data inside the HTML element.
969
1123
  *
@@ -995,13 +1149,6 @@ export interface RootConfig {
995
1149
  * ```
996
1150
  *
997
1151
  * See also {@link module:core/editor/editor~Editor.create Editor.create()} documentation for the editor implementation which you use.
998
- *
999
- * **Note:** If initial data is passed to `Editor.create()` in the first parameter (instead of a DOM element), and,
1000
- * at the same time, root `initialData` is set, an error will be thrown as those two options exclude themselves.
1001
- *
1002
- * If `config.root.initialData` is not set when the editor is initialized, the data received in `Editor.create()` call
1003
- * will be used to set `config.roots.main.initialData`. As a result, `config.roots.main.initialData` is always set
1004
- * in the editor's config and plugins can read and/or modify it during initialization.
1005
1152
  */
1006
1153
  initialData?: string;
1007
1154
  /**
@@ -1069,16 +1216,20 @@ export interface RootConfig {
1069
1216
  */
1070
1217
  placeholder?: string;
1071
1218
  /**
1072
- * Label text for the `aria-label` attribute set on editor editing area. Used by assistive technologies
1219
+ * Label which briefly describes this editing area.
1220
+ *
1221
+ * It is used for the `aria-label` attribute set on the editor editing area, helping assistive technologies
1073
1222
  * to tell apart multiple editor instances (editing areas) on the page. If not set, a default
1074
1223
  * "Rich Text Editor. Editing area [name of the area]" is used instead.
1075
1224
  *
1225
+ * It can also be used by other features when referring to this editing area (e.g. AI features).
1226
+ *
1076
1227
  * ```ts
1077
1228
  * ClassicEditor
1078
1229
  * .create( {
1079
1230
  * attachTo: document.querySelector( '#editor' ),
1080
1231
  * root: {
1081
- * label: 'My editor'
1232
+ * label: 'Article main content'
1082
1233
  * }
1083
1234
  * } )
1084
1235
  * .then( ... )
@@ -1092,19 +1243,19 @@ export interface RootConfig {
1092
1243
  * roots: {
1093
1244
  * header: {
1094
1245
  * element: document.querySelector( '#header' ),
1095
- * label: 'Header label'
1246
+ * label: 'Article header'
1096
1247
  * },
1097
1248
  * content: {
1098
1249
  * element: document.querySelector( '#content' ),
1099
- * label: 'Content label'
1250
+ * label: 'Article main content'
1100
1251
  * },
1101
- * leftSide: {
1102
- * element: document.querySelector( '#left-side' ),
1103
- * label: 'Left side label'
1252
+ * sideQuote: {
1253
+ * element: document.querySelector( '#side-quote' ),
1254
+ * label: 'Side-quote'
1104
1255
  * },
1105
- * rightSide: {
1106
- * element: document.querySelector( '#right-side' ),
1107
- * label: 'Right side label'
1256
+ * relatedLinks: {
1257
+ * element: document.querySelector( '#related-links' ),
1258
+ * label: 'Related links'
1108
1259
  * }
1109
1260
  * }
1110
1261
  * } )
@@ -1114,22 +1265,6 @@ export interface RootConfig {
1114
1265
  */
1115
1266
  label?: string;
1116
1267
  }
1117
- /**
1118
- * The `config.initialData` option cannot be used together with `config.root.initialData` or
1119
- * `config.roots.<rootName>.initialData` passed in the {@link module:core/editor/editor~Editor.create `Editor.create()`} configuration.
1120
- *
1121
- * @error editor-create-initial-data
1122
- */
1123
- /**
1124
- * The `config.initialData` option cannot be used together with the `config.root.initialData` or `config.roots.main.initialData`.
1125
- *
1126
- * @error editor-create-roots-initial-data
1127
- */
1128
- /**
1129
- * The `config.attachTo` option is available only for the {@link module:editor-classic/classiceditor~ClassicEditor}.
1130
- *
1131
- * @error editor-create-attachto-ignored
1132
- */
1133
1268
  /**
1134
1269
  * The configuration of the editor language.
1135
1270
  *
@@ -7,7 +7,8 @@
7
7
  --ck-content-font-size:medium;
8
8
  --ck-content-font-color:#000;
9
9
  --ck-content-line-height:1.5;
10
- --ck-content-word-break:break-word;
10
+ --ck-content-word-break:normal;
11
+ --ck-content-overflow-wrap:break-word;
11
12
  }
12
13
 
13
14
  .ck-content{
@@ -16,4 +17,5 @@
16
17
  color:var(--ck-content-font-color);
17
18
  line-height:var(--ck-content-line-height);
18
19
  word-break:var(--ck-content-word-break);
20
+ overflow-wrap:var(--ck-content-overflow-wrap);
19
21
  }
@@ -7,5 +7,6 @@
7
7
  --ck-content-font-size:medium;
8
8
  --ck-content-font-color:#000;
9
9
  --ck-content-line-height:1.5;
10
- --ck-content-word-break:break-word;
10
+ --ck-content-word-break:normal;
11
+ --ck-content-overflow-wrap:break-word;
11
12
  }
package/dist/index.css CHANGED
@@ -7,7 +7,8 @@
7
7
  --ck-content-font-size: medium;
8
8
  --ck-content-font-color: #000;
9
9
  --ck-content-line-height: 1.5;
10
- --ck-content-word-break: break-word;
10
+ --ck-content-word-break: normal;
11
+ --ck-content-overflow-wrap: break-word;
11
12
  }
12
13
 
13
14
  .ck-content {
@@ -16,6 +17,7 @@
16
17
  color: var(--ck-content-font-color);
17
18
  line-height: var(--ck-content-line-height);
18
19
  word-break: var(--ck-content-word-break);
20
+ overflow-wrap: var(--ck-content-overflow-wrap);
19
21
  }
20
22
 
21
23
  /*# sourceMappingURL=index.css.map */
@@ -1 +1 @@
1
- {"version":3,"sources":["../theme/core.css","index.css"],"names":[],"mappings":";;;;AAKA,CAAA,IAAA,CAAA;ACJA,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,SAAS,CAAC,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,KAAK;AACzE,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,MAAM;AAChC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG;AAC/B,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;AAC/B,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,IAAI;AACrC;;ADQA,CAAA,EAAA,CAAA,OAAA,CAAA;ACLA,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC;AAC5C,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC;AACxC,CAAC,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC;AACrC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC;AAC5C,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC;AAC1C;;AAEA,CAAC,CAAC,CAAC,CAAC,gBAAgB,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC","file":"index.css.map","sourcesContent":["/*\n * Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n\n:root {\n\t--ck-content-font-family: Helvetica, Arial, Tahoma, Verdana, Sans-Serif;\n\t--ck-content-font-size: medium;\n\t/* stylelint-disable-next-line declaration-property-value-disallowed-list */\n\t--ck-content-font-color: #000;\n\t--ck-content-line-height: 1.5;\n\t--ck-content-word-break: break-word;\n}\n\n.ck-content {\n\tfont-family: var(--ck-content-font-family);\n\tfont-size: var(--ck-content-font-size);\n\tcolor: var(--ck-content-font-color);\n\tline-height: var(--ck-content-line-height);\n\tword-break: var(--ck-content-word-break);\n}\n",":root {\n --ck-content-font-family: Helvetica, Arial, Tahoma, Verdana, Sans-Serif;\n --ck-content-font-size: medium;\n --ck-content-font-color: #000;\n --ck-content-line-height: 1.5;\n --ck-content-word-break: break-word;\n}\n\n.ck-content {\n font-family: var(--ck-content-font-family);\n font-size: var(--ck-content-font-size);\n color: var(--ck-content-font-color);\n line-height: var(--ck-content-line-height);\n word-break: var(--ck-content-word-break);\n}\n\n/*# sourceMappingURL=index.css.map */"]}
1
+ {"version":3,"sources":["../theme/core.css","index.css"],"names":[],"mappings":";;;;AAKA,CAAA,IAAA,CAAA;ACJA,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,SAAS,CAAC,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,KAAK;AACzE,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,MAAM;AAChC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG;AAC/B,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;AAC/B,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,MAAM;AACjC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC,IAAI;AACxC;;ADQA,CAAA,EAAA,CAAA,OAAA,CAAA;ACLA,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC;AAC5C,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC;AACxC,CAAC,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC;AACrC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC;AAC5C,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC;AAC1C,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC;AAChD;;AAEA,CAAC,CAAC,CAAC,CAAC,gBAAgB,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC","file":"index.css.map","sourcesContent":["/*\n * Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n\n:root {\n\t--ck-content-font-family: Helvetica, Arial, Tahoma, Verdana, Sans-Serif;\n\t--ck-content-font-size: medium;\n\t/* stylelint-disable-next-line declaration-property-value-disallowed-list */\n\t--ck-content-font-color: #000;\n\t--ck-content-line-height: 1.5;\n\t--ck-content-word-break: normal;\n\t--ck-content-overflow-wrap: break-word;\n}\n\n.ck-content {\n\tfont-family: var(--ck-content-font-family);\n\tfont-size: var(--ck-content-font-size);\n\tcolor: var(--ck-content-font-color);\n\tline-height: var(--ck-content-line-height);\n\tword-break: var(--ck-content-word-break);\n\toverflow-wrap: var(--ck-content-overflow-wrap);\n}\n",":root {\n --ck-content-font-family: Helvetica, Arial, Tahoma, Verdana, Sans-Serif;\n --ck-content-font-size: medium;\n --ck-content-font-color: #000;\n --ck-content-line-height: 1.5;\n --ck-content-word-break: normal;\n --ck-content-overflow-wrap: break-word;\n}\n\n.ck-content {\n font-family: var(--ck-content-font-family);\n font-size: var(--ck-content-font-size);\n color: var(--ck-content-font-color);\n line-height: var(--ck-content-line-height);\n word-break: var(--ck-content-word-break);\n overflow-wrap: var(--ck-content-overflow-wrap);\n}\n\n/*# sourceMappingURL=index.css.map */"]}
package/dist/index.js CHANGED
@@ -2,7 +2,7 @@
2
2
  * @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
3
3
  * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
4
4
  */
5
- import { ObservableMixin, insertToPriorityArray, CKEditorError, EmitterMixin, Config, Locale, Collection, KeystrokeHandler, env, global, uid, decodeLicenseKey, toArray, crc32, releaseDate, logError, isFeatureBlockedByLicenseKey, setDataInElement, getDataFromElement } from '@ckeditor/ckeditor5-utils/dist/index.js';
5
+ import { ObservableMixin, insertToPriorityArray, CKEditorError, EmitterMixin, Config, Locale, Collection, KeystrokeHandler, env, global, uid, decodeLicenseKey, toArray, crc32, releaseDate, logError, isFeatureBlockedByLicenseKey, setDataInElement, logWarning, getDataFromElement } from '@ckeditor/ckeditor5-utils/dist/index.js';
6
6
  import { get, set, isFunction, isElement as isElement$1 } from 'es-toolkit/compat';
7
7
  import { Model, StylesProcessor, DataController, EditingController, Conversion } from '@ckeditor/ckeditor5-engine/dist/index.js';
8
8
  import { EditorWatchdog, ContextWatchdog } from '@ckeditor/ckeditor5-watchdog/dist/index.js';
@@ -2896,10 +2896,40 @@ function isTextArea(sourceElement) {
2896
2896
  const mainRootConfig = config.get('root');
2897
2897
  const rootsConfig = config.get('roots') || Object.create(null);
2898
2898
  // Avoid mixing `config.root` and `config.roots.main`.
2899
- if (mainRootConfig && (!defaultRootName || defaultRootName in rootsConfig)) {
2900
- // Documented in core/editor/editorconfig.ts.
2901
- // eslint-disable-next-line ckeditor5-rules/ckeditor-error-message
2902
- throw new CKEditorError('editor-create-roots-initial-data');
2899
+ if (mainRootConfig) {
2900
+ if (!defaultRootName) {
2901
+ /**
2902
+ * The {@link module:core/editor/editorconfig~EditorConfig#root `config.root`} option is designed
2903
+ * for single-root editors and cannot be used with the
2904
+ * {@link module:editor-multi-root/multirooteditor~MultiRootEditor multi-root editor}.
2905
+ *
2906
+ * To configure a multi-root editor, define each root individually using
2907
+ * {@link module:core/editor/editorconfig~EditorConfig#roots `config.roots`}:
2908
+ *
2909
+ * ```ts
2910
+ * MultiRootEditor.create( {
2911
+ * roots: {
2912
+ * header: { initialData: '<p>Header</p>' },
2913
+ * content: { initialData: '<p>Content</p>' }
2914
+ * }
2915
+ * } );
2916
+ * ```
2917
+ *
2918
+ * @error editor-create-multi-root-with-main
2919
+ */ throw new CKEditorError('editor-create-multi-root-with-main', null);
2920
+ } else if (defaultRootName in rootsConfig) {
2921
+ /**
2922
+ * Both {@link module:core/editor/editorconfig~EditorConfig#root `config.root`} and
2923
+ * `config.roots.main` are set, but they both configure the same default editing root,
2924
+ * which creates an ambiguity. Use one or the other:
2925
+ *
2926
+ * * {@link module:core/editor/editorconfig~EditorConfig#root `config.root`} for a single-root editor.
2927
+ * * {@link module:core/editor/editorconfig~EditorConfig#roots `config.roots`} when defining
2928
+ * multiple roots.
2929
+ *
2930
+ * @error editor-create-roots-with-main
2931
+ */ throw new CKEditorError('editor-create-roots-with-main', null);
2932
+ }
2903
2933
  }
2904
2934
  // Move `config.root` to `config.roots.main`.
2905
2935
  // This makes access to root configuration more consistent as all roots will be defined in `config.roots`.
@@ -2920,32 +2950,87 @@ function isTextArea(sourceElement) {
2920
2950
  for (const rootName of rootNames){
2921
2951
  const rootConfig = rootsConfig[rootName] || Object.create(null);
2922
2952
  const sourceElementOrDataForRoot = sourceElementIsPlainObject ? sourceElementsOrData[rootName] : sourceElementsOrData;
2953
+ // Assign `sourceElement` to root config if it's an element.
2954
+ if (!separateAttachTo && isElement(sourceElementOrDataForRoot)) {
2955
+ if (rootConfig.element) {
2956
+ /**
2957
+ * The root element is specified both as the first argument of the editor `create()` method
2958
+ * (e.g. {@link module:editor-inline/inlineeditor~InlineEditor.create `InlineEditor.create()`} or
2959
+ * {@link module:editor-multi-root/multirooteditor~MultiRootEditor.create `MultiRootEditor.create()`})
2960
+ * and in {@link module:core/editor/editorconfig~RootConfig#element `config.root.element`}
2961
+ * (or `config.roots.<rootName>.element` for the
2962
+ * {@link module:editor-multi-root/multirooteditor~MultiRootEditor multi-root editor}).
2963
+ *
2964
+ * Passing the element as the first argument is deprecated. Remove it and use
2965
+ * {@link module:core/editor/editorconfig~RootConfig#element `config.root.element`}
2966
+ * (or `config.roots.<rootName>.element` for the multi-root editor) instead.
2967
+ *
2968
+ * @error editor-create-root-element-overspecified
2969
+ */ throw new CKEditorError('editor-create-root-element-overspecified', null);
2970
+ }
2971
+ rootConfig.element = sourceElementOrDataForRoot;
2972
+ }
2973
+ if (separateAttachTo && isElement(rootConfig.element)) {
2974
+ /**
2975
+ * The {@link module:editor-classic/classiceditor~ClassicEditor} ignores
2976
+ * {@link module:core/editor/editorconfig~RootConfig#element `config.root.element`} because
2977
+ * the classic editor replaces the DOM element with its own UI rather than editing inline within it.
2978
+ * Use {@link module:core/editor/editorconfig~EditorConfig#attachTo `config.attachTo`}
2979
+ * to specify the DOM element the editor should replace.
2980
+ *
2981
+ * @error editor-create-root-element-not-supported
2982
+ */ logWarning('editor-create-root-element-not-supported');
2983
+ }
2923
2984
  // No dedicated initial data for the root.
2924
2985
  if (rootConfig.initialData === undefined) {
2925
2986
  // No legacy initial data for the root, either.
2926
2987
  if (legacyInitialData[rootName] === undefined) {
2927
2988
  // Use source element data or data itself as a string.
2928
- // Fall back to `rootConfig.element` or `config.attachTo` (for ClassicEditor) for data extraction.
2989
+ // Fall back to legacy sourceElement, `rootConfig.element` or `config.attachTo` (for ClassicEditor) for data extraction.
2929
2990
  rootConfig.initialData = getInitialData(sourceElementOrDataForRoot || rootConfig.element || separateAttachTo && config.get('attachTo') || '');
2930
2991
  } else if (sourceElementOrDataForRoot && !isElement(sourceElementOrDataForRoot)) {
2931
- // Documented in core/editor/editorconfig.ts.
2932
- // eslint-disable-next-line ckeditor5-rules/ckeditor-error-message
2933
- throw new CKEditorError('editor-create-initial-data', null);
2992
+ /**
2993
+ * The initial data is specified both as the first argument of the editor `create()` method
2994
+ * (e.g. {@link module:editor-inline/inlineeditor~InlineEditor.create `InlineEditor.create()`} or
2995
+ * {@link module:editor-multi-root/multirooteditor~MultiRootEditor.create `MultiRootEditor.create()`})
2996
+ * and in the deprecated {@link module:core/editor/editorconfig~EditorConfig#initialData `config.initialData`}.
2997
+ *
2998
+ * Passing initial data as the first argument is deprecated. Remove it and use
2999
+ * {@link module:core/editor/editorconfig~RootConfig#initialData `config.root.initialData`}
3000
+ * (or `config.roots.<rootName>.initialData` for the multi-root editor) instead.
3001
+ *
3002
+ * @error editor-create-initial-data-overspecified
3003
+ */ throw new CKEditorError('editor-create-initial-data-overspecified', null);
2934
3004
  } else {
2935
3005
  rootConfig.initialData = legacyInitialData[rootName];
2936
3006
  }
2937
3007
  } else if (sourceElementOrDataForRoot && !isElement(sourceElementOrDataForRoot)) {
2938
- // Documented in core/editor/editorconfig.ts.
2939
- // eslint-disable-next-line ckeditor5-rules/ckeditor-error-message
2940
- throw new CKEditorError('editor-create-initial-data', null);
3008
+ /**
3009
+ * The initial data is specified both as the first argument of the editor `create()` method
3010
+ * (e.g. {@link module:editor-inline/inlineeditor~InlineEditor.create `InlineEditor.create()`} or
3011
+ * {@link module:editor-multi-root/multirooteditor~MultiRootEditor.create `MultiRootEditor.create()`})
3012
+ * and in {@link module:core/editor/editorconfig~RootConfig#initialData `config.root.initialData`}
3013
+ * (or `config.roots.<rootName>.initialData` for the multi-root editor).
3014
+ *
3015
+ * Passing initial data as the first argument is deprecated. Remove it and use
3016
+ * {@link module:core/editor/editorconfig~RootConfig#initialData `config.root.initialData`}
3017
+ * (or `config.roots.<rootName>.initialData` for the multi-root editor) instead.
3018
+ *
3019
+ * @error editor-create-root-initial-data-overspecified
3020
+ */ throw new CKEditorError('editor-create-root-initial-data-overspecified', null);
2941
3021
  } else if (legacyInitialData[rootName] !== undefined) {
2942
- // Documented in core/editor/editorconfig.ts.
2943
- // eslint-disable-next-line ckeditor5-rules/ckeditor-error-message
2944
- throw new CKEditorError('editor-create-roots-initial-data');
2945
- }
2946
- // Assign `sourceElement` to root config if it's an element.
2947
- if (!separateAttachTo && isElement(sourceElementOrDataForRoot)) {
2948
- rootConfig.element = sourceElementOrDataForRoot;
3022
+ /**
3023
+ * The initial data is specified both in
3024
+ * {@link module:core/editor/editorconfig~RootConfig#initialData `config.root.initialData`}
3025
+ * (or `config.roots.<rootName>.initialData` for the multi-root editor) and in the deprecated
3026
+ * {@link module:core/editor/editorconfig~EditorConfig#initialData `config.initialData`}.
3027
+ *
3028
+ * The `config.initialData` option is deprecated. Remove it and use
3029
+ * {@link module:core/editor/editorconfig~RootConfig#initialData `config.root.initialData`}
3030
+ * (or `config.roots.<rootName>.initialData` for the multi-root editor) instead.
3031
+ *
3032
+ * @error editor-create-legacy-initial-data-overspecified
3033
+ */ throw new CKEditorError('editor-create-legacy-initial-data-overspecified', null);
2949
3034
  }
2950
3035
  // Handle legacy `config.placeholder` and `config.label` for the root.
2951
3036
  rootConfig.placeholder ??= getLegacyPlainConfigValue(config, 'placeholder', rootName);
@@ -2954,9 +3039,36 @@ function isTextArea(sourceElement) {
2954
3039
  }
2955
3040
  // The ClassicEditor has a special separate config option `attachTo`.
2956
3041
  // It is used as a source of editor data and attachment element, but not the root element.
2957
- if (separateAttachTo && config.get('attachTo') === undefined && isElement(sourceElementsOrData)) {
3042
+ if (separateAttachTo && isElement(sourceElementsOrData)) {
3043
+ if (config.get('attachTo')) {
3044
+ /**
3045
+ * The element to attach the editor to is specified both as the first argument of
3046
+ * {@link module:editor-classic/classiceditor~ClassicEditor.create `ClassicEditor.create()`}
3047
+ * and in {@link module:core/editor/editorconfig~EditorConfig#attachTo `config.attachTo`}.
3048
+ *
3049
+ * Passing the element as the first argument is deprecated. Remove it and use
3050
+ * {@link module:core/editor/editorconfig~EditorConfig#attachTo `config.attachTo`} instead.
3051
+ *
3052
+ * @error editor-create-attachto-overspecified
3053
+ */ throw new CKEditorError('editor-create-attachto-overspecified', null);
3054
+ }
2958
3055
  config.set('attachTo', sourceElementsOrData);
2959
3056
  }
3057
+ // The `config.attachTo` is only supported by the ClassicEditor.
3058
+ if (!separateAttachTo && config.get('attachTo')) {
3059
+ /**
3060
+ * The {@link module:core/editor/editorconfig~EditorConfig#attachTo `config.attachTo`} option is only
3061
+ * available for the {@link module:editor-classic/classiceditor~ClassicEditor} because it replaces the
3062
+ * given DOM element with its own UI. Other editor types (e.g. inline, balloon, decoupled) render inside
3063
+ * the root element directly, so `config.attachTo` is not applicable.
3064
+ *
3065
+ * Remove the `attachTo` option from the editor configuration and use
3066
+ * {@link module:core/editor/editorconfig~RootConfig#element `config.root.element`}
3067
+ * (or `config.roots.<rootName>.element` for the multi-root editor) to specify the DOM element instead.
3068
+ *
3069
+ * @error editor-create-attachto-ignored
3070
+ */ throw new CKEditorError('editor-create-attachto-ignored', null);
3071
+ }
2960
3072
  config.set('roots', rootsConfig);
2961
3073
  }
2962
3074
  /**