mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
Merge pull request #6610 from overleaf/jk-better-editing-heartbeat
[web] CM6: improvements to editor heartbeat GitOrigin-RevId: b0e5379d221cba76c91d6d21863ca8355749d18e
This commit is contained in:
parent
fe1cb010b4
commit
ef4e137676
3 changed files with 20 additions and 13 deletions
|
@ -80,7 +80,8 @@ App.controller(
|
||||||
eventTracking,
|
eventTracking,
|
||||||
metadata,
|
metadata,
|
||||||
$q,
|
$q,
|
||||||
CobrandingDataService
|
CobrandingDataService,
|
||||||
|
$window
|
||||||
) {
|
) {
|
||||||
// Don't freak out if we're already in an apply callback
|
// Don't freak out if we're already in an apply callback
|
||||||
let err, pdfLayout, userAgent
|
let err, pdfLayout, userAgent
|
||||||
|
@ -256,8 +257,22 @@ If the project has been renamed please look in your project list for a new proje
|
||||||
return (_loaded = true)
|
return (_loaded = true)
|
||||||
})
|
})
|
||||||
|
|
||||||
$scope.$on('cursor:editor:update', eventTracking.editingSessionHeartbeat)
|
ide.editingSessionHeartbeat = () => {
|
||||||
$scope.$on('scroll:editor:update', eventTracking.editingSessionHeartbeat)
|
eventTracking.editingSessionHeartbeat()
|
||||||
|
}
|
||||||
|
|
||||||
|
$scope.$on('cursor:editor:update', () => {
|
||||||
|
ide.editingSessionHeartbeat()
|
||||||
|
})
|
||||||
|
$scope.$on('scroll:editor:update', () => {
|
||||||
|
ide.editingSessionHeartbeat()
|
||||||
|
})
|
||||||
|
|
||||||
|
angular.element($window).on('click', ide.editingSessionHeartbeat)
|
||||||
|
|
||||||
|
$scope.$on('$destroy', () =>
|
||||||
|
angular.element($window).off('click', ide.editingSessionHeartbeat)
|
||||||
|
)
|
||||||
|
|
||||||
const DARK_THEMES = [
|
const DARK_THEMES = [
|
||||||
'ambiance',
|
'ambiance',
|
||||||
|
|
|
@ -818,16 +818,6 @@ App.directive(
|
||||||
// deletes and then inserts document content
|
// deletes and then inserts document content
|
||||||
session.setAnnotations(scope.annotations)
|
session.setAnnotations(scope.annotations)
|
||||||
|
|
||||||
angular
|
|
||||||
.element($window)
|
|
||||||
.on('click', eventTracking.editingSessionHeartbeat)
|
|
||||||
|
|
||||||
scope.$on('$destroy', () =>
|
|
||||||
angular
|
|
||||||
.element($window)
|
|
||||||
.off('click', eventTracking.editingSessionHeartbeat)
|
|
||||||
)
|
|
||||||
|
|
||||||
if (scope.eventsBridge != null) {
|
if (scope.eventsBridge != null) {
|
||||||
session.on('changeScrollTop', onScroll)
|
session.on('changeScrollTop', onScroll)
|
||||||
}
|
}
|
||||||
|
|
|
@ -70,10 +70,12 @@ App.factory('eventTracking', function ($http, localStorage) {
|
||||||
},
|
},
|
||||||
|
|
||||||
editingSessionHeartbeat() {
|
editingSessionHeartbeat() {
|
||||||
|
sl_console.log('[Event] heartbeat trigger')
|
||||||
if (!(nextHeartbeat <= new Date())) {
|
if (!(nextHeartbeat <= new Date())) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sl_console.log('[Event] send heartbeat request')
|
||||||
_sendEditingSessionHeartbeat()
|
_sendEditingSessionHeartbeat()
|
||||||
|
|
||||||
heartbeatsSent++
|
heartbeatsSent++
|
||||||
|
|
Loading…
Reference in a new issue