Skip to content

Commit bd002b9

Browse files
authored
Merge pull request #5518 from nextcloud/backport/5508/stable33
[stable33] fix(widget): allow to leave edit mode
2 parents 0d49883 + 5379b92 commit bd002b9

1 file changed

Lines changed: 15 additions & 10 deletions

File tree

src/view/Office.vue

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -69,17 +69,19 @@
6969
:src="iframeSrc"
7070
:title="iframeTitle" />
7171

72-
<NcButton v-if="isEmbedded && !hasWidgetEditingEnabled" class="toggle-interactive" @click="toggleEdit">
73-
{{ t('richdocuments', 'Edit') }}
72+
<NcButton v-if="isEmbedded" class="toggle-interactive" @click="toggleEdit">
73+
{{ toggleEditString }}
7474
<template #icon>
75-
<PencilIcon />
75+
<EyeIcon v-if="hasWidgetEditingEnabled" />
76+
<PencilIcon v-else />
7677
</template>
7778
</NcButton>
7879
<ZoteroHint :show.sync="showZotero" @submit="reload" />
7980
</div>
8081
</template>
8182

8283
<script>
84+
import EyeIcon from 'vue-material-design-icons/EyeOutline.vue'
8385
import PencilIcon from 'vue-material-design-icons/PencilOutline.vue'
8486
import NcButton from '@nextcloud/vue/dist/Components/NcButton.js'
8587
import NcEmptyContent from '@nextcloud/vue/dist/Components/NcEmptyContent.js'
@@ -141,6 +143,7 @@ export default {
141143
NcButton,
142144
NcEmptyContent,
143145
NcLoadingIcon,
146+
EyeIcon,
144147
PencilIcon,
145148
ZoteroHint,
146149
},
@@ -254,6 +257,11 @@ export default {
254257
showAdminWebsocketFailure() {
255258
return getCurrentUser()?.isAdmin && this.errorType === 'websocketconnectionfailed'
256259
},
260+
toggleEditString() {
261+
return this.hasWidgetEditingEnabled
262+
? t('richdocuments', 'Preview')
263+
: t('richdocuments', 'Edit')
264+
},
257265
},
258266
watch: {
259267
hasWidgetEditingEnabled() {
@@ -548,7 +556,7 @@ export default {
548556
},
549557
550558
toggleEdit() {
551-
this.hasWidgetEditingEnabled = true
559+
this.hasWidgetEditingEnabled = !this.hasWidgetEditingEnabled
552560
},
553561
554562
getDocumentTypeIcon() {
@@ -644,12 +652,9 @@ export default {
644652
max-height: calc(100vh - 120px) !important;
645653
646654
.toggle-interactive {
647-
position: sticky;
648-
bottom: 12px;
649-
right: 12px;
650-
z-index: 1;
651-
margin-left: auto;
652-
margin-right: 0;
655+
position: absolute;
656+
bottom: calc(var(--default-grid-baseline) * 2);
657+
right: calc(var(--default-grid-baseline) * 2);
653658
}
654659
}
655660

0 commit comments

Comments
 (0)