mirror of
https://github.com/penpot/penpot.git
synced 2026-05-30 04:08:08 +00:00
🐛 Fix shift enter not working on text editor v2
This commit is contained in:
parent
1f35f57258
commit
bda977202a
@ -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);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user