@handlewithcare/react-prosemirror 2.8.0-tiptap.10 → 2.8.0-tiptap.11

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 (60) hide show
  1. package/dist/cjs/tiptap/tiptapNodeView.js +26 -13
  2. package/dist/esm/tiptap/tiptapNodeView.js +27 -14
  3. package/dist/tsconfig.tsbuildinfo +1 -1
  4. package/dist/types/constants.d.ts +1 -1
  5. package/dist/types/props.d.ts +26 -26
  6. package/package.json +1 -1
  7. package/dist/esm/@jest/pattern/src/__tests__/TestPathPatterns.test.js +0 -241
  8. package/dist/esm/@swc/cli/lib/swc/__tests__/compile.test.js +0 -19
  9. package/dist/esm/@swc/cli/lib/swc/__tests__/options.test.js +0 -315
  10. package/dist/esm/@swc/cli/lib/swc/__tests__/sources.test.js +0 -161
  11. package/dist/esm/@uiw/react-codemirror/src/__tests__/index.test.js +0 -111
  12. package/dist/esm/cheerio/src/__tests__/deprecated.spec.js +0 -249
  13. package/dist/esm/cheerio/src/__tests__/xml.spec.js +0 -55
  14. package/dist/esm/components/__tests__/ProseMirror.composition.test.js +0 -395
  15. package/dist/esm/components/__tests__/ProseMirror.domchange.test.js +0 -266
  16. package/dist/esm/components/__tests__/ProseMirror.draw-decoration.test.js +0 -968
  17. package/dist/esm/components/__tests__/ProseMirror.draw.test.js +0 -335
  18. package/dist/esm/components/__tests__/ProseMirror.mobile.test.js +0 -54
  19. package/dist/esm/components/__tests__/ProseMirror.node-view.test.js +0 -553
  20. package/dist/esm/components/__tests__/ProseMirror.selection.test.js +0 -440
  21. package/dist/esm/components/__tests__/ProseMirror.test.js +0 -324
  22. package/dist/esm/contexts/__tests__/DeferredLayoutEffects.test.js +0 -98
  23. package/dist/esm/hooks/__tests__/useEditorEffect.test.js +0 -134
  24. package/dist/esm/jsx-ast-utils/__tests__/helper.js +0 -83
  25. package/dist/esm/jsx-ast-utils/__tests__/src/elementType-test.js +0 -76
  26. package/dist/esm/jsx-ast-utils/__tests__/src/eventHandlers-test.js +0 -98
  27. package/dist/esm/jsx-ast-utils/__tests__/src/getProp-parser-test.js +0 -188
  28. package/dist/esm/jsx-ast-utils/__tests__/src/getProp-test.js +0 -119
  29. package/dist/esm/jsx-ast-utils/__tests__/src/getPropLiteralValue-babelparser-test.js +0 -393
  30. package/dist/esm/jsx-ast-utils/__tests__/src/getPropLiteralValue-flowparser-test.js +0 -379
  31. package/dist/esm/jsx-ast-utils/__tests__/src/getPropValue-babelparser-test.js +0 -925
  32. package/dist/esm/jsx-ast-utils/__tests__/src/getPropValue-flowparser-test.js +0 -700
  33. package/dist/esm/jsx-ast-utils/__tests__/src/hasProp-test.js +0 -350
  34. package/dist/esm/jsx-ast-utils/__tests__/src/index-test.js +0 -24
  35. package/dist/esm/jsx-ast-utils/__tests__/src/propName-test.js +0 -37
  36. package/dist/esm/plugins/__tests__/reactKeys.test.js +0 -77
  37. package/dist/esm/tsconfig-paths/lib/__tests__/config-loader.test.d.js +0 -1
  38. package/dist/esm/tsconfig-paths/lib/__tests__/config-loader.test.js +0 -97
  39. package/dist/esm/tsconfig-paths/lib/__tests__/data/match-path-data.d.js +0 -1
  40. package/dist/esm/tsconfig-paths/lib/__tests__/data/match-path-data.js +0 -319
  41. package/dist/esm/tsconfig-paths/lib/__tests__/filesystem.test.d.js +0 -1
  42. package/dist/esm/tsconfig-paths/lib/__tests__/filesystem.test.js +0 -62
  43. package/dist/esm/tsconfig-paths/lib/__tests__/mapping-entry.test.d.js +0 -1
  44. package/dist/esm/tsconfig-paths/lib/__tests__/mapping-entry.test.js +0 -80
  45. package/dist/esm/tsconfig-paths/lib/__tests__/match-path-async.test.d.js +0 -1
  46. package/dist/esm/tsconfig-paths/lib/__tests__/match-path-async.test.js +0 -22
  47. package/dist/esm/tsconfig-paths/lib/__tests__/match-path-sync.test.d.js +0 -1
  48. package/dist/esm/tsconfig-paths/lib/__tests__/match-path-sync.test.js +0 -20
  49. package/dist/esm/tsconfig-paths/lib/__tests__/try-path.test.d.js +0 -1
  50. package/dist/esm/tsconfig-paths/lib/__tests__/try-path.test.js +0 -219
  51. package/dist/esm/tsconfig-paths/lib/__tests__/tsconfig-loader.test.d.js +0 -1
  52. package/dist/esm/tsconfig-paths/lib/__tests__/tsconfig-loader.test.js +0 -323
  53. package/dist/esm/tsconfig-paths/src/__tests__/config-loader.test.js +0 -89
  54. package/dist/esm/tsconfig-paths/src/__tests__/data/match-path-data.js +0 -314
  55. package/dist/esm/tsconfig-paths/src/__tests__/filesystem.test.js +0 -58
  56. package/dist/esm/tsconfig-paths/src/__tests__/mapping-entry.test.js +0 -76
  57. package/dist/esm/tsconfig-paths/src/__tests__/match-path-async.test.js +0 -12
  58. package/dist/esm/tsconfig-paths/src/__tests__/match-path-sync.test.js +0 -10
  59. package/dist/esm/tsconfig-paths/src/__tests__/try-path.test.js +0 -214
  60. package/dist/esm/tsconfig-paths/src/__tests__/tsconfig-loader.test.js +0 -296
