Skip to content

Commit

Permalink
[BUGFIX] ckeditor: propagate changes in editor document
Browse files Browse the repository at this point in the history
If the document model in a ckeditor instance is changed, the changes are
now immediately written back to the related source element and a
`change` event is dispatched, recovering the modal window when closing
the FormEngine.

Resolves: #98717
Releases: main
Change-Id: If605018a2c11e6448900639b2b8fd0fa5d0f4c2b
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/78322
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: core-ci <typo3@b13.com>
Reviewed-by: Stefan Bürk <stefan@buerk.tech>
Tested-by: Stefan Bürk <stefan@buerk.tech>
  • Loading branch information
andreaskienast authored and sbuerk committed Mar 29, 2023
1 parent 5d0be3f commit 96a6d69
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 5 additions & 1 deletion Build/Sources/TypeScript/rte_ckeditor/ckeditor5.ts
Expand Up @@ -132,10 +132,14 @@ export class CKEditor5Element extends LitElement {

CKEditor5
.create(this.target, config)
.then((editor: EditorWithUI) => {
.then((editor: CKEditor5) => {
this.applyEditableElementStyles(editor);
this.handleWordCountPlugin(editor);
this.applyReadOnly(editor);
editor.model.document.on('change:data', (): void => {
editor.updateSourceElement();
this.target.dispatchEvent(new Event('change', { bubbles: true, cancelable: true }));
});

if (this.options.debug) {
window.CKEditorInspector.attach(editor, { isCollapsed: true });
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 96a6d69

Please sign in to comment.