@handlewithcare/react-prosemirror 3.1.0-tiptap.36 → 3.1.0-tiptap.38
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/tiptap/tiptapNodeView.js +10 -9
- package/dist/esm/tiptap/tiptapNodeView.js +10 -9
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types/constants.d.ts +1 -1
- package/dist/types/props.d.ts +26 -26
- package/dist/types/tiptap/tiptapNodeView.d.ts +1 -0
- package/package.json +1 -1
- package/dist/cjs/components/CustomNodeView.js +0 -132
- package/dist/cjs/components/DefaultNodeView.js +0 -67
- package/dist/cjs/components/DocNodeView.js +0 -96
- package/dist/cjs/components/MarkView.js +0 -119
- package/dist/cjs/components/NodeView.js +0 -86
- package/dist/cjs/components/NodeViewComponentProps.js +0 -4
- package/dist/cjs/components/ReactNodeView.js +0 -174
- package/dist/cjs/components/marks/CustomMarkView.js +0 -110
- package/dist/cjs/components/marks/OldMarkView.js +0 -120
- package/dist/cjs/components/nodes/CustomNodeView.js +0 -135
- package/dist/cjs/contexts/ChildDescriptorsContext.js +0 -19
- package/dist/cjs/hooks/useNodeViewDescriptor.js +0 -156
- package/dist/cjs/tiptap/TiptapNodeView.js +0 -26
- package/dist/esm/components/CustomNodeView.js +0 -81
- package/dist/esm/components/DefaultNodeView.js +0 -16
- package/dist/esm/components/DocNodeView.js +0 -45
- package/dist/esm/components/MarkView.js +0 -68
- package/dist/esm/components/NodeView.js +0 -35
- package/dist/esm/components/NodeViewComponentProps.js +0 -1
- package/dist/esm/components/ReactNodeView.js +0 -123
- package/dist/esm/components/marks/CustomMarkView.js +0 -59
- package/dist/esm/components/marks/OldMarkView.js +0 -69
- package/dist/esm/components/nodes/CustomNodeView.js +0 -84
- package/dist/esm/contexts/ChildDescriptorsContext.js +0 -9
- package/dist/esm/hooks/useNodeViewDescriptor.js +0 -146
- package/dist/esm/tiptap/TiptapNodeView.js +0 -22
- package/dist/types/components/CustomNodeView.d.ts +0 -12
- package/dist/types/components/DefaultNodeView.d.ts +0 -3
- package/dist/types/components/DocNodeView.d.ts +0 -12
- package/dist/types/components/MarkView.d.ts +0 -9
- package/dist/types/components/NodeView.d.ts +0 -11
- package/dist/types/components/NodeViewComponentProps.d.ts +0 -12
- package/dist/types/components/ReactNodeView.d.ts +0 -13
- package/dist/types/components/marks/CustomMarkView.d.ts +0 -12
- package/dist/types/components/marks/OldMarkView.d.ts +0 -10
- package/dist/types/components/nodes/CustomNodeView.d.ts +0 -12
- package/dist/types/contexts/ChildDescriptorsContext.d.ts +0 -6
- package/dist/types/hooks/useNodeViewDescriptor.d.ts +0 -20
- package/dist/types/tiptap/TiptapNodeView.d.ts +0 -15
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
import React, { forwardRef, memo, useContext, useImperativeHandle, useMemo, useRef } from "react";
|
|
2
|
-
import { ChildDescriptorsContext } from "../../contexts/ChildDescriptorsContext.js";
|
|
3
|
-
import { useClientLayoutEffect } from "../../hooks/useClientLayoutEffect.js";
|
|
4
|
-
import { MarkViewDesc, sortViewDescs } from "../../viewdesc.js";
|
|
5
|
-
import { OutputSpec } from "../OutputSpec.js";
|
|
6
|
-
export const MarkView = /*#__PURE__*/ memo(/*#__PURE__*/ forwardRef(function MarkView(param, ref) {
|
|
7
|
-
let { mark, getPos, children, inline = false } = param;
|
|
8
|
-
const { siblingsRef, parentRef } = useContext(ChildDescriptorsContext);
|
|
9
|
-
const viewDescRef = useRef(undefined);
|
|
10
|
-
const childDescriptors = useRef([]);
|
|
11
|
-
const domRef = useRef(null);
|
|
12
|
-
useImperativeHandle(ref, ()=>{
|
|
13
|
-
return domRef.current;
|
|
14
|
-
}, []);
|
|
15
|
-
const outputSpec = useMemo(()=>mark.type.spec.toDOM?.(mark, inline), [
|
|
16
|
-
inline,
|
|
17
|
-
mark
|
|
18
|
-
]);
|
|
19
|
-
if (!outputSpec) throw new Error(`Mark spec for ${mark.type.name} is missing toDOM`);
|
|
20
|
-
useClientLayoutEffect(()=>{
|
|
21
|
-
const siblings = siblingsRef.current;
|
|
22
|
-
return ()=>{
|
|
23
|
-
if (!viewDescRef.current) return;
|
|
24
|
-
if (siblings.includes(viewDescRef.current)) {
|
|
25
|
-
const index = siblings.indexOf(viewDescRef.current);
|
|
26
|
-
siblings.splice(index, 1);
|
|
27
|
-
}
|
|
28
|
-
};
|
|
29
|
-
}, [
|
|
30
|
-
siblingsRef
|
|
31
|
-
]);
|
|
32
|
-
useClientLayoutEffect(()=>{
|
|
33
|
-
if (!domRef.current) return;
|
|
34
|
-
const firstChildDesc = childDescriptors.current[0];
|
|
35
|
-
if (!viewDescRef.current) {
|
|
36
|
-
viewDescRef.current = new MarkViewDesc(parentRef.current, childDescriptors.current, getPos, mark, domRef.current, firstChildDesc?.dom.parentElement ?? domRef.current, {
|
|
37
|
-
dom: domRef.current,
|
|
38
|
-
contentDOM: firstChildDesc?.dom.parentElement ?? domRef.current
|
|
39
|
-
});
|
|
40
|
-
} else {
|
|
41
|
-
viewDescRef.current.parent = parentRef.current;
|
|
42
|
-
viewDescRef.current.spec.dom = viewDescRef.current.dom = domRef.current;
|
|
43
|
-
viewDescRef.current.children = childDescriptors.current;
|
|
44
|
-
viewDescRef.current.spec.contentDOM = viewDescRef.current.contentDOM = firstChildDesc?.dom.parentElement ?? domRef.current;
|
|
45
|
-
viewDescRef.current.mark = mark;
|
|
46
|
-
}
|
|
47
|
-
if (!siblingsRef.current.includes(viewDescRef.current)) {
|
|
48
|
-
siblingsRef.current.push(viewDescRef.current);
|
|
49
|
-
}
|
|
50
|
-
siblingsRef.current.sort(sortViewDescs);
|
|
51
|
-
for (const childDesc of childDescriptors.current){
|
|
52
|
-
childDesc.parent = viewDescRef.current;
|
|
53
|
-
}
|
|
54
|
-
});
|
|
55
|
-
const childContextValue = useMemo(()=>({
|
|
56
|
-
parentRef: viewDescRef,
|
|
57
|
-
siblingsRef: childDescriptors
|
|
58
|
-
}), [
|
|
59
|
-
childDescriptors,
|
|
60
|
-
viewDescRef
|
|
61
|
-
]);
|
|
62
|
-
return /*#__PURE__*/ React.createElement(OutputSpec, {
|
|
63
|
-
ref: domRef,
|
|
64
|
-
outputSpec: outputSpec,
|
|
65
|
-
isMark: true
|
|
66
|
-
}, /*#__PURE__*/ React.createElement(ChildDescriptorsContext.Provider, {
|
|
67
|
-
value: childContextValue
|
|
68
|
-
}, children));
|
|
69
|
-
}));
|
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
import { DOMSerializer } from "prosemirror-model";
|
|
2
|
-
import React, { cloneElement, memo, useMemo, useRef } from "react";
|
|
3
|
-
import { createPortal } from "react-dom";
|
|
4
|
-
import { ChildDescriptionsContext } from "../../contexts/ChildDescriptionsContext.js";
|
|
5
|
-
import { useNodeViewDescription } from "../../hooks/useNodeViewDescription.js";
|
|
6
|
-
import { ChildNodeViews, wrapInDeco } from "../ChildNodeViews.js";
|
|
7
|
-
export const CustomNodeView = /*#__PURE__*/ memo(function CustomNodeView(param) {
|
|
8
|
-
let { constructor, node, getPos, innerDeco, outerDeco } = param;
|
|
9
|
-
const ref = useRef(null);
|
|
10
|
-
const innerRef = useRef(null);
|
|
11
|
-
const nodeProps = useMemo(()=>({
|
|
12
|
-
node,
|
|
13
|
-
getPos,
|
|
14
|
-
decorations: outerDeco,
|
|
15
|
-
innerDecorations: innerDeco,
|
|
16
|
-
contentDOMRef: {
|
|
17
|
-
current: null
|
|
18
|
-
}
|
|
19
|
-
}), [
|
|
20
|
-
node,
|
|
21
|
-
getPos,
|
|
22
|
-
outerDeco,
|
|
23
|
-
innerDeco
|
|
24
|
-
]);
|
|
25
|
-
const createNodeView = function() {
|
|
26
|
-
for(var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++){
|
|
27
|
-
args[_key] = arguments[_key];
|
|
28
|
-
}
|
|
29
|
-
const nodeView = constructor(...args);
|
|
30
|
-
if (!nodeView || !nodeView.dom) {
|
|
31
|
-
const spec = node.type.spec.toDOM?.(node);
|
|
32
|
-
if (!spec) {
|
|
33
|
-
throw new Error(`Node spec for ${node.type.name} is missing toDOM`);
|
|
34
|
-
}
|
|
35
|
-
return DOMSerializer.renderSpec(document, spec, null);
|
|
36
|
-
}
|
|
37
|
-
return nodeView;
|
|
38
|
-
};
|
|
39
|
-
const { childContextValue, contentDOM } = useNodeViewDescription(ref, function() {
|
|
40
|
-
for(var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++){
|
|
41
|
-
args[_key] = arguments[_key];
|
|
42
|
-
}
|
|
43
|
-
const nodeView = createNodeView(...args);
|
|
44
|
-
const contentDOM = nodeView.contentDOM;
|
|
45
|
-
const nodeDOM = nodeView.dom;
|
|
46
|
-
const wrapperDOM = innerRef.current ?? ref.current;
|
|
47
|
-
wrapperDOM.appendChild(nodeDOM);
|
|
48
|
-
if (!contentDOM && nodeDOM instanceof HTMLElement && nodeDOM.tagName !== "BR") {
|
|
49
|
-
if (!nodeDOM.hasAttribute("contenteditable")) {
|
|
50
|
-
nodeDOM.contentEditable = "false";
|
|
51
|
-
}
|
|
52
|
-
if (node.type.spec.draggable) {
|
|
53
|
-
nodeDOM.draggable = true;
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
return {
|
|
57
|
-
...nodeView,
|
|
58
|
-
destroy () {
|
|
59
|
-
if (nodeView.destroy) {
|
|
60
|
-
nodeView.destroy();
|
|
61
|
-
}
|
|
62
|
-
wrapperDOM.removeChild(nodeDOM);
|
|
63
|
-
},
|
|
64
|
-
selectNode: nodeView.selectNode?.bind(nodeView),
|
|
65
|
-
deselectNode: nodeView.deselectNode?.bind(nodeView),
|
|
66
|
-
stopEvent: nodeView.stopEvent?.bind(nodeView),
|
|
67
|
-
ignoreMutation: nodeView.ignoreMutation?.bind(nodeView)
|
|
68
|
-
};
|
|
69
|
-
}, (source)=>source?.contentDOM ?? null, nodeProps);
|
|
70
|
-
const Component = node.isInline ? "span" : "div";
|
|
71
|
-
const props = {
|
|
72
|
-
ref: innerRef
|
|
73
|
-
};
|
|
74
|
-
const children = !node.isLeaf && contentDOM ? /*#__PURE__*/ createPortal(/*#__PURE__*/ React.createElement(ChildDescriptionsContext.Provider, {
|
|
75
|
-
value: childContextValue
|
|
76
|
-
}, /*#__PURE__*/ React.createElement(ChildNodeViews, {
|
|
77
|
-
getPos: getPos,
|
|
78
|
-
node: node,
|
|
79
|
-
innerDecorations: innerDeco
|
|
80
|
-
})), contentDOM) : null;
|
|
81
|
-
return /*#__PURE__*/ cloneElement(outerDeco.reduce(wrapInDeco, /*#__PURE__*/ React.createElement(Component, props, children)), {
|
|
82
|
-
ref
|
|
83
|
-
});
|
|
84
|
-
});
|
|
@@ -1,146 +0,0 @@
|
|
|
1
|
-
import { useContext, useMemo, useRef, useState } from "react";
|
|
2
|
-
import { ReactEditorView } from "../ReactEditorView.js";
|
|
3
|
-
import { ChildDescriptorsContext } from "../contexts/ChildDescriptorsContext.js";
|
|
4
|
-
import { EditorContext } from "../contexts/EditorContext.js";
|
|
5
|
-
import { CompositionViewDesc, ReactNodeViewDesc, sortViewDescs } from "../viewdesc.js";
|
|
6
|
-
import { useClientLayoutEffect } from "./useClientLayoutEffect.js";
|
|
7
|
-
import { useEffectEvent } from "./useEffectEvent.js";
|
|
8
|
-
function findContentDOM(view, source, children) {
|
|
9
|
-
// When a composition is happening, we want to essentially freeze everything,
|
|
10
|
-
// so we maintain the current contentDOM.
|
|
11
|
-
return view.composing ? source?.contentDOM ?? null : children[0]?.dom?.parentElement ?? null;
|
|
12
|
-
}
|
|
13
|
-
export function useNodeViewDescriptor(ref, constructor, props) {
|
|
14
|
-
const { view } = useContext(EditorContext);
|
|
15
|
-
const { parentRef, siblingsRef } = useContext(ChildDescriptorsContext);
|
|
16
|
-
const [dom, setDOM] = useState(null);
|
|
17
|
-
const [nodeDOM, setNodeDOM] = useState(null);
|
|
18
|
-
const [contentDOM, setContentDOM] = useState(null);
|
|
19
|
-
const viewDescRef = useRef();
|
|
20
|
-
const childrenRef = useRef([]);
|
|
21
|
-
const create = useEffectEvent(()=>{
|
|
22
|
-
if (!(view instanceof ReactEditorView)) {
|
|
23
|
-
return;
|
|
24
|
-
}
|
|
25
|
-
const dom = ref.current;
|
|
26
|
-
if (!dom) {
|
|
27
|
-
return;
|
|
28
|
-
}
|
|
29
|
-
const { node, getPos, decorations, innerDecorations } = props;
|
|
30
|
-
const nodeView = constructor(node, view, getPos, decorations, innerDecorations);
|
|
31
|
-
if (!nodeView) {
|
|
32
|
-
return;
|
|
33
|
-
}
|
|
34
|
-
const parent = parentRef.current;
|
|
35
|
-
const children = childrenRef.current;
|
|
36
|
-
const contentDOM = findContentDOM(view, nodeView, children);
|
|
37
|
-
const nodeDOM = nodeView.dom;
|
|
38
|
-
const viewDesc = new ReactNodeViewDesc(parent, children, getPos, node, decorations, innerDecorations, dom, contentDOM, nodeDOM, nodeView);
|
|
39
|
-
setDOM(dom);
|
|
40
|
-
setContentDOM(contentDOM);
|
|
41
|
-
setNodeDOM(nodeDOM);
|
|
42
|
-
return viewDesc;
|
|
43
|
-
});
|
|
44
|
-
const update = useEffectEvent(()=>{
|
|
45
|
-
if (!(view instanceof ReactEditorView)) {
|
|
46
|
-
return false;
|
|
47
|
-
}
|
|
48
|
-
const viewDesc = viewDescRef.current;
|
|
49
|
-
if (!viewDesc) {
|
|
50
|
-
return false;
|
|
51
|
-
}
|
|
52
|
-
const dom = ref.current;
|
|
53
|
-
if (!dom || dom !== viewDesc.dom) {
|
|
54
|
-
return false;
|
|
55
|
-
}
|
|
56
|
-
const contentDOM = findContentDOM(view, viewDesc, viewDesc.children);
|
|
57
|
-
if (contentDOM !== viewDesc.contentDOM) {
|
|
58
|
-
return false;
|
|
59
|
-
}
|
|
60
|
-
if (!dom.contains(viewDesc.nodeDOM)) {
|
|
61
|
-
return false;
|
|
62
|
-
}
|
|
63
|
-
const { node, decorations, innerDecorations } = props;
|
|
64
|
-
return viewDesc.matchesNode(node, decorations, innerDecorations) || viewDesc.update(node, decorations, innerDecorations, view);
|
|
65
|
-
});
|
|
66
|
-
const destroy = useEffectEvent(()=>{
|
|
67
|
-
const viewDesc = viewDescRef.current;
|
|
68
|
-
if (!viewDesc) {
|
|
69
|
-
return;
|
|
70
|
-
}
|
|
71
|
-
viewDesc.destroy();
|
|
72
|
-
const siblings = siblingsRef.current;
|
|
73
|
-
if (siblings.includes(viewDesc)) {
|
|
74
|
-
const index = siblings.indexOf(viewDesc);
|
|
75
|
-
siblings.splice(index, 1);
|
|
76
|
-
}
|
|
77
|
-
setDOM(null);
|
|
78
|
-
setContentDOM(null);
|
|
79
|
-
setNodeDOM(null);
|
|
80
|
-
});
|
|
81
|
-
useClientLayoutEffect(()=>{
|
|
82
|
-
viewDescRef.current = create();
|
|
83
|
-
return ()=>{
|
|
84
|
-
destroy();
|
|
85
|
-
};
|
|
86
|
-
}, [
|
|
87
|
-
create,
|
|
88
|
-
destroy
|
|
89
|
-
]);
|
|
90
|
-
useClientLayoutEffect(()=>{
|
|
91
|
-
if (!update()) {
|
|
92
|
-
destroy();
|
|
93
|
-
viewDescRef.current = create();
|
|
94
|
-
}
|
|
95
|
-
const viewDesc = viewDescRef.current;
|
|
96
|
-
if (!viewDesc) {
|
|
97
|
-
return;
|
|
98
|
-
}
|
|
99
|
-
if (view.dom === viewDesc.dom && view instanceof ReactEditorView) {
|
|
100
|
-
view.docView = viewDesc;
|
|
101
|
-
}
|
|
102
|
-
const parent = parentRef.current;
|
|
103
|
-
const siblings = siblingsRef.current;
|
|
104
|
-
const children = childrenRef.current;
|
|
105
|
-
viewDesc.parent = parent;
|
|
106
|
-
if (!siblings.includes(viewDesc)) {
|
|
107
|
-
siblings.push(viewDesc);
|
|
108
|
-
}
|
|
109
|
-
siblings.sort(sortViewDescs);
|
|
110
|
-
for (const child of children){
|
|
111
|
-
child.parent = viewDesc;
|
|
112
|
-
// Because TextNodeViews can't locate the DOM nodes
|
|
113
|
-
// for compositions, we need to override them here
|
|
114
|
-
if (child instanceof CompositionViewDesc) {
|
|
115
|
-
const compositionTopDOM = viewDesc?.contentDOM?.firstChild;
|
|
116
|
-
if (!compositionTopDOM) throw new Error(`Started a composition but couldn't find the text node it belongs to.`);
|
|
117
|
-
let textDOM = compositionTopDOM;
|
|
118
|
-
while(textDOM.firstChild){
|
|
119
|
-
textDOM = textDOM.firstChild;
|
|
120
|
-
}
|
|
121
|
-
if (!textDOM || !(textDOM instanceof Text)) throw new Error(`Started a composition but couldn't find the text node it belongs to.`);
|
|
122
|
-
child.dom = compositionTopDOM;
|
|
123
|
-
child.textDOM = textDOM;
|
|
124
|
-
child.text = textDOM.data;
|
|
125
|
-
child.textDOM.pmViewDesc = child;
|
|
126
|
-
// It should not be possible to be in a composition because one could
|
|
127
|
-
// not start between the renders that switch the view type.
|
|
128
|
-
view.input.compositionNodes.push(child);
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
});
|
|
132
|
-
const childContextValue = useMemo(()=>({
|
|
133
|
-
parentRef: viewDescRef,
|
|
134
|
-
siblingsRef: childrenRef
|
|
135
|
-
}), [
|
|
136
|
-
childrenRef,
|
|
137
|
-
viewDescRef
|
|
138
|
-
]);
|
|
139
|
-
return {
|
|
140
|
-
childContextValue,
|
|
141
|
-
dom,
|
|
142
|
-
contentDOM,
|
|
143
|
-
nodeDOM,
|
|
144
|
-
ref
|
|
145
|
-
};
|
|
146
|
-
}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { NodeView } from "@tiptap/core";
|
|
2
|
-
/**
|
|
3
|
-
* Subclass of Tiptap's NodeView to be used in tiptapNodeView.
|
|
4
|
-
*
|
|
5
|
-
* Allows us to pass in an existing dom and contentODM from React ProseMirror's
|
|
6
|
-
* ViewDesc, so that we can call Tiptap's default stopEvent and ignoreMutation
|
|
7
|
-
* methods
|
|
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
|
-
get dom() {
|
|
17
|
-
return this._dom;
|
|
18
|
-
}
|
|
19
|
-
get contentDOM() {
|
|
20
|
-
return this._contentDOM;
|
|
21
|
-
}
|
|
22
|
-
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { Node } from "prosemirror-model";
|
|
2
|
-
import { Decoration, DecorationSource, NodeViewConstructor } from "prosemirror-view";
|
|
3
|
-
import React from "react";
|
|
4
|
-
interface Props {
|
|
5
|
-
constructor: NodeViewConstructor;
|
|
6
|
-
node: Node;
|
|
7
|
-
getPos: () => number;
|
|
8
|
-
innerDeco: DecorationSource;
|
|
9
|
-
outerDeco: readonly Decoration[];
|
|
10
|
-
}
|
|
11
|
-
export declare const CustomNodeView: React.NamedExoticComponent<Props>;
|
|
12
|
-
export {};
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { Node } from "prosemirror-model";
|
|
2
|
-
import { Decoration, DecorationSource } from "prosemirror-view";
|
|
3
|
-
import React, { HTMLProps, ReactElement } from "react";
|
|
4
|
-
export interface DocNodeViewProps extends Omit<HTMLProps<HTMLElement>, "as"> {
|
|
5
|
-
as?: ReactElement;
|
|
6
|
-
node: Node;
|
|
7
|
-
getPos: () => number;
|
|
8
|
-
decorations: readonly Decoration[];
|
|
9
|
-
innerDecorations: DecorationSource;
|
|
10
|
-
setMount: (mount: HTMLElement | null) => void;
|
|
11
|
-
}
|
|
12
|
-
export declare const DocNodeView: React.MemoExoticComponent<React.ForwardRefExoticComponent<Omit<DocNodeViewProps, "ref"> & React.RefAttributes<HTMLElement>>>;
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { Mark } from "prosemirror-model";
|
|
2
|
-
import React, { ReactNode } from "react";
|
|
3
|
-
type Props = {
|
|
4
|
-
mark: Mark;
|
|
5
|
-
getPos: () => number;
|
|
6
|
-
children: ReactNode;
|
|
7
|
-
};
|
|
8
|
-
export declare const MarkView: React.MemoExoticComponent<React.ForwardRefExoticComponent<Props & React.RefAttributes<unknown>>>;
|
|
9
|
-
export {};
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { Node } from "prosemirror-model";
|
|
2
|
-
import { Decoration, DecorationSource } from "prosemirror-view";
|
|
3
|
-
import React from "react";
|
|
4
|
-
type Props = {
|
|
5
|
-
node: Node;
|
|
6
|
-
getPos: () => number;
|
|
7
|
-
outerDeco: readonly Decoration[];
|
|
8
|
-
innerDeco: DecorationSource;
|
|
9
|
-
};
|
|
10
|
-
export declare const NodeView: React.NamedExoticComponent<Props>;
|
|
11
|
-
export {};
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { Node } from "prosemirror-model";
|
|
2
|
-
import { Decoration, DecorationSource } from "prosemirror-view";
|
|
3
|
-
import { AllHTMLAttributes, LegacyRef } from "react";
|
|
4
|
-
export interface NodeViewComponentProps extends AllHTMLAttributes<HTMLElement> {
|
|
5
|
-
nodeProps: {
|
|
6
|
-
decorations: readonly Decoration[];
|
|
7
|
-
innerDecorations: DecorationSource;
|
|
8
|
-
node: Node;
|
|
9
|
-
getPos: () => number;
|
|
10
|
-
};
|
|
11
|
-
ref: LegacyRef<any>;
|
|
12
|
-
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { Node } from "prosemirror-model";
|
|
2
|
-
import { Decoration, DecorationSource } from "prosemirror-view";
|
|
3
|
-
import React, { ComponentType } from "react";
|
|
4
|
-
import { NodeViewComponentProps } from "./NodeViewComponentProps.js";
|
|
5
|
-
type Props = {
|
|
6
|
-
component: ComponentType<NodeViewComponentProps>;
|
|
7
|
-
outerDeco: readonly Decoration[];
|
|
8
|
-
getPos: () => number;
|
|
9
|
-
node: Node;
|
|
10
|
-
innerDeco: DecorationSource;
|
|
11
|
-
};
|
|
12
|
-
export declare const ReactNodeView: React.NamedExoticComponent<Props>;
|
|
13
|
-
export {};
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { Mark } from "prosemirror-model";
|
|
2
|
-
import { MarkViewConstructor } from "prosemirror-view";
|
|
3
|
-
import React, { ReactNode } from "react";
|
|
4
|
-
interface Props {
|
|
5
|
-
constructor: MarkViewConstructor;
|
|
6
|
-
mark: Mark;
|
|
7
|
-
inline: boolean;
|
|
8
|
-
getPos: () => number;
|
|
9
|
-
children: ReactNode;
|
|
10
|
-
}
|
|
11
|
-
export declare const CustomMarkView: React.NamedExoticComponent<Props>;
|
|
12
|
-
export {};
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { Mark } from "prosemirror-model";
|
|
2
|
-
import React, { ReactNode } from "react";
|
|
3
|
-
type Props = {
|
|
4
|
-
mark: Mark;
|
|
5
|
-
getPos: () => number;
|
|
6
|
-
children: ReactNode;
|
|
7
|
-
inline?: boolean;
|
|
8
|
-
};
|
|
9
|
-
export declare const MarkView: React.MemoExoticComponent<React.ForwardRefExoticComponent<Props & React.RefAttributes<unknown>>>;
|
|
10
|
-
export {};
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { Node } from "prosemirror-model";
|
|
2
|
-
import { Decoration, DecorationSource, NodeViewConstructor } from "prosemirror-view";
|
|
3
|
-
import React from "react";
|
|
4
|
-
interface Props {
|
|
5
|
-
constructor: NodeViewConstructor;
|
|
6
|
-
node: Node;
|
|
7
|
-
getPos: () => number;
|
|
8
|
-
innerDeco: DecorationSource;
|
|
9
|
-
outerDeco: readonly Decoration[];
|
|
10
|
-
}
|
|
11
|
-
export declare const CustomNodeView: React.NamedExoticComponent<Props>;
|
|
12
|
-
export {};
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { NodeViewConstructor } from "prosemirror-view";
|
|
2
|
-
import { NodeViewComponentProps } from "../components/nodes/NodeViewComponentProps.js";
|
|
3
|
-
import { DOMNode } from "../dom.js";
|
|
4
|
-
import { NodeViewDesc, ViewDesc } from "../viewdesc.js";
|
|
5
|
-
type Props = NodeViewComponentProps["nodeProps"];
|
|
6
|
-
export declare function useNodeViewDescriptor(ref: {
|
|
7
|
-
readonly current: DOMNode | null;
|
|
8
|
-
}, constructor: NodeViewConstructor, props: Props): {
|
|
9
|
-
childContextValue: {
|
|
10
|
-
parentRef: import("react").MutableRefObject<NodeViewDesc | undefined>;
|
|
11
|
-
siblingsRef: import("react").MutableRefObject<ViewDesc[]>;
|
|
12
|
-
};
|
|
13
|
-
dom: Node | null;
|
|
14
|
-
contentDOM: HTMLElement | null;
|
|
15
|
-
nodeDOM: Node | null;
|
|
16
|
-
ref: {
|
|
17
|
-
readonly current: DOMNode | null;
|
|
18
|
-
};
|
|
19
|
-
};
|
|
20
|
-
export {};
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { Editor, NodeView, NodeViewRendererOptions, NodeViewRendererProps } from "@tiptap/core";
|
|
2
|
-
/**
|
|
3
|
-
* Subclass of Tiptap's NodeView to be used in tiptapNodeView.
|
|
4
|
-
*
|
|
5
|
-
* Allows us to pass in an existing dom and contentODM from React ProseMirror's
|
|
6
|
-
* ViewDesc, so that we can call Tiptap's default stopEvent and ignoreMutation
|
|
7
|
-
* methods
|
|
8
|
-
*/
|
|
9
|
-
export declare class ReactProseMirrorNodeView<Component, NodeEditor extends Editor = Editor, Options extends NodeViewRendererOptions = NodeViewRendererOptions> extends NodeView<Component, NodeEditor, Options> {
|
|
10
|
-
private _dom;
|
|
11
|
-
private _contentDOM;
|
|
12
|
-
constructor(component: Component, props: NodeViewRendererProps, dom: HTMLElement, contentDOM: HTMLElement | null, options?: Partial<Options>);
|
|
13
|
-
get dom(): HTMLElement;
|
|
14
|
-
get contentDOM(): HTMLElement | null;
|
|
15
|
-
}
|