mirror of
https://github.com/atom/atom.git
synced 2026-04-28 03:01:47 -04:00
Load editor stylesheet in shadow root with style manager context param
This commit is contained in:
@@ -26,6 +26,10 @@ class TextEditorElement extends HTMLElement
|
||||
@setAttribute('tabindex', -1)
|
||||
@shadowRoot = @createShadowRoot()
|
||||
|
||||
stylesElement = document.createElement('atom-styles')
|
||||
stylesElement.setAttribute('context', 'atom-text-editor')
|
||||
@shadowRoot.appendChild(stylesElement)
|
||||
|
||||
for styleElement in document.querySelectorAll('head style.syntax-theme')
|
||||
@shadowRoot.appendChild(styleElement.cloneNode(true))
|
||||
|
||||
|
||||
@@ -249,6 +249,9 @@ class ThemeManager
|
||||
if nativeStylesheetPath = fs.resolveOnLoadPath(process.platform, ['css', 'less'])
|
||||
@requireStylesheet(nativeStylesheetPath)
|
||||
|
||||
textEditorStylesPath = path.join(@resourcePath, 'static', 'editor.less')
|
||||
atom.styles.addStyleSheet(@loadLessStylesheet(textEditorStylesPath), sourcePath: 'textEditorStylesPath', context: 'atom-text-editor')
|
||||
|
||||
stylesheetElementForId: (id) ->
|
||||
document.head.querySelector("atom-styles style[source-path=\"#{id}\"]")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user