Просмотр исходного кода

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.
Brian Gough 11 лет назад
Родитель
Сommit
2ed934120c
1 измененных файлов с 3 добавлено и 2 удалено
  1. 3 2
      services/web/public/coffee/ide/editor/directives/aceEditor.coffee

+ 3 - 2
services/web/public/coffee/ide/editor/directives/aceEditor.coffee

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