From 0012bb2accc9f776f6a37f07c18e764ca49429a0 Mon Sep 17 00:00:00 2001 From: Peter Stuifzand Date: Mon, 2 Nov 2020 22:51:19 +0100 Subject: [PATCH] Force saveTree output --- list-editor/index.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/list-editor/index.js b/list-editor/index.js index f3b5fbc..de2b614 100644 --- a/list-editor/index.js +++ b/list-editor/index.js @@ -63,9 +63,10 @@ function editor(root, inputData, options) { }); } - function saveTree(from) { + function saveTree(from, opt) { + opt = _.merge({force: false}, opt) return new Promise(function (resolve, reject) { - if (store.hasChanged()) { + if (opt.force || store.hasChanged()) { resolve(store.tree(from)) store.clearChanged() } @@ -83,7 +84,7 @@ function editor(root, inputData, options) { let id = item.attr('data-id') if (opt.recursive) { - return saveTree(id) + return saveTree(id, {force: true}) } return new Promise(function (resolve, reject) {