@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
@@ -6,17 +6,15 @@ import { NodeView } from "@tiptap/core";
6
6
  * ViewDesc, so that we can call Tiptap's default stopEvent and ignoreMutation
7
7
  * methods
8
8
  */ export class ReactProseMirrorNodeView extends NodeView {
9
- _dom;
10
- _contentDOM;
11
- constructor(component, props, dom, contentDOM, options){
12
- super(component, props, options);
13
- this._dom = dom;
14
- this._contentDOM = contentDOM;
15
- }
16
9
  get dom() {
17
10
  return this._dom;
18
11
  }
19
12
  get contentDOM() {
20
13
  return this._contentDOM;
21
14
  }
15
+ constructor(component, props, dom, contentDOM, options){
16
+ super(component, props, options);
17
+ this._dom = dom;
18
+ this._contentDOM = contentDOM;
19
+ }
22
20
  }
@@ -2,15 +2,10 @@ import { Editor } from "@tiptap/core";
2
2
  import { EditorState } from "prosemirror-state";
3
3
  import { StaticEditorView } from "../StaticEditorView.js";
4
4
  export class TiptapEditor extends Editor {
5
- constructor(options = {}){
6
- super({
7
- ...options,
8
- element: null
9
- });
10
- }
11
5
  get view() {
12
- return(// @ts-expect-error private property
13
- this.editorView ?? new StaticEditorView({
6
+ var // @ts-expect-error private property
7
+ _editorView;
8
+ return (_editorView = this.editorView) !== null && _editorView !== void 0 ? _editorView : new StaticEditorView({
14
9
  state: EditorState.create({
15
10
  schema: this.extensionManager.schema
16
11
  }),
@@ -19,6 +14,12 @@ export class TiptapEditor extends Editor {
19
14
  role: "textbox",
20
15
  ...this.options.editorProps.attributes
21
16
  }
22
- }));
17
+ });
18
+ }
19
+ constructor(options = {}){
20
+ super({
21
+ ...options,
22
+ element: null
23
+ });
23
24
  }
24
25
  }
@@ -1,3 +1,17 @@
1
+ function _extends() {
2
+ _extends = Object.assign || function(target) {
3
+ for(var i = 1; i < arguments.length; i++){
4
+ var source = arguments[i];
5
+ for(var key in source){
6
+ if (Object.prototype.hasOwnProperty.call(source, key)) {
7
+ target[key] = source[key];
8
+ }
9
+ }
10
+ }
11
+ return target;
12
+ };
13
+ return _extends.apply(this, arguments);
14
+ }
1
15
  import React, { useContext, useSyncExternalStore } from "react";
2
16
  import { createPortal } from "react-dom";
3
17
  import { ProseMirrorDoc } from "../components/ProseMirrorDoc.js";
@@ -6,7 +20,7 @@ import { TiptapEditorContext } from "./contexts/TiptapEditorContext.js";
6
20
  /**
7
21
  * This component renders all of the editor's registered "React renderers".
8
22
  */ const Portals = (param)=>{
9
- let { contentComponent } = param;
23
+ let { contentComponent } = param;
10
24
  const renderers = useSyncExternalStore(contentComponent.subscribe, contentComponent.getSnapshot, contentComponent.getServerSnapshot);
11
25
  return /*#__PURE__*/ React.createElement(React.Fragment, null, Object.values(renderers));
12
26
  };
@@ -50,9 +64,9 @@ function getInstance() {
50
64
  };
51
65
  }
