Merge pull request #542 from sharelatex/ja-match-front-to-v1

Update font and line spacing in Ace to match OL v1
This commit is contained in:
James Allen 2018-05-09 12:24:37 +01:00 committed by GitHub
commit 78aefc2871
4 changed files with 16 additions and 0 deletions

View file

@ -321,5 +321,7 @@ module.exports = (app, webRouter, privateApiRouter, publicApiRouter)->
chatMessageBorderLightness : if isOl then "40%" else "70%"
chatMessageBgSaturation : if isOl then "85%" else "60%"
chatMessageBgLightness : if isOl then "40%" else "97%"
editorFontFamily : if isOl then '\\"Lucida Console\\", monospace' else null
editorLineHeight : if isOl then 1.6 else null
renderAnnouncements : !isOl
next()

View file

@ -69,6 +69,8 @@ div.full-size(
track-changes= "editor.trackChanges",
doc-id="editor.open_doc_id"
renderer-data="reviewPanel.rendererData"
font-family="ui.editorFontFamily"
line-height="ui.editorLineHeight"
)
!= moduleIncludes('editor:body', locals)

View file

@ -80,6 +80,8 @@ define [
miniReviewPanelVisible: false
chatResizerSizeOpen: window.uiConfig.chatResizerSizeOpen
chatResizerSizeClosed: window.uiConfig.chatResizerSizeClosed
editorFontFamily: window.uiConfig.editorFontFamily
editorLineHeight: window.uiConfig.editorLineHeight
}
$scope.user = window.user

View file

@ -70,6 +70,8 @@ define [
trackChangesEnabled: "="
docId: "="
rendererData: "="
lineHeight: "="
fontFamily: "="
}
link: (scope, element, attrs) ->
# Don't freak out if we're already in an apply callback
@ -279,6 +281,14 @@ define [
"font-size": value + "px"
})
scope.$watch "fontFamily", (value) ->
if value?
editor.setOption('fontFamily', value)
scope.$watch "lineHeight", (value) ->
if value?
editor.container.style.lineHeight = value
scope.$watch "sharejsDoc", (sharejs_doc, old_sharejs_doc) ->
if old_sharejs_doc?
detachFromAce(old_sharejs_doc)