From 720290878056f55284afe12d216aaa5dac2be2b9 Mon Sep 17 00:00:00 2001 From: Nathan Sobo Date: Thu, 16 Oct 2014 15:19:23 -0600 Subject: [PATCH] Split editor stylesheet into light and shadow DOM versions This prevents the need for a :host pseudo-class in the editor CSS which breaks linting. It also fits selectors targeting the host element in a more intuitive spot in the cascade. --- src/theme-manager.coffee | 2 +- static/atom.less | 1 + static/text-editor-light.less | 13 +++++++++++++ static/{editor.less => text-editor-shadow.less} | 12 ------------ 4 files changed, 15 insertions(+), 13 deletions(-) create mode 100644 static/text-editor-light.less rename static/{editor.less => text-editor-shadow.less} (93%) diff --git a/src/theme-manager.coffee b/src/theme-manager.coffee index 4919fbef2..a0293f2cf 100644 --- a/src/theme-manager.coffee +++ b/src/theme-manager.coffee @@ -249,7 +249,7 @@ class ThemeManager if nativeStylesheetPath = fs.resolveOnLoadPath(process.platform, ['css', 'less']) @requireStylesheet(nativeStylesheetPath) - textEditorStylesPath = path.join(@resourcePath, 'static', 'editor.less') + textEditorStylesPath = path.join(@resourcePath, 'static', 'text-editor-shadow.less') atom.styles.addStyleSheet(@loadLessStylesheet(textEditorStylesPath), sourcePath: textEditorStylesPath, context: 'atom-text-editor') stylesheetElementForId: (id) -> diff --git a/static/atom.less b/static/atom.less index 975905ad1..3f9aad4c9 100644 --- a/static/atom.less +++ b/static/atom.less @@ -22,6 +22,7 @@ @import "popover-list"; @import "messages"; @import "markdown"; +@import "text-editor-light"; @import "select-list"; @import "syntax"; @import "utilities"; diff --git a/static/text-editor-light.less b/static/text-editor-light.less new file mode 100644 index 000000000..7021c4978 --- /dev/null +++ b/static/text-editor-light.less @@ -0,0 +1,13 @@ +@import "ui-variables"; + +atom-text-editor { + display: block; + font-family: Inconsolata, Monaco, Consolas, 'Courier New', Courier; + line-height: 1.3; +} + +atom-text-editor.mini { + font-size: @input-font-size; + line-height: @component-line-height; + max-height: @component-line-height + 2; // +2 for borders +} diff --git a/static/editor.less b/static/text-editor-shadow.less similarity index 93% rename from static/editor.less rename to static/text-editor-shadow.less index 6cf487e9b..8187bdf93 100644 --- a/static/editor.less +++ b/static/text-editor-shadow.less @@ -2,12 +2,6 @@ @import "octicon-utf-codes"; @import "octicon-mixins"; -:host { - display: block; - font-family: Inconsolata, Monaco, Consolas, 'Courier New', Courier; - line-height: 1.3; -} - .editor, .editor-contents { height: 100%; width: 100%; @@ -92,12 +86,6 @@ color: @text-color-subtle; } -:host(.mini) { - font-size: @input-font-size; - line-height: @component-line-height; - max-height: @component-line-height + 2; // +2 for borders -} - .editor { z-index: 0; }