@handlewithcare/react-prosemirror 3.1.0-tiptap.35 → 3.1.0-tiptap.36
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/components/CustomNodeView.js +132 -0
- package/dist/cjs/components/DefaultNodeView.js +67 -0
- package/dist/cjs/components/DocNodeView.js +96 -0
- package/dist/cjs/components/MarkView.js +119 -0
- package/dist/cjs/components/NodeView.js +86 -0
- package/dist/cjs/components/NodeViewComponentProps.js +4 -0
- package/dist/cjs/components/ReactNodeView.js +174 -0
- package/dist/cjs/components/marks/CustomMarkView.js +110 -0
- package/dist/cjs/components/marks/OldMarkView.js +120 -0
- package/dist/cjs/components/nodes/CustomNodeView.js +135 -0
- package/dist/cjs/components/nodes/ReactNodeView.js +1 -1
- package/dist/cjs/contexts/ChildDescriptorsContext.js +19 -0
- package/dist/cjs/hooks/useNodeViewDescriptor.js +156 -0
- package/dist/cjs/tiptap/TiptapNodeView.js +26 -0
- package/dist/cjs/tiptap/tiptapNodeView.js +5 -6
- package/dist/esm/components/CustomNodeView.js +81 -0
- package/dist/esm/components/DefaultNodeView.js +16 -0
- package/dist/esm/components/DocNodeView.js +45 -0
- package/dist/esm/components/MarkView.js +68 -0
- package/dist/esm/components/NodeView.js +35 -0
- package/dist/esm/components/NodeViewComponentProps.js +1 -0
- package/dist/esm/components/ReactNodeView.js +123 -0
- package/dist/esm/components/marks/CustomMarkView.js +59 -0
- package/dist/esm/components/marks/OldMarkView.js +69 -0
- package/dist/esm/components/nodes/CustomNodeView.js +84 -0
- package/dist/esm/components/nodes/ReactNodeView.js +1 -1
- package/dist/esm/contexts/ChildDescriptorsContext.js +9 -0
- package/dist/esm/hooks/useNodeViewDescriptor.js +146 -0
- package/dist/esm/tiptap/TiptapNodeView.js +22 -0
- package/dist/esm/tiptap/tiptapNodeView.js +5 -6
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types/components/CustomNodeView.d.ts +12 -0
- package/dist/types/components/DefaultNodeView.d.ts +3 -0
- package/dist/types/components/DocNodeView.d.ts +12 -0
- package/dist/types/components/MarkView.d.ts +9 -0
- package/dist/types/components/NodeView.d.ts +11 -0
- package/dist/types/components/NodeViewComponentProps.d.ts +12 -0
- package/dist/types/components/ReactNodeView.d.ts +13 -0
- package/dist/types/components/marks/CustomMarkView.d.ts +12 -0
- package/dist/types/components/marks/OldMarkView.d.ts +10 -0
- package/dist/types/components/nodes/CustomNodeView.d.ts +12 -0
- package/dist/types/constants.d.ts +1 -1
- package/dist/types/contexts/ChildDescriptorsContext.d.ts +6 -0
- package/dist/types/hooks/useNodeViewDescriptor.d.ts +20 -0
- package/dist/types/props.d.ts +26 -26
- package/dist/types/tiptap/TiptapNodeView.d.ts +15 -0
- package/package.json +1 -1
|
@@ -0,0 +1,12 @@
|
|
|
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 {};
|
|
@@ -0,0 +1,12 @@
|
|
|
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>>>;
|
|
@@ -0,0 +1,9 @@
|
|
|
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 {};
|
|
@@ -0,0 +1,11 @@
|
|
|
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 {};
|
|
@@ -0,0 +1,12 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
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 {};
|
|
@@ -0,0 +1,12 @@
|
|
|
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 {};
|
|
@@ -0,0 +1,10 @@
|
|
|
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 {};
|
|
@@ -0,0 +1,12 @@
|
|
|
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,4 +1,4 @@
|
|
|
1
1
|
import { Schema } from "prosemirror-model";
|
|
2
2
|
import { EditorState } from "prosemirror-state";
|
|
3
|
-
export declare const EMPTY_SCHEMA: Schema<"
|
|
3
|
+
export declare const EMPTY_SCHEMA: Schema<"text" | "doc", any>;
|
|
4
4
|
export declare const EMPTY_STATE: EditorState;
|
|
@@ -0,0 +1,20 @@
|
|
|
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 {};
|
package/dist/types/props.d.ts
CHANGED
|
@@ -904,19 +904,19 @@ export declare function mergeReactProps(a: HTMLProps<HTMLElement>, b: HTMLProps<
|
|
|
904
904
|
suppressContentEditableWarning?: boolean | undefined;
|
|
905
905
|
suppressHydrationWarning?: boolean | undefined;
|
|
906
906
|
accessKey?: string | undefined;
|
|
907
|
-
autoCapitalize?: "
|
|
907
|
+
autoCapitalize?: "none" | (string & {}) | "off" | "on" | "sentences" | "words" | "characters" | undefined;
|
|
908
908
|
autoFocus?: boolean | undefined;
|
|
909
|
-
contentEditable?: (boolean | "
|
|
909
|
+
contentEditable?: (boolean | "true" | "false") | "inherit" | "plaintext-only" | undefined;
|
|
910
910
|
contextMenu?: string | undefined;
|
|
911
911
|
dir?: string | undefined;
|
|
912
|
-
draggable?: (boolean | "
|
|
913
|
-
enterKeyHint?: "enter" | "done" | "go" | "next" | "previous" | "
|
|
912
|
+
draggable?: (boolean | "true" | "false") | undefined;
|
|
913
|
+
enterKeyHint?: "search" | "enter" | "done" | "go" | "next" | "previous" | "send" | undefined;
|
|
914
914
|
hidden?: boolean | undefined;
|
|
915
915
|
id?: string | undefined;
|
|
916
916
|
lang?: string | undefined;
|
|
917
917
|
nonce?: string | undefined;
|
|
918
918
|
slot?: string | undefined;
|
|
919
|
-
spellCheck?: (boolean | "
|
|
919
|
+
spellCheck?: (boolean | "true" | "false") | undefined;
|
|
920
920
|
tabIndex?: number | undefined;
|
|
921
921
|
title?: string | undefined;
|
|
922
922
|
translate?: "yes" | "no" | undefined;
|
|
@@ -944,57 +944,57 @@ export declare function mergeReactProps(a: HTMLProps<HTMLElement>, b: HTMLProps<
|
|
|
944
944
|
results?: number | undefined;
|
|
945
945
|
security?: string | undefined;
|
|
946
946
|
unselectable?: "off" | "on" | undefined;
|
|
947
|
-
inputMode?: "
|
|
947
|
+
inputMode?: "search" | "text" | "none" | "email" | "tel" | "url" | "numeric" | "decimal" | undefined;
|
|
948
948
|
is?: string | undefined;
|
|
949
949
|
exportparts?: string | undefined;
|
|
950
950
|
part?: string | undefined;
|
|
951
951
|
"aria-activedescendant"?: string | undefined;
|
|
952
|
-
"aria-atomic"?: (boolean | "
|
|
953
|
-
"aria-autocomplete"?: "
|
|
952
|
+
"aria-atomic"?: (boolean | "true" | "false") | undefined;
|
|
953
|
+
"aria-autocomplete"?: "list" | "none" | "both" | "inline" | undefined;
|
|
954
954
|
"aria-braillelabel"?: string | undefined;
|
|
955
955
|
"aria-brailleroledescription"?: string | undefined;
|
|
956
|
-
"aria-busy"?: (boolean | "
|
|
957
|
-
"aria-checked"?: boolean | "
|
|
956
|
+
"aria-busy"?: (boolean | "true" | "false") | undefined;
|
|
957
|
+
"aria-checked"?: boolean | "true" | "false" | "mixed" | undefined;
|
|
958
958
|
"aria-colcount"?: number | undefined;
|
|
959
959
|
"aria-colindex"?: number | undefined;
|
|
960
960
|
"aria-colindextext"?: string | undefined;
|
|
961
961
|
"aria-colspan"?: number | undefined;
|
|
962
962
|
"aria-controls"?: string | undefined;
|
|
963
|
-
"aria-current"?: boolean | "
|
|
963
|
+
"aria-current"?: boolean | "time" | "step" | "date" | "true" | "false" | "page" | "location" | undefined;
|
|
964
964
|
"aria-describedby"?: string | undefined;
|
|
965
965
|
"aria-description"?: string | undefined;
|
|
966
966
|
"aria-details"?: string | undefined;
|
|
967
|
-
"aria-disabled"?: (boolean | "
|
|
968
|
-
"aria-dropeffect"?: "
|
|
967
|
+
"aria-disabled"?: (boolean | "true" | "false") | undefined;
|
|
968
|
+
"aria-dropeffect"?: "copy" | "link" | "none" | "move" | "execute" | "popup" | undefined;
|
|
969
969
|
"aria-errormessage"?: string | undefined;
|
|
970
|
-
"aria-expanded"?: (boolean | "
|
|
970
|
+
"aria-expanded"?: (boolean | "true" | "false") | undefined;
|
|
971
971
|
"aria-flowto"?: string | undefined;
|
|
972
|
-
"aria-grabbed"?: (boolean | "
|
|
973
|
-
"aria-haspopup"?: boolean | "
|
|
974
|
-
"aria-hidden"?: (boolean | "
|
|
975
|
-
"aria-invalid"?: boolean | "
|
|
972
|
+
"aria-grabbed"?: (boolean | "true" | "false") | undefined;
|
|
973
|
+
"aria-haspopup"?: boolean | "dialog" | "menu" | "grid" | "listbox" | "tree" | "true" | "false" | undefined;
|
|
974
|
+
"aria-hidden"?: (boolean | "true" | "false") | undefined;
|
|
975
|
+
"aria-invalid"?: boolean | "true" | "false" | "grammar" | "spelling" | undefined;
|
|
976
976
|
"aria-keyshortcuts"?: string | undefined;
|
|
977
977
|
"aria-label"?: string | undefined;
|
|
978
978
|
"aria-labelledby"?: string | undefined;
|
|
979
979
|
"aria-level"?: number | undefined;
|
|
980
980
|
"aria-live"?: "off" | "assertive" | "polite" | undefined;
|
|
981
|
-
"aria-modal"?: (boolean | "
|
|
982
|
-
"aria-multiline"?: (boolean | "
|
|
983
|
-
"aria-multiselectable"?: (boolean | "
|
|
981
|
+
"aria-modal"?: (boolean | "true" | "false") | undefined;
|
|
982
|
+
"aria-multiline"?: (boolean | "true" | "false") | undefined;
|
|
983
|
+
"aria-multiselectable"?: (boolean | "true" | "false") | undefined;
|
|
984
984
|
"aria-orientation"?: "horizontal" | "vertical" | undefined;
|
|
985
985
|
"aria-owns"?: string | undefined;
|
|
986
986
|
"aria-placeholder"?: string | undefined;
|
|
987
987
|
"aria-posinset"?: number | undefined;
|
|
988
|
-
"aria-pressed"?: boolean | "
|
|
989
|
-
"aria-readonly"?: (boolean | "
|
|
990
|
-
"aria-relevant"?: "text" | "
|
|
991
|
-
"aria-required"?: (boolean | "
|
|
988
|
+
"aria-pressed"?: boolean | "true" | "false" | "mixed" | undefined;
|
|
989
|
+
"aria-readonly"?: (boolean | "true" | "false") | undefined;
|
|
990
|
+
"aria-relevant"?: "text" | "all" | "additions" | "additions removals" | "additions text" | "removals" | "removals additions" | "removals text" | "text additions" | "text removals" | undefined;
|
|
991
|
+
"aria-required"?: (boolean | "true" | "false") | undefined;
|
|
992
992
|
"aria-roledescription"?: string | undefined;
|
|
993
993
|
"aria-rowcount"?: number | undefined;
|
|
994
994
|
"aria-rowindex"?: number | undefined;
|
|
995
995
|
"aria-rowindextext"?: string | undefined;
|
|
996
996
|
"aria-rowspan"?: number | undefined;
|
|
997
|
-
"aria-selected"?: (boolean | "
|
|
997
|
+
"aria-selected"?: (boolean | "true" | "false") | undefined;
|
|
998
998
|
"aria-setsize"?: number | undefined;
|
|
999
999
|
"aria-sort"?: "none" | "ascending" | "descending" | "other" | undefined;
|
|
1000
1000
|
"aria-valuemax"?: number | undefined;
|
|
@@ -0,0 +1,15 @@
|
|
|
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
|
+
}
|