Apply syntax theme stylesheets in text editor shadow DOM via atom.styles

This commit is contained in:
Nathan Sobo
2014-10-15 12:30:17 -06:00
parent 1a98cb7070
commit 582066915b
2 changed files with 2 additions and 7 deletions

View File

@@ -176,9 +176,10 @@ class Package
activateStylesheets: ->
return if @stylesheetsActivated
context = 'atom-text-editor' if @metadata.theme is 'syntax'
group = @getStylesheetType()
for [sourcePath, source] in @stylesheets
@stylesheetDisposables.add(atom.styles.addStyleSheet(source, {sourcePath, sourcePath}))
@stylesheetDisposables.add(atom.styles.addStyleSheet(source, {sourcePath, sourcePath, context}))
@stylesheetsActivated = true
activateResources: ->

View File

@@ -30,12 +30,6 @@ class TextEditorElement extends HTMLElement
stylesElement.setAttribute('context', 'atom-text-editor')
@shadowRoot.appendChild(stylesElement)
for styleElement in document.querySelectorAll('head style.syntax-theme')
@shadowRoot.appendChild(styleElement.cloneNode(true))
atom.themes.onDidAddStylesheet (sheet) =>
@shadowRoot.appendChild(sheet.ownerNode.cloneNode(true))
@root = document.createElement('div')
@root.classList.add('editor', 'editor-colors')
@shadowRoot.appendChild(@root)