Skip to content

Commit

Permalink
tigger autosave on cke button clicks
Browse files Browse the repository at this point in the history
  • Loading branch information
i-just committed Feb 22, 2024
1 parent 0fcc9b0 commit a629ec2
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/web/assets/ckeditor/dist/ckeditor5-craftcms.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/web/assets/ckeditor/dist/ckeditor5-craftcms.js.map

Large diffs are not rendered by default.

9 changes: 8 additions & 1 deletion src/web/assets/ckeditor/src/ckeditor5-craftcms.js
Original file line number Diff line number Diff line change
Expand Up @@ -441,9 +441,16 @@ export const create = async function (element, config) {
// in case the value needs to be normalized
editor.updateSourceElement();

// Keep the source element updated with changes
editor.model.document.on('change:data', () => {
// Keep the source element updated with changes
editor.updateSourceElement();

// trigger autosave when buttons are clicked, e.g. list, bold
// see https://github.com/craftcms/ckeditor/issues/172 for more info
let $form = $(editor.sourceElement.form);
if ($form.length) {
$form.trigger('keyup');
}
});

// Track changes in the source mode
Expand Down

0 comments on commit a629ec2

Please sign in to comment.