@handlewithcare/react-prosemirror 2.8.0 → 2.8.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/commands/reorderSiblings.js +60 -45
- package/dist/cjs/components/nodes/CustomNodeView.js +1 -1
- package/dist/cjs/components/nodes/DocNodeView.js +1 -1
- package/dist/cjs/components/nodes/ReactNodeView.js +3 -1
- package/dist/cjs/hooks/useMarkViewDescription.js +1 -1
- package/dist/cjs/hooks/useNodeViewDescriptor.js +1 -4
- package/dist/cjs/viewdesc.js +10 -0
- package/dist/esm/commands/reorderSiblings.js +49 -42
- package/dist/esm/components/nodes/CustomNodeView.js +1 -1
- package/dist/esm/components/nodes/DocNodeView.js +1 -1
- package/dist/esm/components/nodes/ReactNodeView.js +4 -2
- package/dist/esm/hooks/useMarkViewDescription.js +2 -2
- package/dist/esm/hooks/useNodeViewDescriptor.js +1 -4
- package/dist/esm/viewdesc.js +7 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types/commands/__tests__/reorderSiblings.test.d.ts +1 -0
- package/dist/types/commands/reorderSiblings.d.ts +3 -1
- package/dist/types/hooks/useNodeViewDescriptor.d.ts +3 -1
- package/dist/types/viewdesc.d.ts +3 -0
- package/package.json +2 -2
|
@@ -1,57 +1,72 @@
|
|
|
1
|
-
"use strict";
|
|
1
|
+
/* eslint-disable @typescript-eslint/no-non-null-assertion */ "use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", {
|
|
3
3
|
value: true
|
|
4
4
|
});
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
function _export(target, all) {
|
|
6
|
+
for(var name in all)Object.defineProperty(target, name, {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: all[name]
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
_export(exports, {
|
|
12
|
+
reorderSiblings: function() {
|
|
8
13
|
return reorderSiblings;
|
|
14
|
+
},
|
|
15
|
+
reorderSiblingsOnTransaction: function() {
|
|
16
|
+
return reorderSiblingsOnTransaction;
|
|
9
17
|
}
|
|
10
18
|
});
|
|
11
19
|
const _reactKeys = require("../plugins/reactKeys.js");
|
|
12
20
|
function reorderSiblings(pos, order) {
|
|
13
21
|
return function reorderSiblingsCommand(state, dispatch) {
|
|
14
|
-
const $pos = state.doc.resolve(pos);
|
|
15
|
-
if ($pos.start() !== pos) {
|
|
16
|
-
return false;
|
|
17
|
-
}
|
|
18
|
-
if (!dispatch) return true;
|
|
19
|
-
const nodes = $pos.parent.children;
|
|
20
|
-
const reordered = nodes.map((node, i)=>[
|
|
21
|
-
node,
|
|
22
|
-
i
|
|
23
|
-
]).sort((param, param1)=>{
|
|
24
|
-
let [, a] = param, [, b] = param1;
|
|
25
|
-
return order[a] - order[b];
|
|
26
|
-
}).map((param)=>{
|
|
27
|
-
let [node] = param;
|
|
28
|
-
return node;
|
|
29
|
-
});
|
|
30
22
|
const tr = state.tr;
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
23
|
+
return reorderSiblingsOnTransaction(pos, order, tr, state, dispatch);
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
function reorderSiblingsOnTransaction(pos, order, tr, state, dispatch) {
|
|
27
|
+
const orderLookup = order.reduce((acc, oldIndex, newIndex)=>{
|
|
28
|
+
acc[oldIndex] = newIndex;
|
|
29
|
+
return acc;
|
|
30
|
+
}, []);
|
|
31
|
+
const $pos = state.doc.resolve(pos);
|
|
32
|
+
if ($pos.start() !== pos) {
|
|
33
|
+
return false;
|
|
34
|
+
}
|
|
35
|
+
if (!dispatch) return true;
|
|
36
|
+
const nodes = $pos.parent.children;
|
|
37
|
+
const reordered = nodes.map((node, i)=>[
|
|
38
|
+
node,
|
|
39
|
+
i
|
|
40
|
+
]).sort((param, param1)=>{
|
|
41
|
+
let [, a] = param, [, b] = param1;
|
|
42
|
+
return orderLookup[a] - orderLookup[b];
|
|
43
|
+
}).map((param)=>{
|
|
44
|
+
let [node] = param;
|
|
45
|
+
return node;
|
|
46
|
+
});
|
|
47
|
+
tr.replaceWith(pos, $pos.parent.content.size + pos, reordered);
|
|
48
|
+
const meta = {
|
|
49
|
+
overrides: {}
|
|
56
50
|
};
|
|
51
|
+
const oldPositions = [];
|
|
52
|
+
let start = pos;
|
|
53
|
+
for (const node of nodes){
|
|
54
|
+
oldPositions.push(start);
|
|
55
|
+
start += node.nodeSize;
|
|
56
|
+
}
|
|
57
|
+
start = pos;
|
|
58
|
+
const newPositions = [];
|
|
59
|
+
for(let i = 0; i < reordered.length; i++){
|
|
60
|
+
const node = reordered[i];
|
|
61
|
+
newPositions[order[i]] = start;
|
|
62
|
+
start += node.nodeSize;
|
|
63
|
+
}
|
|
64
|
+
for(let i = 0; i < oldPositions.length; i++){
|
|
65
|
+
const oldPosition = oldPositions[i];
|
|
66
|
+
const newPosition = newPositions[i];
|
|
67
|
+
meta.overrides[oldPosition] = newPosition;
|
|
68
|
+
}
|
|
69
|
+
tr.setMeta(_reactKeys.reactKeysPluginKey, meta);
|
|
70
|
+
dispatch(tr);
|
|
71
|
+
return true;
|
|
57
72
|
}
|
|
@@ -114,7 +114,7 @@ const CustomNodeView = /*#__PURE__*/ (0, _react.memo)(function CustomNodeView(pa
|
|
|
114
114
|
stopEvent: nodeView.stopEvent?.bind(nodeView),
|
|
115
115
|
ignoreMutation: nodeView.ignoreMutation?.bind(nodeView)
|
|
116
116
|
};
|
|
117
|
-
}, nodeProps);
|
|
117
|
+
}, (source)=>source?.contentDOM ?? null, nodeProps);
|
|
118
118
|
const Component = node.isInline ? "span" : "div";
|
|
119
119
|
const props = {
|
|
120
120
|
ref: innerRef
|
|
@@ -78,7 +78,7 @@ const DocNodeView = /*#__PURE__*/ (0, _react.memo)(/*#__PURE__*/ (0, _react.forw
|
|
|
78
78
|
return true;
|
|
79
79
|
}
|
|
80
80
|
};
|
|
81
|
-
}, nodeProps);
|
|
81
|
+
}, ()=>innerRef.current, nodeProps);
|
|
82
82
|
const children = /*#__PURE__*/ _react.default.createElement(_ChildDescriptorsContext.ChildDescriptorsContext.Provider, {
|
|
83
83
|
value: childContextValue
|
|
84
84
|
}, /*#__PURE__*/ _react.default.createElement(_ChildNodeViews.ChildNodeViews, {
|
|
@@ -10,6 +10,7 @@ Object.defineProperty(exports, "ReactNodeView", {
|
|
|
10
10
|
});
|
|
11
11
|
const _react = /*#__PURE__*/ _interop_require_wildcard(require("react"));
|
|
12
12
|
const _ChildDescriptorsContext = require("../../contexts/ChildDescriptorsContext.js");
|
|
13
|
+
const _EditorContext = require("../../contexts/EditorContext.js");
|
|
13
14
|
const _IgnoreMutationContext = require("../../contexts/IgnoreMutationContext.js");
|
|
14
15
|
const _SelectNodeContext = require("../../contexts/SelectNodeContext.js");
|
|
15
16
|
const _StopEventContext = require("../../contexts/StopEventContext.js");
|
|
@@ -58,6 +59,7 @@ function _interop_require_wildcard(obj, nodeInterop) {
|
|
|
58
59
|
}
|
|
59
60
|
const ReactNodeView = /*#__PURE__*/ (0, _react.memo)(function ReactNodeView(param) {
|
|
60
61
|
let { component: Component, outerDeco, getPos, node, innerDeco } = param;
|
|
62
|
+
const { view } = (0, _react.useContext)(_EditorContext.EditorContext);
|
|
61
63
|
const [hasCustomSelectNode, setHasCustomSelectNode] = (0, _react.useState)(false);
|
|
62
64
|
const [selected, setSelected] = (0, _react.useState)(false);
|
|
63
65
|
const ref = (0, _react.useRef)(null);
|
|
@@ -139,7 +141,7 @@ const ReactNodeView = /*#__PURE__*/ (0, _react.memo)(function ReactNodeView(para
|
|
|
139
141
|
return false;
|
|
140
142
|
}
|
|
141
143
|
};
|
|
142
|
-
}, nodeProps);
|
|
144
|
+
}, (source, children)=>view.composing ? source?.contentDOM ?? null : children[0]?.dom.parentElement ?? null, nodeProps);
|
|
143
145
|
const props = {
|
|
144
146
|
nodeProps,
|
|
145
147
|
...!contentDOM && !nodeProps.node.isText && nodeDOM?.nodeName !== "BR" ? {
|
|
@@ -41,7 +41,7 @@ function useMarkViewDescription(ref, constructor, props) {
|
|
|
41
41
|
const parent = parentRef.current;
|
|
42
42
|
const children = childrenRef.current;
|
|
43
43
|
const contentDOM = findContentDOM(markView, children, ref.current);
|
|
44
|
-
const viewDesc = new _viewdesc.
|
|
44
|
+
const viewDesc = new _viewdesc.ReactMarkViewDesc(parent, children, getPos, mark, dom, contentDOM, markView);
|
|
45
45
|
setDOM(dom);
|
|
46
46
|
setContentDOM(contentDOM);
|
|
47
47
|
return viewDesc;
|
|
@@ -15,10 +15,7 @@ const _EditorContext = require("../contexts/EditorContext.js");
|
|
|
15
15
|
const _viewdesc = require("../viewdesc.js");
|
|
16
16
|
const _useClientLayoutEffect = require("./useClientLayoutEffect.js");
|
|
17
17
|
const _useEffectEvent = require("./useEffectEvent.js");
|
|
18
|
-
function
|
|
19
|
-
return source?.contentDOM ?? children[0]?.dom?.parentElement ?? null;
|
|
20
|
-
}
|
|
21
|
-
function useNodeViewDescriptor(ref, constructor, props) {
|
|
18
|
+
function useNodeViewDescriptor(ref, constructor, findContentDOM, props) {
|
|
22
19
|
const { view } = (0, _react.useContext)(_EditorContext.EditorContext);
|
|
23
20
|
const { parentRef, siblingsRef } = (0, _react.useContext)(_ChildDescriptorsContext.ChildDescriptorsContext);
|
|
24
21
|
const [dom, setDOM] = (0, _react.useState)(null);
|
package/dist/cjs/viewdesc.js
CHANGED
|
@@ -18,6 +18,9 @@ _export(exports, {
|
|
|
18
18
|
NodeViewDesc: function() {
|
|
19
19
|
return NodeViewDesc;
|
|
20
20
|
},
|
|
21
|
+
ReactMarkViewDesc: function() {
|
|
22
|
+
return ReactMarkViewDesc;
|
|
23
|
+
},
|
|
21
24
|
ReactNodeViewDesc: function() {
|
|
22
25
|
return ReactNodeViewDesc;
|
|
23
26
|
},
|
|
@@ -743,6 +746,13 @@ let CustomNodeViewDesc = class CustomNodeViewDesc extends NodeViewDesc {
|
|
|
743
746
|
return this.spec.ignoreMutation ? this.spec.ignoreMutation(mutation) : super.ignoreMutation(mutation);
|
|
744
747
|
}
|
|
745
748
|
};
|
|
749
|
+
let ReactMarkViewDesc = class ReactMarkViewDesc extends MarkViewDesc {
|
|
750
|
+
destroy() {
|
|
751
|
+
// React has already destroyed the children (if needed).
|
|
752
|
+
this.children = [];
|
|
753
|
+
super.destroy();
|
|
754
|
+
}
|
|
755
|
+
};
|
|
746
756
|
let ReactNodeViewDesc = class ReactNodeViewDesc extends CustomNodeViewDesc {
|
|
747
757
|
updateChildren(_view, _pos) {
|
|
748
758
|
// React has already updated the children.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { reactKeysPluginKey } from "../plugins/reactKeys.js";
|
|
1
|
+
/* eslint-disable @typescript-eslint/no-non-null-assertion */ import { reactKeysPluginKey } from "../plugins/reactKeys.js";
|
|
2
2
|
/**
|
|
3
3
|
* Create a command function that reorders the adjacent nodes starting
|
|
4
4
|
* at the provided position.
|
|
@@ -10,47 +10,54 @@ import { reactKeysPluginKey } from "../plugins/reactKeys.js";
|
|
|
10
10
|
* and keep the other two in relative order, set `order` to `[1, 2, 0]`.
|
|
11
11
|
*/ export function reorderSiblings(pos, order) {
|
|
12
12
|
return function reorderSiblingsCommand(state, dispatch) {
|
|
13
|
-
const $pos = state.doc.resolve(pos);
|
|
14
|
-
if ($pos.start() !== pos) {
|
|
15
|
-
return false;
|
|
16
|
-
}
|
|
17
|
-
if (!dispatch) return true;
|
|
18
|
-
const nodes = $pos.parent.children;
|
|
19
|
-
const reordered = nodes.map((node, i)=>[
|
|
20
|
-
node,
|
|
21
|
-
i
|
|
22
|
-
]).sort((param, param1)=>{
|
|
23
|
-
let [, a] = param, [, b] = param1;
|
|
24
|
-
return order[a] - order[b];
|
|
25
|
-
}).map((param)=>{
|
|
26
|
-
let [node] = param;
|
|
27
|
-
return node;
|
|
28
|
-
});
|
|
29
13
|
const tr = state.tr;
|
|
30
|
-
|
|
31
|
-
const meta = {
|
|
32
|
-
overrides: {}
|
|
33
|
-
};
|
|
34
|
-
const oldPositions = [];
|
|
35
|
-
let start = pos;
|
|
36
|
-
for (const node of nodes){
|
|
37
|
-
oldPositions.push(start);
|
|
38
|
-
start += node.nodeSize;
|
|
39
|
-
}
|
|
40
|
-
start = pos;
|
|
41
|
-
const newPositions = [];
|
|
42
|
-
for(let i = 0; i < reordered.length; i++){
|
|
43
|
-
const node = reordered[i];
|
|
44
|
-
newPositions[order[i]] = start;
|
|
45
|
-
start += node.nodeSize;
|
|
46
|
-
}
|
|
47
|
-
for(let i = 0; i < oldPositions.length; i++){
|
|
48
|
-
const oldPosition = oldPositions[i];
|
|
49
|
-
const newPosition = newPositions[i];
|
|
50
|
-
meta.overrides[oldPosition] = newPosition;
|
|
51
|
-
}
|
|
52
|
-
tr.setMeta(reactKeysPluginKey, meta);
|
|
53
|
-
dispatch(tr);
|
|
54
|
-
return true;
|
|
14
|
+
return reorderSiblingsOnTransaction(pos, order, tr, state, dispatch);
|
|
55
15
|
};
|
|
56
16
|
}
|
|
17
|
+
export function reorderSiblingsOnTransaction(pos, order, tr, state, dispatch) {
|
|
18
|
+
const orderLookup = order.reduce((acc, oldIndex, newIndex)=>{
|
|
19
|
+
acc[oldIndex] = newIndex;
|
|
20
|
+
return acc;
|
|
21
|
+
}, []);
|
|
22
|
+
const $pos = state.doc.resolve(pos);
|
|
23
|
+
if ($pos.start() !== pos) {
|
|
24
|
+
return false;
|
|
25
|
+
}
|
|
26
|
+
if (!dispatch) return true;
|
|
27
|
+
const nodes = $pos.parent.children;
|
|
28
|
+
const reordered = nodes.map((node, i)=>[
|
|
29
|
+
node,
|
|
30
|
+
i
|
|
31
|
+
]).sort((param, param1)=>{
|
|
32
|
+
let [, a] = param, [, b] = param1;
|
|
33
|
+
return orderLookup[a] - orderLookup[b];
|
|
34
|
+
}).map((param)=>{
|
|
35
|
+
let [node] = param;
|
|
36
|
+
return node;
|
|
37
|
+
});
|
|
38
|
+
tr.replaceWith(pos, $pos.parent.content.size + pos, reordered);
|
|
39
|
+
const meta = {
|
|
40
|
+
overrides: {}
|
|
41
|
+
};
|
|
42
|
+
const oldPositions = [];
|
|
43
|
+
let start = pos;
|
|
44
|
+
for (const node of nodes){
|
|
45
|
+
oldPositions.push(start);
|
|
46
|
+
start += node.nodeSize;
|
|
47
|
+
}
|
|
48
|
+
start = pos;
|
|
49
|
+
const newPositions = [];
|
|
50
|
+
for(let i = 0; i < reordered.length; i++){
|
|
51
|
+
const node = reordered[i];
|
|
52
|
+
newPositions[order[i]] = start;
|
|
53
|
+
start += node.nodeSize;
|
|
54
|
+
}
|
|
55
|
+
for(let i = 0; i < oldPositions.length; i++){
|
|
56
|
+
const oldPosition = oldPositions[i];
|
|
57
|
+
const newPosition = newPositions[i];
|
|
58
|
+
meta.overrides[oldPosition] = newPosition;
|
|
59
|
+
}
|
|
60
|
+
tr.setMeta(reactKeysPluginKey, meta);
|
|
61
|
+
dispatch(tr);
|
|
62
|
+
return true;
|
|
63
|
+
}
|
|
@@ -63,7 +63,7 @@ export const CustomNodeView = /*#__PURE__*/ memo(function CustomNodeView(param)
|
|
|
63
63
|
stopEvent: nodeView.stopEvent?.bind(nodeView),
|
|
64
64
|
ignoreMutation: nodeView.ignoreMutation?.bind(nodeView)
|
|
65
65
|
};
|
|
66
|
-
}, nodeProps);
|
|
66
|
+
}, (source)=>source?.contentDOM ?? null, nodeProps);
|
|
67
67
|
const Component = node.isInline ? "span" : "div";
|
|
68
68
|
const props = {
|
|
69
69
|
ref: innerRef
|
|
@@ -27,7 +27,7 @@ export const DocNodeView = /*#__PURE__*/ memo(/*#__PURE__*/ forwardRef(function
|
|
|
27
27
|
return true;
|
|
28
28
|
}
|
|
29
29
|
};
|
|
30
|
-
}, nodeProps);
|
|
30
|
+
}, ()=>innerRef.current, nodeProps);
|
|
31
31
|
const children = /*#__PURE__*/ React.createElement(ChildDescriptorsContext.Provider, {
|
|
32
32
|
value: childContextValue
|
|
33
33
|
}, /*#__PURE__*/ React.createElement(ChildNodeViews, {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import React, { cloneElement, memo, useCallback, useMemo, useRef, useState } from "react";
|
|
1
|
+
import React, { cloneElement, memo, useCallback, useContext, useMemo, useRef, useState } from "react";
|
|
2
2
|
import { ChildDescriptorsContext } from "../../contexts/ChildDescriptorsContext.js";
|
|
3
|
+
import { EditorContext } from "../../contexts/EditorContext.js";
|
|
3
4
|
import { IgnoreMutationContext } from "../../contexts/IgnoreMutationContext.js";
|
|
4
5
|
import { SelectNodeContext } from "../../contexts/SelectNodeContext.js";
|
|
5
6
|
import { StopEventContext } from "../../contexts/StopEventContext.js";
|
|
@@ -7,6 +8,7 @@ import { useNodeViewDescriptor } from "../../hooks/useNodeViewDescriptor.js";
|
|
|
7
8
|
import { ChildNodeViews, wrapInDeco } from "../ChildNodeViews.js";
|
|
8
9
|
export const ReactNodeView = /*#__PURE__*/ memo(function ReactNodeView(param) {
|
|
9
10
|
let { component: Component, outerDeco, getPos, node, innerDeco } = param;
|
|
11
|
+
const { view } = useContext(EditorContext);
|
|
10
12
|
const [hasCustomSelectNode, setHasCustomSelectNode] = useState(false);
|
|
11
13
|
const [selected, setSelected] = useState(false);
|
|
12
14
|
const ref = useRef(null);
|
|
@@ -88,7 +90,7 @@ export const ReactNodeView = /*#__PURE__*/ memo(function ReactNodeView(param) {
|
|
|
88
90
|
return false;
|
|
89
91
|
}
|
|
90
92
|
};
|
|
91
|
-
}, nodeProps);
|
|
93
|
+
}, (source, children)=>view.composing ? source?.contentDOM ?? null : children[0]?.dom.parentElement ?? null, nodeProps);
|
|
92
94
|
const props = {
|
|
93
95
|
nodeProps,
|
|
94
96
|
...!contentDOM && !nodeProps.node.isText && nodeDOM?.nodeName !== "BR" ? {
|
|
@@ -2,7 +2,7 @@ import { useContext, useMemo, useRef, useState } from "react";
|
|
|
2
2
|
import { ReactEditorView } from "../ReactEditorView.js";
|
|
3
3
|
import { ChildDescriptorsContext } from "../contexts/ChildDescriptorsContext.js";
|
|
4
4
|
import { EditorContext } from "../contexts/EditorContext.js";
|
|
5
|
-
import {
|
|
5
|
+
import { ReactMarkViewDesc, sortViewDescs } from "../viewdesc.js";
|
|
6
6
|
import { useClientLayoutEffect } from "./useClientLayoutEffect.js";
|
|
7
7
|
import { useEffectEvent } from "./useEffectEvent.js";
|
|
8
8
|
function findContentDOM(source, children, dom) {
|
|
@@ -31,7 +31,7 @@ export function useMarkViewDescription(ref, constructor, props) {
|
|
|
31
31
|
const parent = parentRef.current;
|
|
32
32
|
const children = childrenRef.current;
|
|
33
33
|
const contentDOM = findContentDOM(markView, children, ref.current);
|
|
34
|
-
const viewDesc = new
|
|
34
|
+
const viewDesc = new ReactMarkViewDesc(parent, children, getPos, mark, dom, contentDOM, markView);
|
|
35
35
|
setDOM(dom);
|
|
36
36
|
setContentDOM(contentDOM);
|
|
37
37
|
return viewDesc;
|
|
@@ -5,10 +5,7 @@ import { EditorContext } from "../contexts/EditorContext.js";
|
|
|
5
5
|
import { CompositionViewDesc, ReactNodeViewDesc, sortViewDescs } from "../viewdesc.js";
|
|
6
6
|
import { useClientLayoutEffect } from "./useClientLayoutEffect.js";
|
|
7
7
|
import { useEffectEvent } from "./useEffectEvent.js";
|
|
8
|
-
function
|
|
9
|
-
return source?.contentDOM ?? children[0]?.dom?.parentElement ?? null;
|
|
10
|
-
}
|
|
11
|
-
export function useNodeViewDescriptor(ref, constructor, props) {
|
|
8
|
+
export function useNodeViewDescriptor(ref, constructor, findContentDOM, props) {
|
|
12
9
|
const { view } = useContext(EditorContext);
|
|
13
10
|
const { parentRef, siblingsRef } = useContext(ChildDescriptorsContext);
|
|
14
11
|
const [dom, setDOM] = useState(null);
|
package/dist/esm/viewdesc.js
CHANGED
|
@@ -730,6 +730,13 @@ let CustomNodeViewDesc = class CustomNodeViewDesc extends NodeViewDesc {
|
|
|
730
730
|
return this.spec.ignoreMutation ? this.spec.ignoreMutation(mutation) : super.ignoreMutation(mutation);
|
|
731
731
|
}
|
|
732
732
|
};
|
|
733
|
+
export class ReactMarkViewDesc extends MarkViewDesc {
|
|
734
|
+
destroy() {
|
|
735
|
+
// React has already destroyed the children (if needed).
|
|
736
|
+
this.children = [];
|
|
737
|
+
super.destroy();
|
|
738
|
+
}
|
|
739
|
+
}
|
|
733
740
|
export class ReactNodeViewDesc extends CustomNodeViewDesc {
|
|
734
741
|
updateChildren(_view, _pos) {
|
|
735
742
|
// React has already updated the children.
|