mirror of
https://github.com/atom/atom.git
synced 2026-04-28 03:01:47 -04:00
Keep a backward compatible DOM structure for atom-text-editor contents
This commit is contained in:
@@ -6,6 +6,7 @@ module.exports = class OffScreenBlockDecorationsComponent {
|
||||
this.oldState = {offScreenBlockDecorations: {}, width: 0}
|
||||
this.domNode = document.createElement('div')
|
||||
this.domNode.style.visibility = 'hidden'
|
||||
this.domNode.style.position = 'absolute'
|
||||
this.blockDecorationNodesById = {}
|
||||
}
|
||||
|
||||
|
||||
@@ -62,11 +62,7 @@ class TextEditorComponent
|
||||
|
||||
@domElementPool = new DOMElementPool
|
||||
@domNode = document.createElement('div')
|
||||
@domNode.classList.add('editor-contents')
|
||||
# TODO: Remove these backwards compatible classes once everyone has
|
||||
# transitioned to non-shadow DOM selectors.
|
||||
@domNode.classList.add('editor-contents--private')
|
||||
@domNode.classList.add('editor--private')
|
||||
|
||||
@overlayManager = new OverlayManager(@presenter, @domNode, @views)
|
||||
|
||||
|
||||
@@ -30,7 +30,18 @@ class TextEditorElement extends HTMLElement
|
||||
@setAttribute('tabindex', -1)
|
||||
|
||||
initializeContent: (attributes) ->
|
||||
@rootElement = this
|
||||
Object.defineProperty(this, 'shadowRoot', {
|
||||
get: =>
|
||||
Grim.deprecate("""
|
||||
The contents of `atom-text-editor` elements are no longer encapsulated
|
||||
within a shadow DOM boundary. Please, stop using `shadowRoot` and access
|
||||
the editor contents directly instead.
|
||||
""")
|
||||
this
|
||||
})
|
||||
@rootElement = document.createElement('div')
|
||||
@rootElement.classList.add('editor--private')
|
||||
@appendChild(@rootElement)
|
||||
|
||||
attachedCallback: ->
|
||||
@buildModel() unless @getModel()?
|
||||
@@ -106,7 +117,7 @@ class TextEditorElement extends HTMLElement
|
||||
workspace: @workspace
|
||||
assert: @assert
|
||||
)
|
||||
@appendChild(@component.getDomNode())
|
||||
@rootElement.appendChild(@component.getDomNode())
|
||||
inputNode = @component.hiddenInputComponent.getDomNode()
|
||||
inputNode.addEventListener 'focus', @focused.bind(this)
|
||||
inputNode.addEventListener 'blur', => @dispatchEvent(new FocusEvent('blur', bubbles: false))
|
||||
|
||||
Reference in New Issue
Block a user