@handlewithcare/react-prosemirror 3.1.0-tiptap.40 → 3.1.0-tiptap.42

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 (142) hide show
  1. package/README.md +2 -2
  2. package/dist/cjs/ReactEditorView.js +71 -75
  3. package/dist/cjs/StaticEditorView.js +19 -22
  4. package/dist/cjs/browser.js +1 -3
  5. package/dist/cjs/commands/reorderSiblings.js +9 -13
  6. package/dist/cjs/components/ChildNodeViews.js +68 -71
  7. package/dist/cjs/components/CursorWrapper.js +26 -17
  8. package/dist/cjs/components/LayoutGroup.js +12 -16
  9. package/dist/cjs/components/NativeWidgetView.js +15 -19
  10. package/dist/cjs/components/OutputSpec.js +9 -13
  11. package/dist/cjs/components/ProseMirror.js +37 -27
  12. package/dist/cjs/components/ProseMirrorDoc.js +25 -18
  13. package/dist/cjs/components/SeparatorHackView.js +20 -21
  14. package/dist/cjs/components/TextNodeView.js +22 -20
  15. package/dist/cjs/components/TrailingHackView.js +13 -17
  16. package/dist/cjs/components/WidgetView.js +14 -18
  17. package/dist/cjs/components/marks/DefaultMarkView.js +27 -15
  18. package/dist/cjs/components/marks/MarkView.js +32 -23
  19. package/dist/cjs/components/marks/MarkViewConstructorView.js +38 -22
  20. package/dist/cjs/components/marks/ReactMarkView.js +27 -16
  21. package/dist/cjs/components/nodes/DefaultNodeView.js +27 -15
  22. package/dist/cjs/components/nodes/DocNodeView.js +12 -16
  23. package/dist/cjs/components/nodes/NodeView.js +33 -26
  24. package/dist/cjs/components/nodes/NodeViewConstructorView.js +45 -29
  25. package/dist/cjs/components/nodes/ReactNodeView.js +39 -27
  26. package/dist/cjs/constants.js +6 -10
  27. package/dist/cjs/contexts/ChildDescriptionsContext.js +1 -3
  28. package/dist/cjs/contexts/EditorContext.js +1 -3
  29. package/dist/cjs/contexts/EditorStateContext.js +1 -3
  30. package/dist/cjs/contexts/IgnoreMutationContext.js +1 -3
  31. package/dist/cjs/contexts/LayoutGroupContext.js +1 -3
  32. package/dist/cjs/contexts/NodeViewContext.js +1 -3
  33. package/dist/cjs/contexts/SelectNodeContext.js +1 -3
  34. package/dist/cjs/contexts/StopEventContext.js +1 -3
  35. package/dist/cjs/decorations/ReactWidgetType.js +13 -19
  36. package/dist/cjs/decorations/computeDocDeco.js +3 -5
  37. package/dist/cjs/decorations/iterDeco.js +17 -19
  38. package/dist/cjs/decorations/viewDecorations.js +12 -15
  39. package/dist/cjs/dom.js +13 -34
  40. package/dist/cjs/findDOMNode.js +5 -9
  41. package/dist/cjs/hooks/useClientLayoutEffect.js +1 -3
  42. package/dist/cjs/hooks/useComponentEventListeners.js +6 -7
  43. package/dist/cjs/hooks/useEditor.js +30 -28
  44. package/dist/cjs/hooks/useEditorEffect.js +7 -9
  45. package/dist/cjs/hooks/useEditorEventCallback.js +7 -9
  46. package/dist/cjs/hooks/useEditorEventListener.js +6 -8
  47. package/dist/cjs/hooks/useEditorState.js +3 -5
  48. package/dist/cjs/hooks/useEffectEvent.js +1 -3
  49. package/dist/cjs/hooks/useForceUpdate.js +1 -3
  50. package/dist/cjs/hooks/useIgnoreMutation.js +7 -9
  51. package/dist/cjs/hooks/useIsEditorStatic.js +5 -5
  52. package/dist/cjs/hooks/useIsNodeSelected.js +3 -5
  53. package/dist/cjs/hooks/useLayoutGroupEffect.js +5 -7
  54. package/dist/cjs/hooks/useMarkViewDescription.js +25 -24
  55. package/dist/cjs/hooks/useNodePos.js +5 -7
  56. package/dist/cjs/hooks/useNodeViewDescription.js +41 -28
  57. package/dist/cjs/hooks/useReactKeys.js +5 -7
  58. package/dist/cjs/hooks/useSelectNode.js +8 -10
  59. package/dist/cjs/hooks/useStopEvent.js +7 -9
  60. package/dist/cjs/index.js +34 -66
  61. package/dist/cjs/plugins/beforeInputPlugin.js +23 -20
  62. package/dist/cjs/plugins/componentEventListeners.js +6 -8
  63. package/dist/cjs/plugins/componentEventListenersPlugin.js +6 -8
  64. package/dist/cjs/plugins/reactKeys.js +10 -15
  65. package/dist/cjs/props.js +19 -23
  66. package/dist/cjs/refs.js +1 -3
  67. package/dist/cjs/testing/editorViewTestHelpers.js +47 -40
  68. package/dist/cjs/testing/setupProseMirrorView.js +4 -7
  69. package/dist/cjs/tiptap/ReactProseMirrorNodeView.js +6 -10
  70. package/dist/cjs/tiptap/TiptapEditor.js +14 -15
  71. package/dist/cjs/tiptap/TiptapEditorContent.js +28 -18
  72. package/dist/cjs/tiptap/TiptapEditorView.js +34 -23
  73. package/dist/cjs/tiptap/contexts/TiptapEditorContext.js +1 -3
  74. package/dist/cjs/tiptap/extensions/ReactProseMirror.js +6 -8
  75. package/dist/cjs/tiptap/extensions/ReactProseMirrorCommands.js +3 -5
  76. package/dist/cjs/tiptap/extensions/commands/updateAttributes.js +2 -4
  77. package/dist/cjs/tiptap/hooks/useIsInReactProseMirror.js +3 -5
  78. package/dist/cjs/tiptap/hooks/useTiptapEditor.js +14 -12
  79. package/dist/cjs/tiptap/hooks/useTiptapEditorEffect.js +10 -12
  80. package/dist/cjs/tiptap/hooks/useTiptapEditorEventCallback.js +4 -6
  81. package/dist/cjs/tiptap/index.js +18 -36
  82. package/dist/cjs/tiptap/tiptapNodeView.js +62 -48
  83. package/dist/cjs/viewdesc.js +95 -119
  84. package/dist/esm/ReactEditorView.js +67 -69
  85. package/dist/esm/StaticEditorView.js +18 -19
  86. package/dist/esm/commands/reorderSiblings.js +5 -5
  87. package/dist/esm/components/ChildNodeViews.js +36 -33
  88. package/dist/esm/components/CursorWrapper.js +18 -5
  89. package/dist/esm/components/LayoutGroup.js +1 -1
  90. package/dist/esm/components/NativeWidgetView.js +2 -2
  91. package/dist/esm/components/OutputSpec.js +1 -1
  92. package/dist/esm/components/ProseMirror.js +17 -3
  93. package/dist/esm/components/ProseMirrorDoc.js +19 -6
  94. package/dist/esm/components/SeparatorHackView.js +8 -5
  95. package/dist/esm/components/TextNodeView.js +10 -6
  96. package/dist/esm/components/TrailingHackView.js +2 -2
  97. package/dist/esm/components/WidgetView.js +3 -3
  98. package/dist/esm/components/marks/DefaultMarkView.js +22 -6
  99. package/dist/esm/components/marks/MarkView.js +24 -11
  100. package/dist/esm/components/marks/MarkViewConstructorView.js +27 -7
  101. package/dist/esm/components/marks/ReactMarkView.js +18 -3
  102. package/dist/esm/components/nodes/DefaultNodeView.js +22 -6
  103. package/dist/esm/components/nodes/DocNodeView.js +2 -2
  104. package/dist/esm/components/nodes/NodeView.js +24 -11
  105. package/dist/esm/components/nodes/NodeViewConstructorView.js +31 -11
  106. package/dist/esm/components/nodes/ReactNodeView.js +22 -6
  107. package/dist/esm/decorations/ReactWidgetType.js +8 -10
  108. package/dist/esm/decorations/iterDeco.js +13 -13
  109. package/dist/esm/decorations/viewDecorations.js +6 -7
  110. package/dist/esm/dom.js +2 -1
  111. package/dist/esm/findDOMNode.js +1 -1
  112. package/dist/esm/hooks/useComponentEventListeners.js +3 -2
  113. package/dist/esm/hooks/useEditor.js +9 -5
  114. package/dist/esm/hooks/useEditorEffect.js +1 -1
  115. package/dist/esm/hooks/useEditorEventCallback.js +1 -1
  116. package/dist/esm/hooks/useEditorEventListener.js +1 -1
  117. package/dist/esm/hooks/useIsEditorStatic.js +3 -1
  118. package/dist/esm/hooks/useMarkViewDescription.js +10 -7
  119. package/dist/esm/hooks/useNodeViewDescription.js +22 -7
  120. package/dist/esm/hooks/useReactKeys.js +1 -1
  121. package/dist/esm/plugins/beforeInputPlugin.js +17 -12
  122. package/dist/esm/plugins/reactKeys.js +4 -3
  123. package/dist/esm/props.js +15 -15
  124. package/dist/esm/testing/editorViewTestHelpers.js +31 -20
  125. package/dist/esm/testing/setupProseMirrorView.js +2 -1
  126. package/dist/esm/tiptap/ReactProseMirrorNodeView.js +5 -7
  127. package/dist/esm/tiptap/TiptapEditor.js +10 -9
  128. package/dist/esm/tiptap/TiptapEditorContent.js +18 -4
  129. package/dist/esm/tiptap/TiptapEditorView.js +23 -8
  130. package/dist/esm/tiptap/extensions/ReactProseMirror.js +1 -1
  131. package/dist/esm/tiptap/extensions/commands/updateAttributes.js +1 -1
  132. package/dist/esm/tiptap/hooks/useTiptapEditor.js +8 -4
  133. package/dist/esm/tiptap/hooks/useTiptapEditorEffect.js +4 -4
  134. package/dist/esm/tiptap/hooks/useTiptapEditorEventCallback.js +1 -1
  135. package/dist/esm/tiptap/tiptapNodeView.js +38 -20
  136. package/dist/esm/viewdesc.js +72 -74
  137. package/dist/tsconfig.tsbuildinfo +1 -1
  138. package/dist/types/ReactEditorView.d.ts +2 -2
  139. package/dist/types/StaticEditorView.d.ts +2 -1
  140. package/dist/types/props.d.ts +26 -26
  141. package/dist/types/viewdesc.d.ts +2 -0
  142. package/package.json +10 -6
