Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/apis/connect.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ export async function open(
/**
* Update the guest name
* @param guestName the name to use for the local user
* @param connection connection to close
* @param connection connection to update the guest name for
*/
export async function update(
guestName: string,
Expand Down
32 changes: 0 additions & 32 deletions src/components/Editor.singleton.js

This file was deleted.

14 changes: 6 additions & 8 deletions src/components/ViewerComponent.vue
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,18 @@

<script>
import { getSharingToken } from '@nextcloud/sharing/public'
import getEditorInstance from './Editor.singleton.js'
import { defineComponent } from 'vue'
import Editor from './Editor.vue'
import SourceView from './SourceView.vue'

export default {
export default defineComponent({
name: 'ViewerComponent',
components: {
SourceView,
Editor: getEditorInstance,
Editor,
},
inheritAttrs: false,
provide() {

Check warning on line 40 in src/components/ViewerComponent.vue

View workflow job for this annotation

GitHub Actions / NPM lint

The "provide" property should be above the "inheritAttrs" property on line 39
return {
isEmbedded: this.isEmbedded,
}
Expand Down Expand Up @@ -65,10 +67,6 @@
type: String,
default: null,
},
permissions: {
type: String,
default: '',
},
source: {
type: String,
default: undefined,
Expand Down Expand Up @@ -112,7 +110,7 @@
},
t,
},
}
})
</script>
<style lang="scss" scoped>
.text-editor:not(.viewer__file--hidden) {
Expand Down
4 changes: 2 additions & 2 deletions src/viewer.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ import { openMimetypesMarkdown, openMimetypesPlainText } from './helpers/mime.js
* Wrapper for async registration of ViewerComponent.
* Note: it should be named function - the name is used for component registration.
*
* @return {Promise<import('./components/ViewerComponent.vue')>} ViewerComponent
* @return {Promise<import('./views/ViewerView.js')>} ViewerComponent
*/
function AsyncTextViewerComponent() {
return import('./components/ViewerComponent.vue')
return import('./views/ViewerView.js')
}

if (typeof OCA.Viewer === 'undefined') {
Expand Down
4 changes: 2 additions & 2 deletions src/views/RichWorkspace.vue
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ import { t } from '@nextcloud/l10n'
import { generateOcsUrl } from '@nextcloud/router'
import { getSharingToken, isPublicShare } from '@nextcloud/sharing/public'

import getEditorInstance from '../components/Editor.singleton.js'
import Editor from '../components/Editor.vue'
import RichTextReader from '../components/RichTextReader.vue'

const IS_PUBLIC = isPublicShare()
Expand All @@ -58,7 +58,7 @@ export default {
name: 'RichWorkspace',
components: {
RichTextReader,
Editor: getEditorInstance,
Editor,
},
props: {
content: {
Expand Down
40 changes: 40 additions & 0 deletions src/views/ViewerView.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
/**
* SPDX-FileCopyrightText: 2025 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later
*/

import Vue, { defineComponent } from 'vue'
import ViewerComponent from '../components/ViewerComponent.vue'

// The vue instance used inside text constructed with the import above.
let innerVue

/**
* This thin Component wrapper can be rendered inside the viewer.
*
* The viewers vue instance is used for this component as it simply exports
* the options for the options api.
*
* When mounted this component constructs the vue instance
* used inside text based on texts vue import.
*/
export default defineComponent({
name: 'ViewerView',
render: (h) => h('div'),
props: ViewerComponent.props,
mounted() {
innerVue = new Vue({
render: (h) => {
return h(ViewerComponent, {
attrs: this.$attrs,
props: this.$props,
on: this.$listeners,
})
},
})
innerVue.$mount(this.$el)
},
beforeDestroy() {
innerVue.$destroy()
},
})
Loading