|
69 | 69 | :src="iframeSrc" |
70 | 70 | :title="iframeTitle" /> |
71 | 71 |
|
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 }} |
74 | 74 | <template #icon> |
75 | | - <PencilIcon /> |
| 75 | + <EyeIcon v-if="hasWidgetEditingEnabled" /> |
| 76 | + <PencilIcon v-else /> |
76 | 77 | </template> |
77 | 78 | </NcButton> |
78 | 79 | <ZoteroHint :show.sync="showZotero" @submit="reload" /> |
79 | 80 | </div> |
80 | 81 | </template> |
81 | 82 |
|
82 | 83 | <script> |
| 84 | +import EyeIcon from 'vue-material-design-icons/EyeOutline.vue' |
83 | 85 | import PencilIcon from 'vue-material-design-icons/PencilOutline.vue' |
84 | 86 | import NcButton from '@nextcloud/vue/dist/Components/NcButton.js' |
85 | 87 | import NcEmptyContent from '@nextcloud/vue/dist/Components/NcEmptyContent.js' |
@@ -141,6 +143,7 @@ export default { |
141 | 143 | NcButton, |
142 | 144 | NcEmptyContent, |
143 | 145 | NcLoadingIcon, |
| 146 | + EyeIcon, |
144 | 147 | PencilIcon, |
145 | 148 | ZoteroHint, |
146 | 149 | }, |
@@ -254,6 +257,11 @@ export default { |
254 | 257 | showAdminWebsocketFailure() { |
255 | 258 | return getCurrentUser()?.isAdmin && this.errorType === 'websocketconnectionfailed' |
256 | 259 | }, |
| 260 | + toggleEditString() { |
| 261 | + return this.hasWidgetEditingEnabled |
| 262 | + ? t('richdocuments', 'Preview') |
| 263 | + : t('richdocuments', 'Edit') |
| 264 | + }, |
257 | 265 | }, |
258 | 266 | watch: { |
259 | 267 | hasWidgetEditingEnabled() { |
@@ -548,7 +556,7 @@ export default { |
548 | 556 | }, |
549 | 557 |
|
550 | 558 | toggleEdit() { |
551 | | - this.hasWidgetEditingEnabled = true |
| 559 | + this.hasWidgetEditingEnabled = !this.hasWidgetEditingEnabled |
552 | 560 | }, |
553 | 561 |
|
554 | 562 | getDocumentTypeIcon() { |
@@ -644,12 +652,9 @@ export default { |
644 | 652 | max-height: calc(100vh - 120px) !important; |
645 | 653 |
|
646 | 654 | .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); |
653 | 658 | } |
654 | 659 | } |
655 | 660 |
|
|
0 commit comments