Revert to default font when setFontFamily is set to null/undefined

This commit is contained in:
Corey Johnson & Nathan Sobo
2013-04-25 17:53:34 -07:00
committed by Corey Johnson & Kevin Sawicki
parent 1b98bf706e
commit b878be27a0

View File

@@ -1155,14 +1155,17 @@ class Editor extends View
#
# fontFamily - A {String} identifying the CSS `font-family`,
setFontFamily: (fontFamily) ->
return if fontFamily == undefined
headTag = $("head")
styleTag = headTag.find("style.editor-font-family")
if styleTag.length == 0
styleTag = $$ -> @style class: 'editor-font-family'
headTag.append styleTag
styleTag.text(".editor {font-family: #{fontFamily}}")
if fontFamily?
if styleTag.length == 0
styleTag = $$ -> @style class: 'editor-font-family'
headTag.append styleTag
styleTag.text(".editor {font-family: #{fontFamily}}")
else
styleTag.remove()
@redraw()
# Public: Gets the font family for the editor.