fix(ckeditor): revert workaround which breaks shift-selection

This commit is contained in:
Elian Doran 2025-11-27 20:39:59 +02:00
parent 073c02ee0c
commit 16f0ac97f4
No known key found for this signature in database

View File

@ -33,21 +33,7 @@ export default class MoveBlockUpDownPlugin extends Plugin {
const isOnlyMeta = (!e.ctrlKey && !e.altKey && e.metaKey); const isOnlyMeta = (!e.ctrlKey && !e.altKey && e.metaKey);
const isOnlyAlt = (!e.ctrlKey && e.altKey && !e.metaKey); const isOnlyAlt = (!e.ctrlKey && e.altKey && !e.metaKey);
// on Mac, Cmd+Up and Cmd+Down are supposed to jump to the beginning/end of the document. if ((!isMac && isOnlyMeta) || isOnlyAlt) {
// Cmd+Down works in CKEditor, but Cmd+Up doesn't for some reason.
if (isMac && isOnlyMeta) {
e.preventDefault();
e.stopImmediatePropagation();
editor.model.change(writer => {
const position = (command === "moveBlockUp" ? 0 : "end");
writer.setSelection(writer.createPositionAt( editor.model.document.getRoot(), position));
scrollToSelection(editor);
} );
return;
}
if (isOnlyMeta || isOnlyAlt) {
e.preventDefault(); e.preventDefault();
e.stopImmediatePropagation(); e.stopImmediatePropagation();
editor.execute(command); editor.execute(command);