@handlewithcare/react-prosemirror 3.1.0-tiptap.40 → 3.1.0-tiptap.41
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.
- package/README.md +2 -2
- package/dist/cjs/ReactEditorView.js +3 -3
- package/dist/cjs/StaticEditorView.js +3 -3
- package/dist/cjs/components/SeparatorHackView.js +4 -2
- package/dist/cjs/hooks/useNodeViewDescription.js +14 -0
- package/dist/esm/ReactEditorView.js +3 -3
- package/dist/esm/StaticEditorView.js +3 -3
- package/dist/esm/components/SeparatorHackView.js +4 -2
- package/dist/esm/hooks/useNodeViewDescription.js +14 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types/ReactEditorView.d.ts +2 -2
- package/dist/types/StaticEditorView.d.ts +2 -1
- package/dist/types/constants.d.ts +1 -1
- package/dist/types/props.d.ts +26 -26
- package/dist/types/viewdesc.d.ts +1 -1
- package/package.json +9 -6
package/README.md
CHANGED
|
@@ -35,7 +35,7 @@ npm install @handlewithcare/react-prosemirror \
|
|
|
35
35
|
react@^19.1.0 \
|
|
36
36
|
react-dom@^19.1.0 \
|
|
37
37
|
react-reconciler@0.32.0 \
|
|
38
|
-
prosemirror-view@1.
|
|
38
|
+
prosemirror-view@1.41.7 \
|
|
39
39
|
prosemirror-state \
|
|
40
40
|
prosemirror-model
|
|
41
41
|
```
|
|
@@ -47,7 +47,7 @@ yarn add @handlewithcare/react-prosemirror \
|
|
|
47
47
|
react@^19.1.0 \
|
|
48
48
|
react-dom@^19.1.0 \
|
|
49
49
|
react-reconciler@0.32.0 \
|
|
50
|
-
prosemirror-view@1.
|
|
50
|
+
prosemirror-view@1.41.7 \
|
|
51
51
|
prosemirror-state \
|
|
52
52
|
prosemirror-model
|
|
53
53
|
```
|
|
@@ -129,7 +129,7 @@ let ReactEditorView = class ReactEditorView extends _prosemirrorview.EditorView
|
|
|
129
129
|
return undefined;
|
|
130
130
|
}
|
|
131
131
|
const prop = this.props[propName];
|
|
132
|
-
if (prop) {
|
|
132
|
+
if (prop != null) {
|
|
133
133
|
const result = f ? f(prop) : prop;
|
|
134
134
|
if (result) {
|
|
135
135
|
return result;
|
|
@@ -137,7 +137,7 @@ let ReactEditorView = class ReactEditorView extends _prosemirrorview.EditorView
|
|
|
137
137
|
}
|
|
138
138
|
for (const plugin of this.props.plugins ?? []){
|
|
139
139
|
const prop = plugin.props[propName];
|
|
140
|
-
if (prop) {
|
|
140
|
+
if (prop != null) {
|
|
141
141
|
const result = f ? f(prop) : prop;
|
|
142
142
|
if (result) {
|
|
143
143
|
return result;
|
|
@@ -146,7 +146,7 @@ let ReactEditorView = class ReactEditorView extends _prosemirrorview.EditorView
|
|
|
146
146
|
}
|
|
147
147
|
for (const plugin of this.state.plugins){
|
|
148
148
|
const prop = plugin.props[propName];
|
|
149
|
-
if (prop) {
|
|
149
|
+
if (prop != null) {
|
|
150
150
|
const result = f ? f(prop) : prop;
|
|
151
151
|
if (result) {
|
|
152
152
|
return result;
|
|
@@ -46,7 +46,7 @@ let StaticEditorView = class StaticEditorView {
|
|
|
46
46
|
}
|
|
47
47
|
someProp(propName, f) {
|
|
48
48
|
const prop = this.props[propName];
|
|
49
|
-
if (prop) {
|
|
49
|
+
if (prop != null) {
|
|
50
50
|
const result = f ? f(prop) : prop;
|
|
51
51
|
if (result) {
|
|
52
52
|
return result;
|
|
@@ -54,7 +54,7 @@ let StaticEditorView = class StaticEditorView {
|
|
|
54
54
|
}
|
|
55
55
|
for (const plugin of this.props.plugins ?? []){
|
|
56
56
|
const prop = plugin.props[propName];
|
|
57
|
-
if (prop) {
|
|
57
|
+
if (prop != null) {
|
|
58
58
|
const result = f ? f(prop) : prop;
|
|
59
59
|
if (result) {
|
|
60
60
|
return result;
|
|
@@ -63,7 +63,7 @@ let StaticEditorView = class StaticEditorView {
|
|
|
63
63
|
}
|
|
64
64
|
for (const plugin of this.state.plugins){
|
|
65
65
|
const prop = plugin.props[propName];
|
|
66
|
-
if (prop) {
|
|
66
|
+
if (prop != null) {
|
|
67
67
|
const result = f ? f(prop) : prop;
|
|
68
68
|
if (result) {
|
|
69
69
|
return result;
|
|
@@ -76,7 +76,8 @@ function SeparatorHackView(param) {
|
|
|
76
76
|
// we call setShouldRender conditionally
|
|
77
77
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
78
78
|
(0, _useClientLayoutEffect.useClientLayoutEffect)(()=>{
|
|
79
|
-
const
|
|
79
|
+
const nonHackSiblings = siblingsRef.current.filter((viewdesc)=>!(viewdesc instanceof _viewdesc.TrailingHackViewDesc));
|
|
80
|
+
const lastSibling = nonHackSiblings[nonHackSiblings.length - 1];
|
|
80
81
|
if ((_browser.browser.safari || _browser.browser.chrome) && lastSibling?.dom?.contentEditable == "false") {
|
|
81
82
|
setShouldRender(true);
|
|
82
83
|
return;
|
|
@@ -95,6 +96,7 @@ function SeparatorHackView(param) {
|
|
|
95
96
|
});
|
|
96
97
|
return shouldRender ? /*#__PURE__*/ _react.default.createElement("img", {
|
|
97
98
|
ref: ref,
|
|
98
|
-
className: "ProseMirror-separator"
|
|
99
|
+
className: "ProseMirror-separator",
|
|
100
|
+
alt: ""
|
|
99
101
|
}) : null;
|
|
100
102
|
}
|
|
@@ -121,7 +121,21 @@ function useNodeViewDescription(getDOM, getContentDOM, constructor, props) {
|
|
|
121
121
|
if (!siblings.includes(viewDesc)) {
|
|
122
122
|
siblings.push(viewDesc);
|
|
123
123
|
}
|
|
124
|
+
// In strict/concurrent mode, a node can sometimes re-render
|
|
125
|
+
// entirely on its own, without even its parent re-rendering.
|
|
126
|
+
// In this case, we will have added our view descriptions to
|
|
127
|
+
// our parent's children, but our parent has no opportunity
|
|
128
|
+
// to sort its children, because it never renders. So
|
|
129
|
+
// we always sort our siblings, too.
|
|
124
130
|
siblings.sort(_viewdesc.sortViewDescs);
|
|
131
|
+
// If a child updates, usually it will re-render and sort
|
|
132
|
+
// our children for us. But it's possible to reorder
|
|
133
|
+
// child nodes without changing their keys or node
|
|
134
|
+
// instances, in which case our children _won't_
|
|
135
|
+
// rerender. As a fallback, we do one last pass through
|
|
136
|
+
// our own child view descriptions and make sure
|
|
137
|
+
// they're ordered. This should be a cheap no-op in most cases.
|
|
138
|
+
children.sort(_viewdesc.sortViewDescs);
|
|
125
139
|
for (const child of children){
|
|
126
140
|
child.parent = viewDesc;
|
|
127
141
|
// Because TextNodeViews can't locate the DOM nodes
|
|
@@ -129,7 +129,7 @@ function changedNodeViews(a, b) {
|
|
|
129
129
|
return undefined;
|
|
130
130
|
}
|
|
131
131
|
const prop = this.props[propName];
|
|
132
|
-
if (prop) {
|
|
132
|
+
if (prop != null) {
|
|
133
133
|
const result = f ? f(prop) : prop;
|
|
134
134
|
if (result) {
|
|
135
135
|
return result;
|
|
@@ -137,7 +137,7 @@ function changedNodeViews(a, b) {
|
|
|
137
137
|
}
|
|
138
138
|
for (const plugin of this.props.plugins ?? []){
|
|
139
139
|
const prop = plugin.props[propName];
|
|
140
|
-
if (prop) {
|
|
140
|
+
if (prop != null) {
|
|
141
141
|
const result = f ? f(prop) : prop;
|
|
142
142
|
if (result) {
|
|
143
143
|
return result;
|
|
@@ -146,7 +146,7 @@ function changedNodeViews(a, b) {
|
|
|
146
146
|
}
|
|
147
147
|
for (const plugin of this.state.plugins){
|
|
148
148
|
const prop = plugin.props[propName];
|
|
149
|
-
if (prop) {
|
|
149
|
+
if (prop != null) {
|
|
150
150
|
const result = f ? f(prop) : prop;
|
|
151
151
|
if (result) {
|
|
152
152
|
return result;
|
|
@@ -36,7 +36,7 @@ export class StaticEditorView {
|
|
|
36
36
|
}
|
|
37
37
|
someProp(propName, f) {
|
|
38
38
|
const prop = this.props[propName];
|
|
39
|
-
if (prop) {
|
|
39
|
+
if (prop != null) {
|
|
40
40
|
const result = f ? f(prop) : prop;
|
|
41
41
|
if (result) {
|
|
42
42
|
return result;
|
|
@@ -44,7 +44,7 @@ export class StaticEditorView {
|
|
|
44
44
|
}
|
|
45
45
|
for (const plugin of this.props.plugins ?? []){
|
|
46
46
|
const prop = plugin.props[propName];
|
|
47
|
-
if (prop) {
|
|
47
|
+
if (prop != null) {
|
|
48
48
|
const result = f ? f(prop) : prop;
|
|
49
49
|
if (result) {
|
|
50
50
|
return result;
|
|
@@ -53,7 +53,7 @@ export class StaticEditorView {
|
|
|
53
53
|
}
|
|
54
54
|
for (const plugin of this.state.plugins){
|
|
55
55
|
const prop = plugin.props[propName];
|
|
56
|
-
if (prop) {
|
|
56
|
+
if (prop != null) {
|
|
57
57
|
const result = f ? f(prop) : prop;
|
|
58
58
|
if (result) {
|
|
59
59
|
return result;
|
|
@@ -25,7 +25,8 @@ export function SeparatorHackView(param) {
|
|
|
25
25
|
// we call setShouldRender conditionally
|
|
26
26
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
27
27
|
useClientLayoutEffect(()=>{
|
|
28
|
-
const
|
|
28
|
+
const nonHackSiblings = siblingsRef.current.filter((viewdesc)=>!(viewdesc instanceof TrailingHackViewDesc));
|
|
29
|
+
const lastSibling = nonHackSiblings[nonHackSiblings.length - 1];
|
|
29
30
|
if ((browser.safari || browser.chrome) && lastSibling?.dom?.contentEditable == "false") {
|
|
30
31
|
setShouldRender(true);
|
|
31
32
|
return;
|
|
@@ -44,6 +45,7 @@ export function SeparatorHackView(param) {
|
|
|
44
45
|
});
|
|
45
46
|
return shouldRender ? /*#__PURE__*/ React.createElement("img", {
|
|
46
47
|
ref: ref,
|
|
47
|
-
className: "ProseMirror-separator"
|
|
48
|
+
className: "ProseMirror-separator",
|
|
49
|
+
alt: ""
|
|
48
50
|
}) : null;
|
|
49
51
|
}
|
|
@@ -111,7 +111,21 @@ export function useNodeViewDescription(getDOM, getContentDOM, constructor, props
|
|
|
111
111
|
if (!siblings.includes(viewDesc)) {
|
|
112
112
|
siblings.push(viewDesc);
|
|
113
113
|
}
|
|
114
|
+
// In strict/concurrent mode, a node can sometimes re-render
|
|
115
|
+
// entirely on its own, without even its parent re-rendering.
|
|
116
|
+
// In this case, we will have added our view descriptions to
|
|
117
|
+
// our parent's children, but our parent has no opportunity
|
|
118
|
+
// to sort its children, because it never renders. So
|
|
119
|
+
// we always sort our siblings, too.
|
|
114
120
|
siblings.sort(sortViewDescs);
|
|
121
|
+
// If a child updates, usually it will re-render and sort
|
|
122
|
+
// our children for us. But it's possible to reorder
|
|
123
|
+
// child nodes without changing their keys or node
|
|
124
|
+
// instances, in which case our children _won't_
|
|
125
|
+
// rerender. As a fallback, we do one last pass through
|
|
126
|
+
// our own child view descriptions and make sure
|
|
127
|
+
// they're ordered. This should be a cheap no-op in most cases.
|
|
128
|
+
children.sort(sortViewDescs);
|
|
115
129
|
for (const child of children){
|
|
116
130
|
child.parent = viewDesc;
|
|
117
131
|
// Because TextNodeViews can't locate the DOM nodes
|