From 117537434169fb49ff83c10b6b58397adb87c843 Mon Sep 17 00:00:00 2001 From: jean-emmanuel Date: Sun, 27 Feb 2022 09:12:14 +0100 Subject: [PATCH] modal: fix restoring state when recreated --- CHANGELOG.md | 5 +++++ src/client/editor/data-workers.js | 2 +- src/client/widgets/containers/modal.js | 5 +++++ 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a17408f2..49e7ee7e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,10 @@ # Changelog +## 1.15.2 + +- bug fixes + - modal: scroll state not restored when the modal container is recreated + ## 1.15.1 - bug fixes diff --git a/src/client/editor/data-workers.js b/src/client/editor/data-workers.js index bf102cb0..69f2cf60 100644 --- a/src/client/editor/data-workers.js +++ b/src/client/editor/data-workers.js @@ -141,7 +141,7 @@ function updateWidget(widget, options={}) { if (stateManager.queueCounter === 0) { for (let id in scrollState) { for (let w of widgetManager.getWidgetById(id)) { - if (w.getProp('scroll')) w.setScroll(scrollState[id]) + if (w.getProp('scroll')) w.setScroll(scrollState[id][0], scrollState[id][1]) } } } diff --git a/src/client/widgets/containers/modal.js b/src/client/widgets/containers/modal.js index c5d1d11e..6951d1a3 100644 --- a/src/client/widgets/containers/modal.js +++ b/src/client/widgets/containers/modal.js @@ -268,7 +268,12 @@ class Modal extends Panel { } + setScroll(x, y) { + if (x !== undefined) this.popupContent.firstChild.scrollLeft = this.scroll[0] = x + if (y !== undefined) this.popupContent.firstChild.scrollTop = this.scroll[1] = y + + } }