Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix figures panel not showing when none of the figures has a paragraph. #223

Merged
merged 2 commits into from
Feb 5, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions reader/panels/container_panel_view.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
};
Expand Down
4 changes: 4 additions & 0 deletions substance/document/container.js
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,10 @@ Container.Prototype = function() {
return this.listView.length;
};

this.hasContent = function(panelType) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@DavidMorenoCortina, I'm wondering in what situation panelType is used here, because if I remove it and change the code below, it gives the same effect for eLife articles. Is it a hook used elsewhere in other Lens implementations?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@gnott I used panelType in case other panel types are added and their content only have to be shown based on listView. At this moment that check is redundant because all panels are resource type so it could be simplified

return this.listView.length > 0 || (panelType === 'resource' && this.treeView.length > 0);
};

// Returns true if there is another node after a given position.
// --------
//
Expand Down