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

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 (63) hide show
  1. package/dist/cjs/tiptap/TiptapEditorView.js +2 -1
  2. package/dist/cjs/tiptap/tiptapNodeView.js +26 -13
  3. package/dist/esm/tiptap/TiptapEditorView.js +2 -1
  4. package/dist/esm/tiptap/tiptapNodeView.js +27 -14
  5. package/dist/tsconfig.tsbuildinfo +1 -1
  6. package/dist/types/constants.d.ts +1 -1
  7. package/dist/types/props.d.ts +26 -26
  8. package/dist/types/tiptap/TiptapEditorView.d.ts +2 -1
  9. package/package.json +1 -1
  10. package/dist/esm/@jest/pattern/src/__tests__/TestPathPatterns.test.js +0 -241
  11. package/dist/esm/@swc/cli/lib/swc/__tests__/compile.test.js +0 -19
  12. package/dist/esm/@swc/cli/lib/swc/__tests__/options.test.js +0 -315
  13. package/dist/esm/@swc/cli/lib/swc/__tests__/sources.test.js +0 -161
  14. package/dist/esm/@uiw/react-codemirror/src/__tests__/index.test.js +0 -111
  15. package/dist/esm/cheerio/src/__tests__/deprecated.spec.js +0 -249
  16. package/dist/esm/cheerio/src/__tests__/xml.spec.js +0 -55
  17. package/dist/esm/components/__tests__/ProseMirror.composition.test.js +0 -395
  18. package/dist/esm/components/__tests__/ProseMirror.domchange.test.js +0 -266
  19. package/dist/esm/components/__tests__/ProseMirror.draw-decoration.test.js +0 -968
  20. package/dist/esm/components/__tests__/ProseMirror.draw.test.js +0 -335
  21. package/dist/esm/components/__tests__/ProseMirror.mobile.test.js +0 -54
  22. package/dist/esm/components/__tests__/ProseMirror.node-view.test.js +0 -553
  23. package/dist/esm/components/__tests__/ProseMirror.selection.test.js +0 -440
  24. package/dist/esm/components/__tests__/ProseMirror.test.js +0 -324
  25. package/dist/esm/contexts/__tests__/DeferredLayoutEffects.test.js +0 -98
  26. package/dist/esm/hooks/__tests__/useEditorEffect.test.js +0 -134
  27. package/dist/esm/jsx-ast-utils/__tests__/helper.js +0 -83
  28. package/dist/esm/jsx-ast-utils/__tests__/src/elementType-test.js +0 -76
  29. package/dist/esm/jsx-ast-utils/__tests__/src/eventHandlers-test.js +0 -98
  30. package/dist/esm/jsx-ast-utils/__tests__/src/getProp-parser-test.js +0 -188
  31. package/dist/esm/jsx-ast-utils/__tests__/src/getProp-test.js +0 -119
  32. package/dist/esm/jsx-ast-utils/__tests__/src/getPropLiteralValue-babelparser-test.js +0 -393
  33. package/dist/esm/jsx-ast-utils/__tests__/src/getPropLiteralValue-flowparser-test.js +0 -379
  34. package/dist/esm/jsx-ast-utils/__tests__/src/getPropValue-babelparser-test.js +0 -925
  35. package/dist/esm/jsx-ast-utils/__tests__/src/getPropValue-flowparser-test.js +0 -700
  36. package/dist/esm/jsx-ast-utils/__tests__/src/hasProp-test.js +0 -350
  37. package/dist/esm/jsx-ast-utils/__tests__/src/index-test.js +0 -24
  38. package/dist/esm/jsx-ast-utils/__tests__/src/propName-test.js +0 -37
  39. package/dist/esm/plugins/__tests__/reactKeys.test.js +0 -77
  40. package/dist/esm/tsconfig-paths/lib/__tests__/config-loader.test.d.js +0 -1
  41. package/dist/esm/tsconfig-paths/lib/__tests__/config-loader.test.js +0 -97
  42. package/dist/esm/tsconfig-paths/lib/__tests__/data/match-path-data.d.js +0 -1
  43. package/dist/esm/tsconfig-paths/lib/__tests__/data/match-path-data.js +0 -319
  44. package/dist/esm/tsconfig-paths/lib/__tests__/filesystem.test.d.js +0 -1
  45. package/dist/esm/tsconfig-paths/lib/__tests__/filesystem.test.js +0 -62
  46. package/dist/esm/tsconfig-paths/lib/__tests__/mapping-entry.test.d.js +0 -1
  47. package/dist/esm/tsconfig-paths/lib/__tests__/mapping-entry.test.js +0 -80
  48. package/dist/esm/tsconfig-paths/lib/__tests__/match-path-async.test.d.js +0 -1
  49. package/dist/esm/tsconfig-paths/lib/__tests__/match-path-async.test.js +0 -22
  50. package/dist/esm/tsconfig-paths/lib/__tests__/match-path-sync.test.d.js +0 -1
  51. package/dist/esm/tsconfig-paths/lib/__tests__/match-path-sync.test.js +0 -20
  52. package/dist/esm/tsconfig-paths/lib/__tests__/try-path.test.d.js +0 -1
  53. package/dist/esm/tsconfig-paths/lib/__tests__/try-path.test.js +0 -219
  54. package/dist/esm/tsconfig-paths/lib/__tests__/tsconfig-loader.test.d.js +0 -1
  55. package/dist/esm/tsconfig-paths/lib/__tests__/tsconfig-loader.test.js +0 -323
  56. package/dist/esm/tsconfig-paths/src/__tests__/config-loader.test.js +0 -89
  57. package/dist/esm/tsconfig-paths/src/__tests__/data/match-path-data.js +0 -314
  58. package/dist/esm/tsconfig-paths/src/__tests__/filesystem.test.js +0 -58
  59. package/dist/esm/tsconfig-paths/src/__tests__/mapping-entry.test.js +0 -76
  60. package/dist/esm/tsconfig-paths/src/__tests__/match-path-async.test.js +0 -12
  61. package/dist/esm/tsconfig-paths/src/__tests__/match-path-sync.test.js +0 -10
  62. package/dist/esm/tsconfig-paths/src/__tests__/try-path.test.js +0 -214
  63. package/dist/esm/tsconfig-paths/src/__tests__/tsconfig-loader.test.js +0 -296
