Track clicks anywhere on the window as activity when the editor is open

This commit is contained in:
Alberto Fernández Capel 2018-01-25 16:22:19 +00:00
parent a68489a604
commit 839ea496f1

View file

@ -36,7 +36,7 @@ define [
url = ace.config._moduleUrl(args...)
return url
App.directive "aceEditor", ($timeout, $compile, $rootScope, event_tracking, localStorage, $cacheFactory, metadata, graphics, preamble, files, $http, $q) ->
App.directive "aceEditor", ($timeout, $compile, $rootScope, event_tracking, localStorage, $cacheFactory, metadata, graphics, preamble, files, $http, $q, $window) ->
monkeyPatchSearch($rootScope, $compile)
return {
@ -376,8 +376,16 @@ define [
# deletes and then inserts document content
session.setAnnotations scope.annotations
session.on "changeScrollTop", event_tracking.editingSessionHeartbeat
angular.element($window).on('click',
event_tracking.editingSessionHeartbeat)
scope.$on "$destroy", () ->
angular.element($window).off('click',
event_tracking.editingSessionHeartbeat)
if scope.eventsBridge?
session.on "changeScrollTop", onScroll