@@ -4,15 +4,13 @@ Object.defineProperty(exports, "__esModule", {
4
4
  });
5
5
  Object.defineProperty(exports, "TextNodeView", {
6
6
  enumerable: true,
7
- get: function() {
8
- return TextNodeView;
9
- }
7
+ get: ()=>TextNodeView
10
8
  });
11
- const _prosemirrorview = require("prosemirror-view");
9
+ const _prosemirrorView = require("prosemirror-view");
12
10
  const _react = require("react");
13
- const _findDOMNode = require("../findDOMNode.js");
14
- const _viewdesc = require("../viewdesc.js");
15
- const _ChildNodeViews = require("./ChildNodeViews.js");
11
+ const _findDOMNodeJs = require("../findDOMNode.js");
12
+ const _viewdescJs = require("../viewdesc.js");
13
+ const _childNodeViewsJs = require("./ChildNodeViews.js");
16
14
  function shallowEqual(objA, objB) {
17
15
  if (objA === objB) {
18
16
  return true;
@@ -36,38 +34,37 @@ function shallowEqual(objA, objB) {
36
34
  return true;
37
35
  }
38
36
  let TextNodeView = class TextNodeView extends _react.Component {
39
- viewDescRef = null;
40
- renderRef = null;
41
37
  updateEffect() {
42
- const { view, decorations, siblingsRef, parentRef, getPos, node } = this.props;
38
+ const { view , decorations , siblingsRef , parentRef , getPos , node } = this.props;
43
39
  // There simply is no other way to ref a text node
44
40
  // eslint-disable-next-line react/no-find-dom-node
45
- const dom = (0, _findDOMNode.findDOMNode)(this);
41
+ const dom = (0, _findDOMNodeJs.findDOMNode)(this);
46
42
  // We only need to explicitly create a CompositionViewDesc
47
43
  // when a composition was started that produces a new text node.
48
44
  // Otherwise we just rely on re-rendering the renderRef
49
45
  if (!dom) {
50
46
  if (!view.composing) return;
51
- this.viewDescRef = new _viewdesc.CompositionViewDesc(parentRef.current, getPos, // These are just placeholders/dummies. We can't
47
+ var _text, _text1;
48
+ this.viewDescRef = new _viewdescJs.CompositionViewDesc(parentRef.current, getPos, // These are just placeholders/dummies. We can't
52
49
  // actually find the correct DOM nodes from here,
53
50
  // so we let our parent do it.
54
51
  // Passing a valid element here just so that the
55
52
  // ViewDesc constructor doesn't blow up.
56
- document.createElement("div"), document.createTextNode(node.text ?? ""), node.text ?? "");
53
+ document.createElement("div"), document.createTextNode((_text = node.text) !== null && _text !== void 0 ? _text : ""), (_text1 = node.text) !== null && _text1 !== void 0 ? _text1 : "");
57
54
  return;
58
55
  }
59
56
  let textNode = dom;
60
57
  while(textNode.firstChild){
61
58
  textNode = textNode.firstChild;
62
59
  }
63
- if (!this.viewDescRef || this.viewDescRef instanceof _viewdesc.CompositionViewDesc) {
64
- this.viewDescRef = new _viewdesc.TextViewDesc(undefined, [], getPos, node, decorations, _prosemirrorview.DecorationSet.empty, dom, textNode);
60
+ if (!this.viewDescRef || this.viewDescRef instanceof _viewdescJs.CompositionViewDesc) {
61
+ this.viewDescRef = new _viewdescJs.TextViewDesc(undefined, [], getPos, node, decorations, _prosemirrorView.DecorationSet.empty, dom, textNode);
65
62
  } else {
66
63
  this.viewDescRef.parent = parentRef.current;
67
64
  this.viewDescRef.children = [];
68
65
  this.viewDescRef.node = node;
69
66
  this.viewDescRef.outerDeco = decorations;
70
- this.viewDescRef.innerDeco = _prosemirrorview.DecorationSet.empty;
67
+ this.viewDescRef.innerDeco = _prosemirrorView.DecorationSet.empty;
71
68
  this.viewDescRef.dom = dom;
72
69
  this.viewDescRef.dom.pmViewDesc = this.viewDescRef;
73
70
  this.viewDescRef.nodeDOM = textNode;
@@ -75,7 +72,7 @@ let TextNodeView = class TextNodeView extends _react.Component {
75
72
  if (!siblingsRef.current.includes(this.viewDescRef)) {
76
73
  siblingsRef.current.push(this.viewDescRef);
77
74
  }
78
- siblingsRef.current.sort(_viewdesc.sortViewDescs);
75
+ siblingsRef.current.sort(_viewdescJs.sortViewDescs);
79
76
  }
80
77
  shouldComponentUpdate(nextProps) {
81
78
  return !shallowEqual(this.props, nextProps);
@@ -87,7 +84,7 @@ let TextNodeView = class TextNodeView extends _react.Component {
87
84
  this.updateEffect();
88
85
  }
89
86
  componentWillUnmount() {
90
- const { siblingsRef } = this.props;
87
+ const { siblingsRef } = this.props;
91
88
  if (!this.viewDescRef) return;
92
89
  if (siblingsRef.current.includes(this.viewDescRef)) {
93
90
  const index = siblingsRef.current.indexOf(this.viewDescRef);
@@ -95,7 +92,7 @@ let TextNodeView = class TextNodeView extends _react.Component {
95
92
  }
96
93
  }
97
94
  render() {
98
- const { view, getPos, node, decorations } = this.props;
95
+ const { view , getPos , node , decorations } = this.props;
99
96
  // During a composition, it's crucial that we don't try to
100
97
  // update the DOM that the user is working in. If there's
101
98
  // an active composition and the selection is in this node,
@@ -104,7 +101,12 @@ let TextNodeView = class TextNodeView extends _react.Component {
104
101
  if (view.composing && view.state.selection.from >= getPos() && view.state.selection.from <= getPos() + node.nodeSize) {
105
102
  return this.renderRef;
106
103
  }
107
- this.renderRef = decorations.reduce(_ChildNodeViews.wrapInDeco, node.text);
104
+ this.renderRef = decorations.reduce(_childNodeViewsJs.wrapInDeco, node.text);
108
105
  return this.renderRef;
109
106
  }
107
+ constructor(...args){
108
+ super(...args);
109
+ this.viewDescRef = null;
110
+ this.renderRef = null;
111
+ }
110
112
  };
@@ -4,14 +4,12 @@ Object.defineProperty(exports, "__esModule", {
4
4
  });
5
5
  Object.defineProperty(exports, "TrailingHackView", {
6
6
  enumerable: true,
7
- get: function() {
8
- return TrailingHackView;
9
- }
7
+ get: ()=>TrailingHackView
10
8
  });
11
- const _react = /*#__PURE__*/ _interop_require_wildcard(require("react"));
12
- const _ChildDescriptionsContext = require("../contexts/ChildDescriptionsContext.js");
13
- const _useClientLayoutEffect = require("../hooks/useClientLayoutEffect.js");
14
- const _viewdesc = require("../viewdesc.js");
9
+ const _react = /*#__PURE__*/ _interopRequireWildcard(require("react"));
10
+ const _childDescriptionsContextJs = require("../contexts/ChildDescriptionsContext.js");
11
+ const _useClientLayoutEffectJs = require("../hooks/useClientLayoutEffect.js");
12
+ const _viewdescJs = require("../viewdesc.js");
15
13
  function _getRequireWildcardCache(nodeInterop) {
16
14
  if (typeof WeakMap !== "function") return null;
17
15
  var cacheBabelInterop = new WeakMap();
@@ -20,7 +18,7 @@ function _getRequireWildcardCache(nodeInterop) {
20
18
  return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
21
19
  })(nodeInterop);
22
20
  }
23
- function _interop_require_wildcard(obj, nodeInterop) {
21
+ function _interopRequireWildcard(obj, nodeInterop) {
24
22
  if (!nodeInterop && obj && obj.__esModule) {
25
23
  return obj;
26
24
  }
@@ -33,9 +31,7 @@ function _interop_require_wildcard(obj, nodeInterop) {
33
31
  if (cache && cache.has(obj)) {
34
32
  return cache.get(obj);
35
33
  }
36
- var newObj = {
37
- __proto__: null
38
- };
34
+ var newObj = {};
39
35
  var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
40
36
  for(var key in obj){
41
37
  if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
@@ -54,11 +50,11 @@ function _interop_require_wildcard(obj, nodeInterop) {
54
50
  return newObj;
55
51
  }
56
52
  function TrailingHackView(param) {
57
- let { getPos } = param;
58
- const { siblingsRef, parentRef } = (0, _react.useContext)(_ChildDescriptionsContext.ChildDescriptionsContext);
53
+ let { getPos } = param;
54
+ const { siblingsRef , parentRef } = (0, _react.useContext)(_childDescriptionsContextJs.ChildDescriptionsContext);
59
55
  const viewDescRef = (0, _react.useRef)(null);
60
56
  const ref = (0, _react.useRef)(null);
61
- (0, _useClientLayoutEffect.useClientLayoutEffect)(()=>{
57
+ (0, _useClientLayoutEffectJs.useClientLayoutEffect)(()=>{
62
58
  const siblings = siblingsRef.current;
63
59
  return ()=>{
64
60
  if (!viewDescRef.current) return;
@@ -70,10 +66,10 @@ function TrailingHackView(param) {
70
66
  }, [
71
67
  siblingsRef
72
68
  ]);
73
- (0, _useClientLayoutEffect.useClientLayoutEffect)(()=>{
69
+ (0, _useClientLayoutEffectJs.useClientLayoutEffect)(()=>{
74
70
  if (!ref.current) return;
75
71
  if (!viewDescRef.current) {
76
- viewDescRef.current = new _viewdesc.TrailingHackViewDesc(parentRef.current, [], getPos, ref.current, null);
72
+ viewDescRef.current = new _viewdescJs.TrailingHackViewDesc(parentRef.current, [], getPos, ref.current, null);
77
73
  } else {
78
74
  viewDescRef.current.parent = parentRef.current;
79
75
  viewDescRef.current.dom = ref.current;
@@ -81,7 +77,7 @@ function TrailingHackView(param) {
81
77
  if (!siblingsRef.current.includes(viewDescRef.current)) {
82
78
  siblingsRef.current.push(viewDescRef.current);
83
79
  }
84
- siblingsRef.current.sort(_viewdesc.sortViewDescs);
80
+ siblingsRef.current.sort(_viewdescJs.sortViewDescs);
85
81
  });
86
82
  return /*#__PURE__*/ _react.default.createElement("br", {
87
83
  ref: ref,
@@ -4,14 +4,12 @@ Object.defineProperty(exports, "__esModule", {
4
4
  });
5
5
  Object.defineProperty(exports, "WidgetView", {
6
6
  enumerable: true,
7
- get: function() {
8
- return WidgetView;
9
- }
7
+ get: ()=>WidgetView
10
8
  });
11
- const _react = /*#__PURE__*/ _interop_require_wildcard(require("react"));
12
- const _ChildDescriptionsContext = require("../contexts/ChildDescriptionsContext.js");
13
- const _useClientLayoutEffect = require("../hooks/useClientLayoutEffect.js");
14
- const _viewdesc = require("../viewdesc.js");
9
+ const _react = /*#__PURE__*/ _interopRequireWildcard(require("react"));
10
+ const _childDescriptionsContextJs = require("../contexts/ChildDescriptionsContext.js");
11
+ const _useClientLayoutEffectJs = require("../hooks/useClientLayoutEffect.js");
12
+ const _viewdescJs = require("../viewdesc.js");
15
13
  function _getRequireWildcardCache(nodeInterop) {
16
14
  if (typeof WeakMap !== "function") return null;
17
15
  var cacheBabelInterop = new WeakMap();
@@ -20,7 +18,7 @@ function _getRequireWildcardCache(nodeInterop) {
20
18
  return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
21
19
  })(nodeInterop);
22
20
  }
23
- function _interop_require_wildcard(obj, nodeInterop) {
21
+ function _interopRequireWildcard(obj, nodeInterop) {
24
22
  if (!nodeInterop && obj && obj.__esModule) {
25
23
  return obj;
26
24
  }
@@ -33,9 +31,7 @@ function _interop_require_wildcard(obj, nodeInterop) {
33
31
  if (cache && cache.has(obj)) {
34
32
  return cache.get(obj);
35
33
  }
36
- var newObj = {
37
- __proto__: null
38
- };
34
+ var newObj = {};
39
35
  var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
40
36
  for(var key in obj){
41
37
  if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
@@ -54,11 +50,11 @@ function _interop_require_wildcard(obj, nodeInterop) {
54
50
  return newObj;
55
51
  }
56
52
  function WidgetView(param) {
57
- let { widget, getPos } = param;
58
- const { siblingsRef, parentRef } = (0, _react.useContext)(_ChildDescriptionsContext.ChildDescriptionsContext);
53
+ let { widget , getPos } = param;
54
+ const { siblingsRef , parentRef } = (0, _react.useContext)(_childDescriptionsContextJs.ChildDescriptionsContext);
59
55
  const viewDescRef = (0, _react.useRef)(null);
60
56
  const domRef = (0, _react.useRef)(null);
61
- (0, _useClientLayoutEffect.useClientLayoutEffect)(()=>{
57
+ (0, _useClientLayoutEffectJs.useClientLayoutEffect)(()=>{
62
58
  const siblings = siblingsRef.current;
63
59
  return ()=>{
64
60
  if (!viewDescRef.current) return;
@@ -70,10 +66,10 @@ function WidgetView(param) {
70
66
  }, [
71
67
  siblingsRef
72
68
  ]);
73
- (0, _useClientLayoutEffect.useClientLayoutEffect)(()=>{
69
+ (0, _useClientLayoutEffectJs.useClientLayoutEffect)(()=>{
74
70
  if (!domRef.current) return;
75
71
  if (!viewDescRef.current) {
76
- viewDescRef.current = new _viewdesc.WidgetViewDesc(parentRef.current, getPos, widget, domRef.current);
72
+ viewDescRef.current = new _viewdescJs.WidgetViewDesc(parentRef.current, getPos, widget, domRef.current);
77
73
  } else {
78
74
  viewDescRef.current.parent = parentRef.current;
79
75
  viewDescRef.current.widget = widget;
@@ -82,9 +78,9 @@ function WidgetView(param) {
82
78
  if (!siblingsRef.current.includes(viewDescRef.current)) {
83
79
  siblingsRef.current.push(viewDescRef.current);
84
80
  }
85
- siblingsRef.current.sort(_viewdesc.sortViewDescs);
81
+ siblingsRef.current.sort(_viewdescJs.sortViewDescs);
86
82
  });
87
- const { Component } = widget.type;
83
+ const { Component } = widget.type;
88
84
  return Component && /*#__PURE__*/ _react.default.createElement(Component, {
89
85
  ref: domRef,
90
86
  widget: widget,
@@ -4,12 +4,24 @@ Object.defineProperty(exports, "__esModule", {
4
4
  });
5
5
  Object.defineProperty(exports, "DefaultMarkView", {
6
6
  enumerable: true,
7
- get: function() {
8
- return DefaultMarkView;
9
- }
7
+ get: ()=>DefaultMarkView
10
8
  });
11
- const _react = /*#__PURE__*/ _interop_require_wildcard(require("react"));
12
- const _OutputSpec = require("../OutputSpec.js");
9
+ const _react = /*#__PURE__*/ _interopRequireWildcard(require("react"));
10
+ const _outputSpecJs = require("../OutputSpec.js");
11
+ function _extends() {
12
+ _extends = Object.assign || function(target) {
13
+ for(var i = 1; i < arguments.length; i++){
14
+ var source = arguments[i];
15
+ for(var key in source){
16
+ if (Object.prototype.hasOwnProperty.call(source, key)) {
17
+ target[key] = source[key];
18
+ }
19
+ }
20
+ }
21
+ return target;
22
+ };
23
+ return _extends.apply(this, arguments);
24
+ }
13
25
  function _getRequireWildcardCache(nodeInterop) {
14
26
  if (typeof WeakMap !== "function") return null;
15
27
  var cacheBabelInterop = new WeakMap();
@@ -18,7 +30,7 @@ function _getRequireWildcardCache(nodeInterop) {
18
30
  return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
19
31
  })(nodeInterop);
20
32
  }
21
- function _interop_require_wildcard(obj, nodeInterop) {
33
+ function _interopRequireWildcard(obj, nodeInterop) {
22
34
  if (!nodeInterop && obj && obj.__esModule) {
23
35
  return obj;
24
36
  }
@@ -31,9 +43,7 @@ function _interop_require_wildcard(obj, nodeInterop) {
31
43
  if (cache && cache.has(obj)) {
32
44
  return cache.get(obj);
33
45
  }
34
- var newObj = {
35
- __proto__: null
36
- };
46
+ var newObj = {};
37
47
  var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
38
48
  for(var key in obj){
39
49
  if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
@@ -52,19 +62,21 @@ function _interop_require_wildcard(obj, nodeInterop) {
52
62
  return newObj;
53
63
  }
54
64
  const DefaultMarkView = /*#__PURE__*/ (0, _react.forwardRef)(function DefaultMarkView(param, ref) {
55
- let { markProps: { mark, inline, contentDOMRef }, children, ...props } = param;
56
- const spec = (0, _react.useMemo)(()=>mark.type.spec.toDOM?.(mark, inline), [
65
+ let { markProps: { mark , inline , contentDOMRef } , children , ...props } = param;
66
+ const spec = (0, _react.useMemo)(()=>{
67
+ var _spec, ref;
68
+ return (ref = (_spec = mark.type.spec).toDOM) === null || ref === void 0 ? void 0 : ref.call(_spec, mark, inline);
69
+ }, [
57
70
  mark,
58
71
  inline
59
72
  ]);
60
73
  if (!spec) {
61
- throw new Error(`Mark spec for ${mark.type.name} is missing toDOM`);
74
+ throw new Error("Mark spec for ".concat(mark.type.name, " is missing toDOM"));
62
75
  }
63
- return /*#__PURE__*/ _react.default.createElement(_OutputSpec.OutputSpec, {
64
- ...props,
76
+ return /*#__PURE__*/ _react.default.createElement(_outputSpecJs.OutputSpec, _extends({}, props, {
65
77
  outputSpec: spec,
66
78
  contentDOMRef: contentDOMRef,
67
79
  ref: ref,
68
80
  isMark: true
69
- }, children);
81
+ }), children);
70
82
  });
@@ -4,15 +4,27 @@ Object.defineProperty(exports, "__esModule", {
4
4
  });
5
5
  Object.defineProperty(exports, "MarkView", {
6
6
  enumerable: true,
7
- get: function() {
8
- return MarkView;
9
- }
7
+ get: ()=>MarkView
10
8
  });
11
- const _react = /*#__PURE__*/ _interop_require_wildcard(require("react"));
12
- const _NodeViewContext = require("../../contexts/NodeViewContext.js");
13
- const _DefaultMarkView = require("./DefaultMarkView.js");
14
- const _MarkViewConstructorView = require("./MarkViewConstructorView.js");
15
- const _ReactMarkView = require("./ReactMarkView.js");
9
+ const _react = /*#__PURE__*/ _interopRequireWildcard(require("react"));
10
+ const _nodeViewContextJs = require("../../contexts/NodeViewContext.js");
11
+ const _defaultMarkViewJs = require("./DefaultMarkView.js");
12
+ const _markViewConstructorViewJs = require("./MarkViewConstructorView.js");
13
+ const _reactMarkViewJs = require("./ReactMarkView.js");
14
+ function _extends() {
15
+ _extends = Object.assign || function(target) {
16
+ for(var i = 1; i < arguments.length; i++){
17
+ var source = arguments[i];
18
+ for(var key in source){
19
+ if (Object.prototype.hasOwnProperty.call(source, key)) {
20
+ target[key] = source[key];
21
+ }
22
+ }
23
+ }
24
+ return target;
25
+ };
26
+ return _extends.apply(this, arguments);
27
+ }
16
28
  function _getRequireWildcardCache(nodeInterop) {
17
29
  if (typeof WeakMap !== "function") return null;
18
30
  var cacheBabelInterop = new WeakMap();
@@ -21,7 +33,7 @@ function _getRequireWildcardCache(nodeInterop) {
21
33
  return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
22
34
  })(nodeInterop);
23
35
  }
24
- function _interop_require_wildcard(obj, nodeInterop) {
36
+ function _interopRequireWildcard(obj, nodeInterop) {
25
37
  if (!nodeInterop && obj && obj.__esModule) {
26
38
  return obj;
27
39
  }
@@ -34,9 +46,7 @@ function _interop_require_wildcard(obj, nodeInterop) {
34
46
  if (cache && cache.has(obj)) {
35
47
  return cache.get(obj);
36
48
  }
37
- var newObj = {
38
- __proto__: null
39
- };
49
+ var newObj = {};
40
50
  var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
41
51
  for(var key in obj){
42
52
  if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
@@ -55,8 +65,9 @@ function _interop_require_wildcard(obj, nodeInterop) {
55
65
  return newObj;
56
66
  }
57
67
  const MarkView = /*#__PURE__*/ (0, _react.memo)(function MarkView(props) {
58
- const { components, constructors } = (0, _react.useContext)(_NodeViewContext.NodeViewContext);
59
- const component = components[props.mark.type.name] ?? _DefaultMarkView.DefaultMarkView;
68
+ const { components , constructors } = (0, _react.useContext)(_nodeViewContextJs.NodeViewContext);
69
+ var _name;
70
+ const component = (_name = components[props.mark.type.name]) !== null && _name !== void 0 ? _name : _defaultMarkViewJs.DefaultMarkView;
60
71
  const constructor = constructors[props.mark.type.name];
61
72
  // Construct a wrapper component so that the mark view remounts when either
62
73
  // its component or constructor changes. A React mark view would remount
@@ -65,21 +76,19 @@ const MarkView = /*#__PURE__*/ (0, _react.memo)(function MarkView(props) {
65
76
  const Component = (0, _react.useMemo)(()=>{
66
77
  if (constructor) {
67
78
  return function MarkView(props) {
68
- return /*#__PURE__*/ _react.default.createElement(_MarkViewConstructorView.MarkViewConstructorView, {
69
- constructor: constructor,
70
- ...props
71
- });
79
+ return /*#__PURE__*/ _react.default.createElement(_markViewConstructorViewJs.MarkViewConstructorView, _extends({
80
+ constructor: constructor
81
+ }, props));
72
82
  };
73
83
  }
74
84
  return function NodeView(props) {
75
- return /*#__PURE__*/ _react.default.createElement(_ReactMarkView.ReactMarkView, {
76
- component: component,
77
- ...props
78
- });
85
+ return /*#__PURE__*/ _react.default.createElement(_reactMarkViewJs.ReactMarkView, _extends({
86
+ component: component
87
+ }, props));
79
88
  };
80
89
  }, [
81
90
  component,
82
91
  constructor
83
92
  ]);
84
- return /*#__PURE__*/ _react.default.createElement(Component, props);
93
+ return /*#__PURE__*/ _react.default.createElement(Component, _extends({}, props));
85
94
  });
@@ -4,16 +4,28 @@ Object.defineProperty(exports, "__esModule", {
4
4
  });
5
5
  Object.defineProperty(exports, "MarkViewConstructorView", {
6
6
  enumerable: true,
7
- get: function() {
8
- return MarkViewConstructorView;
9
- }
7
+ get: ()=>MarkViewConstructorView
10
8
  });
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 _useForceUpdate = require("../../hooks/useForceUpdate.js");
16
- const _useMarkViewDescription = require("../../hooks/useMarkViewDescription.js");
9
+ const _prosemirrorModel = require("prosemirror-model");
10
+ const _react = /*#__PURE__*/ _interopRequireWildcard(require("react"));
11
+ const _reactDom = require("react-dom");
12
+ const _childDescriptionsContextJs = require("../../contexts/ChildDescriptionsContext.js");
13
+ const _useForceUpdateJs = require("../../hooks/useForceUpdate.js");
14
+ const _useMarkViewDescriptionJs = require("../../hooks/useMarkViewDescription.js");
15
+ function _extends() {
16
+ _extends = Object.assign || function(target) {
17
+ for(var i = 1; i < arguments.length; i++){
18
+ var source = arguments[i];
19
+ for(var key in source){
20
+ if (Object.prototype.hasOwnProperty.call(source, key)) {
21
+ target[key] = source[key];
22
+ }
23
+ }
24
+ }
25
+ return target;
26
+ };
27
+ return _extends.apply(this, arguments);
28
+ }
17
29
  function _getRequireWildcardCache(nodeInterop) {
18
30
  if (typeof WeakMap !== "function") return null;
19
31
  var cacheBabelInterop = new WeakMap();
@@ -22,7 +34,7 @@ function _getRequireWildcardCache(nodeInterop) {
22
34
  return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
23
35
  })(nodeInterop);
24
36
  }
25
- function _interop_require_wildcard(obj, nodeInterop) {
37
+ function _interopRequireWildcard(obj, nodeInterop) {
26
38
  if (!nodeInterop && obj && obj.__esModule) {
27
39
  return obj;
28
40
  }
@@ -35,9 +47,7 @@ function _interop_require_wildcard(obj, nodeInterop) {
35
47
  if (cache && cache.has(obj)) {
36
48
  return cache.get(obj);
37
49
  }
38
- var newObj = {
39
- __proto__: null
40
- };
50
+ var newObj = {};
41
51
  var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
42
52
  for(var key in obj){
43
53
  if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
@@ -56,10 +66,10 @@ function _interop_require_wildcard(obj, nodeInterop) {
56
66
  return newObj;
57
67
  }
58
68
  const MarkViewConstructorView = /*#__PURE__*/ (0, _react.memo)(function MarkViewConstructorView(param) {
59
- let { constructor, mark, inline, getPos, children } = param;
69
+ let { constructor , mark , inline , getPos , children } = param;
60
70
  const ref = (0, _react.useRef)(null);
61
71
  const innerRef = (0, _react.useRef)(null);
62
- const forceUpdate = (0, _useForceUpdate.useForceUpdate)();
72
+ const forceUpdate = (0, _useForceUpdateJs.useForceUpdate)();
63
73
  const markProps = (0, _react.useMemo)(()=>({
64
74
  mark,
65
75
  inline,
@@ -78,21 +88,26 @@ const MarkViewConstructorView = /*#__PURE__*/ (0, _react.memo)(function MarkView
78
88
  }
79
89
  const markView = constructor(...args);
80
90
  if (!markView || !markView.dom) {
81
- const spec = mark.type.spec.toDOM?.(mark, inline);
91
+ var _spec, ref;
92
+ const spec = (ref = (_spec = mark.type.spec).toDOM) === null || ref === void 0 ? void 0 : ref.call(_spec, mark, inline);
82
93
  if (!spec) {
83
- throw new Error(`Mark spec for ${mark.type.name} is missing toDOM`);
94
+ throw new Error("Mark spec for ".concat(mark.type.name, " is missing toDOM"));
84
95
  }
85
- return _prosemirrormodel.DOMSerializer.renderSpec(document, spec, null);
96
+ return _prosemirrorModel.DOMSerializer.renderSpec(document, spec, null);
86
97
  }
87
98
  return markView;
88
99
  };
89
- const { childContextValue, contentDOM } = (0, _useMarkViewDescription.useMarkViewDescription)(()=>ref.current, (markView)=>markView?.contentDOM ?? null, function() {
100
+ var ref1;
101
+ const { childContextValue , contentDOM } = (0, _useMarkViewDescriptionJs.useMarkViewDescription)(()=>ref.current, (markView)=>{
102
+ return (ref1 = markView === null || markView === void 0 ? void 0 : markView.contentDOM) !== null && ref1 !== void 0 ? ref1 : null;
103
+ }, function() {
90
104
  for(var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++){
91
105
  args[_key] = arguments[_key];
92
106
  }
93
107
  const markView = createMarkView(...args);
94
108
  const dom = markView.dom;
95
- const wrapperDOM = innerRef.current ?? ref.current;
109
+ var _current;
110
+ const wrapperDOM = (_current = innerRef.current) !== null && _current !== void 0 ? _current : ref.current;
96
111
  wrapperDOM.appendChild(dom);
97
112
  // Force a re-render so that we properly create
98
113
  // a portal into the contentDOM/dom
@@ -100,7 +115,8 @@ const MarkViewConstructorView = /*#__PURE__*/ (0, _react.memo)(function MarkView
100
115
  return {
101
116
  ...markView,
102
117
  destroy () {
103
- markView.destroy?.();
118
+ var ref;
119
+ (ref = markView.destroy) === null || ref === void 0 ? void 0 : ref.call(markView);
104
120
  wrapperDOM.removeChild(dom);
105
121
  },
106
122
  ignoreMutation: markView.ignoreMutation
@@ -110,7 +126,7 @@ const MarkViewConstructorView = /*#__PURE__*/ (0, _react.memo)(function MarkView
110
126
  const props = {
111
127
  ref: innerRef
112
128
  };
113
- return /*#__PURE__*/ _react.default.createElement(Component, props, contentDOM ? /*#__PURE__*/ (0, _reactdom.createPortal)(/*#__PURE__*/ _react.default.createElement(_ChildDescriptionsContext.ChildDescriptionsContext.Provider, {
129
+ return /*#__PURE__*/ _react.default.createElement(Component, _extends({}, props), contentDOM ? /*#__PURE__*/ (0, _reactDom.createPortal)(/*#__PURE__*/ _react.default.createElement(_childDescriptionsContextJs.ChildDescriptionsContext.Provider, {
114
130
  value: childContextValue
115
131
  }, children), contentDOM) : null);
116
132
  });
@@ -4,14 +4,26 @@ Object.defineProperty(exports, "__esModule", {
4
4
  });
5
5
  Object.defineProperty(exports, "ReactMarkView", {
6
6
  enumerable: true,
7
- get: function() {
8
- return ReactMarkView;
9
- }
7
+ get: ()=>ReactMarkView
10
8
  });
11
- const _react = /*#__PURE__*/ _interop_require_wildcard(require("react"));
12
- const _ChildDescriptionsContext = require("../../contexts/ChildDescriptionsContext.js");
13
- const _IgnoreMutationContext = require("../../contexts/IgnoreMutationContext.js");
14
- const _useMarkViewDescription = require("../../hooks/useMarkViewDescription.js");
9
+ const _react = /*#__PURE__*/ _interopRequireWildcard(require("react"));
10
+ const _childDescriptionsContextJs = require("../../contexts/ChildDescriptionsContext.js");
11
+ const _ignoreMutationContextJs = require("../../contexts/IgnoreMutationContext.js");
12
+ const _useMarkViewDescriptionJs = require("../../hooks/useMarkViewDescription.js");
13
+ function _extends() {
14
+ _extends = Object.assign || function(target) {
15
+ for(var i = 1; i < arguments.length; i++){
16
+ var source = arguments[i];
17
+ for(var key in source){
18
+ if (Object.prototype.hasOwnProperty.call(source, key)) {
19
+ target[key] = source[key];
20
+ }
21
+ }
22
+ }
23
+ return target;
24
+ };
25
+ return _extends.apply(this, arguments);
26
+ }
15
27
  function _getRequireWildcardCache(nodeInterop) {
16
28
  if (typeof WeakMap !== "function") return null;
17
29
  var cacheBabelInterop = new WeakMap();
@@ -20,7 +32,7 @@ function _getRequireWildcardCache(nodeInterop) {
20
32
  return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
21
33
  })(nodeInterop);
22
34
  }
23
- function _interop_require_wildcard(obj, nodeInterop) {
35
+ function _interopRequireWildcard(obj, nodeInterop) {
24
36
  if (!nodeInterop && obj && obj.__esModule) {
25
37
  return obj;
26
38
  }
@@ -33,9 +45,7 @@ function _interop_require_wildcard(obj, nodeInterop) {
33
45
  if (cache && cache.has(obj)) {
34
46
  return cache.get(obj);
35
47
  }
36
- var newObj = {
37
- __proto__: null
38
- };
48
+ var newObj = {};
39
49
  var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
40
50
  for(var key in obj){
41
51
  if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
@@ -54,7 +64,7 @@ function _interop_require_wildcard(obj, nodeInterop) {
54
64
  return newObj;
55
65
  }
56
66
  const ReactMarkView = /*#__PURE__*/ (0, _react.memo)(function ReactMarkView(param) {
57
- let { component: Component, mark, inline, getPos, children } = param;
67
+ let { component: Component , mark , inline , getPos , children } = param;
58
68
  const ref = (0, _react.useRef)(null);
59
69
  const contentDOMRef = (0, _react.useRef)(null);
60
70
  const ignoreMutationRef = (0, _react.useRef)(null);
@@ -76,7 +86,8 @@ const ReactMarkView = /*#__PURE__*/ (0, _react.memo)(function ReactMarkView(para
76
86
  inline,
77
87
  mark
78
88
  ]);
79
- const { childContextValue, refUpdated } = (0, _useMarkViewDescription.useMarkViewDescription)(()=>ref.current, ()=>contentDOMRef.current ?? ref.current, ()=>({
89
+ var _current;
90
+ const { childContextValue , refUpdated } = (0, _useMarkViewDescriptionJs.useMarkViewDescription)(()=>ref.current, ()=>(_current = contentDOMRef.current) !== null && _current !== void 0 ? _current : ref.current, ()=>({
80
91
  dom: ref.current,
81
92
  ignoreMutation (mutation) {
82
93
  const ignoreMutation = ignoreMutationRef.current;
@@ -109,9 +120,9 @@ const ReactMarkView = /*#__PURE__*/ (0, _react.memo)(function ReactMarkView(para
109
120
  markProps,
110
121
  ref: setDOM
111
122
  };
112
- return /*#__PURE__*/ _react.default.createElement(_IgnoreMutationContext.IgnoreMutationContext.Provider, {
123
+ return /*#__PURE__*/ _react.default.createElement(_ignoreMutationContextJs.IgnoreMutationContext.Provider, {
113
124
  value: setIgnoreMutation
114
- }, /*#__PURE__*/ _react.default.createElement(_ChildDescriptionsContext.ChildDescriptionsContext.Provider, {
125
+ }, /*#__PURE__*/ _react.default.createElement(_childDescriptionsContextJs.ChildDescriptionsContext.Provider, {
115
126
  value: childContextValue
116
- }, /*#__PURE__*/ _react.default.createElement(Component, props, children)));
127
+ }, /*#__PURE__*/ _react.default.createElement(Component, _extends({}, props), children)));
117
128
  });