Skip to content
This repository was archived by the owner on Jan 22, 2019. It is now read-only.
Merged
Changes from all commits
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
14 changes: 10 additions & 4 deletions src/libs/github/inject.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -320,16 +320,22 @@ function injectExtensionsGlobalComponents({
}): void {
const headerElem = document.querySelector('div.HeaderMenu>div:last-child')
if (headerElem) {
const commandListElem = document.createElement('div')
commandListElem.className = 'command-palette-button'
headerElem.appendChild(commandListElem)
const commandListClass = 'command-palette-button'

function createCommandList(): HTMLElement {
const commandListElem = document.createElement('div')
commandListElem.className = commandListClass
Copy link

Choose a reason for hiding this comment

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

Doesn't really matter here since you're creating the element from scratch but I always use element.classList.add

headerElem!.appendChild(commandListElem)
return commandListElem
}

render(
<CommandListPopoverButton
extensionsController={extensionsController}
menu={ContributableMenu.CommandPalette}
extensions={extensionsContextController}
/>,
commandListElem
document.querySelector('.' + commandListClass) || createCommandList()
)
}
}
Expand Down