Don't store fontSize and fontFamily as instance variables

This commit is contained in:
Corey Johnson
2013-01-30 12:13:20 -08:00
parent 29ccd271de
commit 9b1cb29e1f
2 changed files with 8 additions and 7 deletions

View File

@@ -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