Skip to content

Commit

Permalink
fix: Isolate all used components for the viewer component from parent…
Browse files Browse the repository at this point in the history
… vue instance

Signed-off-by: Julius Härtl <[email protected]>
  • Loading branch information
juliusknorr committed Apr 3, 2024
1 parent 6001f7b commit 4badeff
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions src/components/ViewerComponent.vue
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
data-text-el="editor-container"
class="text-editor source-viewer">
<Component :is="readerComponent" :content="content" />
<NcButton class="toggle-interactive" @click="toggleEdit">
<NcButton v-if="isEmbedded" class="toggle-interactive" @click="toggleEdit">
{{ t('text', 'Edit') }}
<template #icon>
<PencilIcon />
Expand All @@ -45,22 +45,27 @@
</template>

<script>
import Vue from 'vue'
import axios from '@nextcloud/axios'
import PencilIcon from 'vue-material-design-icons/Pencil.vue'
import NcButton from '@nextcloud/vue/dist/Components/NcButton.js'
import PlainTextReader from './PlainTextReader.vue'
import RichTextReader from './RichTextReader.vue'
import { translate, translatePlural } from '@nextcloud/l10n'

import { getSharingToken } from '../helpers/token.js'
import getEditorInstance from './Editor.singleton.js'

Vue.prototype.t = translate
Vue.prototype.n = translatePlural

export default {
name: 'ViewerComponent',
components: {
NcButton,
PencilIcon,
RichTextReader,
PlainTextReader,
NcButton: Vue.extend(NcButton),
PencilIcon: Vue.extend(PencilIcon),
RichTextReader: Vue.extend(RichTextReader),
PlainTextReader: Vue.extend(PlainTextReader),
Editor: getEditorInstance,
},
provide() {
Expand Down Expand Up @@ -139,6 +144,7 @@ export default {
},

methods: {
t: translate,
async loadFileContent() {
if (this.useSourceView) {
const response = await axios.get(this.source)
Expand Down

0 comments on commit 4badeff

Please sign in to comment.