@@ -54,7 +54,7 @@ function _interop_require_wildcard(obj, nodeInterop) {
54
54
  return newObj;
55
55
  }
56
56
  function TiptapEditorView(param) {
57
- let { editor, nodeViews, children } = param;
57
+ let { editor, nodeViews, children, static: isStatic = false } = param;
58
58
  const forceUpdate = (0, _useForceUpdate.useForceUpdate)();
59
59
  const dispatchTransaction = (0, _react1.useCallback)((tr)=>{
60
60
  // @ts-expect-error calling private method
@@ -84,6 +84,7 @@ function TiptapEditorView(param) {
84
84
  editor
85
85
  ]);
86
86
  return /*#__PURE__*/ _react1.default.createElement(_ProseMirror.ProseMirror, {
87
+ static: isStatic,
87
88
  className: "tiptap",
88
89
  ...initialEditorProps,
89
90
  markViews: markViews,
@@ -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({
@@ -5,7 +5,7 @@ import { useForceUpdate } from "../hooks/useForceUpdate.js";
5
5
  /**
6
6
  * Render a Tiptap-compatible React ProseMirror editor.
7
7
  */ export function TiptapEditorView(param) {
8
- let { editor, nodeViews, children } = param;
8
+ let { editor, nodeViews, children, static: isStatic = false } = param;
9
9
  const forceUpdate = useForceUpdate();
10
10
  const dispatchTransaction = useCallback((tr)=>{
11
11
  // @ts-expect-error calling private method
@@ -35,6 +35,7 @@ import { useForceUpdate } from "../hooks/useForceUpdate.js";
35
35
  editor
36
36
  ]);
37
37
  return /*#__PURE__*/ React.createElement(ProseMirror, {
38
+ static: isStatic,
38
39
  className: "tiptap",
39
40
  ...initialEditorProps,
40
41
  markViews: markViews,
@@ -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({