From ed6ca9cd0619af62b95b1a112198b48d48527717 Mon Sep 17 00:00:00 2001 From: Nathan Sobo Date: Wed, 12 Nov 2014 14:50:35 -0700 Subject: [PATCH] Remove .editor class to force themes to style background via :host MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The goal is to allow the editor’s styling to be overridden as follows: atom-text-editor { background: black; color: white; } If we retain these classes, themes will continue to style the root element of the editor and destroy the ability to style the editor in this way. You would instead have to do the following: atom-text-editor::shadow .editor { background: black; color: white; } This is way less intuitive and confusing for people. --- src/text-editor-component.coffee | 5 ++++- src/text-editor-element.coffee | 5 ++--- static/text-editor-shadow.less | 4 ++-- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/text-editor-component.coffee b/src/text-editor-component.coffee index 06749233d..6f67e4c46 100644 --- a/src/text-editor-component.coffee +++ b/src/text-editor-component.coffee @@ -90,7 +90,10 @@ TextEditorComponent = React.createClass style.height = scrollViewHeight if @autoHeight - className = 'editor-contents' + if useShadowDOM + className = 'editor-contents--private' + else + className = 'editor-contents' className += ' is-focused' if focused className += ' has-selection' if hasSelection diff --git a/src/text-editor-element.coffee b/src/text-editor-element.coffee index 643b71f5e..511433f72 100644 --- a/src/text-editor-element.coffee +++ b/src/text-editor-element.coffee @@ -42,18 +42,17 @@ class TextEditorElement extends HTMLElement @stylesElement.initialize() @rootElement = document.createElement('div') - @rootElement.classList.add('shadow') + @rootElement.classList.add('editor--private') @shadowRoot.appendChild(@stylesElement) @shadowRoot.appendChild(@rootElement) else @useShadowDOM = false + @classList.add('editor', 'editor-colors') @stylesElement = document.head.querySelector('atom-styles') @rootElement = this - @rootElement.classList.add('editor', 'editor-colors') - createSpacePenShim: -> TextEditorView ?= require './text-editor-view' @__spacePenView = new TextEditorView(this) diff --git a/static/text-editor-shadow.less b/static/text-editor-shadow.less index b71999099..d9cb65b63 100644 --- a/static/text-editor-shadow.less +++ b/static/text-editor-shadow.less @@ -2,12 +2,12 @@ @import "octicon-utf-codes"; @import "octicon-mixins"; -.editor, .editor-contents { +.editor--private, .editor-contents--private { height: 100%; width: 100%; } -.editor-contents { +.editor-contents--private { width: 100%; overflow: hidden; cursor: text;