🐛 Fix shift enter not working on text editor v2

This commit is contained in:
Aitor Moreno 2026-05-28 11:52:46 +02:00 committed by GitHub
parent 1f35f57258
commit bda977202a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -447,10 +447,7 @@ export class TextEditor extends EventTarget {
if ((e.ctrlKey || e.metaKey) && e.key === "a") {
e.preventDefault();
this.selectAll();
return;
}
if ((e.ctrlKey || e.metaKey) && e.key === "Backspace") {
} else if ((e.ctrlKey || e.metaKey) && e.key === "Backspace") {
e.preventDefault();
if (this.#selectionController.isCollapsed) {
this.#selectionController.removeWordBackward();
@ -458,6 +455,14 @@ export class TextEditor extends EventTarget {
this.#selectionController.removeSelected();
}
this.#notifyLayout(LayoutType.FULL);
} else if (e.shiftKey && e.key === "Enter") {
e.preventDefault();
if (this.#selectionController.isCollapsed) {
this.#selectionController.insertParagraph();
} else {
this.#selectionController.replaceWithParagraph();
}
this.#notifyLayout(LayoutType.FULL);
}
};