@handlewithcare/react-prosemirror 2.9.0-tiptap.24 → 3.0.0
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/README.md +140 -75
- package/dist/cjs/StaticEditorView.js +0 -3
- package/dist/cjs/components/ChildNodeViews.js +4 -4
- package/dist/cjs/components/NativeWidgetView.js +2 -2
- package/dist/cjs/components/OutputSpec.js +10 -3
- package/dist/cjs/components/ProseMirror.js +11 -17
- package/dist/cjs/components/SeparatorHackView.js +2 -2
- package/dist/cjs/components/TrailingHackView.js +2 -2
- package/dist/cjs/components/WidgetView.js +2 -2
- package/dist/cjs/components/marks/DefaultMarkView.js +2 -1
- package/dist/cjs/components/marks/MarkView.js +2 -2
- package/dist/cjs/components/marks/{CustomMarkView.js → MarkViewConstructorView.js} +16 -7
- package/dist/cjs/components/marks/ReactMarkView.js +26 -6
- package/dist/cjs/components/nodes/DefaultNodeView.js +3 -2
- package/dist/cjs/components/nodes/DocNodeView.js +7 -6
- package/dist/cjs/components/nodes/NodeView.js +17 -6
- package/dist/cjs/components/nodes/{CustomNodeView.js → NodeViewConstructorView.js} +22 -9
- package/dist/cjs/components/nodes/ReactNodeView.js +59 -17
- package/dist/cjs/contexts/{ChildDescriptorsContext.js → ChildDescriptionsContext.js} +3 -3
- package/dist/cjs/hooks/useEditor.js +0 -4
- package/dist/cjs/hooks/useEditorEventCallback.js +1 -1
- package/dist/cjs/hooks/useMarkViewDescription.js +24 -21
- package/dist/cjs/hooks/useNodePos.js +18 -0
- package/dist/cjs/hooks/{useNodeViewDescriptor.js → useNodeViewDescription.js} +30 -25
- package/dist/cjs/index.js +8 -0
- package/dist/cjs/refs.js +28 -0
- package/dist/cjs/viewdesc.js +18 -5
- package/dist/esm/StaticEditorView.js +0 -3
- package/dist/esm/components/ChildNodeViews.js +4 -4
- package/dist/esm/components/NativeWidgetView.js +2 -2
- package/dist/esm/components/OutputSpec.js +10 -3
- package/dist/esm/components/ProseMirror.js +11 -17
- package/dist/esm/components/SeparatorHackView.js +2 -2
- package/dist/esm/components/TrailingHackView.js +2 -2
- package/dist/esm/components/WidgetView.js +2 -2
- package/dist/esm/components/marks/DefaultMarkView.js +2 -1
- package/dist/esm/components/marks/MarkView.js +2 -2
- package/dist/esm/components/marks/{CustomMarkView.js → MarkViewConstructorView.js} +14 -5
- package/dist/esm/components/marks/ReactMarkView.js +26 -6
- package/dist/esm/components/nodes/DefaultNodeView.js +3 -2
- package/dist/esm/components/nodes/DocNodeView.js +8 -7
- package/dist/esm/components/nodes/NodeView.js +7 -4
- package/dist/esm/components/nodes/{CustomNodeView.js → NodeViewConstructorView.js} +20 -7
- package/dist/esm/components/nodes/ReactNodeView.js +59 -17
- package/dist/esm/contexts/{ChildDescriptorsContext.js → ChildDescriptionsContext.js} +1 -1
- package/dist/esm/hooks/useEditor.js +0 -4
- package/dist/esm/hooks/useEditorEffect.js +0 -4
- package/dist/esm/hooks/useEditorEventCallback.js +6 -4
- package/dist/esm/hooks/useMarkViewDescription.js +26 -23
- package/dist/esm/hooks/useNodePos.js +15 -0
- package/dist/esm/hooks/{useNodeViewDescriptor.js → useNodeViewDescription.js} +29 -24
- package/dist/esm/index.js +2 -0
- package/dist/esm/refs.js +18 -0
- package/dist/esm/viewdesc.js +13 -6
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types/AbstractEditorView.d.ts +0 -1
- package/dist/types/StaticEditorView.d.ts +0 -1
- package/dist/types/components/OutputSpec.d.ts +2 -1
- package/dist/types/components/ProseMirror.d.ts +3 -11
- package/dist/types/components/ProseMirrorDoc.d.ts +2 -2
- package/dist/types/components/marks/DefaultMarkView.d.ts +1 -1
- package/dist/types/components/marks/MarkViewComponentProps.d.ts +4 -3
- package/dist/types/components/marks/{CustomMarkView.d.ts → MarkViewConstructorView.d.ts} +1 -1
- package/dist/types/components/nodes/DefaultNodeView.d.ts +1 -1
- package/dist/types/components/nodes/DocNodeView.d.ts +2 -2
- package/dist/types/components/nodes/NodeView.d.ts +1 -0
- package/dist/types/components/nodes/NodeViewComponentProps.d.ts +4 -3
- package/dist/types/components/{CustomNodeView.d.ts → nodes/NodeViewConstructorView.d.ts} +1 -1
- package/dist/types/constants.d.ts +1 -1
- package/dist/types/contexts/{ChildDescriptorsContext.d.ts → ChildDescriptionsContext.d.ts} +1 -1
- package/dist/types/hooks/useEditorEffect.d.ts +0 -4
- package/dist/types/hooks/useEditorEventCallback.d.ts +6 -4
- package/dist/types/hooks/useMarkViewDescription.d.ts +6 -9
- package/dist/types/hooks/useNodePos.d.ts +9 -0
- package/dist/types/hooks/{useNodeViewDescriptor.d.ts → useNodeViewDescription.d.ts} +5 -9
- package/dist/types/index.d.ts +2 -0
- package/dist/types/props.d.ts +26 -26
- package/dist/types/refs.d.ts +2 -0
- package/dist/types/viewdesc.d.ts +4 -0
- package/package.json +12 -20
- package/dist/cjs/components/CustomNodeView.js +0 -132
- package/dist/cjs/components/DefaultNodeView.js +0 -67
- package/dist/cjs/components/DocNodeView.js +0 -96
- package/dist/cjs/components/MarkView.js +0 -119
- package/dist/cjs/components/NodeView.js +0 -86
- package/dist/cjs/components/NodeViewComponentProps.js +0 -4
- package/dist/cjs/components/ReactNodeView.js +0 -174
- package/dist/cjs/components/marks/OldMarkView.js +0 -120
- package/dist/cjs/tiptap/ReactProseMirrorNodeView.js +0 -26
- package/dist/cjs/tiptap/TiptapEditor.js +0 -34
- package/dist/cjs/tiptap/TiptapEditorContent.js +0 -142
- package/dist/cjs/tiptap/TiptapEditorView.js +0 -118
- package/dist/cjs/tiptap/TiptapNodeView.js +0 -26
- package/dist/cjs/tiptap/contexts/TiptapEditorContext.js +0 -12
- package/dist/cjs/tiptap/extensions/ReactProseMirror.js +0 -40
- package/dist/cjs/tiptap/hooks/useIsInReactProseMirror.js +0 -15
- package/dist/cjs/tiptap/hooks/useTiptapEditor.js +0 -43
- package/dist/cjs/tiptap/hooks/useTiptapEditorEffect.js +0 -35
- package/dist/cjs/tiptap/hooks/useTiptapEditorEventCallback.js +0 -35
- package/dist/cjs/tiptap/index.js +0 -48
- package/dist/cjs/tiptap/tiptapNodeView.js +0 -237
- package/dist/esm/components/CustomNodeView.js +0 -81
- package/dist/esm/components/DefaultNodeView.js +0 -16
- package/dist/esm/components/DocNodeView.js +0 -45
- package/dist/esm/components/MarkView.js +0 -68
- package/dist/esm/components/NodeView.js +0 -35
- package/dist/esm/components/NodeViewComponentProps.js +0 -1
- package/dist/esm/components/ReactNodeView.js +0 -123
- package/dist/esm/components/marks/OldMarkView.js +0 -69
- package/dist/esm/tiptap/ReactProseMirrorNodeView.js +0 -22
- package/dist/esm/tiptap/TiptapEditor.js +0 -24
- package/dist/esm/tiptap/TiptapEditorContent.js +0 -91
- package/dist/esm/tiptap/TiptapEditorView.js +0 -69
- package/dist/esm/tiptap/TiptapNodeView.js +0 -22
- package/dist/esm/tiptap/contexts/TiptapEditorContext.js +0 -2
- package/dist/esm/tiptap/extensions/ReactProseMirror.js +0 -30
- package/dist/esm/tiptap/hooks/useIsInReactProseMirror.js +0 -5
- package/dist/esm/tiptap/hooks/useTiptapEditor.js +0 -33
- package/dist/esm/tiptap/hooks/useTiptapEditorEffect.js +0 -42
- package/dist/esm/tiptap/hooks/useTiptapEditorEventCallback.js +0 -35
- package/dist/esm/tiptap/index.js +0 -9
- package/dist/esm/tiptap/tiptapNodeView.js +0 -205
- package/dist/types/components/DefaultNodeView.d.ts +0 -3
- package/dist/types/components/DocNodeView.d.ts +0 -12
- package/dist/types/components/MarkView.d.ts +0 -9
- package/dist/types/components/NodeView.d.ts +0 -11
- package/dist/types/components/NodeViewComponentProps.d.ts +0 -12
- package/dist/types/components/ReactNodeView.d.ts +0 -13
- package/dist/types/components/marks/OldMarkView.d.ts +0 -10
- package/dist/types/components/nodes/CustomNodeView.d.ts +0 -12
- package/dist/types/tiptap/ReactProseMirrorNodeView.d.ts +0 -15
- package/dist/types/tiptap/TiptapEditor.d.ts +0 -6
- package/dist/types/tiptap/TiptapEditorContent.d.ts +0 -19
- package/dist/types/tiptap/TiptapEditorView.d.ts +0 -16
- package/dist/types/tiptap/TiptapNodeView.d.ts +0 -15
- package/dist/types/tiptap/contexts/TiptapEditorContext.d.ts +0 -6
- package/dist/types/tiptap/extensions/ReactProseMirror.d.ts +0 -9
- package/dist/types/tiptap/hooks/useIsInReactProseMirror.d.ts +0 -1
- package/dist/types/tiptap/hooks/useTiptapEditor.d.ts +0 -4
- package/dist/types/tiptap/hooks/useTiptapEditorEffect.d.ts +0 -21
- package/dist/types/tiptap/hooks/useTiptapEditorEventCallback.d.ts +0 -13
- package/dist/types/tiptap/index.d.ts +0 -9
- package/dist/types/tiptap/tiptapNodeView.d.ts +0 -50
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
value: true
|
|
4
|
-
});
|
|
5
|
-
Object.defineProperty(exports, "DefaultNodeView", {
|
|
6
|
-
enumerable: true,
|
|
7
|
-
get: function() {
|
|
8
|
-
return DefaultNodeView;
|
|
9
|
-
}
|
|
10
|
-
});
|
|
11
|
-
const _react = /*#__PURE__*/ _interop_require_wildcard(require("react"));
|
|
12
|
-
const _OutputSpec = require("./OutputSpec.js");
|
|
13
|
-
function _getRequireWildcardCache(nodeInterop) {
|
|
14
|
-
if (typeof WeakMap !== "function") return null;
|
|
15
|
-
var cacheBabelInterop = new WeakMap();
|
|
16
|
-
var cacheNodeInterop = new WeakMap();
|
|
17
|
-
return (_getRequireWildcardCache = function(nodeInterop) {
|
|
18
|
-
return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
|
|
19
|
-
})(nodeInterop);
|
|
20
|
-
}
|
|
21
|
-
function _interop_require_wildcard(obj, nodeInterop) {
|
|
22
|
-
if (!nodeInterop && obj && obj.__esModule) {
|
|
23
|
-
return obj;
|
|
24
|
-
}
|
|
25
|
-
if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
|
|
26
|
-
return {
|
|
27
|
-
default: obj
|
|
28
|
-
};
|
|
29
|
-
}
|
|
30
|
-
var cache = _getRequireWildcardCache(nodeInterop);
|
|
31
|
-
if (cache && cache.has(obj)) {
|
|
32
|
-
return cache.get(obj);
|
|
33
|
-
}
|
|
34
|
-
var newObj = {
|
|
35
|
-
__proto__: null
|
|
36
|
-
};
|
|
37
|
-
var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
|
|
38
|
-
for(var key in obj){
|
|
39
|
-
if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
40
|
-
var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
|
|
41
|
-
if (desc && (desc.get || desc.set)) {
|
|
42
|
-
Object.defineProperty(newObj, key, desc);
|
|
43
|
-
} else {
|
|
44
|
-
newObj[key] = obj[key];
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
newObj.default = obj;
|
|
49
|
-
if (cache) {
|
|
50
|
-
cache.set(obj, newObj);
|
|
51
|
-
}
|
|
52
|
-
return newObj;
|
|
53
|
-
}
|
|
54
|
-
const DefaultNodeView = /*#__PURE__*/ (0, _react.forwardRef)(function DefaultNodeView(param, ref) {
|
|
55
|
-
let { nodeProps: { node }, children, ...props } = param;
|
|
56
|
-
const spec = (0, _react.useMemo)(()=>node.type.spec.toDOM?.(node), [
|
|
57
|
-
node
|
|
58
|
-
]);
|
|
59
|
-
if (!spec) {
|
|
60
|
-
throw new Error(`Node spec for ${node.type.name} is missing toDOM`);
|
|
61
|
-
}
|
|
62
|
-
return /*#__PURE__*/ _react.default.createElement(_OutputSpec.OutputSpec, {
|
|
63
|
-
...props,
|
|
64
|
-
outputSpec: spec,
|
|
65
|
-
ref: ref
|
|
66
|
-
}, children);
|
|
67
|
-
});
|
|
@@ -1,96 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
value: true
|
|
4
|
-
});
|
|
5
|
-
Object.defineProperty(exports, "DocNodeView", {
|
|
6
|
-
enumerable: true,
|
|
7
|
-
get: function() {
|
|
8
|
-
return DocNodeView;
|
|
9
|
-
}
|
|
10
|
-
});
|
|
11
|
-
const _react = /*#__PURE__*/ _interop_require_wildcard(require("react"));
|
|
12
|
-
const _ChildDescriptorsContext = require("../contexts/ChildDescriptorsContext.js");
|
|
13
|
-
const _useNodeViewDescriptor = require("../hooks/useNodeViewDescriptor.js");
|
|
14
|
-
const _ChildNodeViews = require("./ChildNodeViews.js");
|
|
15
|
-
function _getRequireWildcardCache(nodeInterop) {
|
|
16
|
-
if (typeof WeakMap !== "function") return null;
|
|
17
|
-
var cacheBabelInterop = new WeakMap();
|
|
18
|
-
var cacheNodeInterop = new WeakMap();
|
|
19
|
-
return (_getRequireWildcardCache = function(nodeInterop) {
|
|
20
|
-
return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
|
|
21
|
-
})(nodeInterop);
|
|
22
|
-
}
|
|
23
|
-
function _interop_require_wildcard(obj, nodeInterop) {
|
|
24
|
-
if (!nodeInterop && obj && obj.__esModule) {
|
|
25
|
-
return obj;
|
|
26
|
-
}
|
|
27
|
-
if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
|
|
28
|
-
return {
|
|
29
|
-
default: obj
|
|
30
|
-
};
|
|
31
|
-
}
|
|
32
|
-
var cache = _getRequireWildcardCache(nodeInterop);
|
|
33
|
-
if (cache && cache.has(obj)) {
|
|
34
|
-
return cache.get(obj);
|
|
35
|
-
}
|
|
36
|
-
var newObj = {
|
|
37
|
-
__proto__: null
|
|
38
|
-
};
|
|
39
|
-
var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
|
|
40
|
-
for(var key in obj){
|
|
41
|
-
if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
42
|
-
var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
|
|
43
|
-
if (desc && (desc.get || desc.set)) {
|
|
44
|
-
Object.defineProperty(newObj, key, desc);
|
|
45
|
-
} else {
|
|
46
|
-
newObj[key] = obj[key];
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
newObj.default = obj;
|
|
51
|
-
if (cache) {
|
|
52
|
-
cache.set(obj, newObj);
|
|
53
|
-
}
|
|
54
|
-
return newObj;
|
|
55
|
-
}
|
|
56
|
-
const DocNodeView = /*#__PURE__*/ (0, _react.memo)(/*#__PURE__*/ (0, _react.forwardRef)(function DocNodeView(param, ref) {
|
|
57
|
-
let { as, node, getPos, decorations, innerDecorations, setMount, ...elementProps } = param;
|
|
58
|
-
const innerRef = (0, _react.useRef)(null);
|
|
59
|
-
(0, _react.useImperativeHandle)(ref, ()=>innerRef.current);
|
|
60
|
-
(0, _react.useImperativeHandle)(setMount, ()=>innerRef.current);
|
|
61
|
-
const nodeProps = (0, _react.useMemo)(()=>({
|
|
62
|
-
node,
|
|
63
|
-
getPos,
|
|
64
|
-
decorations,
|
|
65
|
-
innerDecorations
|
|
66
|
-
}), [
|
|
67
|
-
node,
|
|
68
|
-
getPos,
|
|
69
|
-
decorations,
|
|
70
|
-
innerDecorations
|
|
71
|
-
]);
|
|
72
|
-
const { childContextValue } = (0, _useNodeViewDescriptor.useNodeViewDescriptor)(innerRef, ()=>{
|
|
73
|
-
const dom = innerRef.current;
|
|
74
|
-
return {
|
|
75
|
-
dom,
|
|
76
|
-
contentDOM: dom,
|
|
77
|
-
update () {
|
|
78
|
-
return true;
|
|
79
|
-
}
|
|
80
|
-
};
|
|
81
|
-
}, nodeProps);
|
|
82
|
-
const children = /*#__PURE__*/ _react.default.createElement(_ChildDescriptorsContext.ChildDescriptorsContext.Provider, {
|
|
83
|
-
value: childContextValue
|
|
84
|
-
}, /*#__PURE__*/ _react.default.createElement(_ChildNodeViews.ChildNodeViews, {
|
|
85
|
-
getPos: getPos,
|
|
86
|
-
node: node,
|
|
87
|
-
innerDecorations: innerDecorations
|
|
88
|
-
}));
|
|
89
|
-
const props = {
|
|
90
|
-
...elementProps,
|
|
91
|
-
suppressContentEditableWarning: true,
|
|
92
|
-
ref: innerRef
|
|
93
|
-
};
|
|
94
|
-
const element = as ? /*#__PURE__*/ (0, _react.cloneElement)(as, props, children) : /*#__PURE__*/ (0, _react.createElement)("div", props, children);
|
|
95
|
-
return nodeProps.decorations.reduce(_ChildNodeViews.wrapInDeco, element);
|
|
96
|
-
}));
|
|
@@ -1,119 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
value: true
|
|
4
|
-
});
|
|
5
|
-
Object.defineProperty(exports, "MarkView", {
|
|
6
|
-
enumerable: true,
|
|
7
|
-
get: function() {
|
|
8
|
-
return MarkView;
|
|
9
|
-
}
|
|
10
|
-
});
|
|
11
|
-
const _react = /*#__PURE__*/ _interop_require_wildcard(require("react"));
|
|
12
|
-
const _ChildDescriptorsContext = require("../contexts/ChildDescriptorsContext.js");
|
|
13
|
-
const _useClientLayoutEffect = require("../hooks/useClientLayoutEffect.js");
|
|
14
|
-
const _viewdesc = require("../viewdesc.js");
|
|
15
|
-
const _OutputSpec = require("./OutputSpec.js");
|
|
16
|
-
function _getRequireWildcardCache(nodeInterop) {
|
|
17
|
-
if (typeof WeakMap !== "function") return null;
|
|
18
|
-
var cacheBabelInterop = new WeakMap();
|
|
19
|
-
var cacheNodeInterop = new WeakMap();
|
|
20
|
-
return (_getRequireWildcardCache = function(nodeInterop) {
|
|
21
|
-
return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
|
|
22
|
-
})(nodeInterop);
|
|
23
|
-
}
|
|
24
|
-
function _interop_require_wildcard(obj, nodeInterop) {
|
|
25
|
-
if (!nodeInterop && obj && obj.__esModule) {
|
|
26
|
-
return obj;
|
|
27
|
-
}
|
|
28
|
-
if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
|
|
29
|
-
return {
|
|
30
|
-
default: obj
|
|
31
|
-
};
|
|
32
|
-
}
|
|
33
|
-
var cache = _getRequireWildcardCache(nodeInterop);
|
|
34
|
-
if (cache && cache.has(obj)) {
|
|
35
|
-
return cache.get(obj);
|
|
36
|
-
}
|
|
37
|
-
var newObj = {
|
|
38
|
-
__proto__: null
|
|
39
|
-
};
|
|
40
|
-
var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
|
|
41
|
-
for(var key in obj){
|
|
42
|
-
if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
43
|
-
var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
|
|
44
|
-
if (desc && (desc.get || desc.set)) {
|
|
45
|
-
Object.defineProperty(newObj, key, desc);
|
|
46
|
-
} else {
|
|
47
|
-
newObj[key] = obj[key];
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
newObj.default = obj;
|
|
52
|
-
if (cache) {
|
|
53
|
-
cache.set(obj, newObj);
|
|
54
|
-
}
|
|
55
|
-
return newObj;
|
|
56
|
-
}
|
|
57
|
-
const MarkView = /*#__PURE__*/ (0, _react.memo)(/*#__PURE__*/ (0, _react.forwardRef)(function MarkView(param, ref) {
|
|
58
|
-
let { mark, getPos, children } = param;
|
|
59
|
-
const { siblingsRef, parentRef } = (0, _react.useContext)(_ChildDescriptorsContext.ChildDescriptorsContext);
|
|
60
|
-
const viewDescRef = (0, _react.useRef)(undefined);
|
|
61
|
-
const childDescriptors = (0, _react.useRef)([]);
|
|
62
|
-
const domRef = (0, _react.useRef)(null);
|
|
63
|
-
(0, _react.useImperativeHandle)(ref, ()=>{
|
|
64
|
-
return domRef.current;
|
|
65
|
-
}, []);
|
|
66
|
-
const outputSpec = (0, _react.useMemo)(()=>mark.type.spec.toDOM?.(mark, true), [
|
|
67
|
-
mark
|
|
68
|
-
]);
|
|
69
|
-
if (!outputSpec) throw new Error(`Mark spec for ${mark.type.name} is missing toDOM`);
|
|
70
|
-
(0, _useClientLayoutEffect.useClientLayoutEffect)(()=>{
|
|
71
|
-
const siblings = siblingsRef.current;
|
|
72
|
-
return ()=>{
|
|
73
|
-
if (!viewDescRef.current) return;
|
|
74
|
-
if (siblings.includes(viewDescRef.current)) {
|
|
75
|
-
const index = siblings.indexOf(viewDescRef.current);
|
|
76
|
-
siblings.splice(index, 1);
|
|
77
|
-
}
|
|
78
|
-
};
|
|
79
|
-
}, [
|
|
80
|
-
siblingsRef
|
|
81
|
-
]);
|
|
82
|
-
(0, _useClientLayoutEffect.useClientLayoutEffect)(()=>{
|
|
83
|
-
if (!domRef.current) return;
|
|
84
|
-
const firstChildDesc = childDescriptors.current[0];
|
|
85
|
-
if (!viewDescRef.current) {
|
|
86
|
-
viewDescRef.current = new _viewdesc.MarkViewDesc(parentRef.current, childDescriptors.current, getPos, mark, domRef.current, firstChildDesc?.dom.parentElement ?? domRef.current, {
|
|
87
|
-
dom: domRef.current,
|
|
88
|
-
contentDOM: firstChildDesc?.dom.parentElement ?? domRef.current
|
|
89
|
-
});
|
|
90
|
-
} else {
|
|
91
|
-
viewDescRef.current.parent = parentRef.current;
|
|
92
|
-
viewDescRef.current.spec.dom = viewDescRef.current.dom = domRef.current;
|
|
93
|
-
viewDescRef.current.children = childDescriptors.current;
|
|
94
|
-
viewDescRef.current.spec.contentDOM = viewDescRef.current.contentDOM = firstChildDesc?.dom.parentElement ?? domRef.current;
|
|
95
|
-
viewDescRef.current.mark = mark;
|
|
96
|
-
}
|
|
97
|
-
if (!siblingsRef.current.includes(viewDescRef.current)) {
|
|
98
|
-
siblingsRef.current.push(viewDescRef.current);
|
|
99
|
-
}
|
|
100
|
-
siblingsRef.current.sort(_viewdesc.sortViewDescs);
|
|
101
|
-
for (const childDesc of childDescriptors.current){
|
|
102
|
-
childDesc.parent = viewDescRef.current;
|
|
103
|
-
}
|
|
104
|
-
});
|
|
105
|
-
const childContextValue = (0, _react.useMemo)(()=>({
|
|
106
|
-
parentRef: viewDescRef,
|
|
107
|
-
siblingsRef: childDescriptors
|
|
108
|
-
}), [
|
|
109
|
-
childDescriptors,
|
|
110
|
-
viewDescRef
|
|
111
|
-
]);
|
|
112
|
-
return /*#__PURE__*/ _react.default.createElement(_OutputSpec.OutputSpec, {
|
|
113
|
-
ref: domRef,
|
|
114
|
-
outputSpec: outputSpec,
|
|
115
|
-
isMark: true
|
|
116
|
-
}, /*#__PURE__*/ _react.default.createElement(_ChildDescriptorsContext.ChildDescriptorsContext.Provider, {
|
|
117
|
-
value: childContextValue
|
|
118
|
-
}, children));
|
|
119
|
-
}));
|
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
value: true
|
|
4
|
-
});
|
|
5
|
-
Object.defineProperty(exports, "NodeView", {
|
|
6
|
-
enumerable: true,
|
|
7
|
-
get: function() {
|
|
8
|
-
return NodeView;
|
|
9
|
-
}
|
|
10
|
-
});
|
|
11
|
-
const _react = /*#__PURE__*/ _interop_require_wildcard(require("react"));
|
|
12
|
-
const _NodeViewContext = require("../contexts/NodeViewContext.js");
|
|
13
|
-
const _CustomNodeView = require("./CustomNodeView.js");
|
|
14
|
-
const _DefaultNodeView = require("./DefaultNodeView.js");
|
|
15
|
-
const _ReactNodeView = require("./ReactNodeView.js");
|
|
16
|
-
function _getRequireWildcardCache(nodeInterop) {
|
|
17
|
-
if (typeof WeakMap !== "function") return null;
|
|
18
|
-
var cacheBabelInterop = new WeakMap();
|
|
19
|
-
var cacheNodeInterop = new WeakMap();
|
|
20
|
-
return (_getRequireWildcardCache = function(nodeInterop) {
|
|
21
|
-
return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
|
|
22
|
-
})(nodeInterop);
|
|
23
|
-
}
|
|
24
|
-
function _interop_require_wildcard(obj, nodeInterop) {
|
|
25
|
-
if (!nodeInterop && obj && obj.__esModule) {
|
|
26
|
-
return obj;
|
|
27
|
-
}
|
|
28
|
-
if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
|
|
29
|
-
return {
|
|
30
|
-
default: obj
|
|
31
|
-
};
|
|
32
|
-
}
|
|
33
|
-
var cache = _getRequireWildcardCache(nodeInterop);
|
|
34
|
-
if (cache && cache.has(obj)) {
|
|
35
|
-
return cache.get(obj);
|
|
36
|
-
}
|
|
37
|
-
var newObj = {
|
|
38
|
-
__proto__: null
|
|
39
|
-
};
|
|
40
|
-
var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
|
|
41
|
-
for(var key in obj){
|
|
42
|
-
if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
43
|
-
var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
|
|
44
|
-
if (desc && (desc.get || desc.set)) {
|
|
45
|
-
Object.defineProperty(newObj, key, desc);
|
|
46
|
-
} else {
|
|
47
|
-
newObj[key] = obj[key];
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
newObj.default = obj;
|
|
52
|
-
if (cache) {
|
|
53
|
-
cache.set(obj, newObj);
|
|
54
|
-
}
|
|
55
|
-
return newObj;
|
|
56
|
-
}
|
|
57
|
-
const NodeView = /*#__PURE__*/ (0, _react.memo)(function NodeView(props) {
|
|
58
|
-
const { components, constructors } = (0, _react.useContext)(_NodeViewContext.NodeViewContext);
|
|
59
|
-
const component = components[props.node.type.name] ?? _DefaultNodeView.DefaultNodeView;
|
|
60
|
-
const constructor = constructors[props.node.type.name];
|
|
61
|
-
// Construct a wrapper component so that the node view remounts when either
|
|
62
|
-
// its component or constructor changes. A React node view would remount if
|
|
63
|
-
// its underlying component changed without this wrapper, but a custom node
|
|
64
|
-
// view otherwise uses the same React components for all custom node views.
|
|
65
|
-
const Component = (0, _react.useMemo)(()=>{
|
|
66
|
-
if (constructor) {
|
|
67
|
-
return function NodeView(props) {
|
|
68
|
-
return /*#__PURE__*/ _react.default.createElement(_CustomNodeView.CustomNodeView, {
|
|
69
|
-
constructor: constructor,
|
|
70
|
-
...props
|
|
71
|
-
});
|
|
72
|
-
};
|
|
73
|
-
} else {
|
|
74
|
-
return function NodeView(props) {
|
|
75
|
-
return /*#__PURE__*/ _react.default.createElement(_ReactNodeView.ReactNodeView, {
|
|
76
|
-
component: component,
|
|
77
|
-
...props
|
|
78
|
-
});
|
|
79
|
-
};
|
|
80
|
-
}
|
|
81
|
-
}, [
|
|
82
|
-
constructor,
|
|
83
|
-
component
|
|
84
|
-
]);
|
|
85
|
-
return /*#__PURE__*/ _react.default.createElement(Component, props);
|
|
86
|
-
});
|
|
@@ -1,174 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
value: true
|
|
4
|
-
});
|
|
5
|
-
Object.defineProperty(exports, "ReactNodeView", {
|
|
6
|
-
enumerable: true,
|
|
7
|
-
get: function() {
|
|
8
|
-
return ReactNodeView;
|
|
9
|
-
}
|
|
10
|
-
});
|
|
11
|
-
const _react = /*#__PURE__*/ _interop_require_wildcard(require("react"));
|
|
12
|
-
const _ChildDescriptorsContext = require("../contexts/ChildDescriptorsContext.js");
|
|
13
|
-
const _IgnoreMutationContext = require("../contexts/IgnoreMutationContext.js");
|
|
14
|
-
const _SelectNodeContext = require("../contexts/SelectNodeContext.js");
|
|
15
|
-
const _StopEventContext = require("../contexts/StopEventContext.js");
|
|
16
|
-
const _useNodeViewDescriptor = require("../hooks/useNodeViewDescriptor.js");
|
|
17
|
-
const _ChildNodeViews = require("./ChildNodeViews.js");
|
|
18
|
-
function _getRequireWildcardCache(nodeInterop) {
|
|
19
|
-
if (typeof WeakMap !== "function") return null;
|
|
20
|
-
var cacheBabelInterop = new WeakMap();
|
|
21
|
-
var cacheNodeInterop = new WeakMap();
|
|
22
|
-
return (_getRequireWildcardCache = function(nodeInterop) {
|
|
23
|
-
return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
|
|
24
|
-
})(nodeInterop);
|
|
25
|
-
}
|
|
26
|
-
function _interop_require_wildcard(obj, nodeInterop) {
|
|
27
|
-
if (!nodeInterop && obj && obj.__esModule) {
|
|
28
|
-
return obj;
|
|
29
|
-
}
|
|
30
|
-
if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
|
|
31
|
-
return {
|
|
32
|
-
default: obj
|
|
33
|
-
};
|
|
34
|
-
}
|
|
35
|
-
var cache = _getRequireWildcardCache(nodeInterop);
|
|
36
|
-
if (cache && cache.has(obj)) {
|
|
37
|
-
return cache.get(obj);
|
|
38
|
-
}
|
|
39
|
-
var newObj = {
|
|
40
|
-
__proto__: null
|
|
41
|
-
};
|
|
42
|
-
var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
|
|
43
|
-
for(var key in obj){
|
|
44
|
-
if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
45
|
-
var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
|
|
46
|
-
if (desc && (desc.get || desc.set)) {
|
|
47
|
-
Object.defineProperty(newObj, key, desc);
|
|
48
|
-
} else {
|
|
49
|
-
newObj[key] = obj[key];
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
newObj.default = obj;
|
|
54
|
-
if (cache) {
|
|
55
|
-
cache.set(obj, newObj);
|
|
56
|
-
}
|
|
57
|
-
return newObj;
|
|
58
|
-
}
|
|
59
|
-
const ReactNodeView = /*#__PURE__*/ (0, _react.memo)(function ReactNodeView(param) {
|
|
60
|
-
let { component: Component, outerDeco, getPos, node, innerDeco } = param;
|
|
61
|
-
const [hasCustomSelectNode, setHasCustomSelectNode] = (0, _react.useState)(false);
|
|
62
|
-
const [selected, setSelected] = (0, _react.useState)(false);
|
|
63
|
-
const ref = (0, _react.useRef)(null);
|
|
64
|
-
const innerRef = (0, _react.useRef)(null);
|
|
65
|
-
const selectNodeRef = (0, _react.useRef)(null);
|
|
66
|
-
const deselectNodeRef = (0, _react.useRef)(null);
|
|
67
|
-
const stopEventRef = (0, _react.useRef)(null);
|
|
68
|
-
const ignoreMutationRef = (0, _react.useRef)(null);
|
|
69
|
-
const setSelectNode = (0, _react.useCallback)((selectHandler, deselectHandler)=>{
|
|
70
|
-
selectNodeRef.current = selectHandler;
|
|
71
|
-
deselectNodeRef.current = deselectHandler;
|
|
72
|
-
setHasCustomSelectNode(true);
|
|
73
|
-
return ()=>{
|
|
74
|
-
selectNodeRef.current = null;
|
|
75
|
-
deselectNodeRef.current = null;
|
|
76
|
-
setHasCustomSelectNode(false);
|
|
77
|
-
};
|
|
78
|
-
}, []);
|
|
79
|
-
const setStopEvent = (0, _react.useCallback)((handler)=>{
|
|
80
|
-
stopEventRef.current = handler;
|
|
81
|
-
return ()=>{
|
|
82
|
-
stopEventRef.current = null;
|
|
83
|
-
};
|
|
84
|
-
}, []);
|
|
85
|
-
const setIgnoreMutation = (0, _react.useCallback)((handler)=>{
|
|
86
|
-
ignoreMutationRef.current = handler;
|
|
87
|
-
return ()=>{
|
|
88
|
-
ignoreMutationRef.current = null;
|
|
89
|
-
return ()=>{
|
|
90
|
-
ignoreMutationRef.current = null;
|
|
91
|
-
};
|
|
92
|
-
};
|
|
93
|
-
}, []);
|
|
94
|
-
const nodeProps = (0, _react.useMemo)(()=>({
|
|
95
|
-
node: node,
|
|
96
|
-
getPos: getPos,
|
|
97
|
-
decorations: outerDeco,
|
|
98
|
-
innerDecorations: innerDeco
|
|
99
|
-
}), [
|
|
100
|
-
getPos,
|
|
101
|
-
innerDeco,
|
|
102
|
-
node,
|
|
103
|
-
outerDeco
|
|
104
|
-
]);
|
|
105
|
-
const { childContextValue, contentDOM, nodeDOM } = (0, _useNodeViewDescriptor.useNodeViewDescriptor)(ref, ()=>{
|
|
106
|
-
setSelected(false);
|
|
107
|
-
return {
|
|
108
|
-
dom: innerRef.current ?? ref.current,
|
|
109
|
-
update () {
|
|
110
|
-
return true;
|
|
111
|
-
},
|
|
112
|
-
multiType: true,
|
|
113
|
-
selectNode () {
|
|
114
|
-
const selectNode = selectNodeRef.current;
|
|
115
|
-
if (selectNode) {
|
|
116
|
-
selectNode.call(this);
|
|
117
|
-
}
|
|
118
|
-
setSelected(true);
|
|
119
|
-
},
|
|
120
|
-
deselectNode () {
|
|
121
|
-
const deselectNode = deselectNodeRef.current;
|
|
122
|
-
if (deselectNode) {
|
|
123
|
-
deselectNode.call(this);
|
|
124
|
-
}
|
|
125
|
-
setSelected(false);
|
|
126
|
-
},
|
|
127
|
-
stopEvent (event) {
|
|
128
|
-
const stopEvent = stopEventRef.current;
|
|
129
|
-
if (stopEvent) {
|
|
130
|
-
return stopEvent.call(this, event);
|
|
131
|
-
}
|
|
132
|
-
return false;
|
|
133
|
-
},
|
|
134
|
-
ignoreMutation (mutation) {
|
|
135
|
-
const ignoreMutation = ignoreMutationRef.current;
|
|
136
|
-
if (ignoreMutation) {
|
|
137
|
-
return ignoreMutation.call(this, mutation);
|
|
138
|
-
}
|
|
139
|
-
return false;
|
|
140
|
-
}
|
|
141
|
-
};
|
|
142
|
-
}, nodeProps);
|
|
143
|
-
const props = {
|
|
144
|
-
nodeProps,
|
|
145
|
-
...!contentDOM && !nodeProps.node.isText && nodeDOM?.nodeName !== "BR" ? {
|
|
146
|
-
contentEditable: false,
|
|
147
|
-
suppressContentEditableWarning: true
|
|
148
|
-
} : null,
|
|
149
|
-
...!hasCustomSelectNode && selected ? {
|
|
150
|
-
className: "ProseMirror-selectednode"
|
|
151
|
-
} : null,
|
|
152
|
-
...!hasCustomSelectNode && selected || node.type.spec.draggable ? {
|
|
153
|
-
draggable: true
|
|
154
|
-
} : null,
|
|
155
|
-
ref: innerRef
|
|
156
|
-
};
|
|
157
|
-
const children = !node.isLeaf ? /*#__PURE__*/ _react.default.createElement(_ChildNodeViews.ChildNodeViews, {
|
|
158
|
-
getPos: getPos,
|
|
159
|
-
node: node,
|
|
160
|
-
innerDecorations: innerDeco
|
|
161
|
-
}) : null;
|
|
162
|
-
const element = /*#__PURE__*/ (0, _react.cloneElement)(outerDeco.reduce(_ChildNodeViews.wrapInDeco, /*#__PURE__*/ _react.default.createElement(Component, props, children)), {
|
|
163
|
-
ref
|
|
164
|
-
});
|
|
165
|
-
return /*#__PURE__*/ _react.default.createElement(_SelectNodeContext.SelectNodeContext.Provider, {
|
|
166
|
-
value: setSelectNode
|
|
167
|
-
}, /*#__PURE__*/ _react.default.createElement(_StopEventContext.StopEventContext.Provider, {
|
|
168
|
-
value: setStopEvent
|
|
169
|
-
}, /*#__PURE__*/ _react.default.createElement(_IgnoreMutationContext.IgnoreMutationContext.Provider, {
|
|
170
|
-
value: setIgnoreMutation
|
|
171
|
-
}, /*#__PURE__*/ _react.default.createElement(_ChildDescriptorsContext.ChildDescriptorsContext.Provider, {
|
|
172
|
-
value: childContextValue
|
|
173
|
-
}, element))));
|
|
174
|
-
});
|
|
@@ -1,120 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
value: true
|
|
4
|
-
});
|
|
5
|
-
Object.defineProperty(exports, "MarkView", {
|
|
6
|
-
enumerable: true,
|
|
7
|
-
get: function() {
|
|
8
|
-
return MarkView;
|
|
9
|
-
}
|
|
10
|
-
});
|
|
11
|
-
const _react = /*#__PURE__*/ _interop_require_wildcard(require("react"));
|
|
12
|
-
const _ChildDescriptorsContext = require("../../contexts/ChildDescriptorsContext.js");
|
|
13
|
-
const _useClientLayoutEffect = require("../../hooks/useClientLayoutEffect.js");
|
|
14
|
-
const _viewdesc = require("../../viewdesc.js");
|
|
15
|
-
const _OutputSpec = require("../OutputSpec.js");
|
|
16
|
-
function _getRequireWildcardCache(nodeInterop) {
|
|
17
|
-
if (typeof WeakMap !== "function") return null;
|
|
18
|
-
var cacheBabelInterop = new WeakMap();
|
|
19
|
-
var cacheNodeInterop = new WeakMap();
|
|
20
|
-
return (_getRequireWildcardCache = function(nodeInterop) {
|
|
21
|
-
return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
|
|
22
|
-
})(nodeInterop);
|
|
23
|
-
}
|
|
24
|
-
function _interop_require_wildcard(obj, nodeInterop) {
|
|
25
|
-
if (!nodeInterop && obj && obj.__esModule) {
|
|
26
|
-
return obj;
|
|
27
|
-
}
|
|
28
|
-
if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
|
|
29
|
-
return {
|
|
30
|
-
default: obj
|
|
31
|
-
};
|
|
32
|
-
}
|
|
33
|
-
var cache = _getRequireWildcardCache(nodeInterop);
|
|
34
|
-
if (cache && cache.has(obj)) {
|
|
35
|
-
return cache.get(obj);
|
|
36
|
-
}
|
|
37
|
-
var newObj = {
|
|
38
|
-
__proto__: null
|
|
39
|
-
};
|
|
40
|
-
var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
|
|
41
|
-
for(var key in obj){
|
|
42
|
-
if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
43
|
-
var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
|
|
44
|
-
if (desc && (desc.get || desc.set)) {
|
|
45
|
-
Object.defineProperty(newObj, key, desc);
|
|
46
|
-
} else {
|
|
47
|
-
newObj[key] = obj[key];
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
newObj.default = obj;
|
|
52
|
-
if (cache) {
|
|
53
|
-
cache.set(obj, newObj);
|
|
54
|
-
}
|
|
55
|
-
return newObj;
|
|
56
|
-
}
|
|
57
|
-
const MarkView = /*#__PURE__*/ (0, _react.memo)(/*#__PURE__*/ (0, _react.forwardRef)(function MarkView(param, ref) {
|
|
58
|
-
let { mark, getPos, children, inline = false } = param;
|
|
59
|
-
const { siblingsRef, parentRef } = (0, _react.useContext)(_ChildDescriptorsContext.ChildDescriptorsContext);
|
|
60
|
-
const viewDescRef = (0, _react.useRef)(undefined);
|
|
61
|
-
const childDescriptors = (0, _react.useRef)([]);
|
|
62
|
-
const domRef = (0, _react.useRef)(null);
|
|
63
|
-
(0, _react.useImperativeHandle)(ref, ()=>{
|
|
64
|
-
return domRef.current;
|
|
65
|
-
}, []);
|
|
66
|
-
const outputSpec = (0, _react.useMemo)(()=>mark.type.spec.toDOM?.(mark, inline), [
|
|
67
|
-
inline,
|
|
68
|
-
mark
|
|
69
|
-
]);
|
|
70
|
-
if (!outputSpec) throw new Error(`Mark spec for ${mark.type.name} is missing toDOM`);
|
|
71
|
-
(0, _useClientLayoutEffect.useClientLayoutEffect)(()=>{
|
|
72
|
-
const siblings = siblingsRef.current;
|
|
73
|
-
return ()=>{
|
|
74
|
-
if (!viewDescRef.current) return;
|
|
75
|
-
if (siblings.includes(viewDescRef.current)) {
|
|
76
|
-
const index = siblings.indexOf(viewDescRef.current);
|
|
77
|
-
siblings.splice(index, 1);
|
|
78
|
-
}
|
|
79
|
-
};
|
|
80
|
-
}, [
|
|
81
|
-
siblingsRef
|
|
82
|
-
]);
|
|
83
|
-
(0, _useClientLayoutEffect.useClientLayoutEffect)(()=>{
|
|
84
|
-
if (!domRef.current) return;
|
|
85
|
-
const firstChildDesc = childDescriptors.current[0];
|
|
86
|
-
if (!viewDescRef.current) {
|
|
87
|
-
viewDescRef.current = new _viewdesc.MarkViewDesc(parentRef.current, childDescriptors.current, getPos, mark, domRef.current, firstChildDesc?.dom.parentElement ?? domRef.current, {
|
|
88
|
-
dom: domRef.current,
|
|
89
|
-
contentDOM: firstChildDesc?.dom.parentElement ?? domRef.current
|
|
90
|
-
});
|
|
91
|
-
} else {
|
|
92
|
-
viewDescRef.current.parent = parentRef.current;
|
|
93
|
-
viewDescRef.current.spec.dom = viewDescRef.current.dom = domRef.current;
|
|
94
|
-
viewDescRef.current.children = childDescriptors.current;
|
|
95
|
-
viewDescRef.current.spec.contentDOM = viewDescRef.current.contentDOM = firstChildDesc?.dom.parentElement ?? domRef.current;
|
|
96
|
-
viewDescRef.current.mark = mark;
|
|
97
|
-
}
|
|
98
|
-
if (!siblingsRef.current.includes(viewDescRef.current)) {
|
|
99
|
-
siblingsRef.current.push(viewDescRef.current);
|
|
100
|
-
}
|
|
101
|
-
siblingsRef.current.sort(_viewdesc.sortViewDescs);
|
|
102
|
-
for (const childDesc of childDescriptors.current){
|
|
103
|
-
childDesc.parent = viewDescRef.current;
|
|
104
|
-
}
|
|
105
|
-
});
|
|
106
|
-
const childContextValue = (0, _react.useMemo)(()=>({
|
|
107
|
-
parentRef: viewDescRef,
|
|
108
|
-
siblingsRef: childDescriptors
|
|
109
|
-
}), [
|
|
110
|
-
childDescriptors,
|
|
111
|
-
viewDescRef
|
|
112
|
-
]);
|
|
113
|
-
return /*#__PURE__*/ _react.default.createElement(_OutputSpec.OutputSpec, {
|
|
114
|
-
ref: domRef,
|
|
115
|
-
outputSpec: outputSpec,
|
|
116
|
-
isMark: true
|
|
117
|
-
}, /*#__PURE__*/ _react.default.createElement(_ChildDescriptorsContext.ChildDescriptorsContext.Provider, {
|
|
118
|
-
value: childContextValue
|
|
119
|
-
}, children));
|
|
120
|
-
}));
|