Skip to content

Commit

Permalink
Merge pull request #825 from nextcloud/perf/reference-entrypoint
Browse files Browse the repository at this point in the history
  • Loading branch information
juliusknorr authored Feb 21, 2024
2 parents 4cb0871 + 5c8f63e commit a908069
Showing 1 changed file with 11 additions and 10 deletions.
21 changes: 11 additions & 10 deletions src/reference.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
import { registerCustomPickerElement, registerWidget, NcCustomPickerRenderResult } from '@nextcloud/vue/dist/Components/NcRichText.js'
import Vue from 'vue'

import TablesSmartPicker from './views/SmartPicker.vue'
import { registerCustomPickerElement, registerWidget, NcCustomPickerRenderResult } from '@nextcloud/vue/dist/Functions/registerReference.js'

__webpack_nonce__ = btoa(OC.requestToken) // eslint-disable-line
__webpack_public_path__ = OC.linkTo('tables', 'js/') // eslint-disable-line

registerWidget('tables_link', async (el, { richObjectType, richObject, accessible }) => {
const { default: Vue } = await import(/* webpackChunkName: "reference-table-lazy" */'vue')
const { default: TableReferenceWidget } = await import(/* webpackChunkName: "reference-table-lazy" */'./views/LinkReferenceWidget.vue')
const { default: Vue } = await import('vue')
const { default: TableReferenceWidget } = await import('./views/LinkReferenceWidget.vue')
Vue.mixin({ methods: { t, n } })
const Widget = Vue.extend(TableReferenceWidget)
new Widget({
Expand All @@ -20,9 +17,11 @@ registerWidget('tables_link', async (el, { richObjectType, richObject, accessibl
}).$mount(el)
})

registerWidget('tables_content', async (el, { richObjectType, richObject, accessible }) => {
registerWidget('tables_content', async (el, { richObjectType, richObject, accessible, interactive = true }) => {
const { default: Vue } = await import(/* webpackChunkName: "reference-table-lazy" */'vue')
const { default: TableReferenceWidget } = await import(/* webpackChunkName: "reference-table-lazy" */'./views/ContentReferenceWidget.vue')
const { default: TableReferenceWidget } = interactive
? await import(/* webpackChunkName: "reference-table-lazy" */'./views/ContentReferenceWidget.vue')
: await import(/* webpackChunkName: "reference-table-lazy" */'./views/LinkReferenceWidget.vue')
Vue.mixin({ methods: { t, n } })
const Widget = Vue.extend(TableReferenceWidget)
new Widget({
Expand All @@ -32,9 +31,11 @@ registerWidget('tables_content', async (el, { richObjectType, richObject, access
accessible,
},
}).$mount(el)
})
}, () => {}, { hasInteractiveView: true })

registerCustomPickerElement('tables-ref-tables', (el, { providerId, accessible }) => {
registerCustomPickerElement('tables-ref-tables', async (el, { providerId, accessible }) => {
const { default: Vue } = await import('vue')
const { default: TablesSmartPicker } = await import('./views/SmartPicker.vue')
const Element = Vue.extend(TablesSmartPicker)
const vueElement = new Element({
propsData: {
Expand Down

0 comments on commit a908069

Please sign in to comment.