From dc6110db8d2b269307f425d53908c6e09dbcbaee Mon Sep 17 00:00:00 2001 From: Brian Gough Date: Thu, 16 Nov 2017 11:32:08 +0000 Subject: [PATCH 1/2] 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. --- .../web/public/coffee/ide/editor/directives/aceEditor.coffee | 2 ++ 1 file changed, 2 insertions(+) diff --git a/services/web/public/coffee/ide/editor/directives/aceEditor.coffee b/services/web/public/coffee/ide/editor/directives/aceEditor.coffee index 577a3a0e75..12d3cc7b5b 100644 --- a/services/web/public/coffee/ide/editor/directives/aceEditor.coffee +++ b/services/web/public/coffee/ide/editor/directives/aceEditor.coffee @@ -356,6 +356,7 @@ define [ session.setOption("useWorker", scope.syntaxValidation); # now attach session to editor + editor.setReadOnly(true) editor.setSession(session) doc = session.getDocument() @@ -364,6 +365,7 @@ define [ editor.initing = true sharejs_doc.attachToAce(editor) editor.initing = false + editor.setReadOnly(false) resetScrollMargins() From bd09ef81f24969f5eba978b950086b19ba616276 Mon Sep 17 00:00:00 2001 From: Brian Gough Date: Thu, 16 Nov 2017 15:41:16 +0000 Subject: [PATCH 2/2] added comments --- .../web/public/coffee/ide/editor/directives/aceEditor.coffee | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/services/web/public/coffee/ide/editor/directives/aceEditor.coffee b/services/web/public/coffee/ide/editor/directives/aceEditor.coffee index 12d3cc7b5b..79aad26221 100644 --- a/services/web/public/coffee/ide/editor/directives/aceEditor.coffee +++ b/services/web/public/coffee/ide/editor/directives/aceEditor.coffee @@ -356,7 +356,7 @@ define [ session.setOption("useWorker", scope.syntaxValidation); # now attach session to editor - editor.setReadOnly(true) + editor.setReadOnly(true) # set to readonly until document change handlers are attached editor.setSession(session) doc = session.getDocument() @@ -365,7 +365,8 @@ define [ editor.initing = true sharejs_doc.attachToAce(editor) editor.initing = false - editor.setReadOnly(false) + # now ready to edit document + editor.setReadOnly(scope.readOnly) # respect the readOnly setting, normally false resetScrollMargins()