From a6589d0d06dc58c5c20ce668d0a1063b3007f3a5 Mon Sep 17 00:00:00 2001 From: yflory Date: Fri, 22 Nov 2019 17:58:21 +0100 Subject: [PATCH 1/2] Ability to restore an old version from the debug app --- www/debug/inner.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/www/debug/inner.js b/www/debug/inner.js index 3373b4803..03e4d8d7f 100644 --- a/www/debug/inner.js +++ b/www/debug/inner.js @@ -439,7 +439,12 @@ define([ console.log(doc); }; - config.onLocal = function () { }; + var toRestore; + + config.onLocal = function () { + if (!toRestore) { return; } + cpNfInner.chainpad.contentUpdate(toRestore); + }; config.onInit = function (info) { Title = common.createTitle({}); @@ -463,6 +468,7 @@ define([ onRemote: config.onRemote, setHistory: setHistory, applyVal: function (val) { + toRestore = val; displayDoc(JSON.parse(val) || {}); }, $toolbar: $bar, From 9a8604dfb471f1ddf3b197fca29e81438747adca Mon Sep 17 00:00:00 2001 From: yflory Date: Fri, 22 Nov 2019 18:02:33 +0100 Subject: [PATCH 2/2] Fix debug app restore history --- www/debug/inner.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/www/debug/inner.js b/www/debug/inner.js index 03e4d8d7f..3a98b883e 100644 --- a/www/debug/inner.js +++ b/www/debug/inner.js @@ -441,8 +441,8 @@ define([ var toRestore; - config.onLocal = function () { - if (!toRestore) { return; } + config.onLocal = function (a, restore) { + if (!toRestore || !restore) { return; } cpNfInner.chainpad.contentUpdate(toRestore); }; @@ -464,7 +464,9 @@ define([ /* add a history button */ var histConfig = { - onLocal: config.onLocal, + onLocal: function () { + config.onLocal(null, true); + }, onRemote: config.onRemote, setHistory: setHistory, applyVal: function (val) {