Skip to content

Commit

Permalink
Merge pull request #4278 from nextcloud/fix/viewer-wrapper
Browse files Browse the repository at this point in the history
fix: Apply viewer wrapper as we do it in text
  • Loading branch information
elzody authored Nov 29, 2024
2 parents 72238cc + faf758a commit 806f407
Show file tree
Hide file tree
Showing 4 changed files with 68 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/components/Modal/ZoteroHint.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
-->

<template>
<NcModal :show="show" @close="close" :name="t('richdocument', 'Link to your Zotero library')">
<NcModal :show="show" :name="t('richdocument', 'Link to your Zotero library')" @close="close">
<div class="zotero-hint">
<h2>{{ t('richdocument', 'Link to your Zotero library') }}</h2>
<BookOpenPageVariantOutline :size="96" />
Expand Down
2 changes: 1 addition & 1 deletion src/view/Office.vue
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,7 @@ export default {
FilesAppIntegration.updateFileInfo(undefined, Date.now())
}
disableScrollLock()
this.$parent.close()
this.$emit('close')
},
reload() {
this.loading = LOADING_STATE.LOADING
Expand Down
64 changes: 64 additions & 0 deletions src/view/Viewer.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
<!--
- SPDX-FileCopyrightText: 2023 Nextcloud GmbH and Nextcloud contributors
- SPDX-License-Identifier: AGPL-3.0-or-later
-->
<!--
- This component is a wrapper around the Office component to be used in the viewer
- We currently need this to isolate the vue instances
-->
<template>
<Office :filename="filename"
:fileid="fileid"
:has-preview="hasPreview"
:source="source"
:mime="mime"
:permissions="permissions"
:is-embedded="isEmbedded"
@close="$parent.close()"
@update:loaded="$emit('update:loaded', $event)" />
</template>
<script>
import Vue from 'vue'
import Office from './Office.vue'

Vue.prototype.t = t
Vue.prototype.n = n

export default {
name: 'Viewer',
components: {
Office: Vue.extend(Office),
},
props: {
filename: {
type: String,
default: null,
},
fileid: {
type: Number,
default: null,
},
hasPreview: {
type: Boolean,
required: false,
default: () => false,
},
source: {
type: String,
default: null,
},
mime: {
type: String,
default: null,
},
permissions: {
type: String,
default: '',
},
isEmbedded: {
type: Boolean,
default: false,
},
},
}
</script>
5 changes: 2 additions & 3 deletions src/viewer.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,9 @@
import './init-shared.js'
import '../css/filetypes.scss'

import Vue from 'vue'
import Office from './view/Office.vue'
import { getCapabilities } from './services/capabilities.ts'
import { autoSetupBuiltInCodeServerIfNeeded } from './services/builtInCode.ts'
import Viewer from './view/Viewer.vue'

const supportedMimes = getCapabilities().mimetypes

Expand All @@ -18,7 +17,7 @@ if (OCA.Viewer) {
id: 'richdocuments',
group: null,
mimes: supportedMimes,
component: Vue.extend(Office),
component: Viewer,
theme: 'default',
canCompare: true,
})
Expand Down

0 comments on commit 806f407

Please sign in to comment.