Comparar commits

..

2 Commits

Autor SHA1 Mensagem Data
Nathan Sobo f06c3402c3 WIP: Transfer foreground/background color into shadow DOM
Refs #4086
2014-11-11 16:59:36 -07:00
Nathan Sobo e3d70ebad0 💄 2014-11-11 16:58:38 -07:00
6 arquivos alterados com 85 adições e 65 exclusões
+29 -28
Ver Arquivo
@@ -1,31 +1,32 @@
<?xml version="1.0" encoding="utf-8"?>
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
<metadata>
<id><%= name %></id>
<version><%= version %></version>
<authors>The Atom Community</authors>
<owners>The Atom Community</owners>
<iconUrl>https://raw.githubusercontent.com/atom/atom/master/resources/win/atom.ico</iconUrl>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<description><%= description %></description>
</metadata>
<files>
<file src="locales\**" target="lib\net45\locales" />
<file src="resources\**" target="lib\net45\resources" />
<file src="*.pak" target="lib\net45" />
<file src="atom.exe" target="lib\net45\atom.exe" />
<file src="atom.exe.gui" target="lib\net45\atom.exe.gui" />
<file src="chromiumcontent.dll" target="lib\net45\chromiumcontent.dll" />
<file src="d3dcompiler_43.dll" target="lib\net45\d3dcompiler_43.dll" />
<file src="ffmpegsumo.dll" target="lib\net45\ffmpegsumo.dll" />
<file src="icudtl.dat" target="lib\net45\icudtl.dat" />
<file src="libEGL.dll" target="lib\net45\libEGL.dll" />
<file src="libGLESv2.dll" target="lib\net45\libGLESv2.dll" />
<file src="LICENSE" target="lib\net45\LICENSE" />
<file src="msvcp120.dll" target="lib\net45\msvcp120.dll" />
<file src="msvcr120.dll" target="lib\net45\msvcr120.dll" />
<file src="vccorlib120.dll" target="lib\net45\vccorlib120.dll" />
<file src="version" target="lib\net45\version" />
<file src="xinput1_3.dll" target="lib\net45\xinput1_3.dll" />
</files>
<metadata>
<id><%= name %></id>
<version><%= version %></version>
<authors>The Atom Community</authors>
<owners>The Atom Community</owners>
<iconUrl>https://raw.githubusercontent.com/atom/atom/master/resources/win/atom.ico</iconUrl>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<description><%= description %></description>
</metadata>
<files>
<file src="locales\**" target="lib\net45\locales" />
<file src="resources\**" target="lib\net45\resources" />
<file src="*.pak" target="lib\net45" />
<file src="atom.exe" target="lib\net45\atom.exe" />
<file src="atom.exe.gui" target="lib\net45\atom.exe.gui" />
<file src="chromiumcontent.dll" target="lib\net45\chromiumcontent.dll" />
<file src="d3dcompiler_43.dll" target="lib\net45\d3dcompiler_43.dll" />
<file src="ffmpegsumo.dll" target="lib\net45\ffmpegsumo.dll" />
<file src="icudtl.dat" target="lib\net45\icudtl.dat" />
<file src="libEGL.dll" target="lib\net45\libEGL.dll" />
<file src="libGLESv2.dll" target="lib\net45\libGLESv2.dll" />
<file src="LICENSE" target="lib\net45\LICENSE" />
<file src="msvcp120.dll" target="lib\net45\msvcp120.dll" />
<file src="msvcr120.dll" target="lib\net45\msvcr120.dll" />
<file src="vccorlib120.dll" target="lib\net45\vccorlib120.dll" />
<file src="version" target="lib\net45\version" />
<file src="xinput1_3.dll" target="lib\net45\xinput1_3.dll" />
</files>
</package>
+1 -1
Ver Arquivo
@@ -112,7 +112,7 @@
# Apple Specific
'cmd-backspace': 'editor:delete-to-beginning-of-line'
'cmd-shift-backspace': 'editor:delete-to-beginning-of-line'
'cmd-delete': 'editor:delete-to-end-of-line'
'cmd-delete': 'editor:delete-to-beginning-of-line'
'ctrl-A': 'editor:select-to-first-character-of-line'
'ctrl-E': 'editor:select-to-end-of-line'
'cmd-left': 'editor:move-to-first-character-of-line'
+21 -1
Ver Arquivo
@@ -57,7 +57,27 @@ describe "TextEditorElement", ->
document.body.focus()
expect(blurCalled).toBe true
describe "when the themes finish loading", ->
describe "style transfer", ->
beforeEach ->
waitsForPromise -> atom.themes.activateThemes()
afterEach ->
atom.themes.deactivateThemes()
ffit "transfers the foreground and background colors into the shadow DOM", ->
runs ->
element = new TextEditorElement()
jasmineContent.appendChild(element)
initialBackgroundColor = getComputedStyle(element.shadowRoot.querySelector('.editor')).backgroundColor
atom.styles.addStyleSheet """
atom-text-editor { background: red; }
"""
newBackgroundColor = getComputedStyle(element.shadowRoot.querySelector('.editor')).backgroundColor
expect(newBackgroundColor).not.toBe initialBackgroundColor
describe "when the themes finish loading with the shadow DOM disabled (regressios)", ->
[themeReloadCallback, initialThemeLoadComplete, element] = []
beforeEach ->
+3 -22
Ver Arquivo
@@ -2550,21 +2550,15 @@ describe "TextEditor", ->
describe "when no text is selected", ->
beforeEach ->
editor.setSelectedBufferRanges([
[[1, 5], [1, 5]],
[[5, 8], [5, 8]]
])
editor.setSelectedBufferRanges([[1, 0], [1, 0]])
editor.addCursorAtBufferPosition([5, 0])
it "copies the lines on which there are cursors", ->
editor.copySelectedText()
expect(atom.clipboard.readWithMetadata().metadata.selections).toEqual([
" var sort = function(items) {\n"
"var quicksort = function () {\n"
" current = items.shift();\n"
])
expect(editor.getSelectedBufferRanges()).toEqual([
[[1, 5], [1, 5]],
[[5, 8], [5, 8]]
])
describe ".pasteText()", ->
it "pastes text into the buffer", ->
@@ -3476,19 +3470,6 @@ describe "TextEditor", ->
runs ->
expect(editor.softTabs).toBe false
it "uses hard tabs in Makefile files", ->
# FIXME remove once this is handled by a scoped setting in the
# language-make package
waitsForPromise ->
atom.packages.activatePackage('language-make')
waitsForPromise ->
atom.project.open('Makefile').then (o) -> editor = o
runs ->
expect(editor.softTabs).toBe false
describe ".destroy()", ->
it "destroys all markers associated with the edit session", ->
expect(buffer.getMarkerCount()).toBeGreaterThan 0
+29 -2
Ver Arquivo
@@ -14,7 +14,6 @@ class TextEditorElement extends HTMLElement
focusOnAttach: false
createdCallback: ->
@subscriptions =
@initializeContent()
@createSpacePenShim()
@addEventListener 'focus', @focused.bind(this)
@@ -36,13 +35,18 @@ class TextEditorElement extends HTMLElement
@shadowRoot.appendChild(@stylesElement)
@shadowRoot.appendChild(@rootElement)
if atom.themes.isInitialLoadComplete()
@observeGlobalStyles()
else
loadSubscription = atom.themes.onDidReloadAll(@observeGlobalStyles.bind(this))
else
@stylesElement = document.head.querySelector('atom-styles')
@rootElement = this
@rootElement.classList.add('editor', 'editor-colors')
createSpacePenShim: ->
TextEditorView ?= require './text-editor-view'
@__spacePenView = new TextEditorView(this)
@@ -53,6 +57,29 @@ class TextEditorElement extends HTMLElement
@component.checkForVisibilityChange()
@focus() if @focusOnAttach
observeGlobalStyles: ->
globalStyles = document.head.querySelector('atom-styles')
globalStyles.onDidAddStyleElement(@transferComputedStyles.bind(this))
@transferComputedStyles()
transferComputedStyles: ->
unless @hostOverrideStyleElement?
@hostOverrideStyleElement = document.createElement('style')
@shadowRoot.insertBefore(@hostOverrideStyleElement, @stylesElement.nextSibling)
{color, backgroundColor} = getComputedStyle(this)
@hostOverrideStyleElement.textContent = """
.editor-colors {
background-color: #{backgroundColor};
color: #{color};
}
.cursor {
border-color: #{color};
}
"""
setModel: (model) ->
throw new Error("Model already assigned on TextEditorElement") if @model?
return if model.isDestroyed()
+2 -11
Ver Arquivo
@@ -2243,10 +2243,6 @@ class TextEditor extends Model
# Returns a {Boolean} or undefined if no non-comment lines had leading
# whitespace.
usesSoftTabs: ->
# FIXME Remove once this can be specified as a scoped setting in the
# language-make package
return false if @getGrammar().scopeName is 'source.makefile'
for bufferRow in [0..@buffer.getLastRow()]
continue if @displayBuffer.tokenizedBuffer.tokenizedLineForRow(bufferRow).isComment()
@@ -2467,13 +2463,8 @@ class TextEditor extends Model
copySelectedText: ->
maintainClipboard = false
for selection in @getSelections()
if selection.isEmpty()
previousRange = selection.getBufferRange()
selection.selectLine()
selection.copy(maintainClipboard)
selection.setBufferRange(previousRange)
else
selection.copy(maintainClipboard)
selection.selectLine() if selection.isEmpty()
selection.copy(maintainClipboard)
maintainClipboard = true
# Essential: For each selection, cut the selected text.