@ckeditor/ckeditor5-engine 44.1.0 → 44.2.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/LICENSE.md +1 -1
- package/dist/index-content.css +2 -2
- package/dist/index-editor.css +2 -2
- package/dist/index.css +4 -4
- package/dist/index.css.map +1 -1
- package/dist/index.js +646 -77
- package/dist/index.js.map +1 -1
- package/package.json +23 -3
- package/src/controller/datacontroller.d.ts +1 -1
- package/src/controller/datacontroller.js +1 -1
- package/src/controller/editingcontroller.d.ts +1 -1
- package/src/controller/editingcontroller.js +1 -1
- package/src/conversion/conversion.d.ts +1 -1
- package/src/conversion/conversion.js +1 -1
- package/src/conversion/conversionhelpers.d.ts +1 -1
- package/src/conversion/conversionhelpers.js +1 -1
- package/src/conversion/downcastdispatcher.d.ts +1 -1
- package/src/conversion/downcastdispatcher.js +1 -1
- package/src/conversion/downcasthelpers.d.ts +1 -1
- package/src/conversion/downcasthelpers.js +1 -1
- package/src/conversion/mapper.d.ts +249 -20
- package/src/conversion/mapper.js +524 -38
- package/src/conversion/modelconsumable.d.ts +1 -1
- package/src/conversion/modelconsumable.js +1 -1
- package/src/conversion/upcastdispatcher.d.ts +1 -1
- package/src/conversion/upcastdispatcher.js +1 -1
- package/src/conversion/upcasthelpers.d.ts +1 -1
- package/src/conversion/upcasthelpers.js +1 -1
- package/src/conversion/viewconsumable.d.ts +1 -1
- package/src/conversion/viewconsumable.js +1 -1
- package/src/dataprocessor/basichtmlwriter.d.ts +1 -1
- package/src/dataprocessor/basichtmlwriter.js +1 -1
- package/src/dataprocessor/dataprocessor.d.ts +1 -1
- package/src/dataprocessor/dataprocessor.js +1 -1
- package/src/dataprocessor/htmldataprocessor.d.ts +1 -1
- package/src/dataprocessor/htmldataprocessor.js +1 -1
- package/src/dataprocessor/htmlwriter.d.ts +1 -1
- package/src/dataprocessor/htmlwriter.js +1 -1
- package/src/dataprocessor/xmldataprocessor.d.ts +1 -1
- package/src/dataprocessor/xmldataprocessor.js +1 -1
- package/src/dev-utils/model.d.ts +1 -1
- package/src/dev-utils/model.js +1 -1
- package/src/dev-utils/operationreplayer.d.ts +1 -1
- package/src/dev-utils/operationreplayer.js +1 -1
- package/src/dev-utils/utils.d.ts +1 -1
- package/src/dev-utils/utils.js +1 -1
- package/src/dev-utils/view.d.ts +1 -1
- package/src/dev-utils/view.js +1 -1
- package/src/index.d.ts +4 -2
- package/src/index.js +2 -1
- package/src/model/batch.d.ts +1 -1
- package/src/model/batch.js +7 -3
- package/src/model/differ.d.ts +1 -1
- package/src/model/differ.js +1 -1
- package/src/model/document.d.ts +1 -1
- package/src/model/document.js +1 -1
- package/src/model/documentfragment.d.ts +1 -1
- package/src/model/documentfragment.js +1 -1
- package/src/model/documentselection.d.ts +1 -1
- package/src/model/documentselection.js +1 -1
- package/src/model/element.d.ts +1 -1
- package/src/model/element.js +1 -1
- package/src/model/history.d.ts +1 -1
- package/src/model/history.js +1 -1
- package/src/model/item.d.ts +1 -1
- package/src/model/item.js +1 -1
- package/src/model/liveposition.d.ts +1 -1
- package/src/model/liveposition.js +1 -1
- package/src/model/liverange.d.ts +1 -1
- package/src/model/liverange.js +1 -1
- package/src/model/markercollection.d.ts +1 -1
- package/src/model/markercollection.js +1 -1
- package/src/model/model.d.ts +1 -1
- package/src/model/model.js +1 -1
- package/src/model/node.d.ts +1 -1
- package/src/model/node.js +1 -1
- package/src/model/nodelist.d.ts +1 -1
- package/src/model/nodelist.js +1 -1
- package/src/model/operation/attributeoperation.d.ts +1 -1
- package/src/model/operation/attributeoperation.js +1 -1
- package/src/model/operation/detachoperation.d.ts +1 -1
- package/src/model/operation/detachoperation.js +1 -1
- package/src/model/operation/insertoperation.d.ts +1 -1
- package/src/model/operation/insertoperation.js +1 -1
- package/src/model/operation/markeroperation.d.ts +1 -1
- package/src/model/operation/markeroperation.js +1 -1
- package/src/model/operation/mergeoperation.d.ts +1 -1
- package/src/model/operation/mergeoperation.js +1 -1
- package/src/model/operation/moveoperation.d.ts +1 -1
- package/src/model/operation/moveoperation.js +1 -1
- package/src/model/operation/nooperation.d.ts +1 -1
- package/src/model/operation/nooperation.js +1 -1
- package/src/model/operation/operation.d.ts +4 -1
- package/src/model/operation/operation.js +2 -2
- package/src/model/operation/operationfactory.d.ts +1 -1
- package/src/model/operation/operationfactory.js +1 -1
- package/src/model/operation/renameoperation.d.ts +1 -1
- package/src/model/operation/renameoperation.js +1 -1
- package/src/model/operation/rootattributeoperation.d.ts +1 -1
- package/src/model/operation/rootattributeoperation.js +1 -1
- package/src/model/operation/rootoperation.d.ts +1 -1
- package/src/model/operation/rootoperation.js +1 -1
- package/src/model/operation/splitoperation.d.ts +1 -1
- package/src/model/operation/splitoperation.js +1 -1
- package/src/model/operation/transform.d.ts +1 -1
- package/src/model/operation/transform.js +1 -1
- package/src/model/operation/utils.d.ts +1 -1
- package/src/model/operation/utils.js +1 -1
- package/src/model/position.d.ts +1 -1
- package/src/model/position.js +1 -1
- package/src/model/range.d.ts +1 -1
- package/src/model/range.js +1 -1
- package/src/model/rootelement.d.ts +1 -1
- package/src/model/rootelement.js +1 -1
- package/src/model/schema.d.ts +1 -1
- package/src/model/schema.js +1 -1
- package/src/model/selection.d.ts +1 -1
- package/src/model/selection.js +9 -2
- package/src/model/text.d.ts +1 -1
- package/src/model/text.js +1 -1
- package/src/model/textproxy.d.ts +1 -1
- package/src/model/textproxy.js +1 -1
- package/src/model/treewalker.d.ts +17 -1
- package/src/model/treewalker.js +26 -1
- package/src/model/typecheckable.d.ts +1 -1
- package/src/model/typecheckable.js +1 -1
- package/src/model/utils/autoparagraphing.d.ts +1 -1
- package/src/model/utils/autoparagraphing.js +1 -1
- package/src/model/utils/deletecontent.d.ts +1 -1
- package/src/model/utils/deletecontent.js +1 -1
- package/src/model/utils/getselectedcontent.d.ts +1 -1
- package/src/model/utils/getselectedcontent.js +1 -1
- package/src/model/utils/insertcontent.d.ts +1 -1
- package/src/model/utils/insertcontent.js +1 -1
- package/src/model/utils/insertobject.d.ts +1 -1
- package/src/model/utils/insertobject.js +1 -1
- package/src/model/utils/modifyselection.d.ts +1 -1
- package/src/model/utils/modifyselection.js +1 -1
- package/src/model/utils/selection-post-fixer.d.ts +1 -1
- package/src/model/utils/selection-post-fixer.js +1 -1
- package/src/model/writer.d.ts +1 -1
- package/src/model/writer.js +1 -1
- package/src/view/attributeelement.d.ts +1 -1
- package/src/view/attributeelement.js +1 -1
- package/src/view/containerelement.d.ts +1 -1
- package/src/view/containerelement.js +1 -1
- package/src/view/datatransfer.d.ts +1 -1
- package/src/view/datatransfer.js +1 -1
- package/src/view/document.d.ts +1 -1
- package/src/view/document.js +1 -1
- package/src/view/documentfragment.d.ts +6 -4
- package/src/view/documentfragment.js +7 -7
- package/src/view/documentselection.d.ts +1 -1
- package/src/view/documentselection.js +1 -1
- package/src/view/domconverter.d.ts +1 -1
- package/src/view/domconverter.js +1 -1
- package/src/view/downcastwriter.d.ts +1 -1
- package/src/view/downcastwriter.js +1 -1
- package/src/view/editableelement.d.ts +1 -1
- package/src/view/editableelement.js +1 -1
- package/src/view/element.d.ts +1 -1
- package/src/view/element.js +3 -3
- package/src/view/elementdefinition.d.ts +1 -1
- package/src/view/elementdefinition.js +1 -1
- package/src/view/emptyelement.d.ts +1 -1
- package/src/view/emptyelement.js +1 -1
- package/src/view/filler.d.ts +1 -1
- package/src/view/filler.js +1 -1
- package/src/view/item.d.ts +1 -1
- package/src/view/item.js +1 -1
- package/src/view/matcher.d.ts +1 -1
- package/src/view/matcher.js +1 -1
- package/src/view/node.d.ts +13 -4
- package/src/view/node.js +5 -4
- package/src/view/observer/arrowkeysobserver.d.ts +1 -1
- package/src/view/observer/arrowkeysobserver.js +1 -1
- package/src/view/observer/bubblingemittermixin.d.ts +1 -1
- package/src/view/observer/bubblingemittermixin.js +1 -1
- package/src/view/observer/bubblingeventinfo.d.ts +1 -1
- package/src/view/observer/bubblingeventinfo.js +1 -1
- package/src/view/observer/clickobserver.d.ts +1 -1
- package/src/view/observer/clickobserver.js +1 -1
- package/src/view/observer/compositionobserver.d.ts +1 -1
- package/src/view/observer/compositionobserver.js +1 -1
- package/src/view/observer/domeventdata.d.ts +1 -1
- package/src/view/observer/domeventdata.js +1 -1
- package/src/view/observer/domeventobserver.d.ts +1 -1
- package/src/view/observer/domeventobserver.js +1 -1
- package/src/view/observer/fakeselectionobserver.d.ts +1 -1
- package/src/view/observer/fakeselectionobserver.js +1 -1
- package/src/view/observer/focusobserver.d.ts +1 -1
- package/src/view/observer/focusobserver.js +1 -1
- package/src/view/observer/inputobserver.d.ts +1 -1
- package/src/view/observer/inputobserver.js +1 -1
- package/src/view/observer/keyobserver.d.ts +1 -1
- package/src/view/observer/keyobserver.js +1 -1
- package/src/view/observer/mouseobserver.d.ts +1 -1
- package/src/view/observer/mouseobserver.js +1 -1
- package/src/view/observer/mutationobserver.d.ts +1 -1
- package/src/view/observer/mutationobserver.js +1 -1
- package/src/view/observer/observer.d.ts +1 -1
- package/src/view/observer/observer.js +1 -1
- package/src/view/observer/selectionobserver.d.ts +1 -1
- package/src/view/observer/selectionobserver.js +1 -1
- package/src/view/observer/tabobserver.d.ts +1 -1
- package/src/view/observer/tabobserver.js +1 -1
- package/src/view/observer/touchobserver.d.ts +73 -0
- package/src/view/observer/touchobserver.js +29 -0
- package/src/view/placeholder.d.ts +1 -1
- package/src/view/placeholder.js +23 -17
- package/src/view/position.d.ts +1 -1
- package/src/view/position.js +1 -1
- package/src/view/range.d.ts +1 -1
- package/src/view/range.js +1 -1
- package/src/view/rawelement.d.ts +1 -1
- package/src/view/rawelement.js +1 -1
- package/src/view/renderer.d.ts +1 -1
- package/src/view/renderer.js +1 -1
- package/src/view/rooteditableelement.d.ts +1 -1
- package/src/view/rooteditableelement.js +1 -1
- package/src/view/selection.d.ts +1 -1
- package/src/view/selection.js +1 -1
- package/src/view/styles/background.d.ts +1 -1
- package/src/view/styles/background.js +1 -1
- package/src/view/styles/border.d.ts +1 -1
- package/src/view/styles/border.js +1 -1
- package/src/view/styles/margin.d.ts +1 -1
- package/src/view/styles/margin.js +1 -1
- package/src/view/styles/padding.d.ts +1 -1
- package/src/view/styles/padding.js +1 -1
- package/src/view/styles/utils.d.ts +1 -1
- package/src/view/styles/utils.js +1 -1
- package/src/view/stylesmap.d.ts +1 -1
- package/src/view/stylesmap.js +1 -1
- package/src/view/text.d.ts +1 -1
- package/src/view/text.js +1 -1
- package/src/view/textproxy.d.ts +1 -1
- package/src/view/textproxy.js +1 -1
- package/src/view/treewalker.d.ts +17 -1
- package/src/view/treewalker.js +25 -1
- package/src/view/typecheckable.d.ts +1 -1
- package/src/view/typecheckable.js +1 -1
- package/src/view/uielement.d.ts +1 -1
- package/src/view/uielement.js +1 -1
- package/src/view/upcastwriter.d.ts +1 -1
- package/src/view/upcastwriter.js +1 -1
- package/src/view/view.d.ts +1 -1
- package/src/view/view.js +1 -1
- package/theme/placeholder.css +1 -1
- package/theme/renderer.css +1 -1
- package/dist/controller/datacontroller.d.ts +0 -339
- package/dist/controller/editingcontroller.d.ts +0 -102
- package/dist/conversion/conversion.d.ts +0 -482
- package/dist/conversion/conversionhelpers.d.ts +0 -30
- package/dist/conversion/downcastdispatcher.d.ts +0 -566
- package/dist/conversion/downcasthelpers.d.ts +0 -1194
- package/dist/conversion/mapper.d.ts +0 -507
- package/dist/conversion/modelconsumable.d.ts +0 -205
- package/dist/conversion/upcastdispatcher.d.ts +0 -496
- package/dist/conversion/upcasthelpers.d.ts +0 -503
- package/dist/conversion/viewconsumable.d.ts +0 -373
- package/dist/dataprocessor/basichtmlwriter.d.ts +0 -22
- package/dist/dataprocessor/dataprocessor.d.ts +0 -65
- package/dist/dataprocessor/htmldataprocessor.d.ts +0 -80
- package/dist/dataprocessor/htmlwriter.d.ts +0 -20
- package/dist/dataprocessor/xmldataprocessor.d.ts +0 -94
- package/dist/dev-utils/model.d.ts +0 -130
- package/dist/dev-utils/operationreplayer.d.ts +0 -55
- package/dist/dev-utils/utils.d.ts +0 -41
- package/dist/dev-utils/view.d.ts +0 -324
- package/dist/index.d.ts +0 -122
- package/dist/model/batch.d.ts +0 -110
- package/dist/model/differ.d.ts +0 -511
- package/dist/model/document.d.ts +0 -278
- package/dist/model/documentfragment.d.ts +0 -223
- package/dist/model/documentselection.d.ts +0 -424
- package/dist/model/element.d.ts +0 -191
- package/dist/model/history.d.ts +0 -118
- package/dist/model/item.d.ts +0 -18
- package/dist/model/liveposition.d.ts +0 -81
- package/dist/model/liverange.d.ts +0 -106
- package/dist/model/markercollection.d.ts +0 -339
- package/dist/model/model.d.ts +0 -923
- package/dist/model/node.d.ts +0 -262
- package/dist/model/nodelist.d.ts +0 -119
- package/dist/model/operation/attributeoperation.d.ts +0 -107
- package/dist/model/operation/detachoperation.d.ts +0 -64
- package/dist/model/operation/insertoperation.d.ts +0 -94
- package/dist/model/operation/markeroperation.d.ts +0 -95
- package/dist/model/operation/mergeoperation.d.ts +0 -104
- package/dist/model/operation/moveoperation.d.ts +0 -100
- package/dist/model/operation/nooperation.d.ts +0 -42
- package/dist/model/operation/operation.d.ts +0 -100
- package/dist/model/operation/operationfactory.d.ts +0 -22
- package/dist/model/operation/renameoperation.d.ts +0 -87
- package/dist/model/operation/rootattributeoperation.d.ts +0 -102
- package/dist/model/operation/rootoperation.d.ts +0 -80
- package/dist/model/operation/splitoperation.d.ts +0 -113
- package/dist/model/operation/transform.d.ts +0 -104
- package/dist/model/operation/utils.d.ts +0 -75
- package/dist/model/position.d.ts +0 -549
- package/dist/model/range.d.ts +0 -462
- package/dist/model/rootelement.d.ts +0 -64
- package/dist/model/schema.d.ts +0 -1334
- package/dist/model/selection.d.ts +0 -486
- package/dist/model/text.d.ts +0 -70
- package/dist/model/textproxy.d.ts +0 -148
- package/dist/model/treewalker.d.ts +0 -190
- package/dist/model/typecheckable.d.ts +0 -289
- package/dist/model/utils/autoparagraphing.d.ts +0 -41
- package/dist/model/utils/deletecontent.d.ts +0 -62
- package/dist/model/utils/getselectedcontent.d.ts +0 -34
- package/dist/model/utils/insertcontent.d.ts +0 -50
- package/dist/model/utils/insertobject.d.ts +0 -51
- package/dist/model/utils/modifyselection.d.ts +0 -52
- package/dist/model/utils/selection-post-fixer.d.ts +0 -78
- package/dist/model/writer.d.ts +0 -855
- package/dist/view/attributeelement.d.ts +0 -112
- package/dist/view/containerelement.d.ts +0 -53
- package/dist/view/datatransfer.d.ts +0 -83
- package/dist/view/document.d.ts +0 -188
- package/dist/view/documentfragment.d.ts +0 -157
- package/dist/view/documentselection.d.ts +0 -310
- package/dist/view/domconverter.d.ts +0 -665
- package/dist/view/downcastwriter.d.ts +0 -1000
- package/dist/view/editableelement.d.ts +0 -66
- package/dist/view/element.d.ts +0 -472
- package/dist/view/elementdefinition.d.ts +0 -91
- package/dist/view/emptyelement.d.ts +0 -45
- package/dist/view/filler.d.ts +0 -115
- package/dist/view/item.d.ts +0 -18
- package/dist/view/matcher.d.ts +0 -490
- package/dist/view/node.d.ts +0 -166
- package/dist/view/observer/arrowkeysobserver.d.ts +0 -49
- package/dist/view/observer/bubblingemittermixin.d.ts +0 -170
- package/dist/view/observer/bubblingeventinfo.d.ts +0 -51
- package/dist/view/observer/clickobserver.d.ts +0 -47
- package/dist/view/observer/compositionobserver.d.ts +0 -86
- package/dist/view/observer/domeventdata.d.ts +0 -54
- package/dist/view/observer/domeventobserver.d.ts +0 -82
- package/dist/view/observer/fakeselectionobserver.d.ts +0 -51
- package/dist/view/observer/focusobserver.d.ts +0 -98
- package/dist/view/observer/inputobserver.d.ts +0 -90
- package/dist/view/observer/keyobserver.d.ts +0 -70
- package/dist/view/observer/mouseobserver.d.ts +0 -93
- package/dist/view/observer/mutationobserver.d.ts +0 -119
- package/dist/view/observer/observer.d.ts +0 -93
- package/dist/view/observer/selectionobserver.d.ts +0 -151
- package/dist/view/observer/tabobserver.d.ts +0 -50
- package/dist/view/placeholder.d.ts +0 -100
- package/dist/view/position.d.ts +0 -192
- package/dist/view/range.d.ts +0 -283
- package/dist/view/rawelement.d.ts +0 -77
- package/dist/view/renderer.d.ts +0 -281
- package/dist/view/rooteditableelement.d.ts +0 -45
- package/dist/view/selection.d.ts +0 -379
- package/dist/view/styles/background.d.ts +0 -37
- package/dist/view/styles/border.d.ts +0 -47
- package/dist/view/styles/margin.d.ts +0 -33
- package/dist/view/styles/padding.d.ts +0 -33
- package/dist/view/styles/utils.d.ts +0 -97
- package/dist/view/stylesmap.d.ts +0 -685
- package/dist/view/text.d.ts +0 -78
- package/dist/view/textproxy.d.ts +0 -101
- package/dist/view/treewalker.d.ts +0 -199
- package/dist/view/typecheckable.d.ts +0 -452
- package/dist/view/uielement.d.ts +0 -100
- package/dist/view/upcastwriter.d.ts +0 -421
- package/dist/view/view.d.ts +0 -488
|
@@ -1,130 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
4
|
-
*/
|
|
5
|
-
/**
|
|
6
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
7
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
|
8
|
-
*/
|
|
9
|
-
import Model from '../model/model.js';
|
|
10
|
-
import ModelRange from '../model/range.js';
|
|
11
|
-
import ModelPosition from '../model/position.js';
|
|
12
|
-
import ModelSelection from '../model/selection.js';
|
|
13
|
-
import ModelDocumentFragment from '../model/documentfragment.js';
|
|
14
|
-
import DocumentSelection from '../model/documentselection.js';
|
|
15
|
-
import type { BatchType } from '../model/batch.js';
|
|
16
|
-
import type MarkerCollection from '../model/markercollection.js';
|
|
17
|
-
import type { default as Schema, SchemaContextDefinition } from '../model/schema.js';
|
|
18
|
-
import type ModelNode from '../model/node.js';
|
|
19
|
-
/**
|
|
20
|
-
* Writes the content of a model {@link module:engine/model/document~Document document} to an HTML-like string.
|
|
21
|
-
*
|
|
22
|
-
* ```ts
|
|
23
|
-
* getData( editor.model ); // -> '<paragraph>Foo![]</paragraph>'
|
|
24
|
-
* ```
|
|
25
|
-
*
|
|
26
|
-
* **Note:** A {@link module:engine/model/text~Text text} node that contains attributes will be represented as:
|
|
27
|
-
*
|
|
28
|
-
* ```xml
|
|
29
|
-
* <$text attribute="value">Text data</$text>
|
|
30
|
-
* ```
|
|
31
|
-
*
|
|
32
|
-
* **Note:** Using this tool in production-grade code is not recommended. It was designed for development, prototyping,
|
|
33
|
-
* debugging and testing.
|
|
34
|
-
*
|
|
35
|
-
* @param options.withoutSelection Whether to write the selection. When set to `true`, the selection will
|
|
36
|
-
* not be included in the returned string.
|
|
37
|
-
* @param options.rootName The name of the root from which the data should be stringified. If not provided,
|
|
38
|
-
* the default `main` name will be used.
|
|
39
|
-
* @param options.convertMarkers Whether to include markers in the returned string.
|
|
40
|
-
* @returns The stringified data.
|
|
41
|
-
*/
|
|
42
|
-
export declare function getData(model: Model, options?: {
|
|
43
|
-
withoutSelection?: boolean;
|
|
44
|
-
rootName?: string;
|
|
45
|
-
convertMarkers?: boolean;
|
|
46
|
-
}): string;
|
|
47
|
-
export declare namespace getData {
|
|
48
|
-
var _stringify: typeof stringify;
|
|
49
|
-
}
|
|
50
|
-
/**
|
|
51
|
-
* Sets the content of a model {@link module:engine/model/document~Document document} provided as an HTML-like string.
|
|
52
|
-
*
|
|
53
|
-
* ```ts
|
|
54
|
-
* setData( editor.model, '<paragraph>Foo![]</paragraph>' );
|
|
55
|
-
* ```
|
|
56
|
-
*
|
|
57
|
-
* **Note:** Remember to register elements in the {@link module:engine/model/model~Model#schema model's schema} before
|
|
58
|
-
* trying to use them.
|
|
59
|
-
*
|
|
60
|
-
* **Note:** To create a {@link module:engine/model/text~Text text} node that contains attributes use:
|
|
61
|
-
*
|
|
62
|
-
* ```xml
|
|
63
|
-
* <$text attribute="value">Text data</$text>
|
|
64
|
-
* ```
|
|
65
|
-
*
|
|
66
|
-
* **Note:** Using this tool in production-grade code is not recommended. It was designed for development, prototyping,
|
|
67
|
-
* debugging and testing.
|
|
68
|
-
*
|
|
69
|
-
* @param data HTML-like string to write into the document.
|
|
70
|
-
* @param options.rootName Root name where parsed data will be stored. If not provided, the default `main`
|
|
71
|
-
* name will be used.
|
|
72
|
-
* @param options.selectionAttributes A list of attributes which will be passed to the selection.
|
|
73
|
-
* @param options.lastRangeBackward If set to `true`, the last range will be added as backward.
|
|
74
|
-
* @param options.batchType Batch type used for inserting elements. See {@link module:engine/model/batch~Batch#constructor}.
|
|
75
|
-
* See {@link module:engine/model/batch~Batch#type}.
|
|
76
|
-
*/
|
|
77
|
-
export declare function setData(model: Model, data: string, options?: {
|
|
78
|
-
rootName?: string;
|
|
79
|
-
selectionAttributes?: Record<string, unknown>;
|
|
80
|
-
lastRangeBackward?: boolean;
|
|
81
|
-
batchType?: BatchType;
|
|
82
|
-
inlineObjectElements?: Array<string>;
|
|
83
|
-
}): void;
|
|
84
|
-
export declare namespace setData {
|
|
85
|
-
var _parse: typeof parse;
|
|
86
|
-
}
|
|
87
|
-
/**
|
|
88
|
-
* Converts model nodes to HTML-like string representation.
|
|
89
|
-
*
|
|
90
|
-
* **Note:** A {@link module:engine/model/text~Text text} node that contains attributes will be represented as:
|
|
91
|
-
*
|
|
92
|
-
* ```xml
|
|
93
|
-
* <$text attribute="value">Text data</$text>
|
|
94
|
-
* ```
|
|
95
|
-
*
|
|
96
|
-
* @param node A node to stringify.
|
|
97
|
-
* @param selectionOrPositionOrRange A selection instance whose ranges will be included in the returned string data.
|
|
98
|
-
* If a range instance is provided, it will be converted to a selection containing this range. If a position instance
|
|
99
|
-
* is provided, it will be converted to a selection containing one range collapsed at this position.
|
|
100
|
-
* @param markers Markers to include.
|
|
101
|
-
* @returns An HTML-like string representing the model.
|
|
102
|
-
*/
|
|
103
|
-
export declare function stringify(node: ModelNode | ModelDocumentFragment, selectionOrPositionOrRange?: ModelSelection | DocumentSelection | ModelPosition | ModelRange | null, markers?: MarkerCollection | null): string;
|
|
104
|
-
/**
|
|
105
|
-
* Parses an HTML-like string and returns the model {@link module:engine/model/rootelement~RootElement rootElement}.
|
|
106
|
-
*
|
|
107
|
-
* **Note:** To create a {@link module:engine/model/text~Text text} node that contains attributes use:
|
|
108
|
-
*
|
|
109
|
-
* ```xml
|
|
110
|
-
* <$text attribute="value">Text data</$text>
|
|
111
|
-
* ```
|
|
112
|
-
*
|
|
113
|
-
* @param data HTML-like string to be parsed.
|
|
114
|
-
* @param schema A schema instance used by converters for element validation.
|
|
115
|
-
* @param options Additional configuration.
|
|
116
|
-
* @param options.selectionAttributes A list of attributes which will be passed to the selection.
|
|
117
|
-
* @param options.lastRangeBackward If set to `true`, the last range will be added as backward.
|
|
118
|
-
* @param options.context The conversion context. If not provided, the default `'$root'` will be used.
|
|
119
|
-
* @returns Returns the parsed model node or an object with two fields: `model` and `selection`,
|
|
120
|
-
* when selection ranges were included in the data to parse.
|
|
121
|
-
*/
|
|
122
|
-
export declare function parse(data: string, schema: Schema, options?: {
|
|
123
|
-
selectionAttributes?: Record<string, unknown> | Iterable<[string, unknown]>;
|
|
124
|
-
lastRangeBackward?: boolean;
|
|
125
|
-
context?: SchemaContextDefinition;
|
|
126
|
-
inlineObjectElements?: Array<string>;
|
|
127
|
-
}): ModelNode | ModelDocumentFragment | {
|
|
128
|
-
model: ModelNode | ModelDocumentFragment;
|
|
129
|
-
selection: ModelSelection;
|
|
130
|
-
};
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
4
|
-
*/
|
|
5
|
-
/**
|
|
6
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
7
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
|
8
|
-
*/
|
|
9
|
-
import type Model from '../model/model.js';
|
|
10
|
-
import type Operation from '../model/operation/operation.js';
|
|
11
|
-
/**
|
|
12
|
-
* Operation replayer is a development tool created for easy replaying of operations on the document from stringified operations.
|
|
13
|
-
*/
|
|
14
|
-
export default class OperationReplayer {
|
|
15
|
-
private _model;
|
|
16
|
-
private _logSeparator;
|
|
17
|
-
private _operationsToReplay;
|
|
18
|
-
/**
|
|
19
|
-
* @param model Data model.
|
|
20
|
-
* @param logSeparator Separator between operations.
|
|
21
|
-
* @param stringifiedOperations Operations to replay.
|
|
22
|
-
*/
|
|
23
|
-
constructor(model: Model, logSeparator: string, stringifiedOperations: string);
|
|
24
|
-
/**
|
|
25
|
-
* Parses the given string containing stringified operations and sets parsed operations as operations to replay.
|
|
26
|
-
*
|
|
27
|
-
* @param stringifiedOperations Stringified operations to replay.
|
|
28
|
-
*/
|
|
29
|
-
setStringifiedOperations(stringifiedOperations: string): void;
|
|
30
|
-
/**
|
|
31
|
-
* Returns operations to replay.
|
|
32
|
-
*/
|
|
33
|
-
getOperationsToReplay(): Array<Operation>;
|
|
34
|
-
/**
|
|
35
|
-
* Applies all operations with a delay between actions.
|
|
36
|
-
*
|
|
37
|
-
* @param timeInterval Time between applying operations.
|
|
38
|
-
*/
|
|
39
|
-
play(timeInterval?: number): Promise<void>;
|
|
40
|
-
/**
|
|
41
|
-
* Applies `numberOfOperations` operations, beginning after the last applied operation (or first, if no operations were applied).
|
|
42
|
-
*
|
|
43
|
-
* @param numberOfOperations The number of operations to apply.
|
|
44
|
-
*/
|
|
45
|
-
applyOperations(numberOfOperations: number): Promise<void> | undefined;
|
|
46
|
-
/**
|
|
47
|
-
* Applies all operations to replay at once.
|
|
48
|
-
*/
|
|
49
|
-
applyAllOperations(): Promise<void>;
|
|
50
|
-
/**
|
|
51
|
-
* Applies the next operation to replay. Returns a promise with the `isFinished` parameter that is `true` if the last
|
|
52
|
-
* operation in the replayer has been applied, `false` otherwise.
|
|
53
|
-
*/
|
|
54
|
-
applyNextOperation(): Promise<boolean>;
|
|
55
|
-
}
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
4
|
-
*/
|
|
5
|
-
/**
|
|
6
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
7
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
|
8
|
-
*/
|
|
9
|
-
/**
|
|
10
|
-
* Note: This package is used only internally for debugging purposes and should not be used
|
|
11
|
-
* in other environments. It uses a few special methods not existing in the default
|
|
12
|
-
* building process. That is also why there are no tests for this file.
|
|
13
|
-
*
|
|
14
|
-
* @module engine/dev-utils/utils
|
|
15
|
-
*/
|
|
16
|
-
/**
|
|
17
|
-
* Helper function, converts a map to the 'key1="value1" key2="value1"' format.
|
|
18
|
-
*
|
|
19
|
-
* @param map Map to convert.
|
|
20
|
-
* @returns Converted map.
|
|
21
|
-
*/
|
|
22
|
-
export declare function convertMapToTags(map: Iterable<[string, unknown]>): string;
|
|
23
|
-
/**
|
|
24
|
-
* Helper function, converts a map to the `{"key1":"value1","key2":"value2"}` format.
|
|
25
|
-
*
|
|
26
|
-
* @param map Map to convert.
|
|
27
|
-
* @returns Converted map.
|
|
28
|
-
*/
|
|
29
|
-
export declare function convertMapToStringifiedObject(map: Iterable<[string, unknown]>): string;
|
|
30
|
-
/**
|
|
31
|
-
* Helper function that stores the `document` state for a given `version`.
|
|
32
|
-
*/
|
|
33
|
-
export declare function dumpTrees(document: any, version: any): void;
|
|
34
|
-
/**
|
|
35
|
-
* Helper function that initializes document dumping.
|
|
36
|
-
*/
|
|
37
|
-
export declare function initDocumentDumping(document: any): void;
|
|
38
|
-
/**
|
|
39
|
-
* Helper function that logs document for the given version.
|
|
40
|
-
*/
|
|
41
|
-
export declare function logDocument(document: any, version: any): void;
|
package/dist/dev-utils/view.d.ts
DELETED
|
@@ -1,324 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
4
|
-
*/
|
|
5
|
-
/**
|
|
6
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
7
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
|
8
|
-
*/
|
|
9
|
-
/**
|
|
10
|
-
* @module engine/dev-utils/view
|
|
11
|
-
*/
|
|
12
|
-
/**
|
|
13
|
-
* Collection of methods for manipulating the {@link module:engine/view/view view} for testing purposes.
|
|
14
|
-
*/
|
|
15
|
-
import View from '../view/view.js';
|
|
16
|
-
import ViewDocumentFragment from '../view/documentfragment.js';
|
|
17
|
-
import ViewElement from '../view/element.js';
|
|
18
|
-
import DocumentSelection from '../view/documentselection.js';
|
|
19
|
-
import Range from '../view/range.js';
|
|
20
|
-
import Position from '../view/position.js';
|
|
21
|
-
import type ViewNode from '../view/node.js';
|
|
22
|
-
import type DomConverter from '../view/domconverter.js';
|
|
23
|
-
/**
|
|
24
|
-
* Writes the content of the {@link module:engine/view/document~Document document} to an HTML-like string.
|
|
25
|
-
*
|
|
26
|
-
* @param options.withoutSelection Whether to write the selection. When set to `true`, the selection will
|
|
27
|
-
* not be included in the returned string.
|
|
28
|
-
* @param options.rootName The name of the root from which the data should be stringified. If not provided,
|
|
29
|
-
* the default `main` name will be used.
|
|
30
|
-
* @param options.showType When set to `true`, the type of elements will be printed (`<container:p>`
|
|
31
|
-
* instead of `<p>`, `<attribute:b>` instead of `<b>` and `<empty:img>` instead of `<img>`).
|
|
32
|
-
* @param options.showPriority When set to `true`, the attribute element's priority will be printed
|
|
33
|
-
* (`<span view-priority="12">`, `<b view-priority="10">`).
|
|
34
|
-
* @param options.showAttributeElementId When set to `true`, the attribute element's ID will be printed
|
|
35
|
-
* (`<span id="marker:foo">`).
|
|
36
|
-
* @param options.renderUIElements When set to `true`, the inner content of each
|
|
37
|
-
* {@link module:engine/view/uielement~UIElement} will be printed.
|
|
38
|
-
* @param options.renderRawElements When set to `true`, the inner content of each
|
|
39
|
-
* {@link module:engine/view/rawelement~RawElement} will be printed.
|
|
40
|
-
* @param options.domConverter When set to an actual {@link module:engine/view/domconverter~DomConverter DomConverter}
|
|
41
|
-
* instance, it lets the conversion go through exactly the same flow the editing view is going through,
|
|
42
|
-
* i.e. with view data filtering. Otherwise the simple stub is used.
|
|
43
|
-
* @returns The stringified data.
|
|
44
|
-
*/
|
|
45
|
-
export declare function getData(view: View, options?: {
|
|
46
|
-
withoutSelection?: boolean;
|
|
47
|
-
rootName?: string;
|
|
48
|
-
showType?: boolean;
|
|
49
|
-
showPriority?: boolean;
|
|
50
|
-
renderUIElements?: boolean;
|
|
51
|
-
renderRawElements?: boolean;
|
|
52
|
-
domConverter?: DomConverter;
|
|
53
|
-
}): string;
|
|
54
|
-
export declare namespace getData {
|
|
55
|
-
var _stringify: typeof stringify;
|
|
56
|
-
}
|
|
57
|
-
/**
|
|
58
|
-
* Sets the content of a view {@link module:engine/view/document~Document document} provided as an HTML-like string.
|
|
59
|
-
*
|
|
60
|
-
* @param data An HTML-like string to write into the document.
|
|
61
|
-
* @param options.rootName The root name where parsed data will be stored. If not provided,
|
|
62
|
-
* the default `main` name will be used.
|
|
63
|
-
*/
|
|
64
|
-
export declare function setData(view: View, data: string, options?: {
|
|
65
|
-
rootName?: string;
|
|
66
|
-
}): void;
|
|
67
|
-
export declare namespace setData {
|
|
68
|
-
var _parse: typeof parse;
|
|
69
|
-
}
|
|
70
|
-
/**
|
|
71
|
-
* Converts view elements to HTML-like string representation.
|
|
72
|
-
*
|
|
73
|
-
* A root element can be provided as {@link module:engine/view/text~Text text}:
|
|
74
|
-
*
|
|
75
|
-
* ```ts
|
|
76
|
-
* const text = downcastWriter.createText( 'foobar' );
|
|
77
|
-
* stringify( text ); // 'foobar'
|
|
78
|
-
* ```
|
|
79
|
-
*
|
|
80
|
-
* or as an {@link module:engine/view/element~Element element}:
|
|
81
|
-
*
|
|
82
|
-
* ```ts
|
|
83
|
-
* const element = downcastWriter.createElement( 'p', null, downcastWriter.createText( 'foobar' ) );
|
|
84
|
-
* stringify( element ); // '<p>foobar</p>'
|
|
85
|
-
* ```
|
|
86
|
-
*
|
|
87
|
-
* or as a {@link module:engine/view/documentfragment~DocumentFragment document fragment}:
|
|
88
|
-
*
|
|
89
|
-
* ```ts
|
|
90
|
-
* const text = downcastWriter.createText( 'foobar' );
|
|
91
|
-
* const b = downcastWriter.createElement( 'b', { name: 'test' }, text );
|
|
92
|
-
* const p = downcastWriter.createElement( 'p', { style: 'color:red;' } );
|
|
93
|
-
* const fragment = downcastWriter.createDocumentFragment( [ p, b ] );
|
|
94
|
-
*
|
|
95
|
-
* stringify( fragment ); // '<p style="color:red;"></p><b name="test">foobar</b>'
|
|
96
|
-
* ```
|
|
97
|
-
*
|
|
98
|
-
* Additionally, a {@link module:engine/view/documentselection~DocumentSelection selection} instance can be provided.
|
|
99
|
-
* Ranges from the selection will then be included in the output data.
|
|
100
|
-
* If a range position is placed inside the element node, it will be represented with `[` and `]`:
|
|
101
|
-
*
|
|
102
|
-
* ```ts
|
|
103
|
-
* const text = downcastWriter.createText( 'foobar' );
|
|
104
|
-
* const b = downcastWriter.createElement( 'b', null, text );
|
|
105
|
-
* const p = downcastWriter.createElement( 'p', null, b );
|
|
106
|
-
* const selection = downcastWriter.createSelection(
|
|
107
|
-
* downcastWriter.createRangeIn( p )
|
|
108
|
-
* );
|
|
109
|
-
*
|
|
110
|
-
* stringify( p, selection ); // '<p>[<b>foobar</b>]</p>'
|
|
111
|
-
* ```
|
|
112
|
-
*
|
|
113
|
-
* If a range is placed inside the text node, it will be represented with `{` and `}`:
|
|
114
|
-
*
|
|
115
|
-
* ```ts
|
|
116
|
-
* const text = downcastWriter.createText( 'foobar' );
|
|
117
|
-
* const b = downcastWriter.createElement( 'b', null, text );
|
|
118
|
-
* const p = downcastWriter.createElement( 'p', null, b );
|
|
119
|
-
* const selection = downcastWriter.createSelection(
|
|
120
|
-
* downcastWriter.createRange( downcastWriter.createPositionAt( text, 1 ), downcastWriter.createPositionAt( text, 5 ) )
|
|
121
|
-
* );
|
|
122
|
-
*
|
|
123
|
-
* stringify( p, selection ); // '<p><b>f{ooba}r</b></p>'
|
|
124
|
-
* ```
|
|
125
|
-
*
|
|
126
|
-
* ** Note: **
|
|
127
|
-
* It is possible to unify selection markers to `[` and `]` for both (inside and outside text)
|
|
128
|
-
* by setting the `sameSelectionCharacters=true` option. It is mainly used when the view stringify option is used by
|
|
129
|
-
* model utilities.
|
|
130
|
-
*
|
|
131
|
-
* Multiple ranges are supported:
|
|
132
|
-
*
|
|
133
|
-
* ```ts
|
|
134
|
-
* const text = downcastWriter.createText( 'foobar' );
|
|
135
|
-
* const selection = downcastWriter.createSelection( [
|
|
136
|
-
* downcastWriter.createRange( downcastWriter.createPositionAt( text, 0 ), downcastWriter.createPositionAt( text, 1 ) ),
|
|
137
|
-
* downcastWriter.createRange( downcastWriter.createPositionAt( text, 3 ), downcastWriter.createPositionAt( text, 5 ) )
|
|
138
|
-
* ] );
|
|
139
|
-
*
|
|
140
|
-
* stringify( text, selection ); // '{f}oo{ba}r'
|
|
141
|
-
* ```
|
|
142
|
-
*
|
|
143
|
-
* A {@link module:engine/view/range~Range range} or {@link module:engine/view/position~Position position} instance can be provided
|
|
144
|
-
* instead of the {@link module:engine/view/documentselection~DocumentSelection selection} instance. If a range instance
|
|
145
|
-
* is provided, it will be converted to a selection containing this range. If a position instance is provided, it will
|
|
146
|
-
* be converted to a selection containing one range collapsed at this position.
|
|
147
|
-
*
|
|
148
|
-
* ```ts
|
|
149
|
-
* const text = downcastWriter.createText( 'foobar' );
|
|
150
|
-
* const range = downcastWriter.createRange( downcastWriter.createPositionAt( text, 0 ), downcastWriter.createPositionAt( text, 1 ) );
|
|
151
|
-
* const position = downcastWriter.createPositionAt( text, 3 );
|
|
152
|
-
*
|
|
153
|
-
* stringify( text, range ); // '{f}oobar'
|
|
154
|
-
* stringify( text, position ); // 'foo{}bar'
|
|
155
|
-
* ```
|
|
156
|
-
*
|
|
157
|
-
* An additional `options` object can be provided.
|
|
158
|
-
* If `options.showType` is set to `true`, element's types will be
|
|
159
|
-
* presented for {@link module:engine/view/attributeelement~AttributeElement attribute elements},
|
|
160
|
-
* {@link module:engine/view/containerelement~ContainerElement container elements}
|
|
161
|
-
* {@link module:engine/view/emptyelement~EmptyElement empty elements}
|
|
162
|
-
* and {@link module:engine/view/uielement~UIElement UI elements}:
|
|
163
|
-
*
|
|
164
|
-
* ```ts
|
|
165
|
-
* const attribute = downcastWriter.createAttributeElement( 'b' );
|
|
166
|
-
* const container = downcastWriter.createContainerElement( 'p' );
|
|
167
|
-
* const empty = downcastWriter.createEmptyElement( 'img' );
|
|
168
|
-
* const ui = downcastWriter.createUIElement( 'span' );
|
|
169
|
-
* getData( attribute, null, { showType: true } ); // '<attribute:b></attribute:b>'
|
|
170
|
-
* getData( container, null, { showType: true } ); // '<container:p></container:p>'
|
|
171
|
-
* getData( empty, null, { showType: true } ); // '<empty:img></empty:img>'
|
|
172
|
-
* getData( ui, null, { showType: true } ); // '<ui:span></ui:span>'
|
|
173
|
-
* ```
|
|
174
|
-
*
|
|
175
|
-
* If `options.showPriority` is set to `true`, a priority will be displayed for all
|
|
176
|
-
* {@link module:engine/view/attributeelement~AttributeElement attribute elements}.
|
|
177
|
-
*
|
|
178
|
-
* ```ts
|
|
179
|
-
* const attribute = downcastWriter.createAttributeElement( 'b' );
|
|
180
|
-
* attribute._priority = 20;
|
|
181
|
-
* getData( attribute, null, { showPriority: true } ); // <b view-priority="20"></b>
|
|
182
|
-
* ```
|
|
183
|
-
*
|
|
184
|
-
* If `options.showAttributeElementId` is set to `true`, the attribute element's id will be displayed for all
|
|
185
|
-
* {@link module:engine/view/attributeelement~AttributeElement attribute elements} that have it set.
|
|
186
|
-
*
|
|
187
|
-
* ```ts
|
|
188
|
-
* const attribute = downcastWriter.createAttributeElement( 'span' );
|
|
189
|
-
* attribute._id = 'marker:foo';
|
|
190
|
-
* getData( attribute, null, { showAttributeElementId: true } ); // <span view-id="marker:foo"></span>
|
|
191
|
-
* ```
|
|
192
|
-
*
|
|
193
|
-
* @param node The node to stringify.
|
|
194
|
-
* @param selectionOrPositionOrRange A selection instance whose ranges will be included in the returned string data.
|
|
195
|
-
* If a range instance is provided, it will be converted to a selection containing this range. If a position instance
|
|
196
|
-
* is provided, it will be converted to a selection containing one range collapsed at this position.
|
|
197
|
-
* @param options An object with additional options.
|
|
198
|
-
* @param options.showType When set to `true`, the type of elements will be printed (`<container:p>`
|
|
199
|
-
* instead of `<p>`, `<attribute:b>` instead of `<b>` and `<empty:img>` instead of `<img>`).
|
|
200
|
-
* @param options.showPriority When set to `true`, the attribute element's priority will be printed
|
|
201
|
-
* (`<span view-priority="12">`, `<b view-priority="10">`).
|
|
202
|
-
* @param options.showAttributeElementId When set to `true`, attribute element's id will be printed
|
|
203
|
-
* (`<span id="marker:foo">`).
|
|
204
|
-
* @param options.ignoreRoot When set to `true`, the root's element opening and closing will not be printed.
|
|
205
|
-
* Mainly used by the `getData` function to ignore the {@link module:engine/view/document~Document document's} root element.
|
|
206
|
-
* @param options.sameSelectionCharacters When set to `true`, the selection inside the text will be marked as
|
|
207
|
-
* `{` and `}` and the selection outside the text as `[` and `]`. When set to `false`, both will be marked as `[` and `]` only.
|
|
208
|
-
* @param options.renderUIElements When set to `true`, the inner content of each
|
|
209
|
-
* {@link module:engine/view/uielement~UIElement} will be printed.
|
|
210
|
-
* @param options.renderRawElements When set to `true`, the inner content of each
|
|
211
|
-
* {@link module:engine/view/rawelement~RawElement} will be printed.
|
|
212
|
-
* @param options.domConverter When set to an actual {@link module:engine/view/domconverter~DomConverter DomConverter}
|
|
213
|
-
* instance, it lets the conversion go through exactly the same flow the editing view is going through,
|
|
214
|
-
* i.e. with view data filtering. Otherwise the simple stub is used.
|
|
215
|
-
* @returns An HTML-like string representing the view.
|
|
216
|
-
*/
|
|
217
|
-
export declare function stringify(node: ViewNode | ViewDocumentFragment, selectionOrPositionOrRange?: DocumentSelection | Position | Range | null, options?: {
|
|
218
|
-
showType?: boolean;
|
|
219
|
-
showPriority?: boolean;
|
|
220
|
-
showAttributeElementId?: boolean;
|
|
221
|
-
ignoreRoot?: boolean;
|
|
222
|
-
sameSelectionCharacters?: boolean;
|
|
223
|
-
renderUIElements?: boolean;
|
|
224
|
-
renderRawElements?: boolean;
|
|
225
|
-
domConverter?: DomConverter;
|
|
226
|
-
}): string;
|
|
227
|
-
/**
|
|
228
|
-
* Parses an HTML-like string and returns a view tree.
|
|
229
|
-
* A simple string will be converted to a {@link module:engine/view/text~Text text} node:
|
|
230
|
-
*
|
|
231
|
-
* ```ts
|
|
232
|
-
* parse( 'foobar' ); // Returns an instance of text.
|
|
233
|
-
* ```
|
|
234
|
-
*
|
|
235
|
-
* {@link module:engine/view/element~Element Elements} will be parsed with attributes as children:
|
|
236
|
-
*
|
|
237
|
-
* ```ts
|
|
238
|
-
* parse( '<b name="baz">foobar</b>' ); // Returns an instance of element with the `baz` attribute and a text child node.
|
|
239
|
-
* ```
|
|
240
|
-
*
|
|
241
|
-
* Multiple nodes provided on root level will be converted to a
|
|
242
|
-
* {@link module:engine/view/documentfragment~DocumentFragment document fragment}:
|
|
243
|
-
*
|
|
244
|
-
* ```ts
|
|
245
|
-
* parse( '<b>foo</b><i>bar</i>' ); // Returns a document fragment with two child elements.
|
|
246
|
-
* ```
|
|
247
|
-
*
|
|
248
|
-
* The method can parse multiple {@link module:engine/view/range~Range ranges} provided in string data and return a
|
|
249
|
-
* {@link module:engine/view/documentselection~DocumentSelection selection} instance containing these ranges. Ranges placed inside
|
|
250
|
-
* {@link module:engine/view/text~Text text} nodes should be marked using `{` and `}` brackets:
|
|
251
|
-
*
|
|
252
|
-
* ```ts
|
|
253
|
-
* const { text, selection } = parse( 'f{ooba}r' );
|
|
254
|
-
* ```
|
|
255
|
-
*
|
|
256
|
-
* Ranges placed outside text nodes should be marked using `[` and `]` brackets:
|
|
257
|
-
*
|
|
258
|
-
* ```ts
|
|
259
|
-
* const { root, selection } = parse( '<p>[<b>foobar</b>]</p>' );
|
|
260
|
-
* ```
|
|
261
|
-
*
|
|
262
|
-
* ** Note: **
|
|
263
|
-
* It is possible to unify selection markers to `[` and `]` for both (inside and outside text)
|
|
264
|
-
* by setting `sameSelectionCharacters=true` option. It is mainly used when the view parse option is used by model utilities.
|
|
265
|
-
*
|
|
266
|
-
* Sometimes there is a need for defining the order of ranges inside the created selection. This can be achieved by providing
|
|
267
|
-
* the range order array as an additional parameter:
|
|
268
|
-
*
|
|
269
|
-
* ```ts
|
|
270
|
-
* const { root, selection } = parse( '{fo}ob{ar}{ba}z', { order: [ 2, 3, 1 ] } );
|
|
271
|
-
* ```
|
|
272
|
-
*
|
|
273
|
-
* In the example above, the first range (`{fo}`) will be added to the selection as the second one, the second range (`{ar}`) will be
|
|
274
|
-
* added as the third and the third range (`{ba}`) will be added as the first one.
|
|
275
|
-
*
|
|
276
|
-
* If the selection's last range should be added as a backward one
|
|
277
|
-
* (so the {@link module:engine/view/documentselection~DocumentSelection#anchor selection anchor} is represented
|
|
278
|
-
* by the `end` position and {@link module:engine/view/documentselection~DocumentSelection#focus selection focus} is
|
|
279
|
-
* represented by the `start` position), use the `lastRangeBackward` flag:
|
|
280
|
-
*
|
|
281
|
-
* ```ts
|
|
282
|
-
* const { root, selection } = parse( `{foo}bar{baz}`, { lastRangeBackward: true } );
|
|
283
|
-
* ```
|
|
284
|
-
*
|
|
285
|
-
* Some more examples and edge cases:
|
|
286
|
-
*
|
|
287
|
-
* ```ts
|
|
288
|
-
* // Returns an empty document fragment.
|
|
289
|
-
* parse( '' );
|
|
290
|
-
*
|
|
291
|
-
* // Returns an empty document fragment and a collapsed selection.
|
|
292
|
-
* const { root, selection } = parse( '[]' );
|
|
293
|
-
*
|
|
294
|
-
* // Returns an element and a selection that is placed inside the document fragment containing that element.
|
|
295
|
-
* const { root, selection } = parse( '[<a></a>]' );
|
|
296
|
-
* ```
|
|
297
|
-
*
|
|
298
|
-
* @param data An HTML-like string to be parsed.
|
|
299
|
-
* @param options.order An array with the order of parsed ranges added to the returned
|
|
300
|
-
* {@link module:engine/view/documentselection~DocumentSelection Selection} instance. Each element should represent the
|
|
301
|
-
* desired position of each range in the selection instance. For example: `[2, 3, 1]` means that the first range will be
|
|
302
|
-
* placed as the second, the second as the third and the third as the first.
|
|
303
|
-
* @param options.lastRangeBackward If set to `true`, the last range will be added as backward to the returned
|
|
304
|
-
* {@link module:engine/view/documentselection~DocumentSelection selection} instance.
|
|
305
|
-
* @param options.rootElement The default root to use when parsing elements.
|
|
306
|
-
* When set to `null`, the root element will be created automatically. If set to
|
|
307
|
-
* {@link module:engine/view/element~Element Element} or {@link module:engine/view/documentfragment~DocumentFragment DocumentFragment},
|
|
308
|
-
* this node will be used as the root for all parsed nodes.
|
|
309
|
-
* @param options.sameSelectionCharacters When set to `false`, the selection inside the text should be marked using
|
|
310
|
-
* `{` and `}` and the selection outside the ext using `[` and `]`. When set to `true`, both should be marked with `[` and `]` only.
|
|
311
|
-
* @param options.stylesProcessor Styles processor.
|
|
312
|
-
* @returns Returns the parsed view node or an object with two fields: `view` and `selection` when selection ranges were included in the
|
|
313
|
-
* data to parse.
|
|
314
|
-
*/
|
|
315
|
-
export declare function parse(data: string, options?: {
|
|
316
|
-
order?: Array<number>;
|
|
317
|
-
lastRangeBackward?: boolean;
|
|
318
|
-
rootElement?: ViewElement | ViewDocumentFragment;
|
|
319
|
-
sameSelectionCharacters?: boolean;
|
|
320
|
-
inlineObjectElements?: Array<string>;
|
|
321
|
-
}): ViewNode | ViewDocumentFragment | {
|
|
322
|
-
view: ViewNode | ViewDocumentFragment;
|
|
323
|
-
selection: DocumentSelection;
|
|
324
|
-
};
|