-
Notifications
You must be signed in to change notification settings - Fork 115
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Use Close_Session post message to properly end the Collabora edi…
…ting before opening locally Signed-off-by: Julius Härtl <[email protected]>
- Loading branch information
1 parent
4d2712d
commit 14f9f92
Showing
4 changed files
with
47 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
/* | ||
* @copyright Copyright (c) 2023 Julius Härtl <[email protected]> | ||
* @copyright Copyright (c) 2023 Julius Härtl <[email protected]> | ||
* | ||
* @author Julius Härtl <[email protected]> | ||
* | ||
|
@@ -36,20 +36,6 @@ export default { | |
startOpenLocalProcess() { | ||
this.showOpenLocalConfirmation() | ||
}, | ||
async unlockAndOpenLocally() { | ||
if (this.openingLocally) { | ||
let shouldContinue = true | ||
try { | ||
await this.unlockFile() | ||
} catch (e) { | ||
shouldContinue = e.response.status === 400 | ||
} | ||
|
||
if (shouldContinue) { | ||
this.openLocally() | ||
} | ||
} | ||
}, | ||
|
||
showOpenLocalConfirmation() { | ||
window.OC.dialogs.confirmDestructive( | ||
|
@@ -66,8 +52,20 @@ export default { | |
return | ||
} | ||
this.openingLocally = true | ||
this.sendPostMessage('Get_Views') | ||
}) | ||
this.postMessage.registerPostMessageHandler(this.handleCloseSession) | ||
this.sendPostMessage('Action_Save', { | ||
DontTerminateEdit: false, | ||
DontSaveIfUnmodified: false, | ||
Notify: false, | ||
}) | ||
this.sendPostMessage('Close_Session') | ||
}, | ||
) | ||
}, | ||
|
||
handleCloseSession() { | ||
this.postMessage.unregisterPostMessageHandler(this.handleCloseSession) | ||
this.openLocally() | ||
}, | ||
|
||
showOpenLocalFinished() { | ||
|
@@ -91,8 +89,9 @@ export default { | |
return | ||
} | ||
this.openingLocally = true | ||
this.sendPostMessage('Get_Views') | ||
}) | ||
this.openLocally() | ||
}, | ||
) | ||
}, | ||
|
||
unlockFile() { | ||
|
@@ -114,7 +113,7 @@ export default { | |
|
||
this.showOpenLocalFinished(url, window.top) | ||
this.close() | ||
window.location.href = url | ||
window.open(url, '_self') | ||
}) | ||
} | ||
}, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters