Răsfoiți Sursa

Merge pull request #331 from sharelatex/ja-autocomplete-fix

Potential fix for the auto-complete bug
James Allen 8 ani în urmă
părinte
comite
a427414920

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

@@ -91,8 +91,8 @@ define [
 					else
 						editor.setOption('behavioursEnabled', false)
 
-				window.editors ||= []
-				window.editors.push editor
+				window._debug_editors ||= []
+				window._debug_editors.push editor
 
 				scope.name = attrs.aceEditor
 
@@ -428,7 +428,10 @@ define [
 						rendererData.lineHeight = editor.renderer.lineHeight
 
 				scope.$on '$destroy', () ->
-					detachFromAce(scope.sharejsDoc)
+					if scope.sharejsDoc?
+						detachFromAce(scope.sharejsDoc)
+
+				scope.$emit "#{scope.name}:inited", editor
 
 			template: """
 				<div class="ace-editor-wrapper">

+ 1 - 1
services/web/public/coffee/ide/editor/directives/aceEditor/auto-complete/AutoCompleteManager.coffee

@@ -224,7 +224,7 @@ define [
 					#   is likely to end up with `\href{}ref{}`
 					if !data?
 						completions = this.completions
-						popup = editor.completer.popup
+						popup = this.popup
 						data = popup.getData(popup.getRow())
 						data.completer =
 							insertMatch: (editor, matchData) ->