diff --git a/src/view/FilesAppIntegration.js b/src/view/FilesAppIntegration.js index 970ab4e7c7..99a5e4da7e 100644 --- a/src/view/FilesAppIntegration.js +++ b/src/view/FilesAppIntegration.js @@ -116,7 +116,7 @@ export default { const newFileModel = oldFile.clone() newFileModel.set('id', node.fileid) newFileModel.set('name', newName) - newFileModel.set('mtime', Date.now()) + newFileModel.set('mtime', node.mtime?.getTime()) this.getFileList() .add(newFileModel.toJSON()) } @@ -487,6 +487,13 @@ export default { } }, + async refreshFileInfo() { + const node = await this.getFileNode(true) + if (node) { + emit('files:node:updated', node) + } + }, + async updateFileInfo(name, mtime) { const node = await this.getFileNode() diff --git a/src/view/Office.vue b/src/view/Office.vue index 2b008b9332..6056af86b9 100644 --- a/src/view/Office.vue +++ b/src/view/Office.vue @@ -406,7 +406,7 @@ export default { close() { FilesAppIntegration.close() if (this.modified) { - FilesAppIntegration.updateFileInfo(undefined, Date.now()) + FilesAppIntegration.refreshFileInfo() } disableScrollLock() this.restoreFavicon() @@ -526,7 +526,7 @@ export default { this.switchToSavedAsFile(newFileName) } else { // When saving the current file, update its modification time - FilesAppIntegration.updateFileInfo(undefined, Date.now()) + FilesAppIntegration.refreshFileInfo() } } break @@ -580,19 +580,11 @@ export default { case 'Action_GetLinkPreview': this.resolveLink(args.url) break - case 'Action_Save': - if (this.modified) { - FilesAppIntegration.updateFileInfo(undefined, Date.now()) - } - break - case 'UI_Save': - FilesAppIntegration.updateFileInfo(undefined, Date.now()) - break case 'Clicked_Button': this.buttonClicked(args) break case 'Doc_ModifiedStatus': - if (args.Modified !== this.modified && !this.openingLocally) { + if (this.modified && !args.Modified && !this.openingLocally) { FilesAppIntegration.updateFileInfo(undefined, Date.now()) } this.modified = args.Modified