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: """
@@ -239,7 +243,6 @@ define [
""" } - ] monkeyPatchSearch = ($rootScope, $compile) -> SearchBox = ace.require("ace/ext/searchbox").SearchBox diff --git a/services/web/public/coffee/ide/pdf/controllers/PdfController.coffee b/services/web/public/coffee/ide/pdf/controllers/PdfController.coffee index 48405c3c26..6cb85b2146 100644 --- a/services/web/public/coffee/ide/pdf/controllers/PdfController.coffee +++ b/services/web/public/coffee/ide/pdf/controllers/PdfController.coffee @@ -2,7 +2,7 @@ define [ "base" "libs/latex-log-parser" ], (App, LogParser) -> - App.controller "PdfController", ["$scope", "$http", "ide", "$modal", "synctex", ($scope, $http, ide, $modal, synctex) -> + App.controller "PdfController", ($scope, $http, ide, $modal, synctex, event_tracking) -> autoCompile = true $scope.$on "project:joined", () -> return if !autoCompile @@ -93,9 +93,17 @@ define [ return path + compileCount = 0 $scope.recompile = (options = {}) -> return if $scope.pdf.compiling $scope.pdf.compiling = true + + if !options.isAutoCompile + compileCount++ + if compileCount == 1 + event_tracking.send('editor-interaction', 'single-compile') + else if compileCount == 3 + event_tracking.send('editor-interaction', 'multi-compile') options.rootDocOverride_id = getRootDocOverride_id() @@ -163,7 +171,6 @@ define [ $scope.switchToFlatLayout() if pdfLayout == "flat" else $scope.switchToSideBySideLayout() - ] App.factory "synctex", ["ide", "$http", "$q", (ide, $http, $q) -> synctex =