@handlewithcare/react-prosemirror 3.1.0-tiptap.36 → 3.1.0-tiptap.37

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.
Files changed (42) hide show
  1. package/dist/tsconfig.tsbuildinfo +1 -1
  2. package/dist/types/props.d.ts +6 -6
  3. package/package.json +1 -1
  4. package/dist/cjs/components/CustomNodeView.js +0 -132
  5. package/dist/cjs/components/DefaultNodeView.js +0 -67
  6. package/dist/cjs/components/DocNodeView.js +0 -96
  7. package/dist/cjs/components/MarkView.js +0 -119
  8. package/dist/cjs/components/NodeView.js +0 -86
  9. package/dist/cjs/components/NodeViewComponentProps.js +0 -4
  10. package/dist/cjs/components/ReactNodeView.js +0 -174
  11. package/dist/cjs/components/marks/CustomMarkView.js +0 -110
  12. package/dist/cjs/components/marks/OldMarkView.js +0 -120
  13. package/dist/cjs/components/nodes/CustomNodeView.js +0 -135
  14. package/dist/cjs/contexts/ChildDescriptorsContext.js +0 -19
  15. package/dist/cjs/hooks/useNodeViewDescriptor.js +0 -156
  16. package/dist/cjs/tiptap/TiptapNodeView.js +0 -26
  17. package/dist/esm/components/CustomNodeView.js +0 -81
  18. package/dist/esm/components/DefaultNodeView.js +0 -16
  19. package/dist/esm/components/DocNodeView.js +0 -45
  20. package/dist/esm/components/MarkView.js +0 -68
  21. package/dist/esm/components/NodeView.js +0 -35
  22. package/dist/esm/components/NodeViewComponentProps.js +0 -1
  23. package/dist/esm/components/ReactNodeView.js +0 -123
  24. package/dist/esm/components/marks/CustomMarkView.js +0 -59
  25. package/dist/esm/components/marks/OldMarkView.js +0 -69
  26. package/dist/esm/components/nodes/CustomNodeView.js +0 -84
  27. package/dist/esm/contexts/ChildDescriptorsContext.js +0 -9
  28. package/dist/esm/hooks/useNodeViewDescriptor.js +0 -146
  29. package/dist/esm/tiptap/TiptapNodeView.js +0 -22
  30. package/dist/types/components/CustomNodeView.d.ts +0 -12
  31. package/dist/types/components/DefaultNodeView.d.ts +0 -3
  32. package/dist/types/components/DocNodeView.d.ts +0 -12
  33. package/dist/types/components/MarkView.d.ts +0 -9
  34. package/dist/types/components/NodeView.d.ts +0 -11
  35. package/dist/types/components/NodeViewComponentProps.d.ts +0 -12
  36. package/dist/types/components/ReactNodeView.d.ts +0 -13
  37. package/dist/types/components/marks/CustomMarkView.d.ts +0 -12
  38. package/dist/types/components/marks/OldMarkView.d.ts +0 -10
  39. package/dist/types/components/nodes/CustomNodeView.d.ts +0 -12
  40. package/dist/types/contexts/ChildDescriptorsContext.d.ts +0 -6
  41. package/dist/types/hooks/useNodeViewDescriptor.d.ts +0 -20
  42. package/dist/types/tiptap/TiptapNodeView.d.ts +0 -15
