diff --git a/services/web/public/coffee/ide.coffee b/services/web/public/coffee/ide.coffee index 3f6497cdc3..45906c2e1a 100644 --- a/services/web/public/coffee/ide.coffee +++ b/services/web/public/coffee/ide.coffee @@ -22,6 +22,7 @@ define [ "directives/scroll" "directives/onEnter" "filters/formatDate" + "main/event-tracking" ], ( App FileTreeManager diff --git a/services/web/public/coffee/ide/editor/directives/aceEditor.coffee b/services/web/public/coffee/ide/editor/directives/aceEditor.coffee index 5f2eceffab..a92f2bd003 100644 --- a/services/web/public/coffee/ide/editor/directives/aceEditor.coffee +++ b/services/web/public/coffee/ide/editor/directives/aceEditor.coffee @@ -18,7 +18,7 @@ define [ url = ace.config._moduleUrl(args...) + "?fingerprint=#{window.aceFingerprint}" return url - App.directive "aceEditor", ["$timeout", "$compile", "$rootScope", ($timeout, $compile, $rootScope) -> + App.directive "aceEditor", ($timeout, $compile, $rootScope, event_tracking) -> monkeyPatchSearch($rootScope, $compile) return { @@ -142,7 +142,11 @@ define [ session.setMode("ace/mode/latex") session.setAnnotations scope.annotations - emitChange = () -> + updateCount = 0 + onChange = () -> + updateCount++ + if updateCount == 100 + event_tracking.send 'editor-interaction', 'multi-doc-update' scope.$emit "#{scope.name}:change" attachToAce = (sharejs_doc) -> @@ -152,7 +156,7 @@ define [ session = editor.getSession() doc = session.getDocument() - doc.on "change", emitChange + doc.on "change", onChange sharejs_doc.on "remoteop.recordForUndo", () => undoManager.nextUpdateIsRemote = true @@ -167,7 +171,7 @@ define [ session = editor.getSession() doc = session.getDocument() - doc.off "change", emitChange + doc.off "change", onChange template: """