Browse Source

Fix Talk sidebar in public share pages without header actions

The ".header-right" element may not exist in the public share page if
there are no header actions, for example, if the downloads of the share
are hidden. In that case the ".header-right" element needs to be
explicitly added.

Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
pull/3573/head
Daniel Calviño Sánchez 6 years ago
parent
commit
4da0ffc55d
  1. 9
      src/mainPublicShareSidebar.js

9
src/mainPublicShareSidebar.js

@ -86,6 +86,15 @@ function addTalkSidebarTrigger() {
talkSidebarTriggerElement.addEventListener('click', () => {
sidebarState.isOpen = !sidebarState.isOpen
})
// The ".header-right" element may not exist in the public share page if
// there are no header actions.
if (!document.querySelector('.header-right')) {
const headerRightElement = document.createElement('div')
headerRightElement.setAttribute('class', 'header-right')
document.querySelector('#header').append(headerRightElement)
}
document.querySelector('.header-right').append(talkSidebarTriggerElement)
}

Loading…
Cancel
Save