@@ -73,6 +73,30 @@ function tiptapNodeView(param) {
73
73
  const extensionManager = editor?.extensionManager ?? null;
74
74
  const extensions = extensionManager?.extensions ?? null;
75
75
  const selected = (0, _useIsNodeSelected.useIsNodeSelected)();
76
+ // This is just a dummy ref to satisfy Tiptap's types
77
+ const innerRef = (0, _react1.useRef)(null);
78
+ const htmlAttributes = (0, _react1.useMemo)(()=>{
79
+ if (!extensions) return {};
80
+ const attributes = (0, _core.getAttributesFromExtensions)(extensions);
81
+ const extensionAttributes = attributes.filter((attribute)=>attribute.type === extension.name);
82
+ return (0, _core.getRenderedAttributes)(node, extensionAttributes);
83
+ }, [
84
+ extensions,
85
+ node
86
+ ]);
87
+ const tiptapNodeViewRef = (0, _react1.useRef)(null);
88
+ if (!tiptapNodeViewRef.current && editor) {
89
+ tiptapNodeViewRef.current = new _core.NodeView(WrappedComponent, {
90
+ extension,
91
+ decorations,
92
+ editor,
93
+ getPos,
94
+ HTMLAttributes: htmlAttributes,
95
+ innerDecorations,
96
+ node,
97
+ view: editor.view
98
+ });
99
+ }
76
100
  (0, _useStopEvent.useStopEvent)((_, event)=>{
77
101
  if (stopEvent) {
78
102
  return stopEvent.call({
@@ -83,7 +107,7 @@ function tiptapNodeView(param) {
83
107
  event
84
108
  });
85
109
  }
86
- return false;
110
+ return tiptapNodeViewRef.current?.stopEvent(event) ?? false;
87
111
  });
88
112
  (0, _useIgnoreMutation.useIgnoreMutation)((_, mutation)=>{
89
113
  if (ignoreMutation) {
@@ -95,19 +119,8 @@ function tiptapNodeView(param) {
95
119
  mutation
96
120
  });
97
121
  }
98
- return false;
122
+ return tiptapNodeViewRef.current?.ignoreMutation(mutation) ?? false;
99
123
  });
100
- // This is just a dummy ref to satisfy Tiptap's types
101
- const innerRef = (0, _react1.useRef)(null);
102
- const htmlAttributes = (0, _react1.useMemo)(()=>{
103
- if (!extensions) return {};
104
- const attributes = (0, _core.getAttributesFromExtensions)(extensions);
105
- const extensionAttributes = attributes.filter((attribute)=>attribute.type === extension.name);
106
- return (0, _core.getRenderedAttributes)(node, extensionAttributes);
107
- }, [
108
- extensions,
109
- node
110
- ]);
111
124
  const { extraClassName, htmlProps } = (0, _react1.useMemo)(()=>{
112
125
  if (!attrs) return {};
113
126
  const resolvedAttrs = typeof attrs === "function" ? attrs({
@@ -1,4 +1,4 @@
1
- import { getAttributesFromExtensions, getRenderedAttributes } from "@tiptap/core";
1
+ import { NodeView, getAttributesFromExtensions, getRenderedAttributes } from "@tiptap/core";
2
2
  import { ReactNodeViewContentProvider, useCurrentEditor } from "@tiptap/react";
3
3
  import cx from "classnames";
4
4
  import React, { forwardRef, memo, useMemo, useRef } from "react";
@@ -41,6 +41,30 @@ import { htmlAttrsToReactProps } from "../props.js";
41
41
  const extensionManager = editor?.extensionManager ?? null;
42
42
  const extensions = extensionManager?.extensions ?? null;
43
43
  const selected = useIsNodeSelected();
44
+ // This is just a dummy ref to satisfy Tiptap's types
45
+ const innerRef = useRef(null);
46
+ const htmlAttributes = useMemo(()=>{
47
+ if (!extensions) return {};
48
+ const attributes = getAttributesFromExtensions(extensions);
49
+ const extensionAttributes = attributes.filter((attribute)=>attribute.type === extension.name);
50
+ return getRenderedAttributes(node, extensionAttributes);
51
+ }, [
52
+ extensions,
53
+ node
54
+ ]);
55
+ const tiptapNodeViewRef = useRef(null);
56
+ if (!tiptapNodeViewRef.current && editor) {
57
+ tiptapNodeViewRef.current = new NodeView(WrappedComponent, {
58
+ extension,
59
+ decorations,
60
+ editor,
61
+ getPos,
62
+ HTMLAttributes: htmlAttributes,
63
+ innerDecorations,
64
+ node,
65
+ view: editor.view
66
+ });
67
+ }
44
68
  useStopEvent((_, event)=>{
45
69
  if (stopEvent) {
46
70
  return stopEvent.call({
@@ -51,7 +75,7 @@ import { htmlAttrsToReactProps } from "../props.js";
51
75
  event
52
76
  });
53
77
  }
54
- return false;
78
+ return tiptapNodeViewRef.current?.stopEvent(event) ?? false;
55
79
  });
56
80
  useIgnoreMutation((_, mutation)=>{
57
81
  if (ignoreMutation) {
@@ -63,19 +87,8 @@ import { htmlAttrsToReactProps } from "../props.js";
63
87
  mutation
64
88
  });
65
89
  }
66
- return false;
90
+ return tiptapNodeViewRef.current?.ignoreMutation(mutation) ?? false;
67
91
  });
68
- // This is just a dummy ref to satisfy Tiptap's types
69
- const innerRef = useRef(null);
70
- const htmlAttributes = useMemo(()=>{
71
- if (!extensions) return {};
72
- const attributes = getAttributesFromExtensions(extensions);
73
- const extensionAttributes = attributes.filter((attribute)=>attribute.type === extension.name);
74
- return getRenderedAttributes(node, extensionAttributes);
75
- }, [
76
- extensions,
77
- node
78
- ]);
79
92
  const { extraClassName, htmlProps } = useMemo(()=>{
80
93
  if (!attrs) return {};
81
94
  const resolvedAttrs = typeof attrs === "function" ? attrs({