Skip to content

Commit 7ff11fd

Browse files
authored
Merge pull request #5517 from nextcloud/backport/5508/stable32
[stable32] fix(widget): allow to leave edit mode
2 parents 33c8d1c + 48d858e commit 7ff11fd

File tree

1 file changed

+15
-10
lines changed

1 file changed

+15
-10
lines changed

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'
@@ -139,6 +141,7 @@ export default {
139141
NcButton,
140142
NcEmptyContent,
141143
NcLoadingIcon,
144+
EyeIcon,
142145
PencilIcon,
143146
ZoteroHint,
144147
},
@@ -249,6 +252,11 @@ export default {
249252
showAdminWebsocketFailure() {
250253
return getCurrentUser()?.isAdmin && this.errorType === 'websocketconnectionfailed'
251254
},
255+
toggleEditString() {
256+
return this.hasWidgetEditingEnabled
257+
? t('richdocuments', 'Preview')
258+
: t('richdocuments', 'Edit')
259+
},
252260
},
253261
watch: {
254262
hasWidgetEditingEnabled() {
@@ -537,7 +545,7 @@ export default {
537545
},
538546
539547
toggleEdit() {
540-
this.hasWidgetEditingEnabled = true
548+
this.hasWidgetEditingEnabled = !this.hasWidgetEditingEnabled
541549
},
542550
543551
},
@@ -578,12 +586,9 @@ export default {
578586
max-height: calc(100vh - 120px) !important;
579587
580588
.toggle-interactive {
581-
position: sticky;
582-
bottom: 12px;
583-
right: 12px;
584-
z-index: 1;
585-
margin-left: auto;
586-
margin-right: 0;
589+
position: absolute;
590+
bottom: calc(var(--default-grid-baseline) * 2);
591+
right: calc(var(--default-grid-baseline) * 2);
587592
}
588593
}
589594

0 commit comments

Comments
 (0)