From 93cd752e244c36c471f8a576a486effc46613864 Mon Sep 17 00:00:00 2001 From: Jakob Ackermann Date: Thu, 11 Feb 2021 09:42:19 +0000 Subject: [PATCH] Merge pull request #3646 from overleaf/jpa-narrow-global-watch-dog-scope [frontend] aceEditor: narrow down the scope of the global watch dog GitOrigin-RevId: 610c771eb6e4dc04acfe0a6ba6e5be7796aaeb87 --- .../frontend/js/ide/editor/directives/aceEditor.js | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/services/web/frontend/js/ide/editor/directives/aceEditor.js b/services/web/frontend/js/ide/editor/directives/aceEditor.js index 0244d48fb7..3bc583ab94 100644 --- a/services/web/frontend/js/ide/editor/directives/aceEditor.js +++ b/services/web/frontend/js/ide/editor/directives/aceEditor.js @@ -117,10 +117,15 @@ App.directive('aceEditor', function( const editor = ace.edit(element.find('.ace-editor-body')[0]) editor.$blockScrolling = Infinity - // end-to-end check for edits -> acks, globally on any doc - // This may catch a missing attached ShareJsDoc that in turn bails out - // on missing acks. - ide.globalEditorWatchdogManager.attachToEditor('Ace', editor) + // Besides the main editor, other elements will re-use this directive + // for displaying read-only content -- e.g. the history panes. + const editorAcceptsChanges = attrs.aceEditor === 'editor' + if (editorAcceptsChanges) { + // end-to-end check for edits -> acks, globally on any doc + // This may catch a missing attached ShareJsDoc that in turn bails out + // on missing acks. + ide.globalEditorWatchdogManager.attachToEditor('Ace', editor) + } // auto-insertion of braces, brackets, dollars editor.setOption('behavioursEnabled', scope.autoPairDelimiters || false)