From e102b61c7d83e2cdbcc91a1a9bcd6dade180c357 Mon Sep 17 00:00:00 2001 From: Paulo Gustavo Veiga Date: Sun, 12 Dec 2021 19:11:35 -0800 Subject: [PATCH] Fix ColorPalettePanel initialization --- .../src/components/widget/ColorPalettePanel.js | 6 ++---- .../mindplot/src/components/widget/ToolbarPaneItem.js | 11 ++++------- 2 files changed, 6 insertions(+), 11 deletions(-) diff --git a/packages/mindplot/src/components/widget/ColorPalettePanel.js b/packages/mindplot/src/components/widget/ColorPalettePanel.js index 3a95168d..0aa99c59 100644 --- a/packages/mindplot/src/components/widget/ColorPalettePanel.js +++ b/packages/mindplot/src/components/widget/ColorPalettePanel.js @@ -22,11 +22,9 @@ import ToolbarPaneItem from './ToolbarPaneItem'; class ColorPalettePanel extends ToolbarPaneItem { constructor(buttonId, model, baseUrl) { $assert($defined(baseUrl), 'baseUrl can not be null'); - super(buttonId, model, (() => this._setUrl(baseUrl))); - } - - _setUrl(baseUrl) { + super(buttonId, model, true); this._baseUrl = baseUrl; + super._init(); } _load() { diff --git a/packages/mindplot/src/components/widget/ToolbarPaneItem.js b/packages/mindplot/src/components/widget/ToolbarPaneItem.js index cdb47b91..7450038b 100644 --- a/packages/mindplot/src/components/widget/ToolbarPaneItem.js +++ b/packages/mindplot/src/components/widget/ToolbarPaneItem.js @@ -20,20 +20,17 @@ import ToolbarItem from './ToolbarItem'; import FloatingTip from './FloatingTip'; class ToolbarPaneItem extends ToolbarItem { - constructor(buttonId, model, lazyInit) { + constructor(buttonId, model, delayInit) { $assert(buttonId, 'buttonId can not be null'); $assert(model, 'model can not be null'); super(buttonId, null, { topicAction: true, relAction: false }); - // delay initialization in case of bring required. - if (lazyInit) { - lazyInit.bind(this)(); - } - const handler = () => (this.isVisible() ? this.hide() : this.show()); this.setEventHandler(handler); this._model = model; - this._panelElem = this._init(); + if (!delayInit) { + this._panelElem = this._init(); + } this._visible = false; }