From 6021c1b5cc0af94e798fdd1995daf96b7b367f40 Mon Sep 17 00:00:00 2001 From: Ian Gulliver Date: Tue, 25 Jun 2019 17:57:46 +0000 Subject: [PATCH] Don't proceed to next node on escape --- architype.js | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/architype.js b/architype.js index 773c526..83b24b4 100644 --- a/architype.js +++ b/architype.js @@ -625,6 +625,17 @@ class Node extends EditorEntryBase { onInputKeyDown(e) { switch (e.key) { case 'Enter': + e.stopPropagation(); + e.preventDefault(); + if (this.elem_.nextElementSibling && + this.elem_.nextElementSibling.xArchObj && + this.elem_.nextElementSibling.xArchObj.getLabel() == '') { + this.elem_.nextElementSibling.xArchObj.startEdit(); + } else { + this.stopEdit(); + } + break; + case 'Escape': e.stopPropagation(); e.preventDefault(); @@ -661,13 +672,7 @@ class Node extends EditorEntryBase { } stopEdit() { - if (this.elem_.nextElementSibling && - this.elem_.nextElementSibling.xArchObj && - this.elem_.nextElementSibling.xArchObj.getLabel() == '') { - this.elem_.nextElementSibling.xArchObj.startEdit(); - } else { - this.elem_.focus(); - } + this.elem_.focus(); } static unserialize(ser) {