Skip to content

Commit

Permalink
Merge pull request #57 from craftcms/bugfix/23-cke-4-dies-when-dragged
Browse files Browse the repository at this point in the history
fix - CKE dying when e.g. matrix block is dragged

Fixes #23
  • Loading branch information
brandonkelly committed Jan 4, 2023
2 parents 5a752d0 + e8bcdb3 commit 232234f
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Release Notes for CKEditor for Craft CMS

## Unreleased
- Fixed a bug where CKEditor 4 stopped working when used within a Matrix block, if the block was moved to a new position. ([#23](https://github.com/craftcms/ckeditor/issues/23))

## 1.4.0 - 2022-12-16
- Added RTL language support. ([#33](https://github.com/craftcms/ckeditor/issues/33), [#55](https://github.com/craftcms/ckeditor/pull/55))

Expand Down
10 changes: 10 additions & 0 deletions src/assets/field/dist/init.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,16 @@ async function initCkeditor(id, init) {
Garnish.on(Craft.Preview, 'open close', realInit);
Garnish.on(Craft.LivePreview, 'beforeEnter beforeExit', deinit);
Garnish.on(Craft.LivePreview, 'enter exit', realInit);

// https://github.com/craftcms/ckeditor/issues/23
// for when using "move up" and "move down" menu options
Garnish.on(Craft.MatrixInput, 'beforeMoveBlockUp beforeMoveBlockDown', deinit);
Garnish.on(Craft.MatrixInput, 'moveBlockUp moveBlockDown', realInit);
// for when dragging and dropping
Garnish.on(Craft.MatrixInput, 'blockSortDragStop', null, function() {
deinit();
realInit();
});
} else {
// CKEditor 5
try {
Expand Down

0 comments on commit 232234f

Please sign in to comment.