mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
Report unsaved changes after 60 seconds
This commit is contained in:
parent
f40e984e10
commit
2476c1e868
1 changed files with 8 additions and 0 deletions
|
@ -24,6 +24,8 @@ define [
|
||||||
if oldStatus[doc_id]?
|
if oldStatus[doc_id]?
|
||||||
newStatus[doc_id] = oldStatus[doc_id]
|
newStatus[doc_id] = oldStatus[doc_id]
|
||||||
newStatus[doc_id].unsavedSeconds += 1
|
newStatus[doc_id].unsavedSeconds += 1
|
||||||
|
if newStatus[doc_id].unsavedSeconds == 60
|
||||||
|
reportUnsavedChanges(doc)
|
||||||
else
|
else
|
||||||
newStatus[doc_id] = {
|
newStatus[doc_id] = {
|
||||||
unsavedSeconds: 0
|
unsavedSeconds: 0
|
||||||
|
@ -39,6 +41,12 @@ define [
|
||||||
$scope.docSavingStatusCount = newUnsavedCount
|
$scope.docSavingStatusCount = newUnsavedCount
|
||||||
$scope.$apply()
|
$scope.$apply()
|
||||||
|
|
||||||
|
reportUnsavedChanges = (doc) ->
|
||||||
|
ide.reportError new Error("unsaved changes"), {
|
||||||
|
inflightOp: doc?.getInflightOp(),
|
||||||
|
pendingOp: doc?.getPendingOp()
|
||||||
|
}
|
||||||
|
|
||||||
warnAboutUnsavedChanges = () ->
|
warnAboutUnsavedChanges = () ->
|
||||||
if Document.hasUnsavedChanges()
|
if Document.hasUnsavedChanges()
|
||||||
return "You have unsaved changes. If you leave now they will not be saved."
|
return "You have unsaved changes. If you leave now they will not be saved."
|
||||||
|
|
Loading…
Reference in a new issue