Skip to content

Commit

Permalink
Fix talk integration
Browse files Browse the repository at this point in the history
Signed-off-by: Raimund Schlüßler <[email protected]>
  • Loading branch information
raimund-schluessler committed May 3, 2022
1 parent fc2836e commit 67f690e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 19 deletions.
24 changes: 9 additions & 15 deletions src/helpers/selector.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,27 +25,21 @@
*/
import store from '../store/store.js'

import Vue from 'vue'
import { createApp } from 'vue'

const buildSelector = (selector, propsData = {}) => {
return new Promise((resolve, reject) => {
const container = document.createElement('div')
document.getElementById('body-user').append(container)
const View = Vue.extend(selector)
const ComponentVM = new View({
propsData,
store,
}).$mount(container)
ComponentVM.$root.$on('close', () => {
ComponentVM.$el.remove()
ComponentVM.$destroy()
reject(new Error('Selection canceled'))
})
ComponentVM.$root.$on('select', (id) => {
ComponentVM.$el.remove()
ComponentVM.$destroy()
resolve(id)
const dialog = createApp(selector, {
...propsData,
onClose() {
dialog.$el.remove()
reject(new Error('Selection canceled'))
},
})
.use(store)
.mount(container)
})
}

Expand Down
4 changes: 0 additions & 4 deletions src/talk.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,16 +35,12 @@ import { getRequestToken } from '@nextcloud/auth'
import { translate as t, translatePlural as n } from '@nextcloud/l10n'
import { generateUrl, generateFilePath } from '@nextcloud/router'

import Vue from 'vue'

// eslint-disable-next-line
__webpack_nonce__ = btoa(getRequestToken())

// eslint-disable-next-line
__webpack_public_path__ = generateFilePath('tasks', '', 'js/')

Vue.prototype.$OCA = OCA

window.addEventListener('DOMContentLoaded', () => {
if (!window.OCA?.Talk?.registerMessageAction) {
return
Expand Down

0 comments on commit 67f690e

Please sign in to comment.