@ckeditor/ckeditor5-engine 0.0.0-internal-20241017.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/CHANGELOG.md +4 -0
- package/LICENSE.md +21 -0
- package/README.md +36 -0
- package/dist/controller/datacontroller.d.ts +339 -0
- package/dist/controller/editingcontroller.d.ts +102 -0
- package/dist/conversion/conversion.d.ts +482 -0
- package/dist/conversion/conversionhelpers.d.ts +30 -0
- package/dist/conversion/downcastdispatcher.d.ts +566 -0
- package/dist/conversion/downcasthelpers.d.ts +1194 -0
- package/dist/conversion/mapper.d.ts +507 -0
- package/dist/conversion/modelconsumable.d.ts +205 -0
- package/dist/conversion/upcastdispatcher.d.ts +496 -0
- package/dist/conversion/upcasthelpers.d.ts +503 -0
- package/dist/conversion/viewconsumable.d.ts +373 -0
- package/dist/dataprocessor/basichtmlwriter.d.ts +22 -0
- package/dist/dataprocessor/dataprocessor.d.ts +65 -0
- package/dist/dataprocessor/htmldataprocessor.d.ts +80 -0
- package/dist/dataprocessor/htmlwriter.d.ts +20 -0
- package/dist/dataprocessor/xmldataprocessor.d.ts +94 -0
- package/dist/dev-utils/model.d.ts +130 -0
- package/dist/dev-utils/operationreplayer.d.ts +55 -0
- package/dist/dev-utils/utils.d.ts +41 -0
- package/dist/dev-utils/view.d.ts +324 -0
- package/dist/index-content.css +4 -0
- package/dist/index-editor.css +24 -0
- package/dist/index.css +49 -0
- package/dist/index.css.map +1 -0
- package/dist/index.d.ts +122 -0
- package/dist/index.js +37775 -0
- package/dist/index.js.map +1 -0
- package/dist/model/batch.d.ts +110 -0
- package/dist/model/differ.d.ts +511 -0
- package/dist/model/document.d.ts +278 -0
- package/dist/model/documentfragment.d.ts +204 -0
- package/dist/model/documentselection.d.ts +424 -0
- package/dist/model/element.d.ts +169 -0
- package/dist/model/history.d.ts +118 -0
- package/dist/model/item.d.ts +18 -0
- package/dist/model/liveposition.d.ts +81 -0
- package/dist/model/liverange.d.ts +106 -0
- package/dist/model/markercollection.d.ts +339 -0
- package/dist/model/model.d.ts +923 -0
- package/dist/model/node.d.ts +259 -0
- package/dist/model/nodelist.d.ts +95 -0
- package/dist/model/operation/attributeoperation.d.ts +107 -0
- package/dist/model/operation/detachoperation.d.ts +64 -0
- package/dist/model/operation/insertoperation.d.ts +94 -0
- package/dist/model/operation/markeroperation.d.ts +95 -0
- package/dist/model/operation/mergeoperation.d.ts +104 -0
- package/dist/model/operation/moveoperation.d.ts +100 -0
- package/dist/model/operation/nooperation.d.ts +42 -0
- package/dist/model/operation/operation.d.ts +100 -0
- package/dist/model/operation/operationfactory.d.ts +22 -0
- package/dist/model/operation/renameoperation.d.ts +87 -0
- package/dist/model/operation/rootattributeoperation.d.ts +102 -0
- package/dist/model/operation/rootoperation.d.ts +80 -0
- package/dist/model/operation/splitoperation.d.ts +113 -0
- package/dist/model/operation/transform.d.ts +104 -0
- package/dist/model/operation/utils.d.ts +75 -0
- package/dist/model/position.d.ts +542 -0
- package/dist/model/range.d.ts +462 -0
- package/dist/model/rootelement.d.ts +64 -0
- package/dist/model/schema.d.ts +1334 -0
- package/dist/model/selection.d.ts +486 -0
- package/dist/model/text.d.ts +70 -0
- package/dist/model/textproxy.d.ts +148 -0
- package/dist/model/treewalker.d.ts +190 -0
- package/dist/model/typecheckable.d.ts +289 -0
- package/dist/model/utils/autoparagraphing.d.ts +41 -0
- package/dist/model/utils/deletecontent.d.ts +62 -0
- package/dist/model/utils/getselectedcontent.d.ts +34 -0
- package/dist/model/utils/insertcontent.d.ts +50 -0
- package/dist/model/utils/insertobject.d.ts +51 -0
- package/dist/model/utils/modifyselection.d.ts +52 -0
- package/dist/model/utils/selection-post-fixer.d.ts +78 -0
- package/dist/model/writer.d.ts +855 -0
- package/dist/view/attributeelement.d.ts +112 -0
- package/dist/view/containerelement.d.ts +53 -0
- package/dist/view/datatransfer.d.ts +83 -0
- package/dist/view/document.d.ts +188 -0
- package/dist/view/documentfragment.d.ts +157 -0
- package/dist/view/documentselection.d.ts +310 -0
- package/dist/view/domconverter.d.ts +665 -0
- package/dist/view/downcastwriter.d.ts +1000 -0
- package/dist/view/editableelement.d.ts +66 -0
- package/dist/view/element.d.ts +472 -0
- package/dist/view/elementdefinition.d.ts +91 -0
- package/dist/view/emptyelement.d.ts +45 -0
- package/dist/view/filler.d.ts +115 -0
- package/dist/view/item.d.ts +18 -0
- package/dist/view/matcher.d.ts +490 -0
- package/dist/view/node.d.ts +166 -0
- package/dist/view/observer/arrowkeysobserver.d.ts +49 -0
- package/dist/view/observer/bubblingemittermixin.d.ts +170 -0
- package/dist/view/observer/bubblingeventinfo.d.ts +51 -0
- package/dist/view/observer/clickobserver.d.ts +47 -0
- package/dist/view/observer/compositionobserver.d.ts +86 -0
- package/dist/view/observer/domeventdata.d.ts +54 -0
- package/dist/view/observer/domeventobserver.d.ts +82 -0
- package/dist/view/observer/fakeselectionobserver.d.ts +51 -0
- package/dist/view/observer/focusobserver.d.ts +98 -0
- package/dist/view/observer/inputobserver.d.ts +90 -0
- package/dist/view/observer/keyobserver.d.ts +70 -0
- package/dist/view/observer/mouseobserver.d.ts +93 -0
- package/dist/view/observer/mutationobserver.d.ts +119 -0
- package/dist/view/observer/observer.d.ts +93 -0
- package/dist/view/observer/selectionobserver.d.ts +151 -0
- package/dist/view/observer/tabobserver.d.ts +50 -0
- package/dist/view/placeholder.d.ts +100 -0
- package/dist/view/position.d.ts +192 -0
- package/dist/view/range.d.ts +283 -0
- package/dist/view/rawelement.d.ts +77 -0
- package/dist/view/renderer.d.ts +281 -0
- package/dist/view/rooteditableelement.d.ts +45 -0
- package/dist/view/selection.d.ts +379 -0
- package/dist/view/styles/background.d.ts +37 -0
- package/dist/view/styles/border.d.ts +47 -0
- package/dist/view/styles/margin.d.ts +33 -0
- package/dist/view/styles/padding.d.ts +33 -0
- package/dist/view/styles/utils.d.ts +97 -0
- package/dist/view/stylesmap.d.ts +677 -0
- package/dist/view/text.d.ts +78 -0
- package/dist/view/textproxy.d.ts +101 -0
- package/dist/view/treewalker.d.ts +199 -0
- package/dist/view/typecheckable.d.ts +452 -0
- package/dist/view/uielement.d.ts +100 -0
- package/dist/view/upcastwriter.d.ts +421 -0
- package/dist/view/view.d.ts +488 -0
- package/package.json +49 -0
- package/src/controller/datacontroller.d.ts +335 -0
- package/src/controller/datacontroller.js +481 -0
- package/src/controller/editingcontroller.d.ts +98 -0
- package/src/controller/editingcontroller.js +191 -0
- package/src/conversion/conversion.d.ts +478 -0
- package/src/conversion/conversion.js +601 -0
- package/src/conversion/conversionhelpers.d.ts +26 -0
- package/src/conversion/conversionhelpers.js +32 -0
- package/src/conversion/downcastdispatcher.d.ts +562 -0
- package/src/conversion/downcastdispatcher.js +548 -0
- package/src/conversion/downcasthelpers.d.ts +1190 -0
- package/src/conversion/downcasthelpers.js +2161 -0
- package/src/conversion/mapper.d.ts +503 -0
- package/src/conversion/mapper.js +536 -0
- package/src/conversion/modelconsumable.d.ts +201 -0
- package/src/conversion/modelconsumable.js +333 -0
- package/src/conversion/upcastdispatcher.d.ts +492 -0
- package/src/conversion/upcastdispatcher.js +460 -0
- package/src/conversion/upcasthelpers.d.ts +499 -0
- package/src/conversion/upcasthelpers.js +943 -0
- package/src/conversion/viewconsumable.d.ts +369 -0
- package/src/conversion/viewconsumable.js +535 -0
- package/src/dataprocessor/basichtmlwriter.d.ts +18 -0
- package/src/dataprocessor/basichtmlwriter.js +20 -0
- package/src/dataprocessor/dataprocessor.d.ts +61 -0
- package/src/dataprocessor/dataprocessor.js +5 -0
- package/src/dataprocessor/htmldataprocessor.d.ts +76 -0
- package/src/dataprocessor/htmldataprocessor.js +96 -0
- package/src/dataprocessor/htmlwriter.d.ts +16 -0
- package/src/dataprocessor/htmlwriter.js +5 -0
- package/src/dataprocessor/xmldataprocessor.d.ts +90 -0
- package/src/dataprocessor/xmldataprocessor.js +108 -0
- package/src/dev-utils/model.d.ts +126 -0
- package/src/dev-utils/model.js +397 -0
- package/src/dev-utils/operationreplayer.d.ts +51 -0
- package/src/dev-utils/operationreplayer.js +112 -0
- package/src/dev-utils/utils.d.ts +37 -0
- package/src/dev-utils/utils.js +80 -0
- package/src/dev-utils/view.d.ts +320 -0
- package/src/dev-utils/view.js +970 -0
- package/src/index.d.ts +118 -0
- package/src/index.js +83 -0
- package/src/model/batch.d.ts +106 -0
- package/src/model/batch.js +96 -0
- package/src/model/differ.d.ts +507 -0
- package/src/model/differ.js +1285 -0
- package/src/model/document.d.ts +274 -0
- package/src/model/document.js +360 -0
- package/src/model/documentfragment.d.ts +200 -0
- package/src/model/documentfragment.js +306 -0
- package/src/model/documentselection.d.ts +420 -0
- package/src/model/documentselection.js +993 -0
- package/src/model/element.d.ts +165 -0
- package/src/model/element.js +281 -0
- package/src/model/history.d.ts +114 -0
- package/src/model/history.js +207 -0
- package/src/model/item.d.ts +14 -0
- package/src/model/item.js +5 -0
- package/src/model/liveposition.d.ts +77 -0
- package/src/model/liveposition.js +93 -0
- package/src/model/liverange.d.ts +102 -0
- package/src/model/liverange.js +120 -0
- package/src/model/markercollection.d.ts +335 -0
- package/src/model/markercollection.js +403 -0
- package/src/model/model.d.ts +919 -0
- package/src/model/model.js +838 -0
- package/src/model/node.d.ts +255 -0
- package/src/model/node.js +373 -0
- package/src/model/nodelist.d.ts +91 -0
- package/src/model/nodelist.js +170 -0
- package/src/model/operation/attributeoperation.d.ts +103 -0
- package/src/model/operation/attributeoperation.js +148 -0
- package/src/model/operation/detachoperation.d.ts +60 -0
- package/src/model/operation/detachoperation.js +77 -0
- package/src/model/operation/insertoperation.d.ts +90 -0
- package/src/model/operation/insertoperation.js +135 -0
- package/src/model/operation/markeroperation.d.ts +91 -0
- package/src/model/operation/markeroperation.js +107 -0
- package/src/model/operation/mergeoperation.d.ts +100 -0
- package/src/model/operation/mergeoperation.js +167 -0
- package/src/model/operation/moveoperation.d.ts +96 -0
- package/src/model/operation/moveoperation.js +164 -0
- package/src/model/operation/nooperation.d.ts +38 -0
- package/src/model/operation/nooperation.js +48 -0
- package/src/model/operation/operation.d.ts +96 -0
- package/src/model/operation/operation.js +59 -0
- package/src/model/operation/operationfactory.d.ts +18 -0
- package/src/model/operation/operationfactory.js +44 -0
- package/src/model/operation/renameoperation.d.ts +83 -0
- package/src/model/operation/renameoperation.js +115 -0
- package/src/model/operation/rootattributeoperation.d.ts +98 -0
- package/src/model/operation/rootattributeoperation.js +155 -0
- package/src/model/operation/rootoperation.d.ts +76 -0
- package/src/model/operation/rootoperation.js +90 -0
- package/src/model/operation/splitoperation.d.ts +109 -0
- package/src/model/operation/splitoperation.js +194 -0
- package/src/model/operation/transform.d.ts +100 -0
- package/src/model/operation/transform.js +2119 -0
- package/src/model/operation/utils.d.ts +71 -0
- package/src/model/operation/utils.js +217 -0
- package/src/model/position.d.ts +538 -0
- package/src/model/position.js +977 -0
- package/src/model/range.d.ts +458 -0
- package/src/model/range.js +872 -0
- package/src/model/rootelement.d.ts +60 -0
- package/src/model/rootelement.js +74 -0
- package/src/model/schema.d.ts +1330 -0
- package/src/model/schema.js +1524 -0
- package/src/model/selection.d.ts +482 -0
- package/src/model/selection.js +789 -0
- package/src/model/text.d.ts +66 -0
- package/src/model/text.js +85 -0
- package/src/model/textproxy.d.ts +144 -0
- package/src/model/textproxy.js +189 -0
- package/src/model/treewalker.d.ts +186 -0
- package/src/model/treewalker.js +244 -0
- package/src/model/typecheckable.d.ts +285 -0
- package/src/model/typecheckable.js +16 -0
- package/src/model/utils/autoparagraphing.d.ts +37 -0
- package/src/model/utils/autoparagraphing.js +63 -0
- package/src/model/utils/deletecontent.d.ts +58 -0
- package/src/model/utils/deletecontent.js +488 -0
- package/src/model/utils/getselectedcontent.d.ts +30 -0
- package/src/model/utils/getselectedcontent.js +125 -0
- package/src/model/utils/insertcontent.d.ts +46 -0
- package/src/model/utils/insertcontent.js +661 -0
- package/src/model/utils/insertobject.d.ts +47 -0
- package/src/model/utils/insertobject.js +135 -0
- package/src/model/utils/modifyselection.d.ts +48 -0
- package/src/model/utils/modifyselection.js +186 -0
- package/src/model/utils/selection-post-fixer.d.ts +74 -0
- package/src/model/utils/selection-post-fixer.js +260 -0
- package/src/model/writer.d.ts +851 -0
- package/src/model/writer.js +1306 -0
- package/src/view/attributeelement.d.ts +108 -0
- package/src/view/attributeelement.js +185 -0
- package/src/view/containerelement.d.ts +49 -0
- package/src/view/containerelement.js +80 -0
- package/src/view/datatransfer.d.ts +79 -0
- package/src/view/datatransfer.js +98 -0
- package/src/view/document.d.ts +184 -0
- package/src/view/document.js +122 -0
- package/src/view/documentfragment.d.ts +153 -0
- package/src/view/documentfragment.js +234 -0
- package/src/view/documentselection.d.ts +306 -0
- package/src/view/documentselection.js +256 -0
- package/src/view/domconverter.d.ts +661 -0
- package/src/view/domconverter.js +1523 -0
- package/src/view/downcastwriter.d.ts +996 -0
- package/src/view/downcastwriter.js +1696 -0
- package/src/view/editableelement.d.ts +62 -0
- package/src/view/editableelement.js +62 -0
- package/src/view/element.d.ts +468 -0
- package/src/view/element.js +724 -0
- package/src/view/elementdefinition.d.ts +87 -0
- package/src/view/elementdefinition.js +5 -0
- package/src/view/emptyelement.d.ts +41 -0
- package/src/view/emptyelement.js +73 -0
- package/src/view/filler.d.ts +111 -0
- package/src/view/filler.js +150 -0
- package/src/view/item.d.ts +14 -0
- package/src/view/item.js +5 -0
- package/src/view/matcher.d.ts +486 -0
- package/src/view/matcher.js +507 -0
- package/src/view/node.d.ts +162 -0
- package/src/view/node.js +226 -0
- package/src/view/observer/arrowkeysobserver.d.ts +45 -0
- package/src/view/observer/arrowkeysobserver.js +40 -0
- package/src/view/observer/bubblingemittermixin.d.ts +166 -0
- package/src/view/observer/bubblingemittermixin.js +172 -0
- package/src/view/observer/bubblingeventinfo.d.ts +47 -0
- package/src/view/observer/bubblingeventinfo.js +37 -0
- package/src/view/observer/clickobserver.d.ts +43 -0
- package/src/view/observer/clickobserver.js +29 -0
- package/src/view/observer/compositionobserver.d.ts +82 -0
- package/src/view/observer/compositionobserver.js +62 -0
- package/src/view/observer/domeventdata.d.ts +50 -0
- package/src/view/observer/domeventdata.js +47 -0
- package/src/view/observer/domeventobserver.d.ts +78 -0
- package/src/view/observer/domeventobserver.js +84 -0
- package/src/view/observer/fakeselectionobserver.d.ts +47 -0
- package/src/view/observer/fakeselectionobserver.js +91 -0
- package/src/view/observer/focusobserver.d.ts +94 -0
- package/src/view/observer/focusobserver.js +116 -0
- package/src/view/observer/inputobserver.d.ts +86 -0
- package/src/view/observer/inputobserver.js +166 -0
- package/src/view/observer/keyobserver.d.ts +66 -0
- package/src/view/observer/keyobserver.js +39 -0
- package/src/view/observer/mouseobserver.d.ts +89 -0
- package/src/view/observer/mouseobserver.js +29 -0
- package/src/view/observer/mutationobserver.d.ts +115 -0
- package/src/view/observer/mutationobserver.js +203 -0
- package/src/view/observer/observer.d.ts +89 -0
- package/src/view/observer/observer.js +84 -0
- package/src/view/observer/selectionobserver.d.ts +147 -0
- package/src/view/observer/selectionobserver.js +220 -0
- package/src/view/observer/tabobserver.d.ts +46 -0
- package/src/view/observer/tabobserver.js +42 -0
- package/src/view/placeholder.d.ts +96 -0
- package/src/view/placeholder.js +267 -0
- package/src/view/position.d.ts +188 -0
- package/src/view/position.js +322 -0
- package/src/view/range.d.ts +279 -0
- package/src/view/range.js +430 -0
- package/src/view/rawelement.d.ts +73 -0
- package/src/view/rawelement.js +105 -0
- package/src/view/renderer.d.ts +277 -0
- package/src/view/renderer.js +1056 -0
- package/src/view/rooteditableelement.d.ts +41 -0
- package/src/view/rooteditableelement.js +69 -0
- package/src/view/selection.d.ts +375 -0
- package/src/view/selection.js +559 -0
- package/src/view/styles/background.d.ts +33 -0
- package/src/view/styles/background.js +74 -0
- package/src/view/styles/border.d.ts +43 -0
- package/src/view/styles/border.js +316 -0
- package/src/view/styles/margin.d.ts +29 -0
- package/src/view/styles/margin.js +34 -0
- package/src/view/styles/padding.d.ts +29 -0
- package/src/view/styles/padding.js +34 -0
- package/src/view/styles/utils.d.ts +93 -0
- package/src/view/styles/utils.js +219 -0
- package/src/view/stylesmap.d.ts +673 -0
- package/src/view/stylesmap.js +762 -0
- package/src/view/text.d.ts +74 -0
- package/src/view/text.js +93 -0
- package/src/view/textproxy.d.ts +97 -0
- package/src/view/textproxy.js +124 -0
- package/src/view/treewalker.d.ts +195 -0
- package/src/view/treewalker.js +327 -0
- package/src/view/typecheckable.d.ts +448 -0
- package/src/view/typecheckable.js +19 -0
- package/src/view/uielement.d.ts +96 -0
- package/src/view/uielement.js +183 -0
- package/src/view/upcastwriter.d.ts +417 -0
- package/src/view/upcastwriter.js +359 -0
- package/src/view/view.d.ts +484 -0
- package/src/view/view.js +560 -0
- package/theme/placeholder.css +36 -0
- package/theme/renderer.css +9 -0
package/CHANGELOG.md
ADDED
package/LICENSE.md
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
Software License Agreement
|
|
2
|
+
==========================
|
|
3
|
+
|
|
4
|
+
**CKEditor 5 editing engine** – https://github.com/ckeditor/ckeditor5-engine <br>
|
|
5
|
+
Copyright (c) 2003–2024, [CKSource Holding sp. z o.o.](https://cksource.com) All rights reserved.
|
|
6
|
+
|
|
7
|
+
Licensed under the terms of [GNU General Public License Version 2 or later](http://www.gnu.org/licenses/gpl.html).
|
|
8
|
+
|
|
9
|
+
Sources of Intellectual Property Included in CKEditor
|
|
10
|
+
-----------------------------------------------------
|
|
11
|
+
|
|
12
|
+
Where not otherwise indicated, all CKEditor content is authored by CKSource engineers and consists of CKSource-owned intellectual property. In some specific instances, CKEditor will incorporate work done by developers outside of CKSource with their express permission.
|
|
13
|
+
|
|
14
|
+
The following libraries are included in CKEditor under the [MIT license](https://opensource.org/licenses/MIT):
|
|
15
|
+
|
|
16
|
+
* Lodash - Copyright (c) JS Foundation and other contributors https://js.foundation/. Based on Underscore.js, copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors http://underscorejs.org/.
|
|
17
|
+
|
|
18
|
+
Trademarks
|
|
19
|
+
----------
|
|
20
|
+
|
|
21
|
+
**CKEditor** is a trademark of [CKSource Holding sp. z o.o.](https://cksource.com) All other brand and product names are trademarks, registered trademarks, or service marks of their respective holders.
|
package/README.md
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
CKEditor 5 editing engine
|
|
2
|
+
========================================
|
|
3
|
+
|
|
4
|
+
[](https://www.npmjs.com/package/@ckeditor/ckeditor5-engine)
|
|
5
|
+
[](https://coveralls.io/github/ckeditor/ckeditor5?branch=master)
|
|
6
|
+
[](https://app.travis-ci.com/github/ckeditor/ckeditor5)
|
|
7
|
+
|
|
8
|
+
The CKEditor 5 editing engine implements a flexible MVC-based architecture for creating rich text editing features.
|
|
9
|
+
|
|
10
|
+
## Architecture overview
|
|
11
|
+
|
|
12
|
+
* **Custom data model.** CKEditor 5 implements a tree-structured custom data model, designed to fit multiple requirements such as enabling real-time collaboration and complex editing features (like tables or nested blocks).
|
|
13
|
+
* **Virtual DOM.** CKEditor 5's editing engine features a custom, editing-oriented virtual DOM implementation that aims to hide browser quirks from your sight. **No more `contentEditable` nightmares!**
|
|
14
|
+
* **Real-time collaborative editing**. The editor implements Operational Transformation for the tree-structured model as well as many other mechanisms which were required to create a seamless collaborative UX. Additionally, we provide cloud infrastructure and plugins enabling real-time collaborative editing in your application! [Check the collaboration demo](https://ckeditor.com/docs/ckeditor5/latest/features/collaboration/overview.html).
|
|
15
|
+
* **Extensible.** The entire editor architecture was designed for maximum flexibility. The code is event-based and highly decoupled, allowing you to plug in or replace selected pieces. Features do not directly depend on each other and communicate in standardized ways.
|
|
16
|
+
* **Schema-less core**. The core makes minimal assumptions and can be controlled through the schema. This leaves all decisions to plugins and to you.
|
|
17
|
+
* **Modular architecture.** Not only can the core modules be reused and recomposed but even the features were implemented in a highly granular way. Feel like running a headless CKEditor 5 with a couple of features in Node.js? Not a problem!
|
|
18
|
+
* **Framework for building rich-text editors.** Every use case is different and every editor needs to fulfill different goals. Therefore, we give you the freedom to create your own editors with custom-tailored features and UI.
|
|
19
|
+
* **Heavily tested from day one.** CKEditor 5 comes with 3x more tests than React itself. All packages have 100% code coverage.
|
|
20
|
+
* **8+ years of support.** It is not yet another framework to be gone next year or a hyped proof-of-concept to fail in a real-life scenario. We have over 15 years of experience in creating rich text editors and invested over 4 years in designing and building your next future-proof rich text editor of choice.
|
|
21
|
+
|
|
22
|
+
## Documentation
|
|
23
|
+
|
|
24
|
+
For a general introduction see the [Overview of CKEditor 5 Framework](https://ckeditor.com/docs/ckeditor5/latest/framework/architecture/core-editor-architecture.html) guide and then the [Editing engine architecture guide](https://ckeditor.com/docs/ckeditor5/latest/framework/architecture/editing-engine.html).
|
|
25
|
+
|
|
26
|
+
Additionally, refer to the [`@ckeditor/ckeditor5-engine` package](https://ckeditor.com/docs/ckeditor5/latest/api/engine.html) page in [CKEditor 5 documentation](https://ckeditor.com/docs/ckeditor5/latest/) for even more information.
|
|
27
|
+
|
|
28
|
+
## Installation
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
npm install ckeditor5
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
## License
|
|
35
|
+
|
|
36
|
+
Licensed under the terms of [GNU General Public License Version 2 or later](http://www.gnu.org/licenses/gpl.html). For full details about the license, please check the `LICENSE.md` file or [https://ckeditor.com/legal/ckeditor-oss-license](https://ckeditor.com/legal/ckeditor-oss-license).
|
|
@@ -0,0 +1,339 @@
|
|
|
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-oss-license
|
|
8
|
+
*/
|
|
9
|
+
import Mapper from '../conversion/mapper.js';
|
|
10
|
+
import DowncastDispatcher from '../conversion/downcastdispatcher.js';
|
|
11
|
+
import UpcastDispatcher from '../conversion/upcastdispatcher.js';
|
|
12
|
+
import ViewDocumentFragment from '../view/documentfragment.js';
|
|
13
|
+
import ViewDocument from '../view/document.js';
|
|
14
|
+
import type ViewElement from '../view/element.js';
|
|
15
|
+
import type { StylesProcessor } from '../view/stylesmap.js';
|
|
16
|
+
import type { MatcherPattern } from '../view/matcher.js';
|
|
17
|
+
import type Model from '../model/model.js';
|
|
18
|
+
import type ModelElement from '../model/element.js';
|
|
19
|
+
import type ModelDocumentFragment from '../model/documentfragment.js';
|
|
20
|
+
import type { SchemaContextDefinition } from '../model/schema.js';
|
|
21
|
+
import type { BatchType } from '../model/batch.js';
|
|
22
|
+
import HtmlDataProcessor from '../dataprocessor/htmldataprocessor.js';
|
|
23
|
+
import type DataProcessor from '../dataprocessor/dataprocessor.js';
|
|
24
|
+
declare const DataController_base: {
|
|
25
|
+
new (): import("@ckeditor/ckeditor5-utils").Emitter;
|
|
26
|
+
prototype: import("@ckeditor/ckeditor5-utils").Emitter;
|
|
27
|
+
};
|
|
28
|
+
/**
|
|
29
|
+
* Controller for the data pipeline. The data pipeline controls how data is retrieved from the document
|
|
30
|
+
* and set inside it. Hence, the controller features two methods which allow to {@link ~DataController#get get}
|
|
31
|
+
* and {@link ~DataController#set set} data of the {@link ~DataController#model model}
|
|
32
|
+
* using the given:
|
|
33
|
+
*
|
|
34
|
+
* * {@link module:engine/dataprocessor/dataprocessor~DataProcessor data processor},
|
|
35
|
+
* * downcast converters,
|
|
36
|
+
* * upcast converters.
|
|
37
|
+
*
|
|
38
|
+
* An instance of the data controller is always available in the {@link module:core/editor/editor~Editor#data `editor.data`}
|
|
39
|
+
* property:
|
|
40
|
+
*
|
|
41
|
+
* ```ts
|
|
42
|
+
* editor.data.get( { rootName: 'customRoot' } ); // -> '<p>Hello!</p>'
|
|
43
|
+
* ```
|
|
44
|
+
*/
|
|
45
|
+
export default class DataController extends /* #__PURE__ */ DataController_base {
|
|
46
|
+
/**
|
|
47
|
+
* Data model.
|
|
48
|
+
*/
|
|
49
|
+
readonly model: Model;
|
|
50
|
+
/**
|
|
51
|
+
* Mapper used for the conversion. It has no permanent bindings, because these are created while getting data and
|
|
52
|
+
* are cleared directly after the data are converted. However, the mapper is defined as a class property, because
|
|
53
|
+
* it needs to be passed to the `DowncastDispatcher` as a conversion API.
|
|
54
|
+
*/
|
|
55
|
+
readonly mapper: Mapper;
|
|
56
|
+
/**
|
|
57
|
+
* Downcast dispatcher used by the {@link #get get method}. Downcast converters should be attached to it.
|
|
58
|
+
*/
|
|
59
|
+
readonly downcastDispatcher: DowncastDispatcher;
|
|
60
|
+
/**
|
|
61
|
+
* Upcast dispatcher used by the {@link #set set method}. Upcast converters should be attached to it.
|
|
62
|
+
*/
|
|
63
|
+
readonly upcastDispatcher: UpcastDispatcher;
|
|
64
|
+
/**
|
|
65
|
+
* The view document used by the data controller.
|
|
66
|
+
*/
|
|
67
|
+
readonly viewDocument: ViewDocument;
|
|
68
|
+
/**
|
|
69
|
+
* Styles processor used during the conversion.
|
|
70
|
+
*/
|
|
71
|
+
readonly stylesProcessor: StylesProcessor;
|
|
72
|
+
/**
|
|
73
|
+
* Data processor used specifically for HTML conversion.
|
|
74
|
+
*/
|
|
75
|
+
readonly htmlProcessor: HtmlDataProcessor;
|
|
76
|
+
/**
|
|
77
|
+
* Data processor used during the conversion.
|
|
78
|
+
* Same instance as {@link #htmlProcessor} by default. Can be replaced at run time to handle different format, e.g. XML or Markdown.
|
|
79
|
+
*/
|
|
80
|
+
processor: DataProcessor;
|
|
81
|
+
/**
|
|
82
|
+
* The view downcast writer just for data conversion purposes, i.e. to modify
|
|
83
|
+
* the {@link #viewDocument}.
|
|
84
|
+
*/
|
|
85
|
+
private readonly _viewWriter;
|
|
86
|
+
/**
|
|
87
|
+
* Creates a data controller instance.
|
|
88
|
+
*
|
|
89
|
+
* @param model Data model.
|
|
90
|
+
* @param stylesProcessor The styles processor instance.
|
|
91
|
+
*/
|
|
92
|
+
constructor(model: Model, stylesProcessor: StylesProcessor);
|
|
93
|
+
/**
|
|
94
|
+
* Returns the model's data converted by downcast dispatchers attached to {@link #downcastDispatcher} and
|
|
95
|
+
* formatted by the {@link #processor data processor}.
|
|
96
|
+
*
|
|
97
|
+
* A warning is logged when you try to retrieve data for a detached root, as most probably this is a mistake. A detached root should
|
|
98
|
+
* be treated like it is removed, and you should not save its data. Note, that the detached root data is always an empty string.
|
|
99
|
+
*
|
|
100
|
+
* @fires get
|
|
101
|
+
* @param options Additional configuration for the retrieved data. `DataController` provides two optional
|
|
102
|
+
* properties: `rootName` and `trim`. Other properties of this object are specified by various editor features.
|
|
103
|
+
* @param options.rootName Root name. Default 'main'.
|
|
104
|
+
* @param options.trim Whether returned data should be trimmed. This option is set to `empty` by default,
|
|
105
|
+
* which means whenever editor content is considered empty, an empty string will be returned. To turn off trimming completely
|
|
106
|
+
* use `'none'`. In such cases the exact content will be returned (for example a `<p> </p>` for an empty editor).
|
|
107
|
+
* @returns Output data.
|
|
108
|
+
*/
|
|
109
|
+
get(options?: {
|
|
110
|
+
rootName?: string;
|
|
111
|
+
trim?: 'empty' | 'none';
|
|
112
|
+
[key: string]: unknown;
|
|
113
|
+
}): string;
|
|
114
|
+
/**
|
|
115
|
+
* Returns the content of the given {@link module:engine/model/element~Element model's element} or
|
|
116
|
+
* {@link module:engine/model/documentfragment~DocumentFragment model document fragment} converted by the downcast converters
|
|
117
|
+
* attached to the {@link #downcastDispatcher} and formatted by the {@link #processor data processor}.
|
|
118
|
+
*
|
|
119
|
+
* @param modelElementOrFragment The element whose content will be stringified.
|
|
120
|
+
* @param options Additional configuration passed to the conversion process.
|
|
121
|
+
* @returns Output data.
|
|
122
|
+
*/
|
|
123
|
+
stringify(modelElementOrFragment: ModelElement | ModelDocumentFragment, options?: Record<string, unknown>): string;
|
|
124
|
+
/**
|
|
125
|
+
* Returns the content of the given {@link module:engine/model/element~Element model element} or
|
|
126
|
+
* {@link module:engine/model/documentfragment~DocumentFragment model document fragment} converted by the downcast
|
|
127
|
+
* converters attached to {@link #downcastDispatcher} into a
|
|
128
|
+
* {@link module:engine/view/documentfragment~DocumentFragment view document fragment}.
|
|
129
|
+
*
|
|
130
|
+
* @fires toView
|
|
131
|
+
* @param modelElementOrFragment Element or document fragment whose content will be converted.
|
|
132
|
+
* @param options Additional configuration that will be available through the
|
|
133
|
+
* {@link module:engine/conversion/downcastdispatcher~DowncastConversionApi#options} during the conversion process.
|
|
134
|
+
* @returns Output view DocumentFragment.
|
|
135
|
+
*/
|
|
136
|
+
toView(modelElementOrFragment: ModelElement | ModelDocumentFragment, options?: Record<string, unknown>): ViewDocumentFragment;
|
|
137
|
+
/**
|
|
138
|
+
* Sets the initial input data parsed by the {@link #processor data processor} and
|
|
139
|
+
* converted by the {@link #upcastDispatcher view-to-model converters}.
|
|
140
|
+
* Initial data can be only set to a document whose {@link module:engine/model/document~Document#version} is equal 0.
|
|
141
|
+
*
|
|
142
|
+
* **Note** This method is {@link module:utils/observablemixin~Observable#decorate decorated} which is
|
|
143
|
+
* used by e.g. collaborative editing plugin that syncs remote data on init.
|
|
144
|
+
*
|
|
145
|
+
* When data is passed as a string, it is initialized on the default `main` root:
|
|
146
|
+
*
|
|
147
|
+
* ```ts
|
|
148
|
+
* dataController.init( '<p>Foo</p>' ); // Initializes data on the `main` root only, as no other is specified.
|
|
149
|
+
* ```
|
|
150
|
+
*
|
|
151
|
+
* To initialize data on a different root or multiple roots at once, an object containing `rootName` - `data` pairs should be passed:
|
|
152
|
+
*
|
|
153
|
+
* ```ts
|
|
154
|
+
* dataController.init( { main: '<p>Foo</p>', title: '<h1>Bar</h1>' } ); // Initializes data on both the `main` and `title` roots.
|
|
155
|
+
* ```
|
|
156
|
+
*
|
|
157
|
+
* @fires init
|
|
158
|
+
* @param data Input data as a string or an object containing the `rootName` - `data`
|
|
159
|
+
* pairs to initialize data on multiple roots at once.
|
|
160
|
+
* @returns Promise that is resolved after the data is set on the editor.
|
|
161
|
+
*/
|
|
162
|
+
init(data: string | Record<string, string>): Promise<void>;
|
|
163
|
+
/**
|
|
164
|
+
* Sets the input data parsed by the {@link #processor data processor} and
|
|
165
|
+
* converted by the {@link #upcastDispatcher view-to-model converters}.
|
|
166
|
+
* This method can be used any time to replace existing editor data with the new one without clearing the
|
|
167
|
+
* {@link module:engine/model/document~Document#history document history}.
|
|
168
|
+
*
|
|
169
|
+
* This method also creates a batch with all the changes applied. If all you need is to parse data, use
|
|
170
|
+
* the {@link #parse} method.
|
|
171
|
+
*
|
|
172
|
+
* When data is passed as a string it is set on the default `main` root:
|
|
173
|
+
*
|
|
174
|
+
* ```ts
|
|
175
|
+
* dataController.set( '<p>Foo</p>' ); // Sets data on the `main` root, as no other is specified.
|
|
176
|
+
* ```
|
|
177
|
+
*
|
|
178
|
+
* To set data on a different root or multiple roots at once, an object containing `rootName` - `data` pairs should be passed:
|
|
179
|
+
*
|
|
180
|
+
* ```ts
|
|
181
|
+
* dataController.set( { main: '<p>Foo</p>', title: '<h1>Bar</h1>' } ); // Sets data on the `main` and `title` roots as specified.
|
|
182
|
+
* ```
|
|
183
|
+
*
|
|
184
|
+
* To set the data with a preserved undo stack and add the change to the undo stack, set `{ isUndoable: true }` as a `batchType` option.
|
|
185
|
+
*
|
|
186
|
+
* ```ts
|
|
187
|
+
* dataController.set( '<p>Foo</p>', { batchType: { isUndoable: true } } );
|
|
188
|
+
* ```
|
|
189
|
+
*
|
|
190
|
+
* @fires set
|
|
191
|
+
* @param data Input data as a string or an object containing the `rootName` - `data`
|
|
192
|
+
* pairs to set data on multiple roots at once.
|
|
193
|
+
* @param options Options for setting data.
|
|
194
|
+
* @param options.batchType The batch type that will be used to create a batch for the changes applied by this method.
|
|
195
|
+
* By default, the batch will be set as {@link module:engine/model/batch~Batch#isUndoable not undoable} and the undo stack will be
|
|
196
|
+
* cleared after the new data is applied (all undo steps will be removed). If the batch type `isUndoable` flag is be set to `true`,
|
|
197
|
+
* the undo stack will be preserved instead and not cleared when new data is applied.
|
|
198
|
+
*/
|
|
199
|
+
set(data: string | Record<string, string>, options?: {
|
|
200
|
+
batchType?: BatchType;
|
|
201
|
+
[key: string]: unknown;
|
|
202
|
+
}): void;
|
|
203
|
+
/**
|
|
204
|
+
* Returns the data parsed by the {@link #processor data processor} and then converted by upcast converters
|
|
205
|
+
* attached to the {@link #upcastDispatcher}.
|
|
206
|
+
*
|
|
207
|
+
* @see #set
|
|
208
|
+
* @param data Data to parse.
|
|
209
|
+
* @param context Base context in which the view will be converted to the model.
|
|
210
|
+
* See: {@link module:engine/conversion/upcastdispatcher~UpcastDispatcher#convert}.
|
|
211
|
+
* @returns Parsed data.
|
|
212
|
+
*/
|
|
213
|
+
parse(data: string, context?: SchemaContextDefinition): ModelDocumentFragment;
|
|
214
|
+
/**
|
|
215
|
+
* Returns the result of the given {@link module:engine/view/element~Element view element} or
|
|
216
|
+
* {@link module:engine/view/documentfragment~DocumentFragment view document fragment} converted by the
|
|
217
|
+
* {@link #upcastDispatcher view-to-model converters}, wrapped by {@link module:engine/model/documentfragment~DocumentFragment}.
|
|
218
|
+
*
|
|
219
|
+
* When marker elements were converted during the conversion process, it will be set as a document fragment's
|
|
220
|
+
* {@link module:engine/model/documentfragment~DocumentFragment#markers static markers map}.
|
|
221
|
+
*
|
|
222
|
+
* @fires toModel
|
|
223
|
+
* @param viewElementOrFragment The element or document fragment whose content will be converted.
|
|
224
|
+
* @param context Base context in which the view will be converted to the model.
|
|
225
|
+
* See: {@link module:engine/conversion/upcastdispatcher~UpcastDispatcher#convert}.
|
|
226
|
+
* @returns Output document fragment.
|
|
227
|
+
*/
|
|
228
|
+
toModel(viewElementOrFragment: ViewElement | ViewDocumentFragment, context?: SchemaContextDefinition): ModelDocumentFragment;
|
|
229
|
+
/**
|
|
230
|
+
* Adds the style processor normalization rules.
|
|
231
|
+
*
|
|
232
|
+
* You can implement your own rules as well as use one of the available processor rules:
|
|
233
|
+
*
|
|
234
|
+
* * background: {@link module:engine/view/styles/background~addBackgroundRules}
|
|
235
|
+
* * border: {@link module:engine/view/styles/border~addBorderRules}
|
|
236
|
+
* * margin: {@link module:engine/view/styles/margin~addMarginRules}
|
|
237
|
+
* * padding: {@link module:engine/view/styles/padding~addPaddingRules}
|
|
238
|
+
*/
|
|
239
|
+
addStyleProcessorRules(callback: (stylesProcessor: StylesProcessor) => void): void;
|
|
240
|
+
/**
|
|
241
|
+
* Registers a {@link module:engine/view/matcher~MatcherPattern} on an {@link #htmlProcessor htmlProcessor}
|
|
242
|
+
* and a {@link #processor processor} for view elements whose content should be treated as raw data
|
|
243
|
+
* and not processed during the conversion from DOM to view elements.
|
|
244
|
+
*
|
|
245
|
+
* The raw data can be later accessed by the {@link module:engine/view/element~Element#getCustomProperty view element custom property}
|
|
246
|
+
* `"$rawContent"`.
|
|
247
|
+
*
|
|
248
|
+
* @param pattern Pattern matching all view elements whose content should be treated as a raw data.
|
|
249
|
+
*/
|
|
250
|
+
registerRawContentMatcher(pattern: MatcherPattern): void;
|
|
251
|
+
/**
|
|
252
|
+
* Removes all event listeners set by the DataController.
|
|
253
|
+
*/
|
|
254
|
+
destroy(): void;
|
|
255
|
+
/**
|
|
256
|
+
* Checks whether all provided root names are actually existing editor roots.
|
|
257
|
+
*
|
|
258
|
+
* @param rootNames Root names to check.
|
|
259
|
+
* @returns Whether all provided root names are existing editor roots.
|
|
260
|
+
*/
|
|
261
|
+
private _checkIfRootsExists;
|
|
262
|
+
}
|
|
263
|
+
/**
|
|
264
|
+
* Event fired once the data initialization has finished.
|
|
265
|
+
*
|
|
266
|
+
* @eventName ~DataController#ready
|
|
267
|
+
*/
|
|
268
|
+
export type DataControllerReadyEvent = {
|
|
269
|
+
name: 'ready';
|
|
270
|
+
args: [];
|
|
271
|
+
};
|
|
272
|
+
/**
|
|
273
|
+
* An event fired after the {@link ~DataController#init `init()` method} was run. It can be {@link ~DataController#listenTo listened to} in
|
|
274
|
+
* order to adjust or modify the initialization flow. However, if the `init` event is stopped or prevented,
|
|
275
|
+
* the {@link ~DataController#event:ready `ready` event} should be fired manually.
|
|
276
|
+
*
|
|
277
|
+
* The `init` event is fired by the decorated {@link ~DataController#init} method.
|
|
278
|
+
* See {@link module:utils/observablemixin~Observable#decorate} for more information and samples.
|
|
279
|
+
*
|
|
280
|
+
* @eventName ~DataController#init
|
|
281
|
+
*/
|
|
282
|
+
export type DataControllerInitEvent = {
|
|
283
|
+
name: 'init';
|
|
284
|
+
args: [Parameters<DataController['init']>];
|
|
285
|
+
return: ReturnType<DataController['init']>;
|
|
286
|
+
};
|
|
287
|
+
/**
|
|
288
|
+
* An event fired after {@link ~DataController#set set() method} has been run.
|
|
289
|
+
*
|
|
290
|
+
* The `set` event is fired by the decorated {@link ~DataController#set} method.
|
|
291
|
+
* See {@link module:utils/observablemixin~Observable#decorate} for more information and samples.
|
|
292
|
+
*
|
|
293
|
+
* @eventName ~DataController#set
|
|
294
|
+
*/
|
|
295
|
+
export type DataControllerSetEvent = {
|
|
296
|
+
name: 'set';
|
|
297
|
+
args: [Parameters<DataController['set']>];
|
|
298
|
+
return: ReturnType<DataController['set']>;
|
|
299
|
+
};
|
|
300
|
+
/**
|
|
301
|
+
* Event fired after the {@link ~DataController#get get() method} has been run.
|
|
302
|
+
*
|
|
303
|
+
* The `get` event is fired by the decorated {@link ~DataController#get} method.
|
|
304
|
+
* See {@link module:utils/observablemixin~Observable#decorate} for more information and samples.
|
|
305
|
+
*
|
|
306
|
+
* @eventName ~DataController#get
|
|
307
|
+
*/
|
|
308
|
+
export type DataControllerGetEvent = {
|
|
309
|
+
name: 'get';
|
|
310
|
+
args: [Parameters<DataController['get']>];
|
|
311
|
+
return: ReturnType<DataController['get']>;
|
|
312
|
+
};
|
|
313
|
+
/**
|
|
314
|
+
* Event fired after the {@link ~DataController#toView toView() method} has been run.
|
|
315
|
+
*
|
|
316
|
+
* The `toView` event is fired by the decorated {@link ~DataController#toView} method.
|
|
317
|
+
* See {@link module:utils/observablemixin~Observable#decorate} for more information and samples.
|
|
318
|
+
*
|
|
319
|
+
* @eventName ~DataController#toView
|
|
320
|
+
*/
|
|
321
|
+
export type DataControllerToViewEvent = {
|
|
322
|
+
name: 'toView';
|
|
323
|
+
args: [Parameters<DataController['toView']>];
|
|
324
|
+
return: ReturnType<DataController['toView']>;
|
|
325
|
+
};
|
|
326
|
+
/**
|
|
327
|
+
* Event fired after the {@link ~DataController#toModel toModel() method} has been run.
|
|
328
|
+
*
|
|
329
|
+
* The `toModel` event is fired by the decorated {@link ~DataController#toModel} method.
|
|
330
|
+
* See {@link module:utils/observablemixin~Observable#decorate} for more information and samples.
|
|
331
|
+
*
|
|
332
|
+
* @eventName ~DataController#toModel
|
|
333
|
+
*/
|
|
334
|
+
export type DataControllerToModelEvent = {
|
|
335
|
+
name: 'toModel';
|
|
336
|
+
args: [Parameters<DataController['toModel']>];
|
|
337
|
+
return: ReturnType<DataController['toModel']>;
|
|
338
|
+
};
|
|
339
|
+
export {};
|
|
@@ -0,0 +1,102 @@
|
|
|
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-oss-license
|
|
8
|
+
*/
|
|
9
|
+
import View from '../view/view.js';
|
|
10
|
+
import Mapper from '../conversion/mapper.js';
|
|
11
|
+
import DowncastDispatcher from '../conversion/downcastdispatcher.js';
|
|
12
|
+
import type { default as Model } from '../model/model.js';
|
|
13
|
+
import type ModelItem from '../model/item.js';
|
|
14
|
+
import type { Marker } from '../model/markercollection.js';
|
|
15
|
+
import type { StylesProcessor } from '../view/stylesmap.js';
|
|
16
|
+
declare const EditingController_base: {
|
|
17
|
+
new (): import("@ckeditor/ckeditor5-utils").Observable;
|
|
18
|
+
prototype: import("@ckeditor/ckeditor5-utils").Observable;
|
|
19
|
+
};
|
|
20
|
+
/**
|
|
21
|
+
* A controller for the editing pipeline. The editing pipeline controls the {@link ~EditingController#model model} rendering,
|
|
22
|
+
* including selection handling. It also creates the {@link ~EditingController#view view} which builds a
|
|
23
|
+
* browser-independent virtualization over the DOM elements. The editing controller also attaches default converters.
|
|
24
|
+
*/
|
|
25
|
+
export default class EditingController extends /* #__PURE__ */ EditingController_base {
|
|
26
|
+
/**
|
|
27
|
+
* Editor model.
|
|
28
|
+
*/
|
|
29
|
+
readonly model: Model;
|
|
30
|
+
/**
|
|
31
|
+
* Editing view controller.
|
|
32
|
+
*/
|
|
33
|
+
readonly view: View;
|
|
34
|
+
/**
|
|
35
|
+
* A mapper that describes the model-view binding.
|
|
36
|
+
*/
|
|
37
|
+
readonly mapper: Mapper;
|
|
38
|
+
/**
|
|
39
|
+
* Downcast dispatcher that converts changes from the model to the {@link #view editing view}.
|
|
40
|
+
*/
|
|
41
|
+
readonly downcastDispatcher: DowncastDispatcher;
|
|
42
|
+
/**
|
|
43
|
+
* Creates an editing controller instance.
|
|
44
|
+
*
|
|
45
|
+
* @param model Editing model.
|
|
46
|
+
* @param stylesProcessor The styles processor instance.
|
|
47
|
+
*/
|
|
48
|
+
constructor(model: Model, stylesProcessor: StylesProcessor);
|
|
49
|
+
/**
|
|
50
|
+
* Removes all event listeners attached to the `EditingController`. Destroys all objects created
|
|
51
|
+
* by `EditingController` that need to be destroyed.
|
|
52
|
+
*/
|
|
53
|
+
destroy(): void;
|
|
54
|
+
/**
|
|
55
|
+
* Calling this method will refresh the marker by triggering the downcast conversion for it.
|
|
56
|
+
*
|
|
57
|
+
* Reconverting the marker is useful when you want to change its {@link module:engine/view/element~Element view element}
|
|
58
|
+
* without changing any marker data. For instance:
|
|
59
|
+
*
|
|
60
|
+
* ```ts
|
|
61
|
+
* let isCommentActive = false;
|
|
62
|
+
*
|
|
63
|
+
* model.conversion.markerToHighlight( {
|
|
64
|
+
* model: 'comment',
|
|
65
|
+
* view: data => {
|
|
66
|
+
* const classes = [ 'comment-marker' ];
|
|
67
|
+
*
|
|
68
|
+
* if ( isCommentActive ) {
|
|
69
|
+
* classes.push( 'comment-marker--active' );
|
|
70
|
+
* }
|
|
71
|
+
*
|
|
72
|
+
* return { classes };
|
|
73
|
+
* }
|
|
74
|
+
* } );
|
|
75
|
+
*
|
|
76
|
+
* // ...
|
|
77
|
+
*
|
|
78
|
+
* // Change the property that indicates if marker is displayed as active or not.
|
|
79
|
+
* isCommentActive = true;
|
|
80
|
+
*
|
|
81
|
+
* // Reconverting will downcast and synchronize the marker with the new isCommentActive state value.
|
|
82
|
+
* editor.editing.reconvertMarker( 'comment' );
|
|
83
|
+
* ```
|
|
84
|
+
*
|
|
85
|
+
* **Note**: If you want to reconvert a model item, use {@link #reconvertItem} instead.
|
|
86
|
+
*
|
|
87
|
+
* @param markerOrName Name of a marker to update, or a marker instance.
|
|
88
|
+
*/
|
|
89
|
+
reconvertMarker(markerOrName: Marker | string): void;
|
|
90
|
+
/**
|
|
91
|
+
* Calling this method will downcast a model item on demand (by requesting a refresh in the {@link module:engine/model/differ~Differ}).
|
|
92
|
+
*
|
|
93
|
+
* You can use it if you want the view representation of a specific item updated as a response to external modifications. For instance,
|
|
94
|
+
* when the view structure depends not only on the associated model data but also on some external state.
|
|
95
|
+
*
|
|
96
|
+
* **Note**: If you want to reconvert a model marker, use {@link #reconvertMarker} instead.
|
|
97
|
+
*
|
|
98
|
+
* @param item Item to refresh.
|
|
99
|
+
*/
|
|
100
|
+
reconvertItem(item: ModelItem): void;
|
|
101
|
+
}
|
|
102
|
+
export {};
|