mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-11-14 14:13:43 +01:00
[ide-react] Notify about unsaved changes (#16163)
* Notify about unsaved changes * Move system message components and types to shared folder * Add system messages component GitOrigin-RevId: ab81a24888847bd9a8a390fd1af6b58f471f7a4b
This commit is contained in:
@@ -61,15 +61,28 @@ export class OpenDocuments {
|
||||
})
|
||||
}
|
||||
|
||||
private docsArray() {
|
||||
return Array.from(this.openDocs.values())
|
||||
}
|
||||
|
||||
hasUnsavedChanges() {
|
||||
return this.docsArray().some(doc => doc.hasBufferedOps())
|
||||
for (const doc of this.openDocs.values()) {
|
||||
if (doc.hasBufferedOps()) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
flushAll() {
|
||||
return this.docsArray().map(doc => doc.flush())
|
||||
for (const doc of this.openDocs.values()) {
|
||||
doc.flush()
|
||||
}
|
||||
}
|
||||
|
||||
unsavedDocIds() {
|
||||
const ids = []
|
||||
for (const [docId, doc] of this.openDocs) {
|
||||
if (!doc.pollSavedStatus()) {
|
||||
ids.push(docId)
|
||||
}
|
||||
}
|
||||
return ids
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user