@ckeditor/ckeditor5-engine 45.2.1-alpha.9 → 46.0.0-alpha.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/index.js +2563 -2257
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
- package/src/controller/datacontroller.d.ts +33 -32
- package/src/controller/datacontroller.js +29 -28
- package/src/controller/editingcontroller.d.ts +8 -8
- package/src/controller/editingcontroller.js +10 -10
- package/src/conversion/conversion.d.ts +18 -19
- package/src/conversion/conversion.js +4 -4
- package/src/conversion/conversionhelpers.d.ts +1 -1
- package/src/conversion/conversionhelpers.js +1 -1
- package/src/conversion/downcastdispatcher.d.ts +63 -69
- package/src/conversion/downcastdispatcher.js +16 -16
- package/src/conversion/downcasthelpers.d.ts +94 -83
- package/src/conversion/downcasthelpers.js +63 -53
- package/src/conversion/mapper.d.ts +27 -27
- package/src/conversion/mapper.js +15 -15
- package/src/conversion/modelconsumable.d.ts +26 -26
- package/src/conversion/modelconsumable.js +23 -23
- package/src/conversion/upcastdispatcher.d.ts +33 -32
- package/src/conversion/upcastdispatcher.js +19 -19
- package/src/conversion/upcasthelpers.d.ts +46 -38
- package/src/conversion/upcasthelpers.js +33 -24
- package/src/conversion/viewconsumable.d.ts +50 -45
- package/src/conversion/viewconsumable.js +32 -27
- package/src/dataprocessor/basichtmlwriter.d.ts +4 -2
- package/src/dataprocessor/basichtmlwriter.js +3 -1
- package/src/dataprocessor/dataprocessor.d.ts +7 -6
- package/src/dataprocessor/htmldataprocessor.d.ts +10 -10
- package/src/dataprocessor/htmldataprocessor.js +6 -6
- package/src/dataprocessor/htmlwriter.d.ts +1 -1
- package/src/dataprocessor/xmldataprocessor.d.ts +10 -10
- package/src/dataprocessor/xmldataprocessor.js +6 -6
- package/src/dev-utils/model.d.ts +25 -26
- package/src/dev-utils/model.js +35 -36
- package/src/dev-utils/operationreplayer.d.ts +5 -3
- package/src/dev-utils/operationreplayer.js +4 -2
- package/src/dev-utils/utils.d.ts +8 -0
- package/src/dev-utils/utils.js +8 -0
- package/src/dev-utils/view.d.ts +66 -63
- package/src/dev-utils/view.js +144 -134
- package/src/index.d.ts +135 -106
- package/src/index.js +120 -71
- package/src/legacyerrors.d.ts +5 -0
- package/src/legacyerrors.js +17 -0
- package/src/model/batch.d.ts +2 -15
- package/src/model/batch.js +1 -23
- package/src/model/differ.d.ts +54 -31
- package/src/model/differ.js +15 -15
- package/src/model/document.d.ts +31 -31
- package/src/model/document.js +13 -13
- package/src/model/documentfragment.d.ts +45 -45
- package/src/model/documentfragment.js +40 -40
- package/src/model/documentselection.d.ts +92 -92
- package/src/model/documentselection.js +71 -70
- package/src/model/element.d.ts +31 -31
- package/src/model/element.js +29 -29
- package/src/model/history.d.ts +3 -3
- package/src/model/history.js +2 -2
- package/src/model/item.d.ts +4 -5
- package/src/model/liveposition.d.ts +31 -31
- package/src/model/liveposition.js +18 -18
- package/src/model/liverange.d.ts +42 -38
- package/src/model/liverange.js +17 -16
- package/src/model/markercollection.d.ts +41 -40
- package/src/model/markercollection.js +22 -20
- package/src/model/model.d.ts +82 -81
- package/src/model/model.js +54 -54
- package/src/model/node.d.ts +48 -48
- package/src/model/node.js +31 -31
- package/src/model/nodelist.d.ts +17 -17
- package/src/model/nodelist.js +11 -11
- package/src/model/operation/attributeoperation.d.ts +10 -10
- package/src/model/operation/attributeoperation.js +7 -7
- package/src/model/operation/detachoperation.d.ts +11 -9
- package/src/model/operation/detachoperation.js +8 -6
- package/src/model/operation/insertoperation.d.ts +13 -13
- package/src/model/operation/insertoperation.js +15 -15
- package/src/model/operation/markeroperation.d.ts +12 -12
- package/src/model/operation/markeroperation.js +5 -5
- package/src/model/operation/mergeoperation.d.ts +16 -16
- package/src/model/operation/mergeoperation.js +18 -18
- package/src/model/operation/moveoperation.d.ts +16 -16
- package/src/model/operation/moveoperation.js +18 -15
- package/src/model/operation/nooperation.d.ts +4 -4
- package/src/model/operation/nooperation.js +2 -2
- package/src/model/operation/operation.d.ts +10 -10
- package/src/model/operation/operation.js +5 -5
- package/src/model/operation/operationfactory.d.ts +4 -4
- package/src/model/operation/operationfactory.js +12 -12
- package/src/model/operation/renameoperation.d.ts +10 -10
- package/src/model/operation/renameoperation.js +7 -7
- package/src/model/operation/rootattributeoperation.d.ts +12 -12
- package/src/model/operation/rootattributeoperation.js +8 -8
- package/src/model/operation/rootoperation.d.ts +8 -8
- package/src/model/operation/rootoperation.js +3 -3
- package/src/model/operation/splitoperation.d.ts +17 -17
- package/src/model/operation/splitoperation.js +19 -19
- package/src/model/operation/transform.d.ts +11 -8
- package/src/model/operation/transform.js +66 -49
- package/src/model/operation/utils.d.ts +24 -23
- package/src/model/operation/utils.js +20 -20
- package/src/model/position.d.ts +101 -97
- package/src/model/position.js +69 -64
- package/src/model/range.d.ts +90 -90
- package/src/model/range.js +87 -87
- package/src/model/rootelement.d.ts +11 -11
- package/src/model/rootelement.js +9 -9
- package/src/model/schema.d.ts +158 -154
- package/src/model/schema.js +93 -90
- package/src/model/selection.d.ts +73 -73
- package/src/model/selection.js +62 -62
- package/src/model/text.d.ts +11 -10
- package/src/model/text.js +11 -10
- package/src/model/textproxy.d.ts +39 -38
- package/src/model/textproxy.js +31 -30
- package/src/model/treewalker.d.ts +37 -37
- package/src/model/treewalker.js +14 -14
- package/src/model/typecheckable.d.ts +45 -45
- package/src/model/typecheckable.js +1 -1
- package/src/model/utils/autoparagraphing.d.ts +7 -7
- package/src/model/utils/deletecontent.d.ts +7 -5
- package/src/model/utils/deletecontent.js +13 -11
- package/src/model/utils/getselectedcontent.d.ts +6 -5
- package/src/model/utils/getselectedcontent.js +2 -1
- package/src/model/utils/insertcontent.d.ts +9 -8
- package/src/model/utils/insertcontent.js +41 -40
- package/src/model/utils/insertobject.d.ts +9 -9
- package/src/model/utils/insertobject.js +4 -4
- package/src/model/utils/modifyselection.d.ts +5 -4
- package/src/model/utils/modifyselection.js +12 -11
- package/src/model/utils/selection-post-fixer.d.ts +12 -8
- package/src/model/utils/selection-post-fixer.js +15 -11
- package/src/model/writer.d.ts +102 -101
- package/src/model/writer.js +99 -98
- package/src/view/attributeelement.d.ts +29 -29
- package/src/view/attributeelement.js +25 -25
- package/src/view/containerelement.d.ts +16 -15
- package/src/view/containerelement.js +15 -14
- package/src/view/datatransfer.d.ts +7 -7
- package/src/view/datatransfer.js +1 -1
- package/src/view/document.d.ts +25 -25
- package/src/view/document.js +15 -15
- package/src/view/documentfragment.d.ts +21 -21
- package/src/view/documentfragment.js +14 -14
- package/src/view/documentselection.d.ts +65 -63
- package/src/view/documentselection.js +27 -25
- package/src/view/domconverter.d.ts +94 -89
- package/src/view/domconverter.js +78 -73
- package/src/view/downcastwriter.d.ts +185 -181
- package/src/view/downcastwriter.js +222 -210
- package/src/view/editableelement.d.ts +13 -13
- package/src/view/editableelement.js +8 -8
- package/src/view/element.d.ts +75 -74
- package/src/view/element.js +58 -58
- package/src/view/elementdefinition.d.ts +3 -4
- package/src/view/emptyelement.d.ts +13 -13
- package/src/view/emptyelement.js +13 -13
- package/src/view/filler.d.ts +14 -3
- package/src/view/filler.js +12 -1
- package/src/view/item.d.ts +4 -5
- package/src/view/matcher.d.ts +22 -19
- package/src/view/matcher.js +6 -6
- package/src/view/node.d.ts +33 -33
- package/src/view/node.js +9 -9
- package/src/view/observer/arrowkeysobserver.d.ts +10 -10
- package/src/view/observer/arrowkeysobserver.js +5 -5
- package/src/view/observer/bubblingemittermixin.d.ts +5 -5
- package/src/view/observer/bubblingemittermixin.js +2 -9
- package/src/view/observer/bubblingeventinfo.d.ts +9 -9
- package/src/view/observer/bubblingeventinfo.js +1 -1
- package/src/view/observer/clickobserver.d.ts +8 -8
- package/src/view/observer/clickobserver.js +4 -4
- package/src/view/observer/compositionobserver.d.ts +19 -19
- package/src/view/observer/compositionobserver.js +6 -6
- package/src/view/observer/domeventdata.d.ts +9 -9
- package/src/view/observer/domeventdata.js +2 -2
- package/src/view/observer/domeventobserver.d.ts +3 -3
- package/src/view/observer/domeventobserver.js +5 -5
- package/src/view/observer/fakeselectionobserver.d.ts +9 -9
- package/src/view/observer/fakeselectionobserver.js +8 -8
- package/src/view/observer/focusobserver.d.ts +16 -16
- package/src/view/observer/focusobserver.js +7 -7
- package/src/view/observer/inputobserver.d.ts +18 -18
- package/src/view/observer/inputobserver.js +5 -5
- package/src/view/observer/keyobserver.d.ts +11 -11
- package/src/view/observer/keyobserver.js +3 -3
- package/src/view/observer/mouseobserver.d.ts +16 -16
- package/src/view/observer/mouseobserver.js +3 -3
- package/src/view/observer/mutationobserver.d.ts +21 -21
- package/src/view/observer/mutationobserver.js +7 -7
- package/src/view/observer/observer.d.ts +12 -12
- package/src/view/observer/observer.js +6 -6
- package/src/view/observer/selectionobserver.d.ts +33 -33
- package/src/view/observer/selectionobserver.js +14 -14
- package/src/view/observer/tabobserver.d.ts +10 -10
- package/src/view/observer/tabobserver.js +5 -5
- package/src/view/observer/touchobserver.d.ts +13 -13
- package/src/view/observer/touchobserver.js +3 -3
- package/src/view/placeholder.d.ts +21 -21
- package/src/view/placeholder.js +23 -23
- package/src/view/position.d.ts +49 -49
- package/src/view/position.js +42 -42
- package/src/view/range.d.ts +76 -74
- package/src/view/range.js +67 -65
- package/src/view/rawelement.d.ts +19 -19
- package/src/view/rawelement.js +16 -16
- package/src/view/renderer.d.ts +14 -14
- package/src/view/renderer.js +7 -7
- package/src/view/rooteditableelement.d.ts +8 -7
- package/src/view/rooteditableelement.js +7 -6
- package/src/view/selection.d.ts +66 -64
- package/src/view/selection.js +50 -48
- package/src/view/styles/background.d.ts +2 -2
- package/src/view/styles/background.js +9 -9
- package/src/view/styles/border.d.ts +2 -2
- package/src/view/styles/border.js +13 -13
- package/src/view/styles/margin.d.ts +2 -2
- package/src/view/styles/margin.js +5 -5
- package/src/view/styles/padding.d.ts +2 -2
- package/src/view/styles/padding.js +5 -5
- package/src/view/styles/utils.d.ts +24 -24
- package/src/view/styles/utils.js +25 -25
- package/src/view/stylesmap.d.ts +28 -32
- package/src/view/stylesmap.js +52 -39
- package/src/view/text.d.ts +11 -11
- package/src/view/text.js +10 -10
- package/src/view/textproxy.d.ts +33 -32
- package/src/view/textproxy.js +23 -22
- package/src/view/tokenlist.d.ts +14 -14
- package/src/view/tokenlist.js +10 -10
- package/src/view/treewalker.d.ts +42 -40
- package/src/view/treewalker.js +36 -35
- package/src/view/typecheckable.d.ts +76 -75
- package/src/view/typecheckable.js +1 -1
- package/src/view/uielement.d.ts +22 -21
- package/src/view/uielement.js +17 -16
- package/src/view/upcastwriter.d.ts +70 -70
- package/src/view/upcastwriter.js +42 -42
- package/src/view/view.d.ts +70 -69
- package/src/view/view.js +56 -55
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ckeditor/ckeditor5-engine",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "46.0.0-alpha.0",
|
|
4
4
|
"description": "The editing engine of CKEditor 5 – the best browser-based rich text editor.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"wysiwyg",
|
|
@@ -24,8 +24,8 @@
|
|
|
24
24
|
"type": "module",
|
|
25
25
|
"main": "src/index.js",
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@ckeditor/ckeditor5-utils": "
|
|
28
|
-
"es-toolkit": "1.
|
|
27
|
+
"@ckeditor/ckeditor5-utils": "46.0.0-alpha.0",
|
|
28
|
+
"es-toolkit": "1.39.5"
|
|
29
29
|
},
|
|
30
30
|
"author": "CKSource (http://cksource.com/)",
|
|
31
31
|
"license": "SEE LICENSE IN LICENSE.md",
|
|
@@ -2,21 +2,21 @@
|
|
|
2
2
|
* @license Copyright (c) 2003-2025, 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 Mapper from '../conversion/mapper.js';
|
|
6
|
-
import DowncastDispatcher from '../conversion/downcastdispatcher.js';
|
|
7
|
-
import UpcastDispatcher from '../conversion/upcastdispatcher.js';
|
|
8
|
-
import ViewDocumentFragment from '../view/documentfragment.js';
|
|
9
|
-
import ViewDocument from '../view/document.js';
|
|
10
|
-
import type ViewElement from '../view/element.js';
|
|
5
|
+
import { Mapper } from '../conversion/mapper.js';
|
|
6
|
+
import { DowncastDispatcher } from '../conversion/downcastdispatcher.js';
|
|
7
|
+
import { UpcastDispatcher } from '../conversion/upcastdispatcher.js';
|
|
8
|
+
import { ViewDocumentFragment } from '../view/documentfragment.js';
|
|
9
|
+
import { ViewDocument } from '../view/document.js';
|
|
10
|
+
import { type ViewElement } from '../view/element.js';
|
|
11
11
|
import type { StylesProcessor } from '../view/stylesmap.js';
|
|
12
12
|
import type { MatcherPattern } from '../view/matcher.js';
|
|
13
|
-
import type Model from '../model/model.js';
|
|
14
|
-
import type ModelElement from '../model/element.js';
|
|
15
|
-
import type ModelDocumentFragment from '../model/documentfragment.js';
|
|
16
|
-
import type {
|
|
13
|
+
import { type Model } from '../model/model.js';
|
|
14
|
+
import { type ModelElement } from '../model/element.js';
|
|
15
|
+
import { type ModelDocumentFragment } from '../model/documentfragment.js';
|
|
16
|
+
import type { ModelSchemaContextDefinition } from '../model/schema.js';
|
|
17
17
|
import type { BatchType } from '../model/batch.js';
|
|
18
|
-
import HtmlDataProcessor from '../dataprocessor/htmldataprocessor.js';
|
|
19
|
-
import type DataProcessor from '../dataprocessor/dataprocessor.js';
|
|
18
|
+
import { HtmlDataProcessor } from '../dataprocessor/htmldataprocessor.js';
|
|
19
|
+
import { type DataProcessor } from '../dataprocessor/dataprocessor.js';
|
|
20
20
|
declare const DataController_base: {
|
|
21
21
|
new (): import("@ckeditor/ckeditor5-utils").Emitter;
|
|
22
22
|
prototype: import("@ckeditor/ckeditor5-utils").Emitter;
|
|
@@ -38,7 +38,7 @@ declare const DataController_base: {
|
|
|
38
38
|
* editor.data.get( { rootName: 'customRoot' } ); // -> '<p>Hello!</p>'
|
|
39
39
|
* ```
|
|
40
40
|
*/
|
|
41
|
-
export
|
|
41
|
+
export declare class DataController extends /* #__PURE__ */ DataController_base {
|
|
42
42
|
/**
|
|
43
43
|
* Data model.
|
|
44
44
|
*/
|
|
@@ -108,8 +108,8 @@ export default class DataController extends /* #__PURE__ */ DataController_base
|
|
|
108
108
|
[key: string]: unknown;
|
|
109
109
|
}): string;
|
|
110
110
|
/**
|
|
111
|
-
* Returns the content of the given {@link module:engine/model/element~
|
|
112
|
-
* {@link module:engine/model/documentfragment~
|
|
111
|
+
* Returns the content of the given {@link module:engine/model/element~ModelElement model's element} or
|
|
112
|
+
* {@link module:engine/model/documentfragment~ModelDocumentFragment model document fragment} converted by the downcast converters
|
|
113
113
|
* attached to the {@link #downcastDispatcher} and formatted by the {@link #processor data processor}.
|
|
114
114
|
*
|
|
115
115
|
* @param modelElementOrFragment The element whose content will be stringified.
|
|
@@ -118,22 +118,22 @@ export default class DataController extends /* #__PURE__ */ DataController_base
|
|
|
118
118
|
*/
|
|
119
119
|
stringify(modelElementOrFragment: ModelElement | ModelDocumentFragment, options?: Record<string, unknown>): string;
|
|
120
120
|
/**
|
|
121
|
-
* Returns the content of the given {@link module:engine/model/element~
|
|
122
|
-
* {@link module:engine/model/documentfragment~
|
|
121
|
+
* Returns the content of the given {@link module:engine/model/element~ModelElement model element} or
|
|
122
|
+
* {@link module:engine/model/documentfragment~ModelDocumentFragment model document fragment} converted by the downcast
|
|
123
123
|
* converters attached to {@link #downcastDispatcher} into a
|
|
124
|
-
* {@link module:engine/view/documentfragment~
|
|
124
|
+
* {@link module:engine/view/documentfragment~ViewDocumentFragment view document fragment}.
|
|
125
125
|
*
|
|
126
126
|
* @fires toView
|
|
127
127
|
* @param modelElementOrFragment Element or document fragment whose content will be converted.
|
|
128
128
|
* @param options Additional configuration that will be available through the
|
|
129
129
|
* {@link module:engine/conversion/downcastdispatcher~DowncastConversionApi#options} during the conversion process.
|
|
130
|
-
* @returns Output view
|
|
130
|
+
* @returns Output view ModelDocumentFragment.
|
|
131
131
|
*/
|
|
132
132
|
toView(modelElementOrFragment: ModelElement | ModelDocumentFragment, options?: Record<string, unknown>): ViewDocumentFragment;
|
|
133
133
|
/**
|
|
134
134
|
* Sets the initial input data parsed by the {@link #processor data processor} and
|
|
135
135
|
* converted by the {@link #upcastDispatcher view-to-model converters}.
|
|
136
|
-
* Initial data can be only set to a document whose {@link module:engine/model/document~
|
|
136
|
+
* Initial data can be only set to a document whose {@link module:engine/model/document~ModelDocument#version} is equal 0.
|
|
137
137
|
*
|
|
138
138
|
* **Note** This method is {@link module:utils/observablemixin~Observable#decorate decorated} which is
|
|
139
139
|
* used by e.g. collaborative editing plugin that syncs remote data on init.
|
|
@@ -160,7 +160,7 @@ export default class DataController extends /* #__PURE__ */ DataController_base
|
|
|
160
160
|
* Sets the input data parsed by the {@link #processor data processor} and
|
|
161
161
|
* converted by the {@link #upcastDispatcher view-to-model converters}.
|
|
162
162
|
* This method can be used any time to replace existing editor data with the new one without clearing the
|
|
163
|
-
* {@link module:engine/model/document~
|
|
163
|
+
* {@link module:engine/model/document~ModelDocument#history document history}.
|
|
164
164
|
*
|
|
165
165
|
* This method also creates a batch with all the changes applied. If all you need is to parse data, use
|
|
166
166
|
* the {@link #parse} method.
|
|
@@ -206,14 +206,14 @@ export default class DataController extends /* #__PURE__ */ DataController_base
|
|
|
206
206
|
* See: {@link module:engine/conversion/upcastdispatcher~UpcastDispatcher#convert}.
|
|
207
207
|
* @returns Parsed data.
|
|
208
208
|
*/
|
|
209
|
-
parse(data: string, context?:
|
|
209
|
+
parse(data: string, context?: ModelSchemaContextDefinition): ModelDocumentFragment;
|
|
210
210
|
/**
|
|
211
|
-
* Returns the result of the given {@link module:engine/view/element~
|
|
212
|
-
* {@link module:engine/view/documentfragment~
|
|
213
|
-
* {@link #upcastDispatcher view-to-model converters}, wrapped by {@link module:engine/model/documentfragment~
|
|
211
|
+
* Returns the result of the given {@link module:engine/view/element~ViewElement view element} or
|
|
212
|
+
* {@link module:engine/view/documentfragment~ViewDocumentFragment view document fragment} converted by the
|
|
213
|
+
* {@link #upcastDispatcher view-to-model converters}, wrapped by {@link module:engine/model/documentfragment~ModelDocumentFragment}.
|
|
214
214
|
*
|
|
215
215
|
* When marker elements were converted during the conversion process, it will be set as a document fragment's
|
|
216
|
-
* {@link module:engine/model/documentfragment~
|
|
216
|
+
* {@link module:engine/model/documentfragment~ModelDocumentFragment#markers static markers map}.
|
|
217
217
|
*
|
|
218
218
|
* @fires toModel
|
|
219
219
|
* @param viewElementOrFragment The element or document fragment whose content will be converted.
|
|
@@ -221,16 +221,16 @@ export default class DataController extends /* #__PURE__ */ DataController_base
|
|
|
221
221
|
* See: {@link module:engine/conversion/upcastdispatcher~UpcastDispatcher#convert}.
|
|
222
222
|
* @returns Output document fragment.
|
|
223
223
|
*/
|
|
224
|
-
toModel(viewElementOrFragment: ViewElement | ViewDocumentFragment, context?:
|
|
224
|
+
toModel(viewElementOrFragment: ViewElement | ViewDocumentFragment, context?: ModelSchemaContextDefinition): ModelDocumentFragment;
|
|
225
225
|
/**
|
|
226
226
|
* Adds the style processor normalization rules.
|
|
227
227
|
*
|
|
228
228
|
* You can implement your own rules as well as use one of the available processor rules:
|
|
229
229
|
*
|
|
230
|
-
* * background: {@link module:engine/view/styles/background~
|
|
231
|
-
* * border: {@link module:engine/view/styles/border~
|
|
232
|
-
* * margin: {@link module:engine/view/styles/margin~
|
|
233
|
-
* * padding: {@link module:engine/view/styles/padding~
|
|
230
|
+
* * background: {@link module:engine/view/styles/background~addBackgroundStylesRules}
|
|
231
|
+
* * border: {@link module:engine/view/styles/border~addBorderStylesRules}
|
|
232
|
+
* * margin: {@link module:engine/view/styles/margin~addMarginStylesRules}
|
|
233
|
+
* * padding: {@link module:engine/view/styles/padding~addPaddingStylesRules}
|
|
234
234
|
*/
|
|
235
235
|
addStyleProcessorRules(callback: (stylesProcessor: StylesProcessor) => void): void;
|
|
236
236
|
/**
|
|
@@ -238,7 +238,8 @@ export default class DataController extends /* #__PURE__ */ DataController_base
|
|
|
238
238
|
* and a {@link #processor processor} for view elements whose content should be treated as raw data
|
|
239
239
|
* and not processed during the conversion from DOM to view elements.
|
|
240
240
|
*
|
|
241
|
-
* The raw data can be later accessed by the
|
|
241
|
+
* The raw data can be later accessed by the
|
|
242
|
+
* {@link module:engine/view/element~ViewElement#getCustomProperty view element custom property}
|
|
242
243
|
* `"$rawContent"`.
|
|
243
244
|
*
|
|
244
245
|
* @param pattern Pattern matching all view elements whose content should be treated as a raw data.
|
|
@@ -6,17 +6,17 @@
|
|
|
6
6
|
* @module engine/controller/datacontroller
|
|
7
7
|
*/
|
|
8
8
|
import { CKEditorError, EmitterMixin, ObservableMixin, logWarning } from '@ckeditor/ckeditor5-utils';
|
|
9
|
-
import Mapper from '../conversion/mapper.js';
|
|
10
|
-
import DowncastDispatcher from '../conversion/downcastdispatcher.js';
|
|
9
|
+
import { Mapper } from '../conversion/mapper.js';
|
|
10
|
+
import { DowncastDispatcher } from '../conversion/downcastdispatcher.js';
|
|
11
11
|
import { insertAttributesAndChildren, insertText } from '../conversion/downcasthelpers.js';
|
|
12
|
-
import UpcastDispatcher from '../conversion/upcastdispatcher.js';
|
|
12
|
+
import { UpcastDispatcher } from '../conversion/upcastdispatcher.js';
|
|
13
13
|
import { convertText, convertToModelFragment } from '../conversion/upcasthelpers.js';
|
|
14
|
-
import ViewDocumentFragment from '../view/documentfragment.js';
|
|
15
|
-
import ViewDocument from '../view/document.js';
|
|
16
|
-
import ViewDowncastWriter from '../view/downcastwriter.js';
|
|
17
|
-
import ModelRange from '../model/range.js';
|
|
14
|
+
import { ViewDocumentFragment } from '../view/documentfragment.js';
|
|
15
|
+
import { ViewDocument } from '../view/document.js';
|
|
16
|
+
import { ViewDowncastWriter } from '../view/downcastwriter.js';
|
|
17
|
+
import { ModelRange } from '../model/range.js';
|
|
18
18
|
import { autoParagraphEmptyRoots } from '../model/utils/autoparagraphing.js';
|
|
19
|
-
import HtmlDataProcessor from '../dataprocessor/htmldataprocessor.js';
|
|
19
|
+
import { HtmlDataProcessor } from '../dataprocessor/htmldataprocessor.js';
|
|
20
20
|
/**
|
|
21
21
|
* Controller for the data pipeline. The data pipeline controls how data is retrieved from the document
|
|
22
22
|
* and set inside it. Hence, the controller features two methods which allow to {@link ~DataController#get get}
|
|
@@ -34,7 +34,7 @@ import HtmlDataProcessor from '../dataprocessor/htmldataprocessor.js';
|
|
|
34
34
|
* editor.data.get( { rootName: 'customRoot' } ); // -> '<p>Hello!</p>'
|
|
35
35
|
* ```
|
|
36
36
|
*/
|
|
37
|
-
export
|
|
37
|
+
export class DataController extends /* #__PURE__ */ EmitterMixin() {
|
|
38
38
|
/**
|
|
39
39
|
* Data model.
|
|
40
40
|
*/
|
|
@@ -176,8 +176,8 @@ export default class DataController extends /* #__PURE__ */ EmitterMixin() {
|
|
|
176
176
|
return this.stringify(root, options);
|
|
177
177
|
}
|
|
178
178
|
/**
|
|
179
|
-
* Returns the content of the given {@link module:engine/model/element~
|
|
180
|
-
* {@link module:engine/model/documentfragment~
|
|
179
|
+
* Returns the content of the given {@link module:engine/model/element~ModelElement model's element} or
|
|
180
|
+
* {@link module:engine/model/documentfragment~ModelDocumentFragment model document fragment} converted by the downcast converters
|
|
181
181
|
* attached to the {@link #downcastDispatcher} and formatted by the {@link #processor data processor}.
|
|
182
182
|
*
|
|
183
183
|
* @param modelElementOrFragment The element whose content will be stringified.
|
|
@@ -191,16 +191,16 @@ export default class DataController extends /* #__PURE__ */ EmitterMixin() {
|
|
|
191
191
|
return this.processor.toData(viewDocumentFragment);
|
|
192
192
|
}
|
|
193
193
|
/**
|
|
194
|
-
* Returns the content of the given {@link module:engine/model/element~
|
|
195
|
-
* {@link module:engine/model/documentfragment~
|
|
194
|
+
* Returns the content of the given {@link module:engine/model/element~ModelElement model element} or
|
|
195
|
+
* {@link module:engine/model/documentfragment~ModelDocumentFragment model document fragment} converted by the downcast
|
|
196
196
|
* converters attached to {@link #downcastDispatcher} into a
|
|
197
|
-
* {@link module:engine/view/documentfragment~
|
|
197
|
+
* {@link module:engine/view/documentfragment~ViewDocumentFragment view document fragment}.
|
|
198
198
|
*
|
|
199
199
|
* @fires toView
|
|
200
200
|
* @param modelElementOrFragment Element or document fragment whose content will be converted.
|
|
201
201
|
* @param options Additional configuration that will be available through the
|
|
202
202
|
* {@link module:engine/conversion/downcastdispatcher~DowncastConversionApi#options} during the conversion process.
|
|
203
|
-
* @returns Output view
|
|
203
|
+
* @returns Output view ModelDocumentFragment.
|
|
204
204
|
*/
|
|
205
205
|
toView(modelElementOrFragment, options = {}) {
|
|
206
206
|
const viewDocument = this.viewDocument;
|
|
@@ -225,7 +225,7 @@ export default class DataController extends /* #__PURE__ */ EmitterMixin() {
|
|
|
225
225
|
/**
|
|
226
226
|
* Sets the initial input data parsed by the {@link #processor data processor} and
|
|
227
227
|
* converted by the {@link #upcastDispatcher view-to-model converters}.
|
|
228
|
-
* Initial data can be only set to a document whose {@link module:engine/model/document~
|
|
228
|
+
* Initial data can be only set to a document whose {@link module:engine/model/document~ModelDocument#version} is equal 0.
|
|
229
229
|
*
|
|
230
230
|
* **Note** This method is {@link module:utils/observablemixin~Observable#decorate decorated} which is
|
|
231
231
|
* used by e.g. collaborative editing plugin that syncs remote data on init.
|
|
@@ -250,9 +250,9 @@ export default class DataController extends /* #__PURE__ */ EmitterMixin() {
|
|
|
250
250
|
init(data) {
|
|
251
251
|
if (this.model.document.version) {
|
|
252
252
|
/**
|
|
253
|
-
* Cannot set initial data to a non-empty {@link module:engine/model/document~
|
|
253
|
+
* Cannot set initial data to a non-empty {@link module:engine/model/document~ModelDocument}.
|
|
254
254
|
* Initial data should be set once, during the {@link module:core/editor/editor~Editor} initialization,
|
|
255
|
-
* when the {@link module:engine/model/document~
|
|
255
|
+
* when the {@link module:engine/model/document~ModelDocument#version} is equal 0.
|
|
256
256
|
*
|
|
257
257
|
* @error datacontroller-init-document-not-empty
|
|
258
258
|
*/
|
|
@@ -294,7 +294,7 @@ export default class DataController extends /* #__PURE__ */ EmitterMixin() {
|
|
|
294
294
|
* Sets the input data parsed by the {@link #processor data processor} and
|
|
295
295
|
* converted by the {@link #upcastDispatcher view-to-model converters}.
|
|
296
296
|
* This method can be used any time to replace existing editor data with the new one without clearing the
|
|
297
|
-
* {@link module:engine/model/document~
|
|
297
|
+
* {@link module:engine/model/document~ModelDocument#history document history}.
|
|
298
298
|
*
|
|
299
299
|
* This method also creates a batch with all the changes applied. If all you need is to parse data, use
|
|
300
300
|
* the {@link #parse} method.
|
|
@@ -379,12 +379,12 @@ export default class DataController extends /* #__PURE__ */ EmitterMixin() {
|
|
|
379
379
|
return this.toModel(viewDocumentFragment, context);
|
|
380
380
|
}
|
|
381
381
|
/**
|
|
382
|
-
* Returns the result of the given {@link module:engine/view/element~
|
|
383
|
-
* {@link module:engine/view/documentfragment~
|
|
384
|
-
* {@link #upcastDispatcher view-to-model converters}, wrapped by {@link module:engine/model/documentfragment~
|
|
382
|
+
* Returns the result of the given {@link module:engine/view/element~ViewElement view element} or
|
|
383
|
+
* {@link module:engine/view/documentfragment~ViewDocumentFragment view document fragment} converted by the
|
|
384
|
+
* {@link #upcastDispatcher view-to-model converters}, wrapped by {@link module:engine/model/documentfragment~ModelDocumentFragment}.
|
|
385
385
|
*
|
|
386
386
|
* When marker elements were converted during the conversion process, it will be set as a document fragment's
|
|
387
|
-
* {@link module:engine/model/documentfragment~
|
|
387
|
+
* {@link module:engine/model/documentfragment~ModelDocumentFragment#markers static markers map}.
|
|
388
388
|
*
|
|
389
389
|
* @fires toModel
|
|
390
390
|
* @param viewElementOrFragment The element or document fragment whose content will be converted.
|
|
@@ -402,10 +402,10 @@ export default class DataController extends /* #__PURE__ */ EmitterMixin() {
|
|
|
402
402
|
*
|
|
403
403
|
* You can implement your own rules as well as use one of the available processor rules:
|
|
404
404
|
*
|
|
405
|
-
* * background: {@link module:engine/view/styles/background~
|
|
406
|
-
* * border: {@link module:engine/view/styles/border~
|
|
407
|
-
* * margin: {@link module:engine/view/styles/margin~
|
|
408
|
-
* * padding: {@link module:engine/view/styles/padding~
|
|
405
|
+
* * background: {@link module:engine/view/styles/background~addBackgroundStylesRules}
|
|
406
|
+
* * border: {@link module:engine/view/styles/border~addBorderStylesRules}
|
|
407
|
+
* * margin: {@link module:engine/view/styles/margin~addMarginStylesRules}
|
|
408
|
+
* * padding: {@link module:engine/view/styles/padding~addPaddingStylesRules}
|
|
409
409
|
*/
|
|
410
410
|
addStyleProcessorRules(callback) {
|
|
411
411
|
callback(this.stylesProcessor);
|
|
@@ -415,7 +415,8 @@ export default class DataController extends /* #__PURE__ */ EmitterMixin() {
|
|
|
415
415
|
* and a {@link #processor processor} for view elements whose content should be treated as raw data
|
|
416
416
|
* and not processed during the conversion from DOM to view elements.
|
|
417
417
|
*
|
|
418
|
-
* The raw data can be later accessed by the
|
|
418
|
+
* The raw data can be later accessed by the
|
|
419
|
+
* {@link module:engine/view/element~ViewElement#getCustomProperty view element custom property}
|
|
419
420
|
* `"$rawContent"`.
|
|
420
421
|
*
|
|
421
422
|
* @param pattern Pattern matching all view elements whose content should be treated as a raw data.
|
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
* @license Copyright (c) 2003-2025, 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
|
|
6
|
-
import Mapper from '../conversion/mapper.js';
|
|
7
|
-
import DowncastDispatcher from '../conversion/downcastdispatcher.js';
|
|
8
|
-
import type {
|
|
9
|
-
import type ModelItem from '../model/item.js';
|
|
5
|
+
import { EditingView } from '../view/view.js';
|
|
6
|
+
import { Mapper } from '../conversion/mapper.js';
|
|
7
|
+
import { DowncastDispatcher } from '../conversion/downcastdispatcher.js';
|
|
8
|
+
import type { Model } from '../model/model.js';
|
|
9
|
+
import { type ModelItem } from '../model/item.js';
|
|
10
10
|
import type { Marker } from '../model/markercollection.js';
|
|
11
11
|
import type { StylesProcessor } from '../view/stylesmap.js';
|
|
12
12
|
declare const EditingController_base: {
|
|
@@ -18,7 +18,7 @@ declare const EditingController_base: {
|
|
|
18
18
|
* including selection handling. It also creates the {@link ~EditingController#view view} which builds a
|
|
19
19
|
* browser-independent virtualization over the DOM elements. The editing controller also attaches default converters.
|
|
20
20
|
*/
|
|
21
|
-
export
|
|
21
|
+
export declare class EditingController extends /* #__PURE__ */ EditingController_base {
|
|
22
22
|
/**
|
|
23
23
|
* Editor model.
|
|
24
24
|
*/
|
|
@@ -26,7 +26,7 @@ export default class EditingController extends /* #__PURE__ */ EditingController
|
|
|
26
26
|
/**
|
|
27
27
|
* Editing view controller.
|
|
28
28
|
*/
|
|
29
|
-
readonly view:
|
|
29
|
+
readonly view: EditingView;
|
|
30
30
|
/**
|
|
31
31
|
* A mapper that describes the model-view binding.
|
|
32
32
|
*/
|
|
@@ -50,7 +50,7 @@ export default class EditingController extends /* #__PURE__ */ EditingController
|
|
|
50
50
|
/**
|
|
51
51
|
* Calling this method will refresh the marker by triggering the downcast conversion for it.
|
|
52
52
|
*
|
|
53
|
-
* Reconverting the marker is useful when you want to change its {@link module:engine/view/element~
|
|
53
|
+
* Reconverting the marker is useful when you want to change its {@link module:engine/view/element~ViewElement view element}
|
|
54
54
|
* without changing any marker data. For instance:
|
|
55
55
|
*
|
|
56
56
|
* ```ts
|
|
@@ -6,10 +6,10 @@
|
|
|
6
6
|
* @module engine/controller/editingcontroller
|
|
7
7
|
*/
|
|
8
8
|
import { CKEditorError, ObservableMixin } from '@ckeditor/ckeditor5-utils';
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import Mapper from '../conversion/mapper.js';
|
|
12
|
-
import DowncastDispatcher from '../conversion/downcastdispatcher.js';
|
|
9
|
+
import { ViewRootEditableElement } from '../view/rooteditableelement.js';
|
|
10
|
+
import { EditingView } from '../view/view.js';
|
|
11
|
+
import { Mapper } from '../conversion/mapper.js';
|
|
12
|
+
import { DowncastDispatcher } from '../conversion/downcastdispatcher.js';
|
|
13
13
|
import { cleanSelection, convertCollapsedSelection, convertRangeSelection, insertAttributesAndChildren, insertText, remove } from '../conversion/downcasthelpers.js';
|
|
14
14
|
import { convertSelectionChange } from '../conversion/upcasthelpers.js';
|
|
15
15
|
// @if CK_DEBUG_ENGINE // const { dumpTrees, initDocumentDumping } = require( '../dev-utils/utils' );
|
|
@@ -18,7 +18,7 @@ import { convertSelectionChange } from '../conversion/upcasthelpers.js';
|
|
|
18
18
|
* including selection handling. It also creates the {@link ~EditingController#view view} which builds a
|
|
19
19
|
* browser-independent virtualization over the DOM elements. The editing controller also attaches default converters.
|
|
20
20
|
*/
|
|
21
|
-
export
|
|
21
|
+
export class EditingController extends /* #__PURE__ */ ObservableMixin() {
|
|
22
22
|
/**
|
|
23
23
|
* Editor model.
|
|
24
24
|
*/
|
|
@@ -44,7 +44,7 @@ export default class EditingController extends /* #__PURE__ */ ObservableMixin()
|
|
|
44
44
|
constructor(model, stylesProcessor) {
|
|
45
45
|
super();
|
|
46
46
|
this.model = model;
|
|
47
|
-
this.view = new
|
|
47
|
+
this.view = new EditingView(stylesProcessor);
|
|
48
48
|
this.mapper = new Mapper();
|
|
49
49
|
this.downcastDispatcher = new DowncastDispatcher({
|
|
50
50
|
mapper: this.mapper,
|
|
@@ -83,15 +83,15 @@ export default class EditingController extends /* #__PURE__ */ ObservableMixin()
|
|
|
83
83
|
this.downcastDispatcher.on('cleanSelection', cleanSelection());
|
|
84
84
|
this.downcastDispatcher.on('selection', convertRangeSelection(), { priority: 'low' });
|
|
85
85
|
this.downcastDispatcher.on('selection', convertCollapsedSelection(), { priority: 'low' });
|
|
86
|
-
// Binds {@link module:engine/view/document~
|
|
87
|
-
// {@link module:engine/model/document~
|
|
86
|
+
// Binds {@link module:engine/view/document~ViewDocument#roots view roots collection} to
|
|
87
|
+
// {@link module:engine/model/document~ModelDocument#roots model roots collection} so creating
|
|
88
88
|
// model root automatically creates corresponding view root.
|
|
89
89
|
this.view.document.roots.bindTo(this.model.document.roots).using(root => {
|
|
90
90
|
// $graveyard is a special root that has no reflection in the view.
|
|
91
91
|
if (root.rootName == '$graveyard') {
|
|
92
92
|
return null;
|
|
93
93
|
}
|
|
94
|
-
const viewRoot = new
|
|
94
|
+
const viewRoot = new ViewRootEditableElement(this.view.document, root.name);
|
|
95
95
|
viewRoot.rootName = root.rootName;
|
|
96
96
|
this.mapper.bindElements(root, viewRoot);
|
|
97
97
|
return viewRoot;
|
|
@@ -115,7 +115,7 @@ export default class EditingController extends /* #__PURE__ */ ObservableMixin()
|
|
|
115
115
|
/**
|
|
116
116
|
* Calling this method will refresh the marker by triggering the downcast conversion for it.
|
|
117
117
|
*
|
|
118
|
-
* Reconverting the marker is useful when you want to change its {@link module:engine/view/element~
|
|
118
|
+
* Reconverting the marker is useful when you want to change its {@link module:engine/view/element~ViewElement view element}
|
|
119
119
|
* without changing any marker data. For instance:
|
|
120
120
|
*
|
|
121
121
|
* ```ts
|
|
@@ -6,11 +6,11 @@
|
|
|
6
6
|
* @module engine/conversion/conversion
|
|
7
7
|
*/
|
|
8
8
|
import { type ArrayOrItem, type PriorityString } from '@ckeditor/ckeditor5-utils';
|
|
9
|
-
import UpcastHelpers from './upcasthelpers.js';
|
|
10
|
-
import DowncastHelpers,
|
|
11
|
-
import type DowncastDispatcher from './downcastdispatcher.js';
|
|
12
|
-
import type UpcastDispatcher from './upcastdispatcher.js';
|
|
13
|
-
import type
|
|
9
|
+
import { UpcastHelpers } from './upcasthelpers.js';
|
|
10
|
+
import { DowncastHelpers, type DowncastAttributeCreatorFunction, type DowncastAttributeDescriptor } from './downcasthelpers.js';
|
|
11
|
+
import { type DowncastDispatcher } from './downcastdispatcher.js';
|
|
12
|
+
import { type UpcastDispatcher } from './upcastdispatcher.js';
|
|
13
|
+
import { type ViewElementDefinition } from '../view/elementdefinition.js';
|
|
14
14
|
import type { MatcherPattern } from '../view/matcher.js';
|
|
15
15
|
/**
|
|
16
16
|
* A utility class that helps add converters to upcast and downcast dispatchers.
|
|
@@ -58,7 +58,7 @@ import type { MatcherPattern } from '../view/matcher.js';
|
|
|
58
58
|
* * {@link module:engine/conversion/conversion~Conversion#attributeToAttribute `attributeToAttribute()`} –
|
|
59
59
|
* Model attribute to view attribute and vice versa.
|
|
60
60
|
*/
|
|
61
|
-
export
|
|
61
|
+
export declare class Conversion {
|
|
62
62
|
/**
|
|
63
63
|
* Maps dispatchers group name to ConversionHelpers instances.
|
|
64
64
|
*/
|
|
@@ -149,8 +149,8 @@ export default class Conversion {
|
|
|
149
149
|
*/
|
|
150
150
|
elementToElement(definition: {
|
|
151
151
|
model: string;
|
|
152
|
-
view:
|
|
153
|
-
upcastAlso?: ArrayOrItem<
|
|
152
|
+
view: ViewElementDefinition;
|
|
153
|
+
upcastAlso?: ArrayOrItem<ViewElementDefinition | MatcherPattern>;
|
|
154
154
|
converterPriority?: PriorityString;
|
|
155
155
|
}): void;
|
|
156
156
|
/**
|
|
@@ -317,7 +317,7 @@ export default class Conversion {
|
|
|
317
317
|
key: string;
|
|
318
318
|
name?: string;
|
|
319
319
|
};
|
|
320
|
-
view:
|
|
320
|
+
view: ViewElementDefinition;
|
|
321
321
|
upcastAlso?: ArrayOrItem<MatcherPattern>;
|
|
322
322
|
converterPriority?: PriorityString;
|
|
323
323
|
} | {
|
|
@@ -326,14 +326,14 @@ export default class Conversion {
|
|
|
326
326
|
name?: string;
|
|
327
327
|
values: Array<TValues>;
|
|
328
328
|
};
|
|
329
|
-
view: Record<TValues,
|
|
329
|
+
view: Record<TValues, ViewElementDefinition>;
|
|
330
330
|
upcastAlso?: Record<TValues, ArrayOrItem<MatcherPattern>>;
|
|
331
331
|
converterPriority?: PriorityString;
|
|
332
332
|
}): void;
|
|
333
333
|
/**
|
|
334
334
|
* Sets up converters between the model and the view that convert a model attribute to a view attribute (and vice versa). For example,
|
|
335
335
|
* `<imageBlock src='foo.jpg'></imageBlock>` is converted to `<img src='foo.jpg'></img>` (the same attribute key and value).
|
|
336
|
-
* This type of converters is intended to be used with {@link module:engine/model/element~
|
|
336
|
+
* This type of converters is intended to be used with {@link module:engine/model/element~ModelElement model element} nodes.
|
|
337
337
|
* To convert the text attributes,
|
|
338
338
|
* the {@link module:engine/conversion/conversion~Conversion#attributeToElement `attributeToElement converter`}should be set up.
|
|
339
339
|
*
|
|
@@ -446,12 +446,12 @@ export default class Conversion {
|
|
|
446
446
|
key: string;
|
|
447
447
|
name?: string;
|
|
448
448
|
};
|
|
449
|
-
view: string | (
|
|
449
|
+
view: string | (DowncastAttributeDescriptor & {
|
|
450
450
|
name?: string;
|
|
451
451
|
});
|
|
452
|
-
upcastAlso?: ArrayOrItem<string | (
|
|
452
|
+
upcastAlso?: ArrayOrItem<string | (DowncastAttributeDescriptor & {
|
|
453
453
|
name?: string;
|
|
454
|
-
}) |
|
|
454
|
+
}) | DowncastAttributeCreatorFunction>;
|
|
455
455
|
converterPriority?: PriorityString;
|
|
456
456
|
} | {
|
|
457
457
|
model: {
|
|
@@ -459,12 +459,12 @@ export default class Conversion {
|
|
|
459
459
|
name?: string;
|
|
460
460
|
values: Array<TValues>;
|
|
461
461
|
};
|
|
462
|
-
view: Record<TValues, (
|
|
462
|
+
view: Record<TValues, (DowncastAttributeDescriptor & {
|
|
463
463
|
name?: string;
|
|
464
464
|
})>;
|
|
465
|
-
upcastAlso?: Record<TValues, (
|
|
465
|
+
upcastAlso?: Record<TValues, (DowncastAttributeDescriptor & {
|
|
466
466
|
name?: string;
|
|
467
|
-
}) |
|
|
467
|
+
}) | DowncastAttributeCreatorFunction>;
|
|
468
468
|
converterPriority?: PriorityString;
|
|
469
469
|
}): void;
|
|
470
470
|
/**
|
|
@@ -477,5 +477,4 @@ export default class Conversion {
|
|
|
477
477
|
*/
|
|
478
478
|
private _createConversionHelpers;
|
|
479
479
|
}
|
|
480
|
-
type ConversionType<T extends string> = T extends `${string}Downcast` ? DowncastHelpers : T extends `${string}Upcast` ? UpcastHelpers : DowncastHelpers | UpcastHelpers;
|
|
481
|
-
export {};
|
|
480
|
+
export type ConversionType<T extends string> = T extends `${string}Downcast` ? DowncastHelpers : T extends `${string}Upcast` ? UpcastHelpers : DowncastHelpers | UpcastHelpers;
|
|
@@ -6,8 +6,8 @@
|
|
|
6
6
|
* @module engine/conversion/conversion
|
|
7
7
|
*/
|
|
8
8
|
import { CKEditorError, toArray } from '@ckeditor/ckeditor5-utils';
|
|
9
|
-
import UpcastHelpers from './upcasthelpers.js';
|
|
10
|
-
import DowncastHelpers from './downcasthelpers.js';
|
|
9
|
+
import { UpcastHelpers } from './upcasthelpers.js';
|
|
10
|
+
import { DowncastHelpers } from './downcasthelpers.js';
|
|
11
11
|
/**
|
|
12
12
|
* A utility class that helps add converters to upcast and downcast dispatchers.
|
|
13
13
|
*
|
|
@@ -54,7 +54,7 @@ import DowncastHelpers from './downcasthelpers.js';
|
|
|
54
54
|
* * {@link module:engine/conversion/conversion~Conversion#attributeToAttribute `attributeToAttribute()`} –
|
|
55
55
|
* Model attribute to view attribute and vice versa.
|
|
56
56
|
*/
|
|
57
|
-
export
|
|
57
|
+
export class Conversion {
|
|
58
58
|
/**
|
|
59
59
|
* Maps dispatchers group name to ConversionHelpers instances.
|
|
60
60
|
*/
|
|
@@ -436,7 +436,7 @@ export default class Conversion {
|
|
|
436
436
|
/**
|
|
437
437
|
* Sets up converters between the model and the view that convert a model attribute to a view attribute (and vice versa). For example,
|
|
438
438
|
* `<imageBlock src='foo.jpg'></imageBlock>` is converted to `<img src='foo.jpg'></img>` (the same attribute key and value).
|
|
439
|
-
* This type of converters is intended to be used with {@link module:engine/model/element~
|
|
439
|
+
* This type of converters is intended to be used with {@link module:engine/model/element~ModelElement model element} nodes.
|
|
440
440
|
* To convert the text attributes,
|
|
441
441
|
* the {@link module:engine/conversion/conversion~Conversion#attributeToElement `attributeToElement converter`}should be set up.
|
|
442
442
|
*
|