There was an error while loading. Please reload this page.
2 parents 7d4ea16 + 3a1cd92 commit 00e5cfeCopy full SHA for 00e5cfe
1 file changed
src/viewer.js
@@ -28,5 +28,20 @@ if (typeof OCA.Viewer === 'undefined') {
28
group: null,
29
theme: 'default',
30
canCompare: true,
31
+ downloadCallback: async (fileInfo) => {
32
+ // Save any unsaved changes before download
33
+ const editors = window.OCA?.Text?.editorComponents
34
+ if (editors instanceof Set) {
35
+ for (const editor of editors) {
36
+ if (editor?.fileId === fileInfo.fileid && editor?.dirty) {
37
+ logger.debug('Saving file before download', {
38
+ fileId: fileInfo.fileid,
39
+ })
40
+ await editor.save()
41
+ return
42
+ }
43
44
45
+ },
46
})
47
}
0 commit comments