Fix display of annotations when switching files in ace editor

The annotations (error markers) were not preserved when switching
between files.  The setAnnotations method was being called before the
document is ready -- when the document is attached to ace the content
is deleted and reinserted, which caused the annotations to be removed.
To fix the problem we set the annotations after attaching.
This commit is contained in:
Brian Gough 2015-04-08 14:39:39 +01:00
parent 10cd5186c2
commit 2ed934120c

View file

@ -170,8 +170,6 @@ define [
session = editor.getSession()
session.setUseWrapMode(true)
session.setMode("ace/mode/latex")
session.setAnnotations scope.annotations
updateCount = 0
onChange = () ->
@ -193,6 +191,9 @@ define [
undoManager.nextUpdateIsRemote = true
sharejs_doc.attachToAce(editor)
# need to set annotations after attaching because attaching
# deletes and then inserts document content
session.setAnnotations scope.annotations
editor.focus()