52
66
  export function TiptapEditorContent(param) {
53
- let { editor: editorProp, ...props } = param;
67
+ let { editor: editorProp , ...props } = param;
54
68
  const editor = editorProp;
55
- const { onEditorInitialize, onEditorDeinitialize } = useContext(TiptapEditorContext);
69
+ const { onEditorInitialize , onEditorDeinitialize } = useContext(TiptapEditorContext);
56
70
  useEditorEffect((view)=>{
57
71
  if (editor.view === view) {
58
72
  return;
@@ -86,7 +100,7 @@ export function TiptapEditorContent(param) {
86
100
  onEditorDeinitialize,
87
101
  onEditorInitialize
88
102
  ]);
89
- return /*#__PURE__*/ React.createElement(React.Fragment, null, /*#__PURE__*/ React.createElement(ProseMirrorDoc, props), editor?.contentComponent && /*#__PURE__*/ React.createElement(Portals, {
103
+ return /*#__PURE__*/ React.createElement(React.Fragment, null, /*#__PURE__*/ React.createElement(ProseMirrorDoc, _extends({}, props)), (editor === null || editor === void 0 ? void 0 : editor.contentComponent) && /*#__PURE__*/ React.createElement(Portals, {
90
104
  contentComponent: editor.contentComponent
91
105
  }));
92
106
  }
@@ -1,3 +1,17 @@
1
+ function _extends() {
2
+ _extends = Object.assign || function(target) {
3
+ for(var i = 1; i < arguments.length; i++){
4
+ var source = arguments[i];
5
+ for(var key in source){
6
+ if (Object.prototype.hasOwnProperty.call(source, key)) {
7
+ target[key] = source[key];
8
+ }
9
+ }
10
+ }
11
+ return target;
12
+ };
13
+ return _extends.apply(this, arguments);
14
+ }
1
15
  import { EditorContext } from "@tiptap/react";
2
16
  import cx from "classnames";
3
17
  import React, { useCallback, useMemo, useState } from "react";
@@ -7,9 +21,10 @@ import { TiptapEditorContext } from "./contexts/TiptapEditorContext.js";
7
21
  /**
8
22
  * Render a Tiptap-compatible React ProseMirror editor.
9
23
  */ export function TiptapEditorView(param) {
10
- let { editor, nodeViewComponents, markViewComponents, children, static: isStatic = false } = param;
24
+ let { editor , nodeViewComponents , markViewComponents , children , static: isStatic = false } = param;
25
+ var ref;
11
26
  const [isEditorInitialized, setIsEditorInitialized] = useState(editor.isInitialized);
12
- const attributesProp = editor.options.editorProps?.attributes;
27
+ const attributesProp = (ref = editor.options.editorProps) === null || ref === void 0 ? void 0 : ref.attributes;
13
28
  const [attributes, setAttributes] = useState(typeof attributesProp === "function" ? attributesProp(editor.state) : attributesProp);
14
29
  const forceUpdate = useForceUpdate();
15
30
  const dispatchTransaction = useCallback((tr)=>{
@@ -32,10 +47,10 @@ import { TiptapEditorContext } from "./contexts/TiptapEditorContext.js";
32
47
  attributes: {
33
48
  role: "textbox",
34
49
  ...attributes,
35
- class: cx(attributes?.class, "tiptap")
50
+ class: cx(attributes === null || attributes === void 0 ? void 0 : attributes.class, "tiptap")
36
51
  }
37
52
  };
38
- const { nodeViews, markViews } = editor.isDestroyed ? {
53
+ const { nodeViews , markViews } = editor.isDestroyed ? {
39
54
  nodeViews: undefined,
40
55
  markViews: undefined
41
56
  } : editor.view.props;
@@ -59,16 +74,16 @@ import { TiptapEditorContext } from "./contexts/TiptapEditorContext.js";
59
74
  onEditorDeinitialize,
60
75
  onEditorInitialize
61
76
  ]);
62
- return /*#__PURE__*/ React.createElement(ProseMirror, {
63
- static: isStatic,
64
- ...editorProps,
77
+ return /*#__PURE__*/ React.createElement(ProseMirror, _extends({
78
+ static: isStatic
79
+ }, editorProps, {
65
80
  markViewComponents: markViewComponents,
66
81
  markViews: markViews,
67
82
  nodeViewComponents: nodeViewComponents,
68
83
  nodeViews: nodeViews,
69
84
  state: editor.state,
70
85
  dispatchTransaction: dispatchTransaction
71
- }, /*#__PURE__*/ React.createElement(EditorContext.Provider, {
86
+ }), /*#__PURE__*/ React.createElement(EditorContext.Provider, {
72
87
  value: contextValue
73
88
  }, /*#__PURE__*/ React.createElement(TiptapEditorContext.Provider, {
74
89
  value: tiptapEditorContextValue
@@ -21,7 +21,7 @@ export const ReactProseMirror = Extension.create({
21
21
  * and keep the other two in relative order, set `order` to `[1, 2, 0]`.
22
22
  */ reorderSiblings (initialPos, order) {
23
23
  return function reorderSiblingsCommand(param) {
24
- let { tr, state, dispatch } = param;
24
+ let { tr , state , dispatch } = param;
25
25
  return reorderSiblingsOnTransaction(initialPos, order, tr, state, dispatch);
26
26
  };
27
27
  }
@@ -4,7 +4,7 @@ import { getMarkType, getNodeType, getSchemaTypeNameByName } from "@tiptap/core"
4
4
  export const updateAttributes = function(typeOrName) {
5
5
  let attributes = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
6
6
  return (param)=>{
7
- let { tr, state, dispatch } = param;
7
+ let { tr , state , dispatch } = param;
8
8
  let nodeType = null;
9
9
  let markType = null;
10
10
  const schemaType = getSchemaTypeNameByName(typeof typeOrName === "string" ? typeOrName : typeOrName.name, state.schema);
@@ -1,15 +1,19 @@
1
+ var // @ts-expect-error private property
2
+ _editor;
1
3
  import { useEditor } from "@tiptap/react";
2
4
  import { StaticEditorView } from "../../StaticEditorView.js";
3
5
  import { ReactProseMirror } from "../extensions/ReactProseMirror.js";
4
6
  import { ReactProseMirrorCommands } from "../extensions/ReactProseMirrorCommands.js";
5
7
  export function useTiptapEditor(options, deps) {
8
+ var ref;
9
+ var _extensions;
6
10
  const extensions = [
7
11
  ReactProseMirror,
8
- ...options.extensions ?? []
12
+ ...(_extensions = options.extensions) !== null && _extensions !== void 0 ? _extensions : []
9
13
  ];
10
14
  // If a consumer explicitly disables core extensions (or the Commands core extension)
11
15
  // do not re-add our custom Commands
12
- if (options.enableCoreExtensions === false || typeof options.enableCoreExtensions === "object" && options?.enableCoreExtensions?.commands === false) {
16
+ if (options.enableCoreExtensions === false || typeof options.enableCoreExtensions === "object" && (options === null || options === void 0 ? void 0 : (ref = options.enableCoreExtensions) === null || ref === void 0 ? void 0 : ref.commands) === false) {
13
17
  // Do nothing
14
18
  } else {
15
19
  options.enableCoreExtensions = {
@@ -23,8 +27,8 @@ export function useTiptapEditor(options, deps) {
23
27
  extensions,
24
28
  element: null
25
29
  }, deps);
26
- // @ts-expect-error private property
27
- editor.editorView ??= new StaticEditorView({
30
+ var _editorView;
31
+ (_editorView = (_editor = editor).editorView) !== null && _editorView !== void 0 ? _editorView : _editor.editorView = new StaticEditorView({
28
32
  // @ts-expect-error private property
29
33
  state: editor.editorState,
30
34
  ...editor.options.editorProps,
@@ -22,11 +22,11 @@ import { TiptapEditorContext } from "../contexts/TiptapEditorContext.js";
22
22
  * as a child of the TiptapEditorView component, including
23
23
  * React node view components.
24
24
  */ export function useTiptapEditorEffect(effect, dependencies) {
25
- const { view } = useContext(EditorContext);
26
- const { editor } = useCurrentEditor();
27
- const { isEditorInitialized } = useContext(TiptapEditorContext);
25
+ const { view } = useContext(EditorContext);
26
+ const { editor } = useCurrentEditor();
27
+ const { isEditorInitialized } = useContext(TiptapEditorContext);
28
28
  useEditorEffect(()=>{
29
- if (editor?.view instanceof ReactEditorView && view instanceof ReactEditorView && isEditorInitialized) {
29
+ if ((editor === null || editor === void 0 ? void 0 : editor.view) instanceof ReactEditorView && view instanceof ReactEditorView && isEditorInitialized) {
30
30
  return effect(editor);
31
31
  }
32
32
  // The rules of hooks want to be able to statically
@@ -17,7 +17,7 @@ function assertEditor(editor) {
17
17
  * React node view components.
18
18
  */ export function useTiptapEditorEventCallback(callback) {
19
19
  const ref = useRef(callback);
20
- const { editor } = useCurrentEditor();
20
+ const { editor } = useCurrentEditor();
21
21
  useEditorEffect(()=>{
22
22
  ref.current = callback;
23
23
  }, [
@@ -1,3 +1,17 @@
1
+ function _extends() {
2
+ _extends = Object.assign || function(target) {
3
+ for(var i = 1; i < arguments.length; i++){
4
+ var source = arguments[i];
5
+ for(var key in source){
6
+ if (Object.prototype.hasOwnProperty.call(source, key)) {
7
+ target[key] = source[key];
8
+ }
9
+ }
10
+ }
11
+ return target;
12
+ };
13
+ return _extends.apply(this, arguments);
14
+ }
1
15
  import { getAttributesFromExtensions, getRenderedAttributes } from "@tiptap/core";
2
16
  import { ReactNodeViewContext, useCurrentEditor } from "@tiptap/react";
3
17
  import cx from "classnames";
@@ -35,14 +49,16 @@ import { useTiptapEditorEventCallback } from "./hooks/useTiptapEditorEventCallba
35
49
  * }
36
50
  * ```
37
51
  */ export function tiptapNodeView(param) {
38
- let { component: WrappedComponent, extension, as, className = "", attrs, contentDOMElementTag: InnerTag = "div", stopEvent, ignoreMutation } = param;
52
+ let { component: WrappedComponent , extension , as , className ="" , attrs , contentDOMElementTag: InnerTag = "div" , stopEvent , ignoreMutation } = param;
39
53
  const TiptapNodeView = /*#__PURE__*/ memo(/*#__PURE__*/ forwardRef(function TiptapNodeView(param, ref) {
40
- let { children, nodeProps, ...props } = param;
41
- const { node, getPos, decorations, innerDecorations, contentDOMRef } = nodeProps;
42
- const OuterTag = as ?? (node.type.isInline ? "span" : "div");
43
- const { editor } = useCurrentEditor();
44
- const extensionManager = editor?.extensionManager ?? null;
45
- const extensions = extensionManager?.extensions ?? null;
54
+ let { children , nodeProps , ...props } = param;
55
+ const { node , getPos , decorations , innerDecorations , contentDOMRef } = nodeProps;
56
+ const OuterTag = as !== null && as !== void 0 ? as : node.type.isInline ? "span" : "div";
57
+ const { editor } = useCurrentEditor();
58
+ var ref1;
59
+ const extensionManager = (ref1 = editor === null || editor === void 0 ? void 0 : editor.extensionManager) !== null && ref1 !== void 0 ? ref1 : null;
60
+ var ref2;
61
+ const extensions = (ref2 = extensionManager === null || extensionManager === void 0 ? void 0 : extensionManager.extensions) !== null && ref2 !== void 0 ? ref2 : null;
46
62
  const selected = useIsNodeSelected();
47
63
  const isDraggingRef = useRef(false);
48
64
  const htmlAttributes = useMemo(()=>{
@@ -79,9 +95,10 @@ import { useTiptapEditorEventCallback } from "./hooks/useTiptapEditorEventCallba
79
95
  isDraggingRef.current = nodeView.isDragging;
80
96
  return result;
81
97
  }
82
- const result = nodeView.stopEvent(event) ?? false;
98
+ var ref;
99
+ const result1 = (ref = nodeView.stopEvent(event)) !== null && ref !== void 0 ? ref : false;
83
100
  isDraggingRef.current = nodeView.isDragging;
84
- return result;
101
+ return result1;
85
102
  });
86
103
  useIgnoreMutation(function(_, mutation) {
87
104
  if (ignoreMutation) {
@@ -104,15 +121,16 @@ import { useTiptapEditorEventCallback } from "./hooks/useTiptapEditorEventCallba
104
121
  node,
105
122
  view: editor.view
106
123
  }, this.dom, this.contentDOM);
107
- return nodeView.ignoreMutation(mutation) ?? false;
124
+ var ref;
125
+ return (ref = nodeView.ignoreMutation(mutation)) !== null && ref !== void 0 ? ref : false;
108
126
  });
109
- const { extraClassName, htmlProps } = useMemo(()=>{
127
+ const { extraClassName , htmlProps } = useMemo(()=>{
110
128
  if (!attrs) return {};
111
129
  const resolvedAttrs = typeof attrs === "function" ? attrs({
112
130
  node,
113
131
  HTMLAttributes: htmlAttributes
114
132
  }) : attrs;
115
- const { className: extraClassName, ...htmlProps } = htmlAttrsToReactProps(resolvedAttrs);
133
+ const { className: extraClassName , ...htmlProps } = htmlAttrsToReactProps(resolvedAttrs);
116
134
  return {
117
135
  extraClassName,
118
136
  htmlProps
@@ -121,7 +139,7 @@ import { useTiptapEditorEventCallback } from "./hooks/useTiptapEditorEventCallba
121
139
  htmlAttributes,
122
140
  node
123
141
  ]);
124
- const finalClassName = cx("react-renderer", `node-${node.type.name}`, props.className, className, extraClassName, {
142
+ const finalClassName = cx("react-renderer", "node-".concat(node.type.name), props.className, className, extraClassName, {
125
143
  "ProseMirror-selectednode": selected
126
144
  });
127
145
  const updateAttributes = useEditorEventCallback((_, attributes)=>{
@@ -129,7 +147,7 @@ import { useTiptapEditorEventCallback } from "./hooks/useTiptapEditorEventCallba
129
147
  return;
130
148
  }
131
149
  editor.commands.command((param)=>{
132
- let { tr } = param;
150
+ let { tr } = param;
133
151
  const pos = getPos();
134
152
  tr.setNodeMarkup(pos, undefined, {
135
153
  ...node.attrs,
@@ -189,12 +207,11 @@ import { useTiptapEditorEventCallback } from "./hooks/useTiptapEditorEventCallba
189
207
  if (!editor) return null;
190
208
  return /*#__PURE__*/ React.createElement(ReactNodeViewContext.Provider, {
191
209
  value: nodeViewContext
192
- }, /*#__PURE__*/ React.createElement(OuterTag, {
193
- ref: finalRef,
194
- ...props,
195
- ...htmlProps,
210
+ }, /*#__PURE__*/ React.createElement(OuterTag, _extends({
211
+ ref: finalRef
212
+ }, props, htmlProps, {
196
213
  className: finalClassName
197
- }, /*#__PURE__*/ React.createElement(WrappedComponent, {
214
+ }), /*#__PURE__*/ React.createElement(WrappedComponent, {
198
215
  node: node,
199
216
  getPos: getPos,
200
217
  view: editor.view,
@@ -208,6 +225,7 @@ import { useTiptapEditorEventCallback } from "./hooks/useTiptapEditorEventCallba
208
225
  deleteNode: deleteNode
209
226
  })));
210
227
  }));
211
- TiptapNodeView.displayName = `TiptapNodeView(${WrappedComponent.displayName ?? "Anonymous"})`;
228
+ var _displayName;
229
+ TiptapNodeView.displayName = "TiptapNodeView(".concat((_displayName = WrappedComponent.displayName) !== null && _displayName !== void 0 ? _displayName : "Anonymous", ")");
212
230
  return TiptapNodeView;
213
231
  }