mirror of
https://github.com/atom/atom.git
synced 2026-04-06 03:02:13 -04:00
Don't store fontSize and fontFamily as instance variables
This commit is contained in:
@@ -567,9 +567,9 @@ describe "RootView", ->
|
||||
editor = null
|
||||
beforeEach ->
|
||||
editor = rootView.getActiveEditor()
|
||||
editor.attachToDom()
|
||||
|
||||
it "increases/decreases font size when increase/decrease-font-size events are triggered", ->
|
||||
editor = rootView.getActiveEditor()
|
||||
fontSizeBefore = editor.getFontSize()
|
||||
rootView.trigger 'window:increase-font-size'
|
||||
expect(editor.getFontSize()).toBe fontSizeBefore + 1
|
||||
|
||||
@@ -682,29 +682,30 @@ class Editor extends View
|
||||
autosave: ->
|
||||
@save() if @getPath()?
|
||||
|
||||
setFontSize: (@fontSize) ->
|
||||
setFontSize: (fontSize) ->
|
||||
headTag = $("head")
|
||||
styleTag = headTag.find("style.font-size")
|
||||
if styleTag.length == 0
|
||||
styleTag = $$ -> @style class: 'font-size'
|
||||
headTag.append styleTag
|
||||
|
||||
styleTag.text(".editor {font-size: #{@fontSize}px}")
|
||||
styleTag.text(".editor {font-size: #{fontSize}px}")
|
||||
@redraw()
|
||||
|
||||
getFontSize: -> @fontSize
|
||||
getFontSize: ->
|
||||
parseInt(@css("font-size"))
|
||||
|
||||
setFontFamily: (@fontFamily) ->
|
||||
setFontFamily: (fontFamily) ->
|
||||
headTag = $("head")
|
||||
styleTag = headTag.find("style.font-family")
|
||||
if styleTag.length == 0
|
||||
styleTag = $$ -> @style class: 'font-family'
|
||||
headTag.append styleTag
|
||||
|
||||
styleTag.text(".editor {font-family: #{@fontFamily}}")
|
||||
styleTag.text(".editor {font-family: #{fontFamily}}")
|
||||
@redraw()
|
||||
|
||||
getFontFamily: -> @fontFamily
|
||||
getFontFamily: -> @css("font-family")
|
||||
|
||||
redraw: ->
|
||||
return unless @attached
|
||||
|
||||
Reference in New Issue
Block a user