From 37a8482a876da5de3bb130411b62b70429c1159e Mon Sep 17 00:00:00 2001 From: Peter Stuifzand Date: Wed, 11 Nov 2020 19:49:04 +0100 Subject: [PATCH] Remove old 'Escape' event --- list-editor/index.js | 12 ------------ list-editor/store.js | 2 +- 2 files changed, 1 insertion(+), 13 deletions(-) diff --git a/list-editor/index.js b/list-editor/index.js index d9b3579..e20a214 100644 --- a/list-editor/index.js +++ b/list-editor/index.js @@ -490,21 +490,9 @@ function editor(root, inputData, options) { trigger('change') - // disableDragging(drake) - // render(root, store); - // drake = enableDragging(root) - return false }); - $(root).on('keydown', '.input-line', function (event) { - if (event.key === 'Escape') { - stopEditing(root, store, $(this)) - return false - } - return true - }); - function moveCursor(event, dir) { let target = event.target; diff --git a/list-editor/store.js b/list-editor/store.js index 980407a..6c96df1 100644 --- a/list-editor/store.js +++ b/list-editor/store.js @@ -199,7 +199,7 @@ function Store(inputData) { let index = _.findIndex(idList, (id) => id === currentId) let oldValue = _.clone(values[currentId]) let newValue = callback(values[currentId], values[idList[index - 1]], values[idList[index + 1]]); - if (oldValue && oldValue.text !== newValue.text) { + if (!oldValue || oldValue.text !== newValue.text) { values[currentId] = newValue changed = true }