Skip to content

Commit

Permalink
Show error popup when trying to switch to edit mode for read-only files
Browse files Browse the repository at this point in the history
  • Loading branch information
dschmidt committed Oct 27, 2023
1 parent d905033 commit 92554e5
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions packages/web-app-external/src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,13 @@ export default defineComponent({
const loadAppUrl = useTask(function* (signal, viewMode: string) {
try {
if (props.isReadOnly && viewMode === 'write') {
store.dispatch('showErrorMessage', {
title: $gettext('Cannot open file in edit mode as it is read-only')
})
return
}
const fileId = props.resource.fileId
const baseUrl = urlJoin(
configurationManager.serverUrl,
Expand Down Expand Up @@ -146,10 +153,6 @@ export default defineComponent({
const catchClickMicrosoftEdit = (event) => {
try {
if (JSON.parse(event.data)?.MessageId === 'UI_Edit') {
if (props.isReadOnly) {
console.error('Cannot switch to write mode as file is read-only')
return
}
loadAppUrl.perform('write')
}
} catch (e) {}
Expand Down

0 comments on commit 92554e5

Please sign in to comment.