Don't load base style sheets in AtomEnvironment

As it will happen again right after package activation.

Signed-off-by: Nathan Sobo <nathan@github.com>
This commit is contained in:
Antonio Scandurra
2017-03-08 18:10:54 +01:00
committed by Nathan Sobo
parent 47391110e8
commit fce10242dc
3 changed files with 6 additions and 9 deletions

View File

@@ -233,7 +233,6 @@ class AtomEnvironment extends Model
@config.load()
@themes.loadBaseStylesheets()
@initialStyleElements = @styles.getSnapshot()
@themes.initialLoadComplete = true if onlyLoadBaseStyleSheets
@setBodyPlatformClass()

View File

@@ -126,10 +126,10 @@ class ThemeManager
#
# Returns a {Disposable} on which `.dispose()` can be called to remove the
# required stylesheet.
requireStylesheet: (stylesheetPath) ->
requireStylesheet: (stylesheetPath, priority) ->
if fullPath = @resolveStylesheet(stylesheetPath)
content = @loadStylesheet(fullPath)
@applyStylesheet(fullPath, content)
@applyStylesheet(fullPath, content, priority)
else
throw new Error("Could not find a file at path '#{stylesheetPath}'")
@@ -175,9 +175,7 @@ class ThemeManager
@reloadBaseStylesheets()
reloadBaseStylesheets: ->
@requireStylesheet('../static/atom')
if nativeStylesheetPath = fs.resolveOnLoadPath(process.platform, ['css', 'less'])
@requireStylesheet(nativeStylesheetPath)
@requireStylesheet('../static/atom', -2)
stylesheetElementForId: (id) ->
escapedId = id.replace(/\\/g, '\\\\')
@@ -231,8 +229,8 @@ class ThemeManager
removeStylesheet: (stylesheetPath) ->
@styleSheetDisposablesBySourcePath[stylesheetPath]?.dispose()
applyStylesheet: (path, text) ->
@styleSheetDisposablesBySourcePath[path] = @styleManager.addStyleSheet(text, sourcePath: path)
applyStylesheet: (path, text, priority) ->
@styleSheetDisposablesBySourcePath[path] = @styleManager.addStyleSheet(text, {priority, sourcePath: path})
activateThemes: ->
new Promise (resolve) =>

View File

@@ -51,7 +51,7 @@ class WorkspaceElement extends HTMLElement
line-height: #{@config.get('editor.lineHeight')};
}
"""
@styles.addStyleSheet(styleSheetSource, sourcePath: 'global-text-editor-styles')
@styles.addStyleSheet(styleSheetSource, {sourcePath: 'global-text-editor-styles', priority: -1})
@views.performDocumentPoll()
initialize: (@model, {@views, @workspace, @project, @config, @styles}) ->