From 1b9057f0bf1765bde2dd21c994b3ef9993e905a5 Mon Sep 17 00:00:00 2001 From: David Moreno Cortina Date: Fri, 15 Jan 2021 20:09:04 +0100 Subject: [PATCH 1/2] Fix figures panel not showing when none of the figures has a paragraph. --- reader/panels/container_panel_view.js | 8 ++++---- substance/document/container.js | 4 ++++ 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/reader/panels/container_panel_view.js b/reader/panels/container_panel_view.js index 33a1e530..cdbcfb7b 100644 --- a/reader/panels/container_panel_view.js +++ b/reader/panels/container_panel_view.js @@ -33,12 +33,12 @@ ContainerPanelView.Prototype = function() { this.render = function() { // Hide the whole tab if there is no content - if (this.getContainer().getLength() === 0) { - this.hideToggle(); - this.hide(); - } else { + if (this.getContainer().hasContent()) { this.surface.render(); this.scrollbar.render(); + } else { + this.hideToggle(); + this.hide(); } return this; }; diff --git a/substance/document/container.js b/substance/document/container.js index c139a3c4..8510e9f3 100644 --- a/substance/document/container.js +++ b/substance/document/container.js @@ -136,6 +136,10 @@ Container.Prototype = function() { return this.listView.length; }; + this.hasContent = function(panelType) { + return this.listView.length > 0 || (panelType === 'resource' && this.treeView.length > 0); + }; + // Returns true if there is another node after a given position. // -------- // From 81b057f14461741a83c3d6c5ca46c5fab735d46d Mon Sep 17 00:00:00 2001 From: David Moreno Cortina Date: Sat, 30 Jan 2021 09:46:52 +0100 Subject: [PATCH 2/2] Fix figures panel not showing when none of the figures has a paragraph. --- reader/panels/container_panel_view.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/reader/panels/container_panel_view.js b/reader/panels/container_panel_view.js index cdbcfb7b..b98d1467 100644 --- a/reader/panels/container_panel_view.js +++ b/reader/panels/container_panel_view.js @@ -33,7 +33,7 @@ ContainerPanelView.Prototype = function() { this.render = function() { // Hide the whole tab if there is no content - if (this.getContainer().hasContent()) { + if (this.getContainer().hasContent(this.config.type)) { this.surface.render(); this.scrollbar.render(); } else {