mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-07 20:31:06 -05:00
Merge pull request #2800 from overleaf/jpa-force-flush-onblur
[frontend] EditorManager: flush the documents as the editor looses focus GitOrigin-RevId: 9157eba091e21c80202448b6c28c22dddd8cb687
This commit is contained in:
parent
a9d107fbc9
commit
e1cc614da7
1 changed files with 9 additions and 0 deletions
|
@ -75,6 +75,15 @@ define([
|
||||||
this.$scope.$on('flush-changes', () => {
|
this.$scope.$on('flush-changes', () => {
|
||||||
return Document.flushAll()
|
return Document.flushAll()
|
||||||
})
|
})
|
||||||
|
window.addEventListener('blur', () => {
|
||||||
|
// The browser may put the tab into sleep as it looses focus.
|
||||||
|
// Flushing the documents should help with keeping the documents in
|
||||||
|
// sync: we can use any new version of the doc that the server may
|
||||||
|
// present us. There should be no need to insert local changes into
|
||||||
|
// the doc history as the user comes back.
|
||||||
|
sl_console.log('[EditorManager] forcing flush onblur')
|
||||||
|
Document.flushAll()
|
||||||
|
})
|
||||||
|
|
||||||
this.$scope.$watch('editor.wantTrackChanges', value => {
|
this.$scope.$watch('editor.wantTrackChanges', value => {
|
||||||
if (value == null) {
|
if (value == null) {
|
||||||
|
|
Loading…
Reference in a new issue