tiptap: use clone

This commit is contained in:
fantasticit 2022-05-01 13:27:19 +08:00
parent ca41b31eea
commit 9f5b3f4054
3 changed files with 11 additions and 2 deletions

View File

@ -56,6 +56,7 @@
"@tiptap/suggestion": "^2.0.0-beta.90",
"axios": "^0.25.0",
"classnames": "^2.3.1",
"clone": "^2.1.2",
"deep-equal": "^2.0.5",
"dompurify": "^2.3.5",
"interactjs": "^1.10.11",

View File

@ -1,5 +1,6 @@
import { NodeViewWrapper } from '@tiptap/react';
import cls from 'classnames';
import clone from 'clone';
import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
import { Spin, Typography } from '@douyinfe/semi-ui';
import { Resizeable } from 'components/resizeable';
@ -83,13 +84,13 @@ export const MindWrapper = ({ editor, node, updateAttributes }) => {
mind = new window.MindElixir({
el: `#${containerId.current}`,
direction: window.MindElixir.SIDE,
data: JSON.parse(JSON.stringify(data)),
data: clone(data),
editable: editor.isEditable,
contextMenu: editor.isEditable,
keypress: editor.isEditable,
nodeMenu: editor.isEditable,
toolBar: true,
draggable: false, // 需要修复
draggable: false, // TODO: 需要修复
locale: 'zh_CN',
});
mind.shouldPreventDefault = () => editor.isActive('mind');

View File

@ -86,6 +86,7 @@ importers:
'@types/react': 17.0.38
axios: ^0.25.0
classnames: ^2.3.1
clone: ^2.1.2
deep-equal: ^2.0.5
dompurify: ^2.3.5
interactjs: ^1.10.11
@ -169,6 +170,7 @@ importers:
'@tiptap/suggestion': 2.0.0-beta.90_@tiptap+core@2.0.0-beta.171
axios: 0.25.0
classnames: 2.3.1
clone: 2.1.2
deep-equal: 2.0.5
dompurify: 2.3.5
interactjs: 1.10.11
@ -3021,6 +3023,11 @@ packages:
engines: {node: '>=0.8'}
dev: true
/clone/2.1.2:
resolution: {integrity: sha1-G39Ln1kfHo+DZwQBYANFoCiHQ18=}
engines: {node: '>=0.8'}
dev: false
/clsx/1.1.1:
resolution: {integrity: sha512-6/bPho624p3S2pMyvP5kKBPXnI3ufHLObBFCfgx+LkeR5lg2XYy2hqZqUf45ypD8COn2bhgGJSUE+l5dhNBieA==}
engines: {node: '>=6'}