|
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' |
@@ -139,6 +141,7 @@ export default { |
139 | 141 | NcButton, |
140 | 142 | NcEmptyContent, |
141 | 143 | NcLoadingIcon, |
| 144 | + EyeIcon, |
142 | 145 | PencilIcon, |
143 | 146 | ZoteroHint, |
144 | 147 | }, |
@@ -249,6 +252,11 @@ export default { |
249 | 252 | showAdminWebsocketFailure() { |
250 | 253 | return getCurrentUser()?.isAdmin && this.errorType === 'websocketconnectionfailed' |
251 | 254 | }, |
| 255 | + toggleEditString() { |
| 256 | + return this.hasWidgetEditingEnabled |
| 257 | + ? t('richdocuments', 'Preview') |
| 258 | + : t('richdocuments', 'Edit') |
| 259 | + }, |
252 | 260 | }, |
253 | 261 | watch: { |
254 | 262 | hasWidgetEditingEnabled() { |
@@ -537,7 +545,7 @@ export default { |
537 | 545 | }, |
538 | 546 |
|
539 | 547 | toggleEdit() { |
540 | | - this.hasWidgetEditingEnabled = true |
| 548 | + this.hasWidgetEditingEnabled = !this.hasWidgetEditingEnabled |
541 | 549 | }, |
542 | 550 |
|
543 | 551 | }, |
@@ -578,12 +586,9 @@ export default { |
578 | 586 | max-height: calc(100vh - 120px) !important; |
579 | 587 |
|
580 | 588 | .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); |
587 | 592 | } |
588 | 593 | } |
589 | 594 |
|
|
0 commit comments