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

put ace in readonly mode when changing session

if the session fails to attach successfully (e.g due to an exception in
the changeSession event handler) the editor will be left in a state
where the user will not be able to enter any text.  This should at least
cause them to reload the editor.
Brian Gough 9 лет назад
Родитель
Сommit
dc6110db8d
1 измененных файлов с 2 добавлено и 0 удалено
  1. 2 0
      services/web/public/coffee/ide/editor/directives/aceEditor.coffee

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

@@ -356,6 +356,7 @@ define [
 						session.setOption("useWorker", scope.syntaxValidation);
 						session.setOption("useWorker", scope.syntaxValidation);
 
 
 					# now attach session to editor
 					# now attach session to editor
+					editor.setReadOnly(true)
 					editor.setSession(session)
 					editor.setSession(session)
 
 
 					doc = session.getDocument()
 					doc = session.getDocument()
@@ -364,6 +365,7 @@ define [
 					editor.initing = true
 					editor.initing = true
 					sharejs_doc.attachToAce(editor)
 					sharejs_doc.attachToAce(editor)
 					editor.initing = false
 					editor.initing = false
+					editor.setReadOnly(false)
 
 
 					resetScrollMargins()
 					resetScrollMargins()