-
Notifications
You must be signed in to change notification settings - Fork 123
Expand file tree
/
Copy pathEditableTable.js
More file actions
44 lines (40 loc) · 1.12 KB
/
EditableTable.js
File metadata and controls
44 lines (40 loc) · 1.12 KB
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
/**
* SPDX-FileCopyrightText: 2022 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
import { VueNodeViewRenderer } from '@tiptap/vue-2'
import Table from './Table/Table.js'
import TableCaption from './Table/TableCaption.js'
import TableCell from './Table/TableCell.js'
import TableHeader from './Table/TableHeader.js'
import TableHeaderView from './Table/TableHeaderView.vue'
import TableHeadRow from './Table/TableHeadRow.js'
import TableRow from './Table/TableRow.js'
import TableRowView from './Table/TableRowView.vue'
import TableView from './Table/TableView.vue'
/**
*
* @param {object} node - the node to add the view to.
* @param {object} view - the node view to add to the node.
*/
function extendNodeWithView(node, view) {
return node.extend({
addNodeView() {
return VueNodeViewRenderer(view)
},
})
}
export default Table.extend({
addNodeView() {
return VueNodeViewRenderer(TableView)
},
addExtensions() {
return [
TableCaption,
TableCell,
extendNodeWithView(TableHeader, TableHeaderView),
TableHeadRow,
extendNodeWithView(TableRow, TableRowView),
]
},
})