tiptap: remove flow default data

pull/66/head
fantasticit 2022-06-05 18:40:20 +08:00
parent 157a61ba8c
commit 28fe0c361a
1 changed files with 2 additions and 5 deletions

View File

@ -20,9 +20,6 @@ declare module '@tiptap/core' {
} }
} }
const DEFAULT_XML =
'<mxGraphModel dx="605" dy="327" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="827" pageHeight="1169"><root><mxCell id="0"/><mxCell id="1" parent="0"/><mxCell id="4" value="开始节点" style="rounded=1;whiteSpace=wrap;html=1;" parent="1" vertex="1"><mxGeometry x="260" y="140" width="120" height="60" as="geometry"/></mxCell></root></mxGraphModel>';
export const Flow = Node.create({ export const Flow = Node.create({
name: 'flow', name: 'flow',
group: 'block', group: 'block',
@ -40,7 +37,7 @@ export const Flow = Node.create({
parseHTML: getDatasetAttribute('height'), parseHTML: getDatasetAttribute('height'),
}, },
data: { data: {
default: DEFAULT_XML, default: '',
parseHTML: getDatasetAttribute('data'), parseHTML: getDatasetAttribute('data'),
}, },
defaultShowPicker: { defaultShowPicker: {
@ -78,7 +75,7 @@ export const Flow = Node.create({
(options) => (options) =>
({ tr, commands, chain, editor }) => { ({ tr, commands, chain, editor }) => {
options = options || {}; options = options || {};
options.data = options.data || DEFAULT_XML; options.data = options.data || '';
// @ts-ignore // @ts-ignore
if (tr.selection?.node?.type?.name == this.name) { if (tr.selection?.node?.type?.name == this.name) {