@@ -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,110 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", {
3
- value: true
4
- });
5
- Object.defineProperty(exports, "CustomMarkView", {
6
- enumerable: true,
7
- get: function() {
8
- return CustomMarkView;
9
- }
10
- });
11
- const _prosemirrormodel = require("prosemirror-model");
12
- const _react = /*#__PURE__*/ _interop_require_wildcard(require("react"));
13
- const _reactdom = require("react-dom");
14
- const _ChildDescriptionsContext = require("../../contexts/ChildDescriptionsContext.js");
15
- const _useMarkViewDescription = require("../../hooks/useMarkViewDescription.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 CustomMarkView = /*#__PURE__*/ (0, _react.memo)(function CustomMarkView(param) {
58
- let { constructor, mark, inline, getPos, children } = param;
59
- const ref = (0, _react.useRef)(null);
60
- const innerRef = (0, _react.useRef)(null);
61
- const markProps = (0, _react.useMemo)(()=>({
62
- mark,
63
- inline,
64
- getPos,
65
- contentDOMRef: {
66
- current: null
67
- }
68
- }), [
69
- mark,
70
- inline,
71
- getPos
72
- ]);
73
- const createMarkView = function() {
74
- for(var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++){
75
- args[_key] = arguments[_key];
76
- }
77
- const markView = constructor(...args);
78
- if (!markView || !markView.dom) {
79
- const spec = mark.type.spec.toDOM?.(mark, inline);
80
- if (!spec) {
81
- throw new Error(`Mark spec for ${mark.type.name} is missing toDOM`);
82
- }
83
- return _prosemirrormodel.DOMSerializer.renderSpec(document, spec, null);
84
- }
85
- return markView;
86
- };
87
- const { childContextValue, contentDOM } = (0, _useMarkViewDescription.useMarkViewDescription)(ref, function() {
88
- for(var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++){
89
- args[_key] = arguments[_key];
90
- }
91
- const markView = createMarkView(...args);
92
- const dom = markView.dom;
93
- const wrapperDOM = innerRef.current ?? ref.current;
94
- return {
95
- ...markView,
96
- destroy () {
97
- markView.destroy?.();
98
- wrapperDOM.removeChild(dom);
99
- },
100
- ignoreMutation: markView.ignoreMutation
101
- };
102
- }, (markView)=>markView?.contentDOM ?? null, markProps);
103
- const Component = inline ? "span" : "div";
104
- const props = {
105
- ref: innerRef
106
- };
107
- return /*#__PURE__*/ _react.default.createElement(Component, props, contentDOM ? /*#__PURE__*/ (0, _reactdom.createPortal)(/*#__PURE__*/ _react.default.createElement(_ChildDescriptionsContext.ChildDescriptionsContext.Provider, {
108
- value: childContextValue
109
- }, children), contentDOM) : null);
110
- });
@@ -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
- }));
@@ -1,135 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", {
3
- value: true
4
- });
5
- Object.defineProperty(exports, "CustomNodeView", {
6
- enumerable: true,
7
- get: function() {
8
- return CustomNodeView;
9
- }
10
- });
11
- const _prosemirrormodel = require("prosemirror-model");
12
- const _react = /*#__PURE__*/ _interop_require_wildcard(require("react"));
13
- const _reactdom = require("react-dom");
14
- const _ChildDescriptionsContext = require("../../contexts/ChildDescriptionsContext.js");
15
- const _useNodeViewDescription = require("../../hooks/useNodeViewDescription.js");
16
- const _ChildNodeViews = require("../ChildNodeViews.js");
17
- function _getRequireWildcardCache(nodeInterop) {
18
- if (typeof WeakMap !== "function") return null;
19
- var cacheBabelInterop = new WeakMap();
20
- var cacheNodeInterop = new WeakMap();
21
- return (_getRequireWildcardCache = function(nodeInterop) {
22
- return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
23
- })(nodeInterop);
24
- }
25
- function _interop_require_wildcard(obj, nodeInterop) {
26
- if (!nodeInterop && obj && obj.__esModule) {
27
- return obj;
28
- }
29
- if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
30
- return {
31
- default: obj
32
- };
33
- }
34
- var cache = _getRequireWildcardCache(nodeInterop);
35
- if (cache && cache.has(obj)) {
36
- return cache.get(obj);
37
- }
38
- var newObj = {
39
- __proto__: null
40
- };
41
- var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
42
- for(var key in obj){
43
- if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
44
- var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
45
- if (desc && (desc.get || desc.set)) {
46
- Object.defineProperty(newObj, key, desc);
47
- } else {
48
- newObj[key] = obj[key];
49
- }
50
- }
51
- }
52
- newObj.default = obj;
53
- if (cache) {
54
- cache.set(obj, newObj);
55
- }
56
- return newObj;
57
- }
58
- const CustomNodeView = /*#__PURE__*/ (0, _react.memo)(function CustomNodeView(param) {
59
- let { constructor, node, getPos, innerDeco, outerDeco } = param;
60
- const ref = (0, _react.useRef)(null);
61
- const innerRef = (0, _react.useRef)(null);
62
- const nodeProps = (0, _react.useMemo)(()=>({
63
- node,
64
- getPos,
65
- decorations: outerDeco,
66
- innerDecorations: innerDeco,
67
- contentDOMRef: {
68
- current: null
69
- }
70
- }), [
71
- node,
72
- getPos,
73
- outerDeco,
74
- innerDeco
75
- ]);
76
- const createNodeView = function() {
77
- for(var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++){
78
- args[_key] = arguments[_key];
79
- }
80
- const nodeView = constructor(...args);
81
- if (!nodeView || !nodeView.dom) {
82
- const spec = node.type.spec.toDOM?.(node);
83
- if (!spec) {
84
- throw new Error(`Node spec for ${node.type.name} is missing toDOM`);
85
- }
86
- return _prosemirrormodel.DOMSerializer.renderSpec(document, spec, null);
87
- }
88
- return nodeView;
89
- };
90
- const { childContextValue, contentDOM } = (0, _useNodeViewDescription.useNodeViewDescription)(ref, function() {
91
- for(var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++){
92
- args[_key] = arguments[_key];
93
- }
94
- const nodeView = createNodeView(...args);
95
- const contentDOM = nodeView.contentDOM;
96
- const nodeDOM = nodeView.dom;
97
- const wrapperDOM = innerRef.current ?? ref.current;
98
- wrapperDOM.appendChild(nodeDOM);
99
- if (!contentDOM && nodeDOM instanceof HTMLElement && nodeDOM.tagName !== "BR") {
100
- if (!nodeDOM.hasAttribute("contenteditable")) {
101
- nodeDOM.contentEditable = "false";
102
- }
103
- if (node.type.spec.draggable) {
104
- nodeDOM.draggable = true;
105
- }
106
- }
107
- return {
108
- ...nodeView,
109
- destroy () {
110
- if (nodeView.destroy) {
111
- nodeView.destroy();
112
- }
113
- wrapperDOM.removeChild(nodeDOM);
114
- },
115
- selectNode: nodeView.selectNode?.bind(nodeView),
116
- deselectNode: nodeView.deselectNode?.bind(nodeView),
117
- stopEvent: nodeView.stopEvent?.bind(nodeView),
118
- ignoreMutation: nodeView.ignoreMutation?.bind(nodeView)
119
- };
120
- }, (source)=>source?.contentDOM ?? null, nodeProps);
121
- const Component = node.isInline ? "span" : "div";
122
- const props = {
123
- ref: innerRef
124
- };
125
- const children = !node.isLeaf && contentDOM ? /*#__PURE__*/ (0, _reactdom.createPortal)(/*#__PURE__*/ _react.default.createElement(_ChildDescriptionsContext.ChildDescriptionsContext.Provider, {
126
- value: childContextValue
127
- }, /*#__PURE__*/ _react.default.createElement(_ChildNodeViews.ChildNodeViews, {
128
- getPos: getPos,
129
- node: node,
130
- innerDecorations: innerDeco
131
- })), contentDOM) : null;
132
- return /*#__PURE__*/ (0, _react.cloneElement)(outerDeco.reduce(_ChildNodeViews.wrapInDeco, /*#__PURE__*/ _react.default.createElement(Component, props, children)), {
133
- ref
134
- });
135
- });
@@ -1,19 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", {
3
- value: true
4
- });
5
- Object.defineProperty(exports, "ChildDescriptorsContext", {
6
- enumerable: true,
7
- get: function() {
8
- return ChildDescriptorsContext;
9
- }
10
- });
11
- const _react = require("react");
12
- const ChildDescriptorsContext = (0, _react.createContext)({
13
- parentRef: {
14
- current: undefined
15
- },
16
- siblingsRef: {
17
- current: []
18
- }
19
- });