You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The following are the most important changes and ways to update your code. The list has been split into a section for developers integrating the editor into their systems and a section for plugin authors. However, depending on the CKEditor 5 Framework features that you used you may need to check both sections.
Integration developers
editor.getData() returns an empty string
The editor.getData() method returns an empty string if the editor is empty. If you preferred the old behaviour, then you can use it like this:
Prior to v12.0.0 you could access the editable element via editor.ui.view.editable.editableElement. The assumption was, therefore, that there's only a single editable element in the entire editor.
Since v12.0.0 the editor UI assumes the existance of multiple editable roots. Therefore, the correct way to access the editable DOM element is via:
editor.ui.getEditableElement('editableName');// -> Element
However, since all official editors contain just one editable (which is called main like the engine's root), you can access it like this:
editor.ui.getEditableElement();// -> Element
Main editor UI element
Prior to v12.0.0 you could access the editor's main UI element (its UI container) via editor.element.
The conversion helpers which were available in the @ckeditor/ckeditor5-engine/src/conversion/upcast-converters and @ckeditor/ckeditor5-engine/src/conversion/downcast-converters modules and required importing are now available directly on the for() function.
You can still use editor.conversion.for( ... ).add() method to define totally custom converters, but the conversion helpers are now available only on the for() object.
Mark your widget as isObject in the schema
All model elements which are represented as widgets in the view should be marked with isObject (and isBlock or isInline) in the schema.
If you see that editor.getData() returns an empty string when your widget is the only content of the editor, then there's a high chance that you forgot to use isObject in its schema definition.
Other changes
The editor#dataReady event was removed. The editor.data#ready event has been introduced and should be used instead.
The editor#pluginsReady event was removed. Use Plugin#afterInit() method instead.
The editor#uiReady event was removed. Use editor.ui#ready event instead.
If you did use the following statement in your custom UI plugin, this
change is breaking, as UpcastConverters and DowncastConverters is not exported anymore:
`import {UpcastConverters, DowncastConverters} from 'ckeditor5-exports'`
*Background:* CKEditor5 12.x removed this API as explained in their
[Upgrade Guide in section "Conversion helpers"](ckeditor/ckeditor5#1582)
*How to fix:* Use the new API as described in the upgrade guide of CKEditor5.
*Severity*: Running a search for this on GitHub just shows very few public
packages affected - so this should be safe for most users.
Migration guide for CKEditor 5 v12.0.0.
The following are the most important changes and ways to update your code. The list has been split into a section for developers integrating the editor into their systems and a section for plugin authors. However, depending on the CKEditor 5 Framework features that you used you may need to check both sections.
Integration developers
editor.getData()
returns an empty stringThe
editor.getData()
method returns an empty string if the editor is empty. If you preferred the old behaviour, then you can use it like this:Modifying editable element attributes
Prior to v12.0.0 the editable attributes could have been changed in various ways. For instance directly via:
Since v12.0.0 the only correct and reliable way to manage editable elements attributes is via the editing view, so, through the engine:
Accessing the editable element
Prior to v12.0.0 you could access the editable element via
editor.ui.view.editable.editableElement
. The assumption was, therefore, that there's only a single editable element in the entire editor.Since v12.0.0 the editor UI assumes the existance of multiple editable roots. Therefore, the correct way to access the editable DOM element is via:
However, since all official editors contain just one editable (which is called
main
like the engine's root), you can access it like this:Main editor UI element
Prior to v12.0.0 you could access the editor's main UI element (its UI container) via
editor.element
.Since v12.0.0 that property has been moved to:
Image upload adapters
The
FileLoader#file
property now returns a promise instead of aFile
object directly. See an example how to modify your upload adapter in: https://github.com/ckeditor/ckeditor5-image/pull/282/files.Plugin developers
Conversion helpers
The conversion helpers which were available in the
@ckeditor/ckeditor5-engine/src/conversion/upcast-converters
and@ckeditor/ckeditor5-engine/src/conversion/downcast-converters
modules and required importing are now available directly on thefor()
function.For instance, prior to v12.0.0:
Since v12.0.0:
You can still use
editor.conversion.for( ... ).add()
method to define totally custom converters, but the conversion helpers are now available only on thefor()
object.Mark your widget as
isObject
in the schemaAll model elements which are represented as widgets in the view should be marked with
isObject
(andisBlock
orisInline
) in the schema.If you see that
editor.getData()
returns an empty string when your widget is the only content of the editor, then there's a high chance that you forgot to useisObject
in its schema definition.Other changes
editor#dataReady
event was removed. Theeditor.data#ready
event has been introduced and should be used instead.editor#pluginsReady
event was removed. UsePlugin#afterInit()
method instead.editor#uiReady
event was removed. Useeditor.ui#ready
event instead.ckeditor5-engine
.ckeditor5-widget
.ckeditor5-ui
.The text was updated successfully, but these errors were encountered: