@handlewithcare/react-prosemirror 3.1.0-tiptap.48 → 3.1.0-tiptap.49
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 +0 -2
- package/dist/cjs/components/ChildNodeViews.js +7 -12
- package/dist/cjs/components/CursorWrapper.js +9 -8
- package/dist/cjs/components/TextNodeView.js +38 -112
- package/dist/cjs/hooks/useEditor.js +5 -13
- package/dist/cjs/hooks/useNodeViewDescription.js +15 -38
- package/dist/cjs/plugins/beforeInputPlugin.js +41 -47
- package/dist/cjs/tiptap/hooks/useEditor.js +349 -0
- package/dist/cjs/tiptap/hooks/useTiptapEditor.js +2 -2
- package/dist/cjs/tiptap/utils/ssrJSDOMPatch.js +59 -0
- package/dist/cjs/viewdesc.js +3 -10
- package/dist/esm/ReactEditorView.js +0 -2
- package/dist/esm/components/ChildNodeViews.js +7 -12
- package/dist/esm/components/CursorWrapper.js +10 -9
- package/dist/esm/components/TextNodeView.js +38 -112
- package/dist/esm/hooks/useEditor.js +5 -13
- package/dist/esm/hooks/useNodeViewDescription.js +16 -39
- package/dist/esm/plugins/beforeInputPlugin.js +41 -47
- package/dist/esm/tiptap/hooks/useEditor.js +339 -0
- package/dist/esm/tiptap/hooks/useTiptapEditor.js +1 -1
- package/dist/esm/tiptap/utils/ssrJSDOMPatch.js +56 -0
- package/dist/esm/viewdesc.js +3 -10
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types/ReactEditorView.d.ts +0 -4
- package/dist/types/components/TextNodeView.d.ts +4 -14
- package/dist/types/tiptap/hooks/useEditor.d.ts +38 -0
- package/dist/types/tiptap/hooks/useTiptapEditor.d.ts +1 -1
- package/dist/types/tiptap/utils/ssrJSDOMPatch.d.ts +1 -0
- package/dist/types/viewdesc.d.ts +1 -1
- package/package.json +1 -2
|
@@ -11,10 +11,7 @@ interface DOMObserver {
|
|
|
11
11
|
onSelectionChange(): void;
|
|
12
12
|
}
|
|
13
13
|
interface InputState {
|
|
14
|
-
composing: boolean;
|
|
15
14
|
compositionID: number;
|
|
16
|
-
compositionNode: DOMNode | null;
|
|
17
|
-
compositionEndedAt: number;
|
|
18
15
|
compositionNodes: ViewDesc[];
|
|
19
16
|
compositionPendingChanges: number;
|
|
20
17
|
hideSelectionGuard: (() => void) | null;
|
|
@@ -61,7 +58,6 @@ export declare class ReactEditorView extends EditorView implements AbstractEdito
|
|
|
61
58
|
private nextProps;
|
|
62
59
|
private prevState;
|
|
63
60
|
private _destroyed;
|
|
64
|
-
deferPendingEffects: boolean;
|
|
65
61
|
constructor(place: {
|
|
66
62
|
mount: HTMLElement;
|
|
67
63
|
}, props: DirectEditorProps);
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { Node } from "prosemirror-model";
|
|
2
|
-
import {
|
|
2
|
+
import { Decoration } from "prosemirror-view";
|
|
3
3
|
import { Component, MutableRefObject } from "react";
|
|
4
4
|
import { AbstractEditorView } from "../AbstractEditorView.js";
|
|
5
|
-
import {
|
|
6
|
-
import { CompositionViewDesc, TextViewDesc, ViewDesc } from "../viewdesc.js";
|
|
5
|
+
import { ViewDesc } from "../viewdesc.js";
|
|
7
6
|
type Props = {
|
|
8
7
|
view: AbstractEditorView;
|
|
9
8
|
node: Node;
|
|
@@ -11,19 +10,10 @@ type Props = {
|
|
|
11
10
|
siblingsRef: MutableRefObject<ViewDesc[]>;
|
|
12
11
|
parentRef: MutableRefObject<ViewDesc | undefined>;
|
|
13
12
|
decorations: readonly Decoration[];
|
|
14
|
-
registerEventListener<EventType extends keyof DOMEventMap>(eventType: EventType, handler: EventHandler<EventType>): void;
|
|
15
|
-
unregisterEventListener<EventType extends keyof DOMEventMap>(eventType: EventType, handler: EventHandler<EventType>): void;
|
|
16
13
|
};
|
|
17
14
|
export declare class TextNodeView extends Component<Props> {
|
|
18
|
-
viewDescRef
|
|
19
|
-
renderRef
|
|
20
|
-
wasProtecting: boolean;
|
|
21
|
-
containsCompositionNodeText: boolean;
|
|
22
|
-
shouldProtect(props: Props): boolean;
|
|
23
|
-
handleCompositionEnd: () => void;
|
|
24
|
-
create(): CompositionViewDesc | TextViewDesc | null;
|
|
25
|
-
update(): boolean;
|
|
26
|
-
destroy(): void;
|
|
15
|
+
private viewDescRef;
|
|
16
|
+
private renderRef;
|
|
27
17
|
updateEffect(): void;
|
|
28
18
|
shouldComponentUpdate(nextProps: Props): boolean;
|
|
29
19
|
componentDidMount(): void;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { Editor, type EditorOptions } from "@tiptap/core";
|
|
2
|
+
import { DependencyList } from "react";
|
|
3
|
+
/**
|
|
4
|
+
* The options for the `useEditor` hook.
|
|
5
|
+
*/
|
|
6
|
+
export type UseEditorOptions = Partial<EditorOptions> & {
|
|
7
|
+
/**
|
|
8
|
+
* Whether to render the editor on the first render.
|
|
9
|
+
* If client-side rendering, set this to `true`.
|
|
10
|
+
* If server-side rendering, set this to `false`.
|
|
11
|
+
* @default true
|
|
12
|
+
*/
|
|
13
|
+
immediatelyRender?: boolean;
|
|
14
|
+
/**
|
|
15
|
+
* Whether to re-render the editor on each transaction.
|
|
16
|
+
* This is legacy behavior that will be removed in future versions.
|
|
17
|
+
* @default false
|
|
18
|
+
*/
|
|
19
|
+
shouldRerenderOnTransaction?: boolean;
|
|
20
|
+
};
|
|
21
|
+
/**
|
|
22
|
+
* This hook allows you to create an editor instance.
|
|
23
|
+
* @param options The editor options
|
|
24
|
+
* @param deps The dependencies to watch for changes
|
|
25
|
+
* @returns The editor instance
|
|
26
|
+
* @example const editor = useEditor({ extensions: [...] })
|
|
27
|
+
*/
|
|
28
|
+
export declare function useEditor(options: UseEditorOptions & {
|
|
29
|
+
immediatelyRender: false;
|
|
30
|
+
}, deps?: DependencyList): Editor | null;
|
|
31
|
+
/**
|
|
32
|
+
* This hook allows you to create an editor instance.
|
|
33
|
+
* @param options The editor options
|
|
34
|
+
* @param deps The dependencies to watch for changes
|
|
35
|
+
* @returns The editor instance
|
|
36
|
+
* @example const editor = useEditor({ extensions: [...] })
|
|
37
|
+
*/
|
|
38
|
+
export declare function useEditor(options: UseEditorOptions, deps?: DependencyList): Editor;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { useEditor } from "@tiptap/react";
|
|
2
1
|
import { DependencyList } from "react";
|
|
2
|
+
import { useEditor } from "./useEditor.js";
|
|
3
3
|
export type UseTiptapEditorOptions = Omit<Parameters<typeof useEditor>[0], "element">;
|
|
4
4
|
export declare function useTiptapEditor(options: UseTiptapEditorOptions, deps?: DependencyList): import("@tiptap/core").Editor;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/types/viewdesc.d.ts
CHANGED
|
@@ -133,7 +133,7 @@ export declare class TextViewDesc extends NodeViewDesc {
|
|
|
133
133
|
parseRule(): {
|
|
134
134
|
skip: any;
|
|
135
135
|
};
|
|
136
|
-
update(
|
|
136
|
+
update(_node: Node, _outerDeco: readonly Decoration[], _innerDeco: DecorationSource, _view: ReactEditorView): boolean;
|
|
137
137
|
inParent(): boolean;
|
|
138
138
|
domFromPos(pos: number): {
|
|
139
139
|
node: globalThis.Node;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@handlewithcare/react-prosemirror",
|
|
3
|
-
"version": "3.1.0-tiptap.
|
|
3
|
+
"version": "3.1.0-tiptap.49",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/cjs/index.js",
|
|
@@ -71,7 +71,6 @@
|
|
|
71
71
|
"@typescript-eslint/eslint-plugin": "^5.51.0",
|
|
72
72
|
"@typescript-eslint/parser": "^5.51.0",
|
|
73
73
|
"@uiw/react-codemirror": "^4.23.7",
|
|
74
|
-
"@vitejs/plugin-basic-ssl": "^2.3.0",
|
|
75
74
|
"@vitejs/plugin-react": "^4.3.1",
|
|
76
75
|
"@wdio/browser-runner": "^9.18.1",
|
|
77
76
|
"@wdio/cli": "^9.18.1",
|