@ckeditor/ckeditor5-engine 44.1.0 → 44.2.0-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/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,66 +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/view/editableelement
|
|
11
|
-
*/
|
|
12
|
-
import ContainerElement from './containerelement.js';
|
|
13
|
-
import type { ElementAttributes } from './element.js';
|
|
14
|
-
import type Document from './document.js';
|
|
15
|
-
import type Node from './node.js';
|
|
16
|
-
declare const EditableElement_base: import("@ckeditor/ckeditor5-utils").Mixed<typeof ContainerElement, import("@ckeditor/ckeditor5-utils").Observable>;
|
|
17
|
-
/**
|
|
18
|
-
* Editable element which can be a {@link module:engine/view/rooteditableelement~RootEditableElement root}
|
|
19
|
-
* or nested editable area in the editor.
|
|
20
|
-
*
|
|
21
|
-
* Editable is automatically read-only when its {@link module:engine/view/document~Document Document} is read-only.
|
|
22
|
-
*
|
|
23
|
-
* The constructor of this class shouldn't be used directly. To create new `EditableElement` use the
|
|
24
|
-
* {@link module:engine/view/downcastwriter~DowncastWriter#createEditableElement `downcastWriter#createEditableElement()`} method.
|
|
25
|
-
*/
|
|
26
|
-
export default class EditableElement extends /* #__PURE__ */ EditableElement_base {
|
|
27
|
-
/**
|
|
28
|
-
* Whether the editable is in read-write or read-only mode.
|
|
29
|
-
*
|
|
30
|
-
* @observable
|
|
31
|
-
*/
|
|
32
|
-
isReadOnly: boolean;
|
|
33
|
-
/**
|
|
34
|
-
* Whether the editable is focused.
|
|
35
|
-
*
|
|
36
|
-
* This property updates when {@link module:engine/view/document~Document#isFocused document.isFocused} or view
|
|
37
|
-
* selection is changed.
|
|
38
|
-
*
|
|
39
|
-
* @readonly
|
|
40
|
-
* @observable
|
|
41
|
-
*/
|
|
42
|
-
isFocused: boolean;
|
|
43
|
-
/**
|
|
44
|
-
* Placeholder of editable element.
|
|
45
|
-
*
|
|
46
|
-
* ```ts
|
|
47
|
-
* editor.editing.view.document.getRoot( 'main' ).placeholder = 'New placeholder';
|
|
48
|
-
* ```
|
|
49
|
-
*
|
|
50
|
-
* @observable
|
|
51
|
-
*/
|
|
52
|
-
placeholder?: string;
|
|
53
|
-
/**
|
|
54
|
-
* Creates an editable element.
|
|
55
|
-
*
|
|
56
|
-
* @see module:engine/view/downcastwriter~DowncastWriter#createEditableElement
|
|
57
|
-
* @internal
|
|
58
|
-
* @param document The document instance to which this element belongs.
|
|
59
|
-
* @param name Node name.
|
|
60
|
-
* @param attrs Collection of attributes.
|
|
61
|
-
* @param children A list of nodes to be inserted into created element.
|
|
62
|
-
*/
|
|
63
|
-
constructor(document: Document, name: string, attributes?: ElementAttributes, children?: Node | Iterable<Node>);
|
|
64
|
-
destroy(): void;
|
|
65
|
-
}
|
|
66
|
-
export {};
|
package/dist/view/element.d.ts
DELETED
|
@@ -1,472 +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/view/element
|
|
11
|
-
*/
|
|
12
|
-
import Node from './node.js';
|
|
13
|
-
import { type ArrayOrItem } from '@ckeditor/ckeditor5-utils';
|
|
14
|
-
import { type MatcherPattern } from './matcher.js';
|
|
15
|
-
import { type StyleValue } from './stylesmap.js';
|
|
16
|
-
import type Document from './document.js';
|
|
17
|
-
import type Item from './item.js';
|
|
18
|
-
/**
|
|
19
|
-
* View element.
|
|
20
|
-
*
|
|
21
|
-
* The editing engine does not define a fixed semantics of its elements (it is "DTD-free").
|
|
22
|
-
* This is why the type of the {@link module:engine/view/element~Element} need to
|
|
23
|
-
* be defined by the feature developer. When creating an element you should use one of the following methods:
|
|
24
|
-
*
|
|
25
|
-
* * {@link module:engine/view/downcastwriter~DowncastWriter#createContainerElement `downcastWriter#createContainerElement()`}
|
|
26
|
-
* in order to create a {@link module:engine/view/containerelement~ContainerElement},
|
|
27
|
-
* * {@link module:engine/view/downcastwriter~DowncastWriter#createAttributeElement `downcastWriter#createAttributeElement()`}
|
|
28
|
-
* in order to create a {@link module:engine/view/attributeelement~AttributeElement},
|
|
29
|
-
* * {@link module:engine/view/downcastwriter~DowncastWriter#createEmptyElement `downcastWriter#createEmptyElement()`}
|
|
30
|
-
* in order to create a {@link module:engine/view/emptyelement~EmptyElement}.
|
|
31
|
-
* * {@link module:engine/view/downcastwriter~DowncastWriter#createUIElement `downcastWriter#createUIElement()`}
|
|
32
|
-
* in order to create a {@link module:engine/view/uielement~UIElement}.
|
|
33
|
-
* * {@link module:engine/view/downcastwriter~DowncastWriter#createEditableElement `downcastWriter#createEditableElement()`}
|
|
34
|
-
* in order to create a {@link module:engine/view/editableelement~EditableElement}.
|
|
35
|
-
*
|
|
36
|
-
* Note that for view elements which are not created from the model, like elements from mutations, paste or
|
|
37
|
-
* {@link module:engine/controller/datacontroller~DataController#set data.set} it is not possible to define the type of the element.
|
|
38
|
-
* In such cases the {@link module:engine/view/upcastwriter~UpcastWriter#createElement `UpcastWriter#createElement()`} method
|
|
39
|
-
* should be used to create generic view elements.
|
|
40
|
-
*/
|
|
41
|
-
export default class Element extends Node {
|
|
42
|
-
/**
|
|
43
|
-
* Name of the element.
|
|
44
|
-
*/
|
|
45
|
-
readonly name: string;
|
|
46
|
-
/**
|
|
47
|
-
* A list of attribute names that should be rendered in the editing pipeline even though filtering mechanisms
|
|
48
|
-
* implemented in the {@link module:engine/view/domconverter~DomConverter} (for instance,
|
|
49
|
-
* {@link module:engine/view/domconverter~DomConverter#shouldRenderAttribute}) would filter them out.
|
|
50
|
-
*
|
|
51
|
-
* These attributes can be specified as an option when the element is created by
|
|
52
|
-
* the {@link module:engine/view/downcastwriter~DowncastWriter}. To check whether an unsafe an attribute should
|
|
53
|
-
* be permitted, use the {@link #shouldRenderUnsafeAttribute} method.
|
|
54
|
-
*
|
|
55
|
-
* @internal
|
|
56
|
-
*/
|
|
57
|
-
readonly _unsafeAttributesToRender: Array<string>;
|
|
58
|
-
/**
|
|
59
|
-
* Map of attributes, where attributes names are keys and attributes values are values.
|
|
60
|
-
*/
|
|
61
|
-
private readonly _attrs;
|
|
62
|
-
/**
|
|
63
|
-
* Array of child nodes.
|
|
64
|
-
*/
|
|
65
|
-
private readonly _children;
|
|
66
|
-
/**
|
|
67
|
-
* Set of classes associated with element instance.
|
|
68
|
-
*/
|
|
69
|
-
private readonly _classes;
|
|
70
|
-
/**
|
|
71
|
-
* Normalized styles.
|
|
72
|
-
*/
|
|
73
|
-
private readonly _styles;
|
|
74
|
-
/**
|
|
75
|
-
* Map of custom properties.
|
|
76
|
-
* Custom properties can be added to element instance, will be cloned but not rendered into DOM.
|
|
77
|
-
*/
|
|
78
|
-
private readonly _customProperties;
|
|
79
|
-
/**
|
|
80
|
-
* Creates a view element.
|
|
81
|
-
*
|
|
82
|
-
* Attributes can be passed in various formats:
|
|
83
|
-
*
|
|
84
|
-
* ```ts
|
|
85
|
-
* new Element( viewDocument, 'div', { class: 'editor', contentEditable: 'true' } ); // object
|
|
86
|
-
* new Element( viewDocument, 'div', [ [ 'class', 'editor' ], [ 'contentEditable', 'true' ] ] ); // map-like iterator
|
|
87
|
-
* new Element( viewDocument, 'div', mapOfAttributes ); // map
|
|
88
|
-
* ```
|
|
89
|
-
*
|
|
90
|
-
* @internal
|
|
91
|
-
* @param document The document instance to which this element belongs.
|
|
92
|
-
* @param name Node name.
|
|
93
|
-
* @param attrs Collection of attributes.
|
|
94
|
-
* @param children A list of nodes to be inserted into created element.
|
|
95
|
-
*/
|
|
96
|
-
constructor(document: Document, name: string, attrs?: ElementAttributes, children?: Node | Iterable<Node>);
|
|
97
|
-
/**
|
|
98
|
-
* Number of element's children.
|
|
99
|
-
*/
|
|
100
|
-
get childCount(): number;
|
|
101
|
-
/**
|
|
102
|
-
* Is `true` if there are no nodes inside this element, `false` otherwise.
|
|
103
|
-
*/
|
|
104
|
-
get isEmpty(): boolean;
|
|
105
|
-
/**
|
|
106
|
-
* Gets child at the given index.
|
|
107
|
-
*
|
|
108
|
-
* @param index Index of child.
|
|
109
|
-
* @returns Child node.
|
|
110
|
-
*/
|
|
111
|
-
getChild(index: number): Node | undefined;
|
|
112
|
-
/**
|
|
113
|
-
* Gets index of the given child node. Returns `-1` if child node is not found.
|
|
114
|
-
*
|
|
115
|
-
* @param node Child node.
|
|
116
|
-
* @returns Index of the child node.
|
|
117
|
-
*/
|
|
118
|
-
getChildIndex(node: Node): number;
|
|
119
|
-
/**
|
|
120
|
-
* Gets child nodes iterator.
|
|
121
|
-
*
|
|
122
|
-
* @returns Child nodes iterator.
|
|
123
|
-
*/
|
|
124
|
-
getChildren(): IterableIterator<Node>;
|
|
125
|
-
/**
|
|
126
|
-
* Returns an iterator that contains the keys for attributes. Order of inserting attributes is not preserved.
|
|
127
|
-
*
|
|
128
|
-
* @returns Keys for attributes.
|
|
129
|
-
*/
|
|
130
|
-
getAttributeKeys(): IterableIterator<string>;
|
|
131
|
-
/**
|
|
132
|
-
* Returns iterator that iterates over this element's attributes.
|
|
133
|
-
*
|
|
134
|
-
* Attributes are returned as arrays containing two items. First one is attribute key and second is attribute value.
|
|
135
|
-
* This format is accepted by native `Map` object and also can be passed in `Node` constructor.
|
|
136
|
-
*/
|
|
137
|
-
getAttributes(): IterableIterator<[string, string]>;
|
|
138
|
-
/**
|
|
139
|
-
* Gets attribute by key. If attribute is not present - returns undefined.
|
|
140
|
-
*
|
|
141
|
-
* @param key Attribute key.
|
|
142
|
-
* @returns Attribute value.
|
|
143
|
-
*/
|
|
144
|
-
getAttribute(key: string): string | undefined;
|
|
145
|
-
/**
|
|
146
|
-
* Returns a boolean indicating whether an attribute with the specified key exists in the element.
|
|
147
|
-
*
|
|
148
|
-
* @param key Attribute key.
|
|
149
|
-
* @returns `true` if attribute with the specified key exists in the element, `false` otherwise.
|
|
150
|
-
*/
|
|
151
|
-
hasAttribute(key: string): boolean;
|
|
152
|
-
/**
|
|
153
|
-
* Checks if this element is similar to other element.
|
|
154
|
-
* Both elements should have the same name and attributes to be considered as similar. Two similar elements
|
|
155
|
-
* can contain different set of children nodes.
|
|
156
|
-
*/
|
|
157
|
-
isSimilar(otherElement: Item): boolean;
|
|
158
|
-
/**
|
|
159
|
-
* Returns true if class is present.
|
|
160
|
-
* If more then one class is provided - returns true only when all classes are present.
|
|
161
|
-
*
|
|
162
|
-
* ```ts
|
|
163
|
-
* element.hasClass( 'foo' ); // Returns true if 'foo' class is present.
|
|
164
|
-
* element.hasClass( 'foo', 'bar' ); // Returns true if 'foo' and 'bar' classes are both present.
|
|
165
|
-
* ```
|
|
166
|
-
*/
|
|
167
|
-
hasClass(...className: Array<string>): boolean;
|
|
168
|
-
/**
|
|
169
|
-
* Returns iterator that contains all class names.
|
|
170
|
-
*/
|
|
171
|
-
getClassNames(): Iterable<string>;
|
|
172
|
-
/**
|
|
173
|
-
* Returns style value for the given property mae.
|
|
174
|
-
* If the style does not exist `undefined` is returned.
|
|
175
|
-
*
|
|
176
|
-
* **Note**: This method can work with normalized style names if
|
|
177
|
-
* {@link module:engine/controller/datacontroller~DataController#addStyleProcessorRules a particular style processor rule is enabled}.
|
|
178
|
-
* See {@link module:engine/view/stylesmap~StylesMap#getAsString `StylesMap#getAsString()`} for details.
|
|
179
|
-
*
|
|
180
|
-
* For an element with style set to `'margin:1px'`:
|
|
181
|
-
*
|
|
182
|
-
* ```ts
|
|
183
|
-
* // Enable 'margin' shorthand processing:
|
|
184
|
-
* editor.data.addStyleProcessorRules( addMarginRules );
|
|
185
|
-
*
|
|
186
|
-
* const element = view.change( writer => {
|
|
187
|
-
* const element = writer.createElement();
|
|
188
|
-
* writer.setStyle( 'margin', '1px' );
|
|
189
|
-
* writer.setStyle( 'margin-bottom', '3em' );
|
|
190
|
-
*
|
|
191
|
-
* return element;
|
|
192
|
-
* } );
|
|
193
|
-
*
|
|
194
|
-
* element.getStyle( 'margin' ); // -> 'margin: 1px 1px 3em;'
|
|
195
|
-
* ```
|
|
196
|
-
*/
|
|
197
|
-
getStyle(property: string): string | undefined;
|
|
198
|
-
/**
|
|
199
|
-
* Returns a normalized style object or single style value.
|
|
200
|
-
*
|
|
201
|
-
* For an element with style set to: margin:1px 2px 3em;
|
|
202
|
-
*
|
|
203
|
-
* ```ts
|
|
204
|
-
* element.getNormalizedStyle( 'margin' ) );
|
|
205
|
-
* ```
|
|
206
|
-
*
|
|
207
|
-
* will return:
|
|
208
|
-
*
|
|
209
|
-
* ```ts
|
|
210
|
-
* {
|
|
211
|
-
* top: '1px',
|
|
212
|
-
* right: '2px',
|
|
213
|
-
* bottom: '3em',
|
|
214
|
-
* left: '2px' // a normalized value from margin shorthand
|
|
215
|
-
* }
|
|
216
|
-
* ```
|
|
217
|
-
*
|
|
218
|
-
* and reading for single style value:
|
|
219
|
-
*
|
|
220
|
-
* ```ts
|
|
221
|
-
* styles.getNormalizedStyle( 'margin-left' );
|
|
222
|
-
* ```
|
|
223
|
-
*
|
|
224
|
-
* Will return a `2px` string.
|
|
225
|
-
*
|
|
226
|
-
* **Note**: This method will return normalized values only if
|
|
227
|
-
* {@link module:engine/controller/datacontroller~DataController#addStyleProcessorRules a particular style processor rule is enabled}.
|
|
228
|
-
* See {@link module:engine/view/stylesmap~StylesMap#getNormalized `StylesMap#getNormalized()`} for details.
|
|
229
|
-
*
|
|
230
|
-
* @param property Name of CSS property
|
|
231
|
-
*/
|
|
232
|
-
getNormalizedStyle(property: string): StyleValue;
|
|
233
|
-
/**
|
|
234
|
-
* Returns iterator that contains all style names.
|
|
235
|
-
*
|
|
236
|
-
* @param expand Expand shorthand style properties and return all equivalent style representations.
|
|
237
|
-
*/
|
|
238
|
-
getStyleNames(expand?: boolean): Iterable<string>;
|
|
239
|
-
/**
|
|
240
|
-
* Returns true if style keys are present.
|
|
241
|
-
* If more then one style property is provided - returns true only when all properties are present.
|
|
242
|
-
*
|
|
243
|
-
* ```ts
|
|
244
|
-
* element.hasStyle( 'color' ); // Returns true if 'border-top' style is present.
|
|
245
|
-
* element.hasStyle( 'color', 'border-top' ); // Returns true if 'color' and 'border-top' styles are both present.
|
|
246
|
-
* ```
|
|
247
|
-
*/
|
|
248
|
-
hasStyle(...property: Array<string>): boolean;
|
|
249
|
-
/**
|
|
250
|
-
* Returns ancestor element that match specified pattern.
|
|
251
|
-
* Provided patterns should be compatible with {@link module:engine/view/matcher~Matcher Matcher} as it is used internally.
|
|
252
|
-
*
|
|
253
|
-
* @see module:engine/view/matcher~Matcher
|
|
254
|
-
* @param patterns Patterns used to match correct ancestor. See {@link module:engine/view/matcher~Matcher}.
|
|
255
|
-
* @returns Found element or `null` if no matching ancestor was found.
|
|
256
|
-
*/
|
|
257
|
-
findAncestor(...patterns: Array<MatcherPattern | ((element: Element) => boolean)>): Element | null;
|
|
258
|
-
/**
|
|
259
|
-
* Returns the custom property value for the given key.
|
|
260
|
-
*/
|
|
261
|
-
getCustomProperty(key: string | symbol): unknown;
|
|
262
|
-
/**
|
|
263
|
-
* Returns an iterator which iterates over this element's custom properties.
|
|
264
|
-
* Iterator provides `[ key, value ]` pairs for each stored property.
|
|
265
|
-
*/
|
|
266
|
-
getCustomProperties(): IterableIterator<[string | symbol, unknown]>;
|
|
267
|
-
/**
|
|
268
|
-
* Returns identity string based on element's name, styles, classes and other attributes.
|
|
269
|
-
* Two elements that {@link #isSimilar are similar} will have same identity string.
|
|
270
|
-
* It has the following format:
|
|
271
|
-
*
|
|
272
|
-
* ```ts
|
|
273
|
-
* 'name class="class1,class2" style="style1:value1;style2:value2" attr1="val1" attr2="val2"'
|
|
274
|
-
* ```
|
|
275
|
-
*
|
|
276
|
-
* For example:
|
|
277
|
-
*
|
|
278
|
-
* ```ts
|
|
279
|
-
* const element = writer.createContainerElement( 'foo', {
|
|
280
|
-
* banana: '10',
|
|
281
|
-
* apple: '20',
|
|
282
|
-
* style: 'color: red; border-color: white;',
|
|
283
|
-
* class: 'baz'
|
|
284
|
-
* } );
|
|
285
|
-
*
|
|
286
|
-
* // returns 'foo class="baz" style="border-color:white;color:red" apple="20" banana="10"'
|
|
287
|
-
* element.getIdentity();
|
|
288
|
-
* ```
|
|
289
|
-
*
|
|
290
|
-
* **Note**: Classes, styles and other attributes are sorted alphabetically.
|
|
291
|
-
*/
|
|
292
|
-
getIdentity(): string;
|
|
293
|
-
/**
|
|
294
|
-
* Decides whether an unsafe attribute is whitelisted and should be rendered in the editing pipeline even though filtering mechanisms
|
|
295
|
-
* like {@link module:engine/view/domconverter~DomConverter#shouldRenderAttribute} say it should not.
|
|
296
|
-
*
|
|
297
|
-
* Unsafe attribute names can be specified when creating an element via {@link module:engine/view/downcastwriter~DowncastWriter}.
|
|
298
|
-
*
|
|
299
|
-
* @param attributeName The name of the attribute to be checked.
|
|
300
|
-
*/
|
|
301
|
-
shouldRenderUnsafeAttribute(attributeName: string): boolean;
|
|
302
|
-
/**
|
|
303
|
-
* Clones provided element.
|
|
304
|
-
*
|
|
305
|
-
* @internal
|
|
306
|
-
* @param deep If set to `true` clones element and all its children recursively. When set to `false`,
|
|
307
|
-
* element will be cloned without any children.
|
|
308
|
-
* @returns Clone of this element.
|
|
309
|
-
*/
|
|
310
|
-
_clone(deep?: boolean): this;
|
|
311
|
-
/**
|
|
312
|
-
* {@link module:engine/view/element~Element#_insertChild Insert} a child node or a list of child nodes at the end of this node
|
|
313
|
-
* and sets the parent of these nodes to this element.
|
|
314
|
-
*
|
|
315
|
-
* @see module:engine/view/downcastwriter~DowncastWriter#insert
|
|
316
|
-
* @internal
|
|
317
|
-
* @param items Items to be inserted.
|
|
318
|
-
* @fires change
|
|
319
|
-
* @returns Number of appended nodes.
|
|
320
|
-
*/
|
|
321
|
-
_appendChild(items: Item | string | Iterable<Item | string>): number;
|
|
322
|
-
/**
|
|
323
|
-
* Inserts a child node or a list of child nodes on the given index and sets the parent of these nodes to
|
|
324
|
-
* this element.
|
|
325
|
-
*
|
|
326
|
-
* @internal
|
|
327
|
-
* @see module:engine/view/downcastwriter~DowncastWriter#insert
|
|
328
|
-
* @param index Position where nodes should be inserted.
|
|
329
|
-
* @param items Items to be inserted.
|
|
330
|
-
* @fires change
|
|
331
|
-
* @returns Number of inserted nodes.
|
|
332
|
-
*/
|
|
333
|
-
_insertChild(index: number, items: Item | string | Iterable<Item | string>): number;
|
|
334
|
-
/**
|
|
335
|
-
* Removes number of child nodes starting at the given index and set the parent of these nodes to `null`.
|
|
336
|
-
*
|
|
337
|
-
* @see module:engine/view/downcastwriter~DowncastWriter#remove
|
|
338
|
-
* @internal
|
|
339
|
-
* @param index Number of the first node to remove.
|
|
340
|
-
* @param howMany Number of nodes to remove.
|
|
341
|
-
* @fires change
|
|
342
|
-
* @returns The array of removed nodes.
|
|
343
|
-
*/
|
|
344
|
-
_removeChildren(index: number, howMany?: number): Array<Node>;
|
|
345
|
-
/**
|
|
346
|
-
* Adds or overwrite attribute with a specified key and value.
|
|
347
|
-
*
|
|
348
|
-
* @see module:engine/view/downcastwriter~DowncastWriter#setAttribute
|
|
349
|
-
* @internal
|
|
350
|
-
* @param key Attribute key.
|
|
351
|
-
* @param value Attribute value.
|
|
352
|
-
* @fires change
|
|
353
|
-
*/
|
|
354
|
-
_setAttribute(key: string, value: unknown): void;
|
|
355
|
-
/**
|
|
356
|
-
* Removes attribute from the element.
|
|
357
|
-
*
|
|
358
|
-
* @see module:engine/view/downcastwriter~DowncastWriter#removeAttribute
|
|
359
|
-
* @internal
|
|
360
|
-
* @param key Attribute key.
|
|
361
|
-
* @returns Returns true if an attribute existed and has been removed.
|
|
362
|
-
* @fires change
|
|
363
|
-
*/
|
|
364
|
-
_removeAttribute(key: string): boolean;
|
|
365
|
-
/**
|
|
366
|
-
* Adds specified class.
|
|
367
|
-
*
|
|
368
|
-
* ```ts
|
|
369
|
-
* element._addClass( 'foo' ); // Adds 'foo' class.
|
|
370
|
-
* element._addClass( [ 'foo', 'bar' ] ); // Adds 'foo' and 'bar' classes.
|
|
371
|
-
* ```
|
|
372
|
-
*
|
|
373
|
-
* @see module:engine/view/downcastwriter~DowncastWriter#addClass
|
|
374
|
-
* @internal
|
|
375
|
-
* @fires change
|
|
376
|
-
*/
|
|
377
|
-
_addClass(className: ArrayOrItem<string>): void;
|
|
378
|
-
/**
|
|
379
|
-
* Removes specified class.
|
|
380
|
-
*
|
|
381
|
-
* ```ts
|
|
382
|
-
* element._removeClass( 'foo' ); // Removes 'foo' class.
|
|
383
|
-
* element._removeClass( [ 'foo', 'bar' ] ); // Removes both 'foo' and 'bar' classes.
|
|
384
|
-
* ```
|
|
385
|
-
*
|
|
386
|
-
* @see module:engine/view/downcastwriter~DowncastWriter#removeClass
|
|
387
|
-
* @internal
|
|
388
|
-
* @fires change
|
|
389
|
-
*/
|
|
390
|
-
_removeClass(className: ArrayOrItem<string>): void;
|
|
391
|
-
/**
|
|
392
|
-
* Adds style to the element.
|
|
393
|
-
*
|
|
394
|
-
* ```ts
|
|
395
|
-
* element._setStyle( 'color', 'red' );
|
|
396
|
-
* ```
|
|
397
|
-
*
|
|
398
|
-
* **Note**: This method can work with normalized style names if
|
|
399
|
-
* {@link module:engine/controller/datacontroller~DataController#addStyleProcessorRules a particular style processor rule is enabled}.
|
|
400
|
-
* See {@link module:engine/view/stylesmap~StylesMap#set `StylesMap#set()`} for details.
|
|
401
|
-
*
|
|
402
|
-
* @see module:engine/view/downcastwriter~DowncastWriter#setStyle
|
|
403
|
-
* @label KEY_VALUE
|
|
404
|
-
* @internal
|
|
405
|
-
* @param property Property name.
|
|
406
|
-
* @param value Value to set.
|
|
407
|
-
* @fires change
|
|
408
|
-
*/
|
|
409
|
-
_setStyle(property: string, value: string): void;
|
|
410
|
-
/**
|
|
411
|
-
* Adds style to the element.
|
|
412
|
-
*
|
|
413
|
-
* ```ts
|
|
414
|
-
* element._setStyle( {
|
|
415
|
-
* color: 'red',
|
|
416
|
-
* position: 'fixed'
|
|
417
|
-
* } );
|
|
418
|
-
* ```
|
|
419
|
-
*
|
|
420
|
-
* **Note**: This method can work with normalized style names if
|
|
421
|
-
* {@link module:engine/controller/datacontroller~DataController#addStyleProcessorRules a particular style processor rule is enabled}.
|
|
422
|
-
* See {@link module:engine/view/stylesmap~StylesMap#set `StylesMap#set()`} for details.
|
|
423
|
-
*
|
|
424
|
-
* @see module:engine/view/downcastwriter~DowncastWriter#setStyle
|
|
425
|
-
* @label OBJECT
|
|
426
|
-
* @internal
|
|
427
|
-
* @param properties Object with key - value pairs.
|
|
428
|
-
* @fires change
|
|
429
|
-
*/
|
|
430
|
-
_setStyle(properties: Record<string, string>): void;
|
|
431
|
-
/**
|
|
432
|
-
* Removes specified style.
|
|
433
|
-
*
|
|
434
|
-
* ```ts
|
|
435
|
-
* element._removeStyle( 'color' ); // Removes 'color' style.
|
|
436
|
-
* element._removeStyle( [ 'color', 'border-top' ] ); // Removes both 'color' and 'border-top' styles.
|
|
437
|
-
* ```
|
|
438
|
-
*
|
|
439
|
-
* **Note**: This method can work with normalized style names if
|
|
440
|
-
* {@link module:engine/controller/datacontroller~DataController#addStyleProcessorRules a particular style processor rule is enabled}.
|
|
441
|
-
* See {@link module:engine/view/stylesmap~StylesMap#remove `StylesMap#remove()`} for details.
|
|
442
|
-
*
|
|
443
|
-
* @see module:engine/view/downcastwriter~DowncastWriter#removeStyle
|
|
444
|
-
* @internal
|
|
445
|
-
* @fires change
|
|
446
|
-
*/
|
|
447
|
-
_removeStyle(property: ArrayOrItem<string>): void;
|
|
448
|
-
/**
|
|
449
|
-
* Sets a custom property. Unlike attributes, custom properties are not rendered to the DOM,
|
|
450
|
-
* so they can be used to add special data to elements.
|
|
451
|
-
*
|
|
452
|
-
* @see module:engine/view/downcastwriter~DowncastWriter#setCustomProperty
|
|
453
|
-
* @internal
|
|
454
|
-
*/
|
|
455
|
-
_setCustomProperty(key: string | symbol, value: unknown): void;
|
|
456
|
-
/**
|
|
457
|
-
* Removes the custom property stored under the given key.
|
|
458
|
-
*
|
|
459
|
-
* @see module:engine/view/downcastwriter~DowncastWriter#removeCustomProperty
|
|
460
|
-
* @internal
|
|
461
|
-
* @returns Returns true if property was removed.
|
|
462
|
-
*/
|
|
463
|
-
_removeCustomProperty(key: string | symbol): boolean;
|
|
464
|
-
/**
|
|
465
|
-
* Returns block {@link module:engine/view/filler filler} offset or `null` if block filler is not needed.
|
|
466
|
-
*/
|
|
467
|
-
getFillerOffset?(): number | null;
|
|
468
|
-
}
|
|
469
|
-
/**
|
|
470
|
-
* Collection of attributes.
|
|
471
|
-
*/
|
|
472
|
-
export type ElementAttributes = Record<string, unknown> | Iterable<[string, unknown]> | null;
|
|
@@ -1,91 +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/view/elementdefinition
|
|
11
|
-
*/
|
|
12
|
-
import type { ArrayOrItem } from '@ckeditor/ckeditor5-utils';
|
|
13
|
-
/**
|
|
14
|
-
* A plain object that describes a view element in a way that a concrete, exact view element could be created from that description.
|
|
15
|
-
*
|
|
16
|
-
* ```ts
|
|
17
|
-
* const viewDefinition = {
|
|
18
|
-
* name: 'h1',
|
|
19
|
-
* classes: [ 'foo', 'bar' ]
|
|
20
|
-
* };
|
|
21
|
-
* ```
|
|
22
|
-
*
|
|
23
|
-
* Above describes a view element:
|
|
24
|
-
*
|
|
25
|
-
* ```html
|
|
26
|
-
* <h1 class="foo bar"></h1>
|
|
27
|
-
* ```
|
|
28
|
-
*
|
|
29
|
-
* An example with styles and attributes:
|
|
30
|
-
*
|
|
31
|
-
* ```ts
|
|
32
|
-
* const viewDefinition = {
|
|
33
|
-
* name: 'span',
|
|
34
|
-
* styles: {
|
|
35
|
-
* 'font-size': '12px',
|
|
36
|
-
* 'font-weight': 'bold'
|
|
37
|
-
* },
|
|
38
|
-
* attributes: {
|
|
39
|
-
* 'data-id': '123'
|
|
40
|
-
* }
|
|
41
|
-
* };
|
|
42
|
-
* ```
|
|
43
|
-
*
|
|
44
|
-
* Describes:
|
|
45
|
-
*
|
|
46
|
-
* ```ts
|
|
47
|
-
* <span style="font-size:12px;font-weight:bold" data-id="123"></span>
|
|
48
|
-
* ```
|
|
49
|
-
*/
|
|
50
|
-
export interface ElementObjectDefinition {
|
|
51
|
-
/**
|
|
52
|
-
* View element name.
|
|
53
|
-
*/
|
|
54
|
-
name: string;
|
|
55
|
-
/**
|
|
56
|
-
* Class name or array of class names to match. Each name can be provided in a form of string.
|
|
57
|
-
*/
|
|
58
|
-
classes?: ArrayOrItem<string>;
|
|
59
|
-
/**
|
|
60
|
-
* Object with key-value pairs representing styles. Each object key represents style name. Value under that key must be a string.
|
|
61
|
-
*/
|
|
62
|
-
styles?: Record<string, string>;
|
|
63
|
-
/**
|
|
64
|
-
* Object with key-value pairs representing attributes. Each object key represents attribute name.
|
|
65
|
-
* Value under that key must be a string.
|
|
66
|
-
*/
|
|
67
|
-
attributes?: Record<string, string>;
|
|
68
|
-
/**
|
|
69
|
-
* Element's {@link module:engine/view/attributeelement~AttributeElement#priority priority}.
|
|
70
|
-
*/
|
|
71
|
-
priority?: number;
|
|
72
|
-
}
|
|
73
|
-
/**
|
|
74
|
-
* A plain object that describes a view element or element name.
|
|
75
|
-
*
|
|
76
|
-
* Elements without attributes can be given simply as a string:
|
|
77
|
-
*
|
|
78
|
-
* ```ts
|
|
79
|
-
* const viewDefinition = 'p';
|
|
80
|
-
* ```
|
|
81
|
-
*
|
|
82
|
-
* Which will be treated as:
|
|
83
|
-
*
|
|
84
|
-
* ```ts
|
|
85
|
-
* const viewDefinition = {
|
|
86
|
-
* name: 'p'
|
|
87
|
-
* };
|
|
88
|
-
* ```
|
|
89
|
-
*/
|
|
90
|
-
type ElementDefinition = string | ElementObjectDefinition;
|
|
91
|
-
export default ElementDefinition;
|
|
@@ -1,45 +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/view/emptyelement
|
|
11
|
-
*/
|
|
12
|
-
import Element, { type ElementAttributes } from './element.js';
|
|
13
|
-
import Node from './node.js';
|
|
14
|
-
import type Document from './document.js';
|
|
15
|
-
import type Item from './item.js';
|
|
16
|
-
/**
|
|
17
|
-
* Empty element class. It is used to represent elements that cannot contain any child nodes (for example `<img>` elements).
|
|
18
|
-
*
|
|
19
|
-
* To create a new empty element use the
|
|
20
|
-
* {@link module:engine/view/downcastwriter~DowncastWriter#createEmptyElement `downcastWriter#createEmptyElement()`} method.
|
|
21
|
-
*/
|
|
22
|
-
export default class EmptyElement extends Element {
|
|
23
|
-
/**
|
|
24
|
-
* Creates new instance of EmptyElement.
|
|
25
|
-
*
|
|
26
|
-
* Throws {@link module:utils/ckeditorerror~CKEditorError CKEditorError} `view-emptyelement-cannot-add` when third parameter is passed,
|
|
27
|
-
* to inform that usage of EmptyElement is incorrect (adding child nodes to EmptyElement is forbidden).
|
|
28
|
-
*
|
|
29
|
-
* @see module:engine/view/downcastwriter~DowncastWriter#createEmptyElement
|
|
30
|
-
* @internal
|
|
31
|
-
* @param document The document instance to which this element belongs.
|
|
32
|
-
* @param name Node name.
|
|
33
|
-
* @param attrs Collection of attributes.
|
|
34
|
-
* @param children A list of nodes to be inserted into created element.
|
|
35
|
-
*/
|
|
36
|
-
constructor(document: Document, name: string, attributes?: ElementAttributes, children?: Node | Iterable<Node>);
|
|
37
|
-
/**
|
|
38
|
-
* Overrides {@link module:engine/view/element~Element#_insertChild} method.
|
|
39
|
-
* Throws {@link module:utils/ckeditorerror~CKEditorError CKEditorError} `view-emptyelement-cannot-add` to prevent
|
|
40
|
-
* adding any child nodes to EmptyElement.
|
|
41
|
-
*
|
|
42
|
-
* @internal
|
|
43
|
-
*/
|
|
44
|
-
_insertChild(index: number, items: Item | Iterable<Item>): number;
|
|
45
|
-
}
|