Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/text.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMax <max@nextcloud.com>2022-03-15 14:48:58 +0300
committerMax <max@nextcloud.com>2022-03-31 15:29:21 +0300
commit244386171bb1f8acb10ab07545ab858a6c3d0ceb (patch)
tree755b7061cc5274eda509a137daafa9dd90cb4695
parent39cf02c6e67e1784e23b771bb92dcdfdf6c408ba (diff)
refactor: separate file for TableHeadRow
Signed-off-by: Max <max@nextcloud.com>
-rw-r--r--src/nodes/TableHead.js32
-rw-r--r--src/nodes/TableHeadRow.js30
2 files changed, 32 insertions, 30 deletions
diff --git a/src/nodes/TableHead.js b/src/nodes/TableHead.js
index e5acdc269..fd845fa7d 100644
--- a/src/nodes/TableHead.js
+++ b/src/nodes/TableHead.js
@@ -1,33 +1,5 @@
import { Node, mergeAttributes } from '@tiptap/core'
-
-const tableHeadRow = Node.create({
- name: 'tableHeadRow',
- content: 'tableHeader*',
- tableRole: 'headRow',
-
- addOptions() {
- return {
- HTMLAttributes: {},
- }
- },
-
- parseHTML() {
- return [
- { tag: 'tr' },
- ]
- },
-
- renderHTML({ HTMLAttributes }) {
- return ['tr', mergeAttributes(this.options.HTMLAttributes, HTMLAttributes), 0]
- },
-
- toMarkdown(state, node) {
- state.write('|')
- state.renderInline(node)
- state.ensureNewLine()
- },
-
-})
+import TableHeadRow from './TableHeadRow'
export default Node.create({
name: 'tableHead',
@@ -42,7 +14,7 @@ export default Node.create({
addExtensions() {
return [
- tableHeadRow,
+ TableHeadRow,
]
},
diff --git a/src/nodes/TableHeadRow.js b/src/nodes/TableHeadRow.js
new file mode 100644
index 000000000..a0b9fedd0
--- /dev/null
+++ b/src/nodes/TableHeadRow.js
@@ -0,0 +1,30 @@
+import { Node, mergeAttributes } from '@tiptap/core'
+
+export default Node.create({
+ name: 'tableHeadRow',
+ content: 'tableHeader*',
+ tableRole: 'headRow',
+
+ addOptions() {
+ return {
+ HTMLAttributes: {},
+ }
+ },
+
+ parseHTML() {
+ return [
+ { tag: 'tr' },
+ ]
+ },
+
+ renderHTML({ HTMLAttributes }) {
+ return ['tr', mergeAttributes(this.options.HTMLAttributes, HTMLAttributes), 0]
+ },
+
+ toMarkdown(state, node) {
+ state.write('|')
+ state.renderInline(node)
+ state.ensureNewLine()
+ },
+
+})