Text esc fixes (#925)

* fix incorrectly resetting state on esc

* confirm text on esc
This commit is contained in:
David Luzar 2020-03-12 18:04:56 +01:00 committed by GitHub
parent 3a5ca27600
commit f0e6f4dbb8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 7 deletions

View File

@ -47,6 +47,7 @@ export const actionFinalize = register({
: "selection", : "selection",
draggingElement: null, draggingElement: null,
multiElement: null, multiElement: null,
editingElement: null,
selectedElementIds: {}, selectedElementIds: {},
}, },
}; };

View File

@ -92,13 +92,7 @@ export function textWysiwyg({
editable.onkeydown = ev => { editable.onkeydown = ev => {
if (ev.key === KEYS.ESCAPE) { if (ev.key === KEYS.ESCAPE) {
ev.preventDefault(); ev.preventDefault();
if (initText) {
editable.innerText = initText;
handleSubmit(); handleSubmit();
return;
}
cleanup();
return;
} }
if (ev.key === KEYS.ENTER && !ev.shiftKey) { if (ev.key === KEYS.ENTER && !ev.shiftKey) {
ev.preventDefault(); ev.preventDefault();