1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
|
import { documentReady } from './helpers'
import {
FilesWorkspacePlugin,
registerFileActionFallback,
registerFileCreate,
} from './helpers/files'
import { openMimetypes } from './helpers/mime'
import { loadState } from '@nextcloud/initial-state'
__webpack_nonce__ = btoa(OC.requestToken) // eslint-disable-line
__webpack_public_path__ = OC.linkTo('text', 'js/') // eslint-disable-line
documentReady(() => {
const dir = document.getElementById('dir').value
const mimetype = document.getElementById('mimetype').value
const sharingToken = document.getElementById('sharingToken') ? document.getElementById('sharingToken').value : null
if (dir !== '') {
OC.Plugins.register('OCA.Files.FileList', FilesWorkspacePlugin)
registerFileActionFallback()
registerFileCreate()
} else {
// single file share
const container = document.createElement('div')
container.id = 'texteditor'
const body = document.getElementById('app-content')
body.appendChild(container)
if (openMimetypes.indexOf(mimetype) !== -1) {
Promise.all([
import(/* webpackChunkName: "vendor" */'vue'),
import(/* webpackChunkName: "editor" */'./components/EditorWrapper'),
]).then((imports) => {
const Vue = imports[0].default
Vue.prototype.t = window.t
Vue.prototype.OCA = window.OCA
const Editor = imports[1].default
const vm = new Vue({
render: h => h(Editor, {
props: {
active: true,
shareToken: sharingToken,
mime: mimetype,
},
}),
})
vm.$mount(document.getElementById('preview'))
})
}
}
})
OCA.Text = {
RichWorkspaceEnabled: loadState('text', 'workspace_available'),
}
|