@handlewithcare/react-prosemirror 3.1.0-tiptap.41 → 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.
- package/dist/cjs/ReactEditorView.js +70 -74
- package/dist/cjs/StaticEditorView.js +18 -21
- package/dist/cjs/browser.js +1 -3
- package/dist/cjs/commands/reorderSiblings.js +9 -13
- package/dist/cjs/components/ChildNodeViews.js +68 -71
- package/dist/cjs/components/CursorWrapper.js +26 -17
- package/dist/cjs/components/LayoutGroup.js +12 -16
- package/dist/cjs/components/NativeWidgetView.js +15 -19
- package/dist/cjs/components/OutputSpec.js +9 -13
- package/dist/cjs/components/ProseMirror.js +37 -27
- package/dist/cjs/components/ProseMirrorDoc.js +25 -18
- package/dist/cjs/components/SeparatorHackView.js +17 -20
- package/dist/cjs/components/TextNodeView.js +22 -20
- package/dist/cjs/components/TrailingHackView.js +13 -17
- package/dist/cjs/components/WidgetView.js +14 -18
- package/dist/cjs/components/marks/DefaultMarkView.js +27 -15
- package/dist/cjs/components/marks/MarkView.js +32 -23
- package/dist/cjs/components/marks/MarkViewConstructorView.js +38 -22
- package/dist/cjs/components/marks/ReactMarkView.js +27 -16
- package/dist/cjs/components/nodes/DefaultNodeView.js +27 -15
- package/dist/cjs/components/nodes/DocNodeView.js +12 -16
- package/dist/cjs/components/nodes/NodeView.js +33 -26
- package/dist/cjs/components/nodes/NodeViewConstructorView.js +45 -29
- package/dist/cjs/components/nodes/ReactNodeView.js +39 -27
- package/dist/cjs/constants.js +6 -10
- package/dist/cjs/contexts/ChildDescriptionsContext.js +1 -3
- package/dist/cjs/contexts/EditorContext.js +1 -3
- package/dist/cjs/contexts/EditorStateContext.js +1 -3
- package/dist/cjs/contexts/IgnoreMutationContext.js +1 -3
- package/dist/cjs/contexts/LayoutGroupContext.js +1 -3
- package/dist/cjs/contexts/NodeViewContext.js +1 -3
- package/dist/cjs/contexts/SelectNodeContext.js +1 -3
- package/dist/cjs/contexts/StopEventContext.js +1 -3
- package/dist/cjs/decorations/ReactWidgetType.js +13 -19
- package/dist/cjs/decorations/computeDocDeco.js +3 -5
- package/dist/cjs/decorations/iterDeco.js +17 -19
- package/dist/cjs/decorations/viewDecorations.js +12 -15
- package/dist/cjs/dom.js +13 -34
- package/dist/cjs/findDOMNode.js +5 -9
- package/dist/cjs/hooks/useClientLayoutEffect.js +1 -3
- package/dist/cjs/hooks/useComponentEventListeners.js +6 -7
- package/dist/cjs/hooks/useEditor.js +30 -28
- package/dist/cjs/hooks/useEditorEffect.js +7 -9
- package/dist/cjs/hooks/useEditorEventCallback.js +7 -9
- package/dist/cjs/hooks/useEditorEventListener.js +6 -8
- package/dist/cjs/hooks/useEditorState.js +3 -5
- package/dist/cjs/hooks/useEffectEvent.js +1 -3
- package/dist/cjs/hooks/useForceUpdate.js +1 -3
- package/dist/cjs/hooks/useIgnoreMutation.js +7 -9
- package/dist/cjs/hooks/useIsEditorStatic.js +5 -5
- package/dist/cjs/hooks/useIsNodeSelected.js +3 -5
- package/dist/cjs/hooks/useLayoutGroupEffect.js +5 -7
- package/dist/cjs/hooks/useMarkViewDescription.js +25 -24
- package/dist/cjs/hooks/useNodePos.js +5 -7
- package/dist/cjs/hooks/useNodeViewDescription.js +28 -29
- package/dist/cjs/hooks/useReactKeys.js +5 -7
- package/dist/cjs/hooks/useSelectNode.js +8 -10
- package/dist/cjs/hooks/useStopEvent.js +7 -9
- package/dist/cjs/index.js +34 -66
- package/dist/cjs/plugins/beforeInputPlugin.js +23 -20
- package/dist/cjs/plugins/componentEventListeners.js +6 -8
- package/dist/cjs/plugins/componentEventListenersPlugin.js +6 -8
- package/dist/cjs/plugins/reactKeys.js +10 -15
- package/dist/cjs/props.js +19 -23
- package/dist/cjs/refs.js +1 -3
- package/dist/cjs/testing/editorViewTestHelpers.js +47 -40
- package/dist/cjs/testing/setupProseMirrorView.js +4 -7
- package/dist/cjs/tiptap/ReactProseMirrorNodeView.js +6 -10
- package/dist/cjs/tiptap/TiptapEditor.js +14 -15
- package/dist/cjs/tiptap/TiptapEditorContent.js +28 -18
- package/dist/cjs/tiptap/TiptapEditorView.js +34 -23
- package/dist/cjs/tiptap/contexts/TiptapEditorContext.js +1 -3
- package/dist/cjs/tiptap/extensions/ReactProseMirror.js +6 -8
- package/dist/cjs/tiptap/extensions/ReactProseMirrorCommands.js +3 -5
- package/dist/cjs/tiptap/extensions/commands/updateAttributes.js +2 -4
- package/dist/cjs/tiptap/hooks/useIsInReactProseMirror.js +3 -5
- package/dist/cjs/tiptap/hooks/useTiptapEditor.js +14 -12
- package/dist/cjs/tiptap/hooks/useTiptapEditorEffect.js +10 -12
- package/dist/cjs/tiptap/hooks/useTiptapEditorEventCallback.js +4 -6
- package/dist/cjs/tiptap/index.js +18 -36
- package/dist/cjs/tiptap/tiptapNodeView.js +62 -48
- package/dist/cjs/viewdesc.js +95 -119
- package/dist/esm/ReactEditorView.js +66 -68
- package/dist/esm/StaticEditorView.js +17 -18
- package/dist/esm/commands/reorderSiblings.js +5 -5
- package/dist/esm/components/ChildNodeViews.js +36 -33
- package/dist/esm/components/CursorWrapper.js +18 -5
- package/dist/esm/components/LayoutGroup.js +1 -1
- package/dist/esm/components/NativeWidgetView.js +2 -2
- package/dist/esm/components/OutputSpec.js +1 -1
- package/dist/esm/components/ProseMirror.js +17 -3
- package/dist/esm/components/ProseMirrorDoc.js +19 -6
- package/dist/esm/components/SeparatorHackView.js +4 -3
- package/dist/esm/components/TextNodeView.js +10 -6
- package/dist/esm/components/TrailingHackView.js +2 -2
- package/dist/esm/components/WidgetView.js +3 -3
- package/dist/esm/components/marks/DefaultMarkView.js +22 -6
- package/dist/esm/components/marks/MarkView.js +24 -11
- package/dist/esm/components/marks/MarkViewConstructorView.js +27 -7
- package/dist/esm/components/marks/ReactMarkView.js +18 -3
- package/dist/esm/components/nodes/DefaultNodeView.js +22 -6
- package/dist/esm/components/nodes/DocNodeView.js +2 -2
- package/dist/esm/components/nodes/NodeView.js +24 -11
- package/dist/esm/components/nodes/NodeViewConstructorView.js +31 -11
- package/dist/esm/components/nodes/ReactNodeView.js +22 -6
- package/dist/esm/decorations/ReactWidgetType.js +8 -10
- package/dist/esm/decorations/iterDeco.js +13 -13
- package/dist/esm/decorations/viewDecorations.js +6 -7
- package/dist/esm/dom.js +2 -1
- package/dist/esm/findDOMNode.js +1 -1
- package/dist/esm/hooks/useComponentEventListeners.js +3 -2
- package/dist/esm/hooks/useEditor.js +9 -5
- package/dist/esm/hooks/useEditorEffect.js +1 -1
- package/dist/esm/hooks/useEditorEventCallback.js +1 -1
- package/dist/esm/hooks/useEditorEventListener.js +1 -1
- package/dist/esm/hooks/useIsEditorStatic.js +3 -1
- package/dist/esm/hooks/useMarkViewDescription.js +10 -7
- package/dist/esm/hooks/useNodeViewDescription.js +8 -7
- package/dist/esm/hooks/useReactKeys.js +1 -1
- package/dist/esm/plugins/beforeInputPlugin.js +17 -12
- package/dist/esm/plugins/reactKeys.js +4 -3
- package/dist/esm/props.js +15 -15
- package/dist/esm/testing/editorViewTestHelpers.js +31 -20
- package/dist/esm/testing/setupProseMirrorView.js +2 -1
- package/dist/esm/tiptap/ReactProseMirrorNodeView.js +5 -7
- package/dist/esm/tiptap/TiptapEditor.js +10 -9
- package/dist/esm/tiptap/TiptapEditorContent.js +18 -4
- package/dist/esm/tiptap/TiptapEditorView.js +23 -8
- package/dist/esm/tiptap/extensions/ReactProseMirror.js +1 -1
- package/dist/esm/tiptap/extensions/commands/updateAttributes.js +1 -1
- package/dist/esm/tiptap/hooks/useTiptapEditor.js +8 -4
- package/dist/esm/tiptap/hooks/useTiptapEditorEffect.js +4 -4
- package/dist/esm/tiptap/hooks/useTiptapEditorEventCallback.js +1 -1
- package/dist/esm/tiptap/tiptapNodeView.js +38 -20
- package/dist/esm/viewdesc.js +72 -74
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types/constants.d.ts +1 -1
- package/dist/types/props.d.ts +8 -8
- package/dist/types/viewdesc.d.ts +3 -1
- package/package.json +2 -1
|
@@ -3,8 +3,8 @@ import { ChildDescriptionsContext } from "../contexts/ChildDescriptionsContext.j
|
|
|
3
3
|
import { useClientLayoutEffect } from "../hooks/useClientLayoutEffect.js";
|
|
4
4
|
import { WidgetViewDesc, sortViewDescs } from "../viewdesc.js";
|
|
5
5
|
export function WidgetView(param) {
|
|
6
|
-
let { widget, getPos
|
|
7
|
-
const { siblingsRef, parentRef
|
|
6
|
+
let { widget , getPos } = param;
|
|
7
|
+
const { siblingsRef , parentRef } = useContext(ChildDescriptionsContext);
|
|
8
8
|
const viewDescRef = useRef(null);
|
|
9
9
|
const domRef = useRef(null);
|
|
10
10
|
useClientLayoutEffect(()=>{
|
|
@@ -33,7 +33,7 @@ export function WidgetView(param) {
|
|
|
33
33
|
}
|
|
34
34
|
siblingsRef.current.sort(sortViewDescs);
|
|
35
35
|
});
|
|
36
|
-
const { Component
|
|
36
|
+
const { Component } = widget.type;
|
|
37
37
|
return Component && /*#__PURE__*/ React.createElement(Component, {
|
|
38
38
|
ref: domRef,
|
|
39
39
|
widget: widget,
|
|
@@ -1,19 +1,35 @@
|
|
|
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, { forwardRef, useMemo } from "react";
|
|
2
16
|
import { OutputSpec } from "../OutputSpec.js";
|
|
3
17
|
export const DefaultMarkView = /*#__PURE__*/ forwardRef(function DefaultMarkView(param, ref) {
|
|
4
|
-
let { markProps: { mark, inline, contentDOMRef
|
|
5
|
-
const spec = useMemo(()=>
|
|
18
|
+
let { markProps: { mark , inline , contentDOMRef } , children , ...props } = param;
|
|
19
|
+
const spec = useMemo(()=>{
|
|
20
|
+
var _spec, ref;
|
|
21
|
+
return (ref = (_spec = mark.type.spec).toDOM) === null || ref === void 0 ? void 0 : ref.call(_spec, mark, inline);
|
|
22
|
+
}, [
|
|
6
23
|
mark,
|
|
7
24
|
inline
|
|
8
25
|
]);
|
|
9
26
|
if (!spec) {
|
|
10
|
-
throw new Error(
|
|
27
|
+
throw new Error("Mark spec for ".concat(mark.type.name, " is missing toDOM"));
|
|
11
28
|
}
|
|
12
|
-
return /*#__PURE__*/ React.createElement(OutputSpec, {
|
|
13
|
-
...props,
|
|
29
|
+
return /*#__PURE__*/ React.createElement(OutputSpec, _extends({}, props, {
|
|
14
30
|
outputSpec: spec,
|
|
15
31
|
contentDOMRef: contentDOMRef,
|
|
16
32
|
ref: ref,
|
|
17
33
|
isMark: true
|
|
18
|
-
}, children);
|
|
34
|
+
}), children);
|
|
19
35
|
});
|
|
@@ -1,11 +1,26 @@
|
|
|
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, { memo, useContext, useMemo } from "react";
|
|
2
16
|
import { NodeViewContext } from "../../contexts/NodeViewContext.js";
|
|
3
17
|
import { DefaultMarkView } from "./DefaultMarkView.js";
|
|
4
18
|
import { MarkViewConstructorView } from "./MarkViewConstructorView.js";
|
|
5
19
|
import { ReactMarkView } from "./ReactMarkView.js";
|
|
6
20
|
export const MarkView = /*#__PURE__*/ memo(function MarkView(props) {
|
|
7
|
-
const { components, constructors
|
|
8
|
-
|
|
21
|
+
const { components , constructors } = useContext(NodeViewContext);
|
|
22
|
+
var _name;
|
|
23
|
+
const component = (_name = components[props.mark.type.name]) !== null && _name !== void 0 ? _name : DefaultMarkView;
|
|
9
24
|
const constructor = constructors[props.mark.type.name];
|
|
10
25
|
// Construct a wrapper component so that the mark view remounts when either
|
|
11
26
|
// its component or constructor changes. A React mark view would remount
|
|
@@ -14,21 +29,19 @@ export const MarkView = /*#__PURE__*/ memo(function MarkView(props) {
|
|
|
14
29
|
const Component = useMemo(()=>{
|
|
15
30
|
if (constructor) {
|
|
16
31
|
return function MarkView(props) {
|
|
17
|
-
return /*#__PURE__*/ React.createElement(MarkViewConstructorView, {
|
|
18
|
-
constructor: constructor
|
|
19
|
-
|
|
20
|
-
});
|
|
32
|
+
return /*#__PURE__*/ React.createElement(MarkViewConstructorView, _extends({
|
|
33
|
+
constructor: constructor
|
|
34
|
+
}, props));
|
|
21
35
|
};
|
|
22
36
|
}
|
|
23
37
|
return function NodeView(props) {
|
|
24
|
-
return /*#__PURE__*/ React.createElement(ReactMarkView, {
|
|
25
|
-
component: component
|
|
26
|
-
|
|
27
|
-
});
|
|
38
|
+
return /*#__PURE__*/ React.createElement(ReactMarkView, _extends({
|
|
39
|
+
component: component
|
|
40
|
+
}, props));
|
|
28
41
|
};
|
|
29
42
|
}, [
|
|
30
43
|
component,
|
|
31
44
|
constructor
|
|
32
45
|
]);
|
|
33
|
-
return /*#__PURE__*/ React.createElement(Component, props);
|
|
46
|
+
return /*#__PURE__*/ React.createElement(Component, _extends({}, props));
|
|
34
47
|
});
|
|
@@ -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 { DOMSerializer } from "prosemirror-model";
|
|
2
16
|
import React, { memo, useMemo, useRef } from "react";
|
|
3
17
|
import { createPortal } from "react-dom";
|
|
@@ -5,7 +19,7 @@ import { ChildDescriptionsContext } from "../../contexts/ChildDescriptionsContex
|
|
|
5
19
|
import { useForceUpdate } from "../../hooks/useForceUpdate.js";
|
|
6
20
|
import { useMarkViewDescription } from "../../hooks/useMarkViewDescription.js";
|
|
7
21
|
export const MarkViewConstructorView = /*#__PURE__*/ memo(function MarkViewConstructorView(param) {
|
|
8
|
-
let { constructor, mark, inline, getPos, children
|
|
22
|
+
let { constructor , mark , inline , getPos , children } = param;
|
|
9
23
|
const ref = useRef(null);
|
|
10
24
|
const innerRef = useRef(null);
|
|
11
25
|
const forceUpdate = useForceUpdate();
|
|
@@ -27,21 +41,26 @@ export const MarkViewConstructorView = /*#__PURE__*/ memo(function MarkViewConst
|
|
|
27
41
|
}
|
|
28
42
|
const markView = constructor(...args);
|
|
29
43
|
if (!markView || !markView.dom) {
|
|
30
|
-
|
|
44
|
+
var _spec, ref;
|
|
45
|
+
const spec = (ref = (_spec = mark.type.spec).toDOM) === null || ref === void 0 ? void 0 : ref.call(_spec, mark, inline);
|
|
31
46
|
if (!spec) {
|
|
32
|
-
throw new Error(
|
|
47
|
+
throw new Error("Mark spec for ".concat(mark.type.name, " is missing toDOM"));
|
|
33
48
|
}
|
|
34
49
|
return DOMSerializer.renderSpec(document, spec, null);
|
|
35
50
|
}
|
|
36
51
|
return markView;
|
|
37
52
|
};
|
|
38
|
-
|
|
53
|
+
var ref1;
|
|
54
|
+
const { childContextValue , contentDOM } = useMarkViewDescription(()=>ref.current, (markView)=>{
|
|
55
|
+
return (ref1 = markView === null || markView === void 0 ? void 0 : markView.contentDOM) !== null && ref1 !== void 0 ? ref1 : null;
|
|
56
|
+
}, function() {
|
|
39
57
|
for(var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++){
|
|
40
58
|
args[_key] = arguments[_key];
|
|
41
59
|
}
|
|
42
60
|
const markView = createMarkView(...args);
|
|
43
61
|
const dom = markView.dom;
|
|
44
|
-
|
|
62
|
+
var _current;
|
|
63
|
+
const wrapperDOM = (_current = innerRef.current) !== null && _current !== void 0 ? _current : ref.current;
|
|
45
64
|
wrapperDOM.appendChild(dom);
|
|
46
65
|
// Force a re-render so that we properly create
|
|
47
66
|
// a portal into the contentDOM/dom
|
|
@@ -49,7 +68,8 @@ export const MarkViewConstructorView = /*#__PURE__*/ memo(function MarkViewConst
|
|
|
49
68
|
return {
|
|
50
69
|
...markView,
|
|
51
70
|
destroy () {
|
|
52
|
-
|
|
71
|
+
var ref;
|
|
72
|
+
(ref = markView.destroy) === null || ref === void 0 ? void 0 : ref.call(markView);
|
|
53
73
|
wrapperDOM.removeChild(dom);
|
|
54
74
|
},
|
|
55
75
|
ignoreMutation: markView.ignoreMutation
|
|
@@ -59,7 +79,7 @@ export const MarkViewConstructorView = /*#__PURE__*/ memo(function MarkViewConst
|
|
|
59
79
|
const props = {
|
|
60
80
|
ref: innerRef
|
|
61
81
|
};
|
|
62
|
-
return /*#__PURE__*/ React.createElement(Component, props, contentDOM ? /*#__PURE__*/ createPortal(/*#__PURE__*/ React.createElement(ChildDescriptionsContext.Provider, {
|
|
82
|
+
return /*#__PURE__*/ React.createElement(Component, _extends({}, props), contentDOM ? /*#__PURE__*/ createPortal(/*#__PURE__*/ React.createElement(ChildDescriptionsContext.Provider, {
|
|
63
83
|
value: childContextValue
|
|
64
84
|
}, children), contentDOM) : null);
|
|
65
85
|
});
|
|
@@ -1,9 +1,23 @@
|
|
|
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, { memo, useCallback, useMemo, useRef } from "react";
|
|
2
16
|
import { ChildDescriptionsContext } from "../../contexts/ChildDescriptionsContext.js";
|
|
3
17
|
import { IgnoreMutationContext } from "../../contexts/IgnoreMutationContext.js";
|
|
4
18
|
import { useMarkViewDescription } from "../../hooks/useMarkViewDescription.js";
|
|
5
19
|
export const ReactMarkView = /*#__PURE__*/ memo(function ReactMarkView(param) {
|
|
6
|
-
let { component: Component, mark, inline, getPos, children
|
|
20
|
+
let { component: Component , mark , inline , getPos , children } = param;
|
|
7
21
|
const ref = useRef(null);
|
|
8
22
|
const contentDOMRef = useRef(null);
|
|
9
23
|
const ignoreMutationRef = useRef(null);
|
|
@@ -25,7 +39,8 @@ export const ReactMarkView = /*#__PURE__*/ memo(function ReactMarkView(param) {
|
|
|
25
39
|
inline,
|
|
26
40
|
mark
|
|
27
41
|
]);
|
|
28
|
-
|
|
42
|
+
var _current;
|
|
43
|
+
const { childContextValue , refUpdated } = useMarkViewDescription(()=>ref.current, ()=>(_current = contentDOMRef.current) !== null && _current !== void 0 ? _current : ref.current, ()=>({
|
|
29
44
|
dom: ref.current,
|
|
30
45
|
ignoreMutation (mutation) {
|
|
31
46
|
const ignoreMutation = ignoreMutationRef.current;
|
|
@@ -62,5 +77,5 @@ export const ReactMarkView = /*#__PURE__*/ memo(function ReactMarkView(param) {
|
|
|
62
77
|
value: setIgnoreMutation
|
|
63
78
|
}, /*#__PURE__*/ React.createElement(ChildDescriptionsContext.Provider, {
|
|
64
79
|
value: childContextValue
|
|
65
|
-
}, /*#__PURE__*/ React.createElement(Component, props, children)));
|
|
80
|
+
}, /*#__PURE__*/ React.createElement(Component, _extends({}, props), children)));
|
|
66
81
|
});
|
|
@@ -1,17 +1,33 @@
|
|
|
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, { forwardRef, useMemo } from "react";
|
|
2
16
|
import { OutputSpec } from "../OutputSpec.js";
|
|
3
17
|
export const DefaultNodeView = /*#__PURE__*/ forwardRef(function DefaultNodeView(param, ref) {
|
|
4
|
-
let { nodeProps: { node, contentDOMRef
|
|
5
|
-
const spec = useMemo(()=>
|
|
18
|
+
let { nodeProps: { node , contentDOMRef } , children , ...props } = param;
|
|
19
|
+
const spec = useMemo(()=>{
|
|
20
|
+
var _spec, ref;
|
|
21
|
+
return (ref = (_spec = node.type.spec).toDOM) === null || ref === void 0 ? void 0 : ref.call(_spec, node);
|
|
22
|
+
}, [
|
|
6
23
|
node
|
|
7
24
|
]);
|
|
8
25
|
if (!spec) {
|
|
9
|
-
throw new Error(
|
|
26
|
+
throw new Error("Node spec for ".concat(node.type.name, " is missing toDOM"));
|
|
10
27
|
}
|
|
11
|
-
return /*#__PURE__*/ React.createElement(OutputSpec, {
|
|
12
|
-
...props,
|
|
28
|
+
return /*#__PURE__*/ React.createElement(OutputSpec, _extends({}, props, {
|
|
13
29
|
outputSpec: spec,
|
|
14
30
|
ref: ref,
|
|
15
31
|
contentDOMRef: contentDOMRef
|
|
16
|
-
}, children);
|
|
32
|
+
}), children);
|
|
17
33
|
});
|
|
@@ -3,7 +3,7 @@ import { ChildDescriptionsContext } from "../../contexts/ChildDescriptionsContex
|
|
|
3
3
|
import { useNodeViewDescription } from "../../hooks/useNodeViewDescription.js";
|
|
4
4
|
import { ChildNodeViews, wrapInDeco } from "../ChildNodeViews.js";
|
|
5
5
|
export const DocNodeView = /*#__PURE__*/ memo(/*#__PURE__*/ forwardRef(function DocNodeView(param, ref) {
|
|
6
|
-
let { as, node, getPos, decorations, innerDecorations, setMount, ...elementProps } = param;
|
|
6
|
+
let { as , node , getPos , decorations , innerDecorations , setMount , ...elementProps } = param;
|
|
7
7
|
const innerRef = useRef(null);
|
|
8
8
|
useImperativeHandle(ref, ()=>innerRef.current);
|
|
9
9
|
useImperativeHandle(setMount, ()=>innerRef.current);
|
|
@@ -19,7 +19,7 @@ export const DocNodeView = /*#__PURE__*/ memo(/*#__PURE__*/ forwardRef(function
|
|
|
19
19
|
decorations,
|
|
20
20
|
innerDecorations
|
|
21
21
|
]);
|
|
22
|
-
const { childContextValue
|
|
22
|
+
const { childContextValue } = useNodeViewDescription(()=>innerRef.current, ()=>innerRef.current, ()=>{
|
|
23
23
|
const dom = innerRef.current;
|
|
24
24
|
return {
|
|
25
25
|
dom,
|
|
@@ -1,11 +1,26 @@
|
|
|
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, { createContext, memo, useContext, useMemo } from "react";
|
|
2
16
|
import { NodeViewContext } from "../../contexts/NodeViewContext.js";
|
|
3
17
|
import { DefaultNodeView } from "./DefaultNodeView.js";
|
|
4
18
|
import { NodeViewConstructorView } from "./NodeViewConstructorView.js";
|
|
5
19
|
import { ReactNodeView } from "./ReactNodeView.js";
|
|
6
20
|
export const NodeView = /*#__PURE__*/ memo(function NodeView(props) {
|
|
7
|
-
const { components, constructors
|
|
8
|
-
|
|
21
|
+
const { components , constructors } = useContext(NodeViewContext);
|
|
22
|
+
var _name;
|
|
23
|
+
const component = (_name = components[props.node.type.name]) !== null && _name !== void 0 ? _name : DefaultNodeView;
|
|
9
24
|
const constructor = constructors[props.node.type.name];
|
|
10
25
|
// Construct a wrapper component so that the node view remounts when either
|
|
11
26
|
// its component or constructor changes. A React node view would remount if
|
|
@@ -14,17 +29,15 @@ export const NodeView = /*#__PURE__*/ memo(function NodeView(props) {
|
|
|
14
29
|
const Component = useMemo(()=>{
|
|
15
30
|
if (constructor) {
|
|
16
31
|
return function NodeView(props) {
|
|
17
|
-
return /*#__PURE__*/ React.createElement(NodeViewConstructorView, {
|
|
18
|
-
constructor: constructor
|
|
19
|
-
|
|
20
|
-
});
|
|
32
|
+
return /*#__PURE__*/ React.createElement(NodeViewConstructorView, _extends({
|
|
33
|
+
constructor: constructor
|
|
34
|
+
}, props));
|
|
21
35
|
};
|
|
22
36
|
} else {
|
|
23
37
|
return function NodeView(props) {
|
|
24
|
-
return /*#__PURE__*/ React.createElement(ReactNodeView, {
|
|
25
|
-
component: component
|
|
26
|
-
|
|
27
|
-
});
|
|
38
|
+
return /*#__PURE__*/ React.createElement(ReactNodeView, _extends({
|
|
39
|
+
component: component
|
|
40
|
+
}, props));
|
|
28
41
|
};
|
|
29
42
|
}
|
|
30
43
|
}, [
|
|
@@ -33,6 +46,6 @@ export const NodeView = /*#__PURE__*/ memo(function NodeView(props) {
|
|
|
33
46
|
]);
|
|
34
47
|
return /*#__PURE__*/ React.createElement(GetPosContext.Provider, {
|
|
35
48
|
value: props.getPos
|
|
36
|
-
}, /*#__PURE__*/ React.createElement(Component, props));
|
|
49
|
+
}, /*#__PURE__*/ React.createElement(Component, _extends({}, props)));
|
|
37
50
|
});
|
|
38
51
|
export const GetPosContext = /*#__PURE__*/ createContext(null);
|
|
@@ -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 { DOMSerializer } from "prosemirror-model";
|
|
2
16
|
import React, { cloneElement, memo, useMemo, useRef } from "react";
|
|
3
17
|
import { createPortal } from "react-dom";
|
|
@@ -6,7 +20,7 @@ import { useForceUpdate } from "../../hooks/useForceUpdate.js";
|
|
|
6
20
|
import { useNodeViewDescription } from "../../hooks/useNodeViewDescription.js";
|
|
7
21
|
import { ChildNodeViews, wrapInDeco } from "../ChildNodeViews.js";
|
|
8
22
|
export const NodeViewConstructorView = /*#__PURE__*/ memo(function NodeViewConstructorView(param) {
|
|
9
|
-
let { constructor, node, getPos, innerDeco, outerDeco
|
|
23
|
+
let { constructor , node , getPos , innerDeco , outerDeco } = param;
|
|
10
24
|
const ref = useRef(null);
|
|
11
25
|
const innerRef = useRef(null);
|
|
12
26
|
const forceUpdate = useForceUpdate();
|
|
@@ -30,22 +44,28 @@ export const NodeViewConstructorView = /*#__PURE__*/ memo(function NodeViewConst
|
|
|
30
44
|
}
|
|
31
45
|
const nodeView = constructor(...args);
|
|
32
46
|
if (!nodeView || !nodeView.dom) {
|
|
33
|
-
|
|
47
|
+
var _spec, ref;
|
|
48
|
+
const spec = (ref = (_spec = node.type.spec).toDOM) === null || ref === void 0 ? void 0 : ref.call(_spec, node);
|
|
34
49
|
if (!spec) {
|
|
35
|
-
throw new Error(
|
|
50
|
+
throw new Error("Node spec for ".concat(node.type.name, " is missing toDOM"));
|
|
36
51
|
}
|
|
37
52
|
return DOMSerializer.renderSpec(document, spec, null);
|
|
38
53
|
}
|
|
39
54
|
return nodeView;
|
|
40
55
|
};
|
|
41
|
-
|
|
56
|
+
var ref1;
|
|
57
|
+
const { childContextValue , contentDOM } = useNodeViewDescription(()=>ref.current, (source)=>{
|
|
58
|
+
return (ref1 = source === null || source === void 0 ? void 0 : source.contentDOM) !== null && ref1 !== void 0 ? ref1 : null;
|
|
59
|
+
}, function() {
|
|
42
60
|
for(var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++){
|
|
43
61
|
args[_key] = arguments[_key];
|
|
44
62
|
}
|
|
63
|
+
var ref1, ref2, ref3, ref4, ref5;
|
|
45
64
|
const nodeView = createNodeView(...args);
|
|
46
65
|
const contentDOM = nodeView.contentDOM;
|
|
47
66
|
const nodeDOM = nodeView.dom;
|
|
48
|
-
|
|
67
|
+
var _current;
|
|
68
|
+
const wrapperDOM = (_current = innerRef.current) !== null && _current !== void 0 ? _current : ref.current;
|
|
49
69
|
wrapperDOM.appendChild(nodeDOM);
|
|
50
70
|
if (!contentDOM && nodeDOM instanceof HTMLElement && nodeDOM.tagName !== "BR") {
|
|
51
71
|
if (!nodeDOM.hasAttribute("contenteditable")) {
|
|
@@ -70,11 +90,11 @@ export const NodeViewConstructorView = /*#__PURE__*/ memo(function NodeViewConst
|
|
|
70
90
|
dom: nodeView.dom,
|
|
71
91
|
contentDOM: nodeView.contentDOM,
|
|
72
92
|
multiType: nodeView.multiType,
|
|
73
|
-
update: nodeView.update
|
|
74
|
-
selectNode: nodeView.selectNode
|
|
75
|
-
deselectNode: nodeView.deselectNode
|
|
76
|
-
stopEvent: nodeView.stopEvent
|
|
77
|
-
ignoreMutation: nodeView.ignoreMutation
|
|
93
|
+
update: (ref1 = nodeView.update) === null || ref1 === void 0 ? void 0 : ref1.bind(nodeView),
|
|
94
|
+
selectNode: (ref2 = nodeView.selectNode) === null || ref2 === void 0 ? void 0 : ref2.bind(nodeView),
|
|
95
|
+
deselectNode: (ref3 = nodeView.deselectNode) === null || ref3 === void 0 ? void 0 : ref3.bind(nodeView),
|
|
96
|
+
stopEvent: (ref4 = nodeView.stopEvent) === null || ref4 === void 0 ? void 0 : ref4.bind(nodeView),
|
|
97
|
+
ignoreMutation: (ref5 = nodeView.ignoreMutation) === null || ref5 === void 0 ? void 0 : ref5.bind(nodeView)
|
|
78
98
|
};
|
|
79
99
|
}, nodeProps);
|
|
80
100
|
const Component = node.isInline ? "span" : "div";
|
|
@@ -88,7 +108,7 @@ export const NodeViewConstructorView = /*#__PURE__*/ memo(function NodeViewConst
|
|
|
88
108
|
node: node,
|
|
89
109
|
innerDecorations: innerDeco
|
|
90
110
|
})), contentDOM) : null;
|
|
91
|
-
return /*#__PURE__*/ cloneElement(outerDeco.reduce(wrapInDeco, /*#__PURE__*/ React.createElement(Component, props, children)), {
|
|
111
|
+
return /*#__PURE__*/ cloneElement(outerDeco.reduce(wrapInDeco, /*#__PURE__*/ React.createElement(Component, _extends({}, props), children)), {
|
|
92
112
|
ref
|
|
93
113
|
});
|
|
94
114
|
});
|
|
@@ -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, { cloneElement, memo, useCallback, useMemo, useRef, useState } from "react";
|
|
2
16
|
import { ChildDescriptionsContext } from "../../contexts/ChildDescriptionsContext.js";
|
|
3
17
|
import { IgnoreMutationContext } from "../../contexts/IgnoreMutationContext.js";
|
|
@@ -7,7 +21,8 @@ import { useForceUpdate } from "../../hooks/useForceUpdate.js";
|
|
|
7
21
|
import { useNodeViewDescription } from "../../hooks/useNodeViewDescription.js";
|
|
8
22
|
import { ChildNodeViews, wrapInDeco } from "../ChildNodeViews.js";
|
|
9
23
|
export const ReactNodeView = /*#__PURE__*/ memo(function ReactNodeView(param) {
|
|
10
|
-
let { component: Component, outerDeco, getPos, node, innerDeco
|
|
24
|
+
let { component: Component , outerDeco , getPos , node , innerDeco } = param;
|
|
25
|
+
var ref, ref1;
|
|
11
26
|
const [hasCustomSelectNode, setHasCustomSelectNode] = useState(false);
|
|
12
27
|
const [selected, setSelected] = useState(false);
|
|
13
28
|
const forceUpdate = useForceUpdate();
|
|
@@ -54,10 +69,11 @@ export const ReactNodeView = /*#__PURE__*/ memo(function ReactNodeView(param) {
|
|
|
54
69
|
node,
|
|
55
70
|
outerDeco
|
|
56
71
|
]);
|
|
57
|
-
const { childContextValue, refUpdated
|
|
72
|
+
const { childContextValue , refUpdated } = useNodeViewDescription(()=>domRef.current, ()=>contentDOMRef.current, ()=>{
|
|
58
73
|
setSelected(false);
|
|
74
|
+
var _current;
|
|
59
75
|
return {
|
|
60
|
-
dom: nodeDOMRef.current
|
|
76
|
+
dom: (_current = nodeDOMRef.current) !== null && _current !== void 0 ? _current : domRef.current,
|
|
61
77
|
update () {
|
|
62
78
|
return true;
|
|
63
79
|
},
|
|
@@ -133,14 +149,14 @@ export const ReactNodeView = /*#__PURE__*/ memo(function ReactNodeView(param) {
|
|
|
133
149
|
]);
|
|
134
150
|
const props = {
|
|
135
151
|
nodeProps,
|
|
136
|
-
...!contentDOMRef.current && !nodeProps.node.isText && nodeDOMRef.current
|
|
152
|
+
...!contentDOMRef.current && !nodeProps.node.isText && ((ref = nodeDOMRef.current) === null || ref === void 0 ? void 0 : ref.nodeName) !== "BR" ? {
|
|
137
153
|
contentEditable: false,
|
|
138
154
|
suppressContentEditableWarning: true
|
|
139
155
|
} : null,
|
|
140
156
|
...!hasCustomSelectNode && selected ? {
|
|
141
157
|
className: "ProseMirror-selectednode"
|
|
142
158
|
} : null,
|
|
143
|
-
...!hasCustomSelectNode && selected || !contentDOMRef.current && !nodeProps.node.isText && domRef.current
|
|
159
|
+
...!hasCustomSelectNode && selected || !contentDOMRef.current && !nodeProps.node.isText && ((ref1 = domRef.current) === null || ref1 === void 0 ? void 0 : ref1.nodeName) !== "BR" && node.type.spec.draggable ? {
|
|
144
160
|
draggable: true
|
|
145
161
|
} : null,
|
|
146
162
|
ref: setNodeDOM
|
|
@@ -150,7 +166,7 @@ export const ReactNodeView = /*#__PURE__*/ memo(function ReactNodeView(param) {
|
|
|
150
166
|
node: node,
|
|
151
167
|
innerDecorations: innerDeco
|
|
152
168
|
}) : null;
|
|
153
|
-
const element = /*#__PURE__*/ cloneElement(outerDeco.reduce(wrapInDeco, /*#__PURE__*/ React.createElement(Component, props, children)), {
|
|
169
|
+
const element = /*#__PURE__*/ cloneElement(outerDeco.reduce(wrapInDeco, /*#__PURE__*/ React.createElement(Component, _extends({}, props), children)), {
|
|
154
170
|
ref: setDOM
|
|
155
171
|
});
|
|
156
172
|
return /*#__PURE__*/ React.createElement(SelectNodeContext.Provider, {
|
|
@@ -2,23 +2,15 @@ import { Decoration } from "prosemirror-view";
|
|
|
2
2
|
function compareObjs(a, b) {
|
|
3
3
|
if (a == b) return true;
|
|
4
4
|
for(const p in a)if (a[p] !== b[p]) return false;
|
|
5
|
-
for(const
|
|
5
|
+
for(const p1 in b)if (!(p1 in a)) return false;
|
|
6
6
|
return true;
|
|
7
7
|
}
|
|
8
8
|
const noSpec = {
|
|
9
9
|
side: 0
|
|
10
10
|
};
|
|
11
11
|
export class ReactWidgetType {
|
|
12
|
-
Component;
|
|
13
|
-
side;
|
|
14
|
-
spec;
|
|
15
|
-
constructor(Component, spec){
|
|
16
|
-
this.Component = Component;
|
|
17
|
-
this.spec = spec ?? noSpec;
|
|
18
|
-
this.side = this.spec.side ?? 0;
|
|
19
|
-
}
|
|
20
12
|
map(mapping, span, offset, oldOffset) {
|
|
21
|
-
const { pos, deleted
|
|
13
|
+
const { pos , deleted } = mapping.mapResult(span.from + oldOffset, this.side < 0 ? -1 : 1);
|
|
22
14
|
// @ts-expect-error The Decoration constructor is private/internal, but
|
|
23
15
|
// we need to use it for our custom widget implementation here.
|
|
24
16
|
return deleted ? null : new Decoration(pos - offset, pos - offset, this);
|
|
@@ -32,6 +24,12 @@ export class ReactWidgetType {
|
|
|
32
24
|
destroy() {
|
|
33
25
|
// Can be implemented with React effect hooks
|
|
34
26
|
}
|
|
27
|
+
constructor(Component, spec){
|
|
28
|
+
this.Component = Component;
|
|
29
|
+
this.spec = spec !== null && spec !== void 0 ? spec : noSpec;
|
|
30
|
+
var _side;
|
|
31
|
+
this.side = (_side = this.spec.side) !== null && _side !== void 0 ? _side : 0;
|
|
32
|
+
}
|
|
35
33
|
}
|
|
36
34
|
export function widget(pos, component, spec) {
|
|
37
35
|
// @ts-expect-error The Decoration constructor is private/internal, but
|
|
@@ -43,41 +43,41 @@ onWidget, onNode) {
|
|
|
43
43
|
if (widget) {
|
|
44
44
|
if (widgets) {
|
|
45
45
|
widgets.sort(compareSide);
|
|
46
|
-
for(let
|
|
47
|
-
!(widgets[
|
|
46
|
+
for(let i1 = 0; i1 < widgets.length; i1++)onWidget(widgets[i1], // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
47
|
+
!(widgets[i1].type instanceof ReactWidgetType), offset, parentIndex + i1, !!restNode);
|
|
48
48
|
} else {
|
|
49
49
|
onWidget(widget, // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
50
50
|
!(widget.type instanceof ReactWidgetType), offset, parentIndex, !!restNode);
|
|
51
51
|
}
|
|
52
52
|
}
|
|
53
53
|
}
|
|
54
|
-
let
|
|
54
|
+
let child1, index;
|
|
55
55
|
if (restNode) {
|
|
56
56
|
index = -1;
|
|
57
|
-
|
|
57
|
+
child1 = restNode;
|
|
58
58
|
restNode = null;
|
|
59
59
|
} else if (parentIndex < parent.childCount) {
|
|
60
60
|
index = parentIndex;
|
|
61
|
-
|
|
61
|
+
child1 = parent.child(parentIndex++);
|
|
62
62
|
} else {
|
|
63
63
|
break;
|
|
64
64
|
}
|
|
65
|
-
for(let
|
|
65
|
+
for(let i2 = 0; i2 < active.length; i2++)if (active[i2].to <= offset) active.splice(i2--, 1);
|
|
66
66
|
while(decoIndex < locals.length && locals[decoIndex].from <= offset && locals[decoIndex].to > offset)active.push(locals[decoIndex++]);
|
|
67
|
-
let end = offset +
|
|
68
|
-
if (
|
|
67
|
+
let end = offset + child1.nodeSize;
|
|
68
|
+
if (child1.isText) {
|
|
69
69
|
let cutAt = end;
|
|
70
70
|
if (decoIndex < locals.length && locals[decoIndex].from < cutAt) cutAt = locals[decoIndex].from;
|
|
71
|
-
for(let
|
|
71
|
+
for(let i3 = 0; i3 < active.length; i3++)if (active[i3].to < cutAt) cutAt = active[i3].to;
|
|
72
72
|
if (cutAt < end) {
|
|
73
|
-
restNode =
|
|
74
|
-
|
|
73
|
+
restNode = child1.cut(cutAt - offset);
|
|
74
|
+
child1 = child1.cut(0, cutAt - offset);
|
|
75
75
|
end = cutAt;
|
|
76
76
|
index = -1;
|
|
77
77
|
}
|
|
78
78
|
}
|
|
79
|
-
const outerDeco =
|
|
80
|
-
onNode(
|
|
79
|
+
const outerDeco = child1.isInline && !child1.isLeaf ? active.filter((d)=>!d.inline) : active.slice();
|
|
80
|
+
onNode(child1, outerDeco, deco.forChild(offset, child1), offset, index);
|
|
81
81
|
offset = end;
|
|
82
82
|
}
|
|
83
83
|
}
|
|
@@ -6,10 +6,6 @@ const empty = DecorationSet.empty;
|
|
|
6
6
|
// treat multiple DecorationSet objects as if it were a single object
|
|
7
7
|
// with (a subset of) the same interface.
|
|
8
8
|
let DecorationGroup = class DecorationGroup {
|
|
9
|
-
members;
|
|
10
|
-
constructor(members){
|
|
11
|
-
this.members = members;
|
|
12
|
-
}
|
|
13
9
|
map(mapping, doc) {
|
|
14
10
|
const mappedDecos = this.members.map((member)=>member.map(mapping, doc, noSpec));
|
|
15
11
|
return DecorationGroup.from(mappedDecos);
|
|
@@ -65,6 +61,9 @@ let DecorationGroup = class DecorationGroup {
|
|
|
65
61
|
for(let i = 0; i < this.members.length; i++)// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
66
62
|
this.members[i].forEachSet(f);
|
|
67
63
|
}
|
|
64
|
+
constructor(members){
|
|
65
|
+
this.members = members;
|
|
66
|
+
}
|
|
68
67
|
};
|
|
69
68
|
// Used to sort decorations so that ones with a low start position
|
|
70
69
|
// come first, and within a set with the same start position, those
|
|
@@ -152,9 +151,9 @@ const ViewDecorationsCache = new WeakMap();
|
|
|
152
151
|
areSetsEqual = false;
|
|
153
152
|
}
|
|
154
153
|
if (!areSetsEqual) {
|
|
155
|
-
const
|
|
156
|
-
ViewDecorationsCache.set(view,
|
|
157
|
-
return
|
|
154
|
+
const result1 = DecorationGroup.from(found);
|
|
155
|
+
ViewDecorationsCache.set(view, result1);
|
|
156
|
+
return result1;
|
|
158
157
|
}
|
|
159
158
|
return previous;
|
|
160
159
|
}
|
package/dist/esm/dom.js
CHANGED
|
@@ -36,7 +36,8 @@ function scanFor(node, off, targetNode, targetOff, dir) {
|
|
|
36
36
|
} else if (node.nodeType == 1) {
|
|
37
37
|
const child = node.childNodes[off + (dir < 0 ? -1 : 0)];
|
|
38
38
|
if (child.nodeType == 1 && child.contentEditable == "false") {
|
|
39
|
-
|
|
39
|
+
var ref;
|
|
40
|
+
if ((ref = child.pmViewDesc) === null || ref === void 0 ? void 0 : ref.ignoreForSelection) off += dir;
|
|
40
41
|
else return false;
|
|
41
42
|
} else {
|
|
42
43
|
node = child;
|