-
Notifications
You must be signed in to change notification settings - Fork 126
/
Table.ts
48 lines (44 loc) · 1.79 KB
/
Table.ts
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
import { Table as TableOriginal } from 'tiptap-extensions'
import { VuetifyIconsGroups } from '~/configs/theme'
import VuetifyIcon from '~/extensions/nativeExtensions/icons/VuetifyIcon'
import AbstractExtension from '~/extensions/AbstractExtension'
import ExtensionActionInterface from '~/extensions/actions/ExtensionActionInterface'
import Vue from 'vue'
import ExtensionActionRenderBtn from '~/extensions/actions/renders/btn/ExtensionActionRenderBtn.ts'
import TableWindow from '~/extensions/nativeExtensions/table/TableWindow.vue'
export default class Table extends AbstractExtension {
constructor (options) {
super(options, TableOriginal)
}
get availableActions (): ExtensionActionInterface[] {
const nativeExtensionName = 'table'
return [
{
render: new ExtensionActionRenderBtn({
tooltip: 'TODO',
icons: {
[VuetifyIconsGroups.md]: new VuetifyIcon('table'),
[VuetifyIconsGroups.fa]: new VuetifyIcon('fas fa-table'),
[VuetifyIconsGroups.mdi]: new VuetifyIcon('mdi-table'),
[VuetifyIconsGroups.mdiSvg]: new VuetifyIcon('M8.5,13.5L11,16.5L14.5,12L19,18H5M21,19V5C21,3.89 20.1,3 19,3H5A2,2 0 0,0 3,5V19A2,2 0 0,0 5,21H19A2,2 0 0,0 21,19Z')
},
nativeExtensionName,
async onClick ({ context, editor }) {
const WindowComponent = Vue.extend(TableWindow)
const instance = new WindowComponent({
vuetify: Vue.prototype.tiptapVuetifyPlugin.vuetify,
propsData: {
value: true,
nativeExtensionName,
context,
editor
}
})
instance.$mount()
document.querySelector('body')!.appendChild(instance.$el)
}
})
}
]
}
}