tiptap-markdown
Advanced tools
Comparing version 0.8.8 to 0.8.9
@@ -120,2 +120,3 @@ var __defProp = Object.defineProperty; | ||
super(nodes, marks, options !== null && options !== void 0 ? options : {}); | ||
__publicField(this, "inTable", false); | ||
this.inlines = []; | ||
@@ -354,3 +355,9 @@ } | ||
markdown: { | ||
serialize: defaultMarkdownSerializer.nodes.hard_break, | ||
serialize(state, node, parent, index) { | ||
for (let i = index + 1; i < parent.childCount; i++) | ||
if (parent.child(i).type != node.type) { | ||
state.write(state.inTable ? HTMLNode.storage.markdown.serialize.call(this, state, node, parent) : "\\\n"); | ||
return; | ||
} | ||
}, | ||
parse: { | ||
@@ -509,2 +516,3 @@ // handled by markdown-it | ||
} | ||
state.inTable = true; | ||
node.forEach((row, p, i) => { | ||
@@ -532,2 +540,3 @@ state.write("| "); | ||
state.closeBlock(node); | ||
state.inTable = false; | ||
}, | ||
@@ -534,0 +543,0 @@ parse: { |
@@ -118,2 +118,3 @@ (function(global, factory) { | ||
super(nodes, marks, options !== null && options !== void 0 ? options : {}); | ||
__publicField(this, "inTable", false); | ||
this.inlines = []; | ||
@@ -352,3 +353,9 @@ } | ||
markdown: { | ||
serialize: prosemirrorMarkdown.defaultMarkdownSerializer.nodes.hard_break, | ||
serialize(state2, node, parent, index) { | ||
for (let i = index + 1; i < parent.childCount; i++) | ||
if (parent.child(i).type != node.type) { | ||
state2.write(state2.inTable ? HTMLNode.storage.markdown.serialize.call(this, state2, node, parent) : "\\\n"); | ||
return; | ||
} | ||
}, | ||
parse: { | ||
@@ -507,2 +514,3 @@ // handled by markdown-it | ||
} | ||
state2.inTable = true; | ||
node.forEach((row, p, i) => { | ||
@@ -530,2 +538,3 @@ state2.write("| "); | ||
state2.closeBlock(node); | ||
state2.inTable = false; | ||
}, | ||
@@ -532,0 +541,0 @@ parse: { |
{ | ||
"name": "tiptap-markdown", | ||
"version": "0.8.8", | ||
"version": "0.8.9", | ||
"description": "Edit markdown content in tiptap editor.", | ||
@@ -5,0 +5,0 @@ "scripts": { |
import { Node } from "@tiptap/core"; | ||
import { defaultMarkdownSerializer } from "prosemirror-markdown"; | ||
import HTMLNode from './html'; | ||
const HardBreak = Node.create({ | ||
@@ -16,3 +15,13 @@ name: 'hardBreak', | ||
markdown: { | ||
serialize: defaultMarkdownSerializer.nodes.hard_break, | ||
serialize(state, node, parent, index) { | ||
for (let i = index + 1; i < parent.childCount; i++) | ||
if (parent.child(i).type != node.type) { | ||
state.write( | ||
state.inTable | ||
? HTMLNode.storage.markdown.serialize.call(this, state, node, parent) | ||
: "\\\n" | ||
); | ||
return; | ||
} | ||
}, | ||
parse: { | ||
@@ -19,0 +28,0 @@ // handled by markdown-it |
@@ -21,2 +21,3 @@ import { Node } from "@tiptap/core"; | ||
} | ||
state.inTable = true; | ||
node.forEach((row, p, i) => { | ||
@@ -42,2 +43,3 @@ state.write('| '); | ||
state.closeBlock(node); | ||
state.inTable = false; | ||
}, | ||
@@ -44,0 +46,0 @@ parse: { |
@@ -11,2 +11,4 @@ import { MarkdownSerializerState as BaseMarkdownSerializerState } from "prosemirror-markdown"; | ||
inTable = false; | ||
constructor(nodes, marks, options) { | ||
@@ -13,0 +15,0 @@ super(nodes, marks, options ?? {}); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
237101
3173