@stesura/react-prosemirror 3.2.11-stesura.1
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/LICENSE.txt +21 -0
- package/README.md +939 -0
- package/dist/cjs/AbstractEditorView.js +4 -0
- package/dist/cjs/ReactEditorView.js +194 -0
- package/dist/cjs/StaticEditorView.js +89 -0
- package/dist/cjs/browser.js +53 -0
- package/dist/cjs/commands/reorderSiblings.js +72 -0
- package/dist/cjs/components/ChildNodeViews.js +418 -0
- package/dist/cjs/components/CursorWrapper.js +84 -0
- package/dist/cjs/components/EditorStateSelectorsProvider.js +90 -0
- package/dist/cjs/components/LayoutGroup.js +112 -0
- package/dist/cjs/components/NativeWidgetView.js +108 -0
- package/dist/cjs/components/OutputSpec.js +121 -0
- package/dist/cjs/components/ProseMirror.js +146 -0
- package/dist/cjs/components/ProseMirrorDoc.js +74 -0
- package/dist/cjs/components/SeparatorHackView.js +99 -0
- package/dist/cjs/components/TextNodeView.js +113 -0
- package/dist/cjs/components/TrailingHackView.js +87 -0
- package/dist/cjs/components/WidgetView.js +94 -0
- package/dist/cjs/components/WidgetViewComponentProps.js +4 -0
- package/dist/cjs/components/marks/DefaultMarkView.js +70 -0
- package/dist/cjs/components/marks/MarkView.js +85 -0
- package/dist/cjs/components/marks/MarkViewComponentProps.js +4 -0
- package/dist/cjs/components/marks/MarkViewConstructorView.js +116 -0
- package/dist/cjs/components/marks/ReactMarkView.js +109 -0
- package/dist/cjs/components/nodes/DefaultNodeView.js +68 -0
- package/dist/cjs/components/nodes/DocNodeView.js +97 -0
- package/dist/cjs/components/nodes/NodeView.js +129 -0
- package/dist/cjs/components/nodes/NodeViewComponentProps.js +4 -0
- package/dist/cjs/components/nodes/NodeViewConstructorView.js +145 -0
- package/dist/cjs/components/nodes/ReactNodeView.js +189 -0
- package/dist/cjs/constants.js +33 -0
- package/dist/cjs/contexts/ChildDescriptionsContext.js +19 -0
- package/dist/cjs/contexts/EditorContext.js +12 -0
- package/dist/cjs/contexts/EditorStateContext.js +12 -0
- package/dist/cjs/contexts/EditorStateStoreContext.js +45 -0
- package/dist/cjs/contexts/IgnoreMutationContext.js +12 -0
- package/dist/cjs/contexts/LayoutGroupContext.js +12 -0
- package/dist/cjs/contexts/NodeViewContext.js +12 -0
- package/dist/cjs/contexts/RenderStoreContext.js +54 -0
- package/dist/cjs/contexts/SelectNodeContext.js +12 -0
- package/dist/cjs/contexts/StopEventContext.js +12 -0
- package/dist/cjs/decorations/ReactWidgetType.js +58 -0
- package/dist/cjs/decorations/computeDocDeco.js +44 -0
- package/dist/cjs/decorations/internalTypes.js +4 -0
- package/dist/cjs/decorations/iterDeco.js +91 -0
- package/dist/cjs/decorations/viewDecorations.js +155 -0
- package/dist/cjs/dom.js +147 -0
- package/dist/cjs/findDOMNode.js +46 -0
- package/dist/cjs/hooks/useClientLayoutEffect.js +19 -0
- package/dist/cjs/hooks/useComponentEventListeners.js +72 -0
- package/dist/cjs/hooks/useEditor.js +130 -0
- package/dist/cjs/hooks/useEditorEffect.js +39 -0
- package/dist/cjs/hooks/useEditorEventCallback.js +38 -0
- package/dist/cjs/hooks/useEditorEventListener.js +34 -0
- package/dist/cjs/hooks/useEditorState.js +18 -0
- package/dist/cjs/hooks/useEditorStateSelector.js +17 -0
- package/dist/cjs/hooks/useEffectEvent.js +34 -0
- package/dist/cjs/hooks/useForceUpdate.js +15 -0
- package/dist/cjs/hooks/useIgnoreMutation.js +24 -0
- package/dist/cjs/hooks/useIsComposingIn.js +25 -0
- package/dist/cjs/hooks/useIsEditorStatic.js +15 -0
- package/dist/cjs/hooks/useIsNodeSelected.js +21 -0
- package/dist/cjs/hooks/useLayoutGroupEffect.js +20 -0
- package/dist/cjs/hooks/useMarkViewDescription.js +134 -0
- package/dist/cjs/hooks/useNodePos.js +18 -0
- package/dist/cjs/hooks/useNodeViewDescription.js +154 -0
- package/dist/cjs/hooks/useReactKeys.js +17 -0
- package/dist/cjs/hooks/useSelectNode.js +30 -0
- package/dist/cjs/hooks/useSetDom.js +57 -0
- package/dist/cjs/hooks/useStopEvent.js +24 -0
- package/dist/cjs/index.js +85 -0
- package/dist/cjs/package.json +3 -0
- package/dist/cjs/plugins/beforeInputPlugin.js +356 -0
- package/dist/cjs/plugins/reactKeys.js +121 -0
- package/dist/cjs/props.js +283 -0
- package/dist/cjs/refs.js +28 -0
- package/dist/cjs/testing/editorViewTestHelpers.js +109 -0
- package/dist/cjs/testing/setupProseMirrorView.js +94 -0
- package/dist/cjs/tiptap/ReactProseMirrorNodeView.js +26 -0
- package/dist/cjs/tiptap/TiptapEditor.js +34 -0
- package/dist/cjs/tiptap/TiptapEditorContent.js +143 -0
- package/dist/cjs/tiptap/TiptapEditorView.js +130 -0
- package/dist/cjs/tiptap/contexts/TiptapEditorContext.js +12 -0
- package/dist/cjs/tiptap/extensions/ReactProseMirror.js +40 -0
- package/dist/cjs/tiptap/extensions/ReactProseMirrorCommands.js +21 -0
- package/dist/cjs/tiptap/extensions/commands/updateAttributes.js +104 -0
- package/dist/cjs/tiptap/hooks/useEditor.js +318 -0
- package/dist/cjs/tiptap/hooks/useIsInReactProseMirror.js +15 -0
- package/dist/cjs/tiptap/hooks/useTiptapEditor.js +35 -0
- package/dist/cjs/tiptap/hooks/useTiptapEditorEffect.js +35 -0
- package/dist/cjs/tiptap/hooks/useTiptapEditorEventCallback.js +35 -0
- package/dist/cjs/tiptap/index.js +48 -0
- package/dist/cjs/tiptap/tiptapNodeView.js +245 -0
- package/dist/cjs/viewdesc.js +862 -0
- package/dist/esm/AbstractEditorView.js +1 -0
- package/dist/esm/ReactEditorView.js +194 -0
- package/dist/esm/StaticEditorView.js +79 -0
- package/dist/esm/browser.js +43 -0
- package/dist/esm/commands/reorderSiblings.js +63 -0
- package/dist/esm/components/ChildNodeViews.js +359 -0
- package/dist/esm/components/CursorWrapper.js +33 -0
- package/dist/esm/components/EditorStateSelectorsProvider.js +31 -0
- package/dist/esm/components/LayoutGroup.js +67 -0
- package/dist/esm/components/NativeWidgetView.js +57 -0
- package/dist/esm/components/OutputSpec.js +71 -0
- package/dist/esm/components/ProseMirror.js +95 -0
- package/dist/esm/components/ProseMirrorDoc.js +15 -0
- package/dist/esm/components/SeparatorHackView.js +48 -0
- package/dist/esm/components/TextNodeView.js +103 -0
- package/dist/esm/components/TrailingHackView.js +36 -0
- package/dist/esm/components/WidgetView.js +43 -0
- package/dist/esm/components/WidgetViewComponentProps.js +1 -0
- package/dist/esm/components/marks/DefaultMarkView.js +19 -0
- package/dist/esm/components/marks/MarkView.js +34 -0
- package/dist/esm/components/marks/MarkViewComponentProps.js +1 -0
- package/dist/esm/components/marks/MarkViewConstructorView.js +65 -0
- package/dist/esm/components/marks/ReactMarkView.js +58 -0
- package/dist/esm/components/nodes/DefaultNodeView.js +17 -0
- package/dist/esm/components/nodes/DocNodeView.js +46 -0
- package/dist/esm/components/nodes/NodeView.js +67 -0
- package/dist/esm/components/nodes/NodeViewComponentProps.js +1 -0
- package/dist/esm/components/nodes/NodeViewConstructorView.js +94 -0
- package/dist/esm/components/nodes/ReactNodeView.js +138 -0
- package/dist/esm/constants.js +15 -0
- package/dist/esm/contexts/ChildDescriptionsContext.js +9 -0
- package/dist/esm/contexts/EditorContext.js +7 -0
- package/dist/esm/contexts/EditorStateContext.js +2 -0
- package/dist/esm/contexts/EditorStateStoreContext.js +27 -0
- package/dist/esm/contexts/IgnoreMutationContext.js +2 -0
- package/dist/esm/contexts/LayoutGroupContext.js +2 -0
- package/dist/esm/contexts/NodeViewContext.js +2 -0
- package/dist/esm/contexts/RenderStoreContext.js +33 -0
- package/dist/esm/contexts/SelectNodeContext.js +2 -0
- package/dist/esm/contexts/StopEventContext.js +2 -0
- package/dist/esm/decorations/ReactWidgetType.js +40 -0
- package/dist/esm/decorations/computeDocDeco.js +44 -0
- package/dist/esm/decorations/internalTypes.js +1 -0
- package/dist/esm/decorations/iterDeco.js +85 -0
- package/dist/esm/decorations/viewDecorations.js +155 -0
- package/dist/esm/dom.js +110 -0
- package/dist/esm/findDOMNode.js +31 -0
- package/dist/esm/hooks/useClientLayoutEffect.js +9 -0
- package/dist/esm/hooks/useComponentEventListeners.js +87 -0
- package/dist/esm/hooks/useEditor.js +128 -0
- package/dist/esm/hooks/useEditorEffect.js +46 -0
- package/dist/esm/hooks/useEditorEventCallback.js +38 -0
- package/dist/esm/hooks/useEditorEventListener.js +28 -0
- package/dist/esm/hooks/useEditorState.js +10 -0
- package/dist/esm/hooks/useEditorStateSelector.js +14 -0
- package/dist/esm/hooks/useEffectEvent.js +24 -0
- package/dist/esm/hooks/useForceUpdate.js +8 -0
- package/dist/esm/hooks/useIgnoreMutation.js +14 -0
- package/dist/esm/hooks/useIsComposingIn.js +17 -0
- package/dist/esm/hooks/useIsEditorStatic.js +8 -0
- package/dist/esm/hooks/useIsNodeSelected.js +11 -0
- package/dist/esm/hooks/useLayoutGroupEffect.js +10 -0
- package/dist/esm/hooks/useMarkViewDescription.js +124 -0
- package/dist/esm/hooks/useNodePos.js +15 -0
- package/dist/esm/hooks/useNodeViewDescription.js +144 -0
- package/dist/esm/hooks/useReactKeys.js +7 -0
- package/dist/esm/hooks/useSelectNode.js +20 -0
- package/dist/esm/hooks/useSetDom.js +47 -0
- package/dist/esm/hooks/useStopEvent.js +14 -0
- package/dist/esm/index.js +19 -0
- package/dist/esm/plugins/beforeInputPlugin.js +346 -0
- package/dist/esm/plugins/reactKeys.js +106 -0
- package/dist/esm/props.js +267 -0
- package/dist/esm/refs.js +18 -0
- package/dist/esm/testing/editorViewTestHelpers.js +86 -0
- package/dist/esm/testing/setupProseMirrorView.js +76 -0
- package/dist/esm/tiptap/ReactProseMirrorNodeView.js +22 -0
- package/dist/esm/tiptap/TiptapEditor.js +24 -0
- package/dist/esm/tiptap/TiptapEditorContent.js +99 -0
- package/dist/esm/tiptap/TiptapEditorView.js +76 -0
- package/dist/esm/tiptap/contexts/TiptapEditorContext.js +2 -0
- package/dist/esm/tiptap/extensions/ReactProseMirror.js +30 -0
- package/dist/esm/tiptap/extensions/ReactProseMirrorCommands.js +11 -0
- package/dist/esm/tiptap/extensions/commands/updateAttributes.js +96 -0
- package/dist/esm/tiptap/hooks/useEditor.js +308 -0
- package/dist/esm/tiptap/hooks/useIsInReactProseMirror.js +9 -0
- package/dist/esm/tiptap/hooks/useTiptapEditor.js +31 -0
- package/dist/esm/tiptap/hooks/useTiptapEditorEffect.js +42 -0
- package/dist/esm/tiptap/hooks/useTiptapEditorEventCallback.js +35 -0
- package/dist/esm/tiptap/index.js +9 -0
- package/dist/esm/tiptap/tiptapNodeView.js +211 -0
- package/dist/esm/viewdesc.js +844 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/dist/types/AbstractEditorView.d.ts +28 -0
- package/dist/types/ReactEditorView.d.ts +102 -0
- package/dist/types/StaticEditorView.d.ts +26 -0
- package/dist/types/__tests__/viewdesc.test.d.ts +1 -0
- package/dist/types/browser.d.ts +15 -0
- package/dist/types/commands/__tests__/reorderSiblings.test.d.ts +1 -0
- package/dist/types/commands/reorderSiblings.d.ts +14 -0
- package/dist/types/components/ChildNodeViews.d.ts +9 -0
- package/dist/types/components/CursorWrapper.d.ts +3 -0
- package/dist/types/components/EditorStateSelectorsProvider.d.ts +10 -0
- package/dist/types/components/LayoutGroup.d.ts +12 -0
- package/dist/types/components/NativeWidgetView.d.ts +8 -0
- package/dist/types/components/OutputSpec.d.ts +10 -0
- package/dist/types/components/ProseMirror.d.ts +14 -0
- package/dist/types/components/ProseMirrorDoc.d.ts +16 -0
- package/dist/types/components/SeparatorHackView.d.ts +6 -0
- package/dist/types/components/TextNodeView.d.ts +27 -0
- package/dist/types/components/TrailingHackView.d.ts +6 -0
- package/dist/types/components/WidgetView.d.ts +8 -0
- package/dist/types/components/WidgetViewComponentProps.d.ts +7 -0
- package/dist/types/components/__tests__/ProseMirror.composition.test.d.ts +17 -0
- package/dist/types/components/__tests__/ProseMirror.domchange.test.d.ts +1 -0
- package/dist/types/components/__tests__/ProseMirror.draw-decoration.test.d.ts +1 -0
- package/dist/types/components/__tests__/ProseMirror.draw.test.d.ts +1 -0
- package/dist/types/components/__tests__/ProseMirror.memory-leak.test.d.ts +6 -0
- package/dist/types/components/__tests__/ProseMirror.mobile.test.d.ts +1 -0
- package/dist/types/components/__tests__/ProseMirror.node-view.test.d.ts +1 -0
- package/dist/types/components/__tests__/ProseMirror.selection.test.d.ts +1 -0
- package/dist/types/components/__tests__/ProseMirror.test.d.ts +1 -0
- package/dist/types/components/__tests__/stableContexts.test.d.ts +10 -0
- package/dist/types/components/marks/DefaultMarkView.d.ts +3 -0
- package/dist/types/components/marks/MarkView.d.ts +10 -0
- package/dist/types/components/marks/MarkViewComponentProps.d.ts +11 -0
- package/dist/types/components/marks/MarkViewConstructorView.d.ts +12 -0
- package/dist/types/components/marks/ReactMarkView.d.ts +12 -0
- package/dist/types/components/nodes/DefaultNodeView.d.ts +3 -0
- package/dist/types/components/nodes/DocNodeView.d.ts +12 -0
- package/dist/types/components/nodes/NodeView.d.ts +14 -0
- package/dist/types/components/nodes/NodeViewComponentProps.d.ts +13 -0
- package/dist/types/components/nodes/NodeViewConstructorView.d.ts +12 -0
- package/dist/types/components/nodes/ReactNodeView.d.ts +13 -0
- package/dist/types/constants.d.ts +4 -0
- package/dist/types/contexts/ChildDescriptionsContext.d.ts +7 -0
- package/dist/types/contexts/EditorContext.d.ts +18 -0
- package/dist/types/contexts/EditorStateContext.d.ts +2 -0
- package/dist/types/contexts/EditorStateStoreContext.d.ts +9 -0
- package/dist/types/contexts/IgnoreMutationContext.d.ts +5 -0
- package/dist/types/contexts/LayoutGroupContext.d.ts +5 -0
- package/dist/types/contexts/NodeViewContext.d.ts +9 -0
- package/dist/types/contexts/RenderStoreContext.d.ts +24 -0
- package/dist/types/contexts/SelectNodeContext.d.ts +5 -0
- package/dist/types/contexts/StopEventContext.d.ts +5 -0
- package/dist/types/contexts/__tests__/DeferredLayoutEffects.test.d.ts +1 -0
- package/dist/types/decorations/ReactWidgetType.d.ts +40 -0
- package/dist/types/decorations/computeDocDeco.d.ts +14 -0
- package/dist/types/decorations/internalTypes.d.ts +20 -0
- package/dist/types/decorations/iterDeco.d.ts +3 -0
- package/dist/types/decorations/viewDecorations.d.ts +14 -0
- package/dist/types/dom.d.ts +22 -0
- package/dist/types/findDOMNode.d.ts +3 -0
- package/dist/types/hooks/__tests__/useEditorEffect.test.d.ts +1 -0
- package/dist/types/hooks/useClientLayoutEffect.d.ts +2 -0
- package/dist/types/hooks/useComponentEventListeners.d.ts +34 -0
- package/dist/types/hooks/useEditor.d.ts +37 -0
- package/dist/types/hooks/useEditorEffect.d.ts +21 -0
- package/dist/types/hooks/useEditorEventCallback.d.ts +13 -0
- package/dist/types/hooks/useEditorEventListener.d.ts +8 -0
- package/dist/types/hooks/useEditorState.d.ts +5 -0
- package/dist/types/hooks/useEditorStateSelector.d.ts +10 -0
- package/dist/types/hooks/useEffectEvent.d.ts +1 -0
- package/dist/types/hooks/useForceUpdate.d.ts +5 -0
- package/dist/types/hooks/useIgnoreMutation.d.ts +2 -0
- package/dist/types/hooks/useIsComposingIn.d.ts +4 -0
- package/dist/types/hooks/useIsEditorStatic.d.ts +5 -0
- package/dist/types/hooks/useIsNodeSelected.d.ts +1 -0
- package/dist/types/hooks/useLayoutGroupEffect.d.ts +3 -0
- package/dist/types/hooks/useMarkViewDescription.d.ts +15 -0
- package/dist/types/hooks/useNodePos.d.ts +9 -0
- package/dist/types/hooks/useNodeViewDescription.d.ts +16 -0
- package/dist/types/hooks/useReactKeys.d.ts +2 -0
- package/dist/types/hooks/useSelectNode.d.ts +2 -0
- package/dist/types/hooks/useSetDom.d.ts +2 -0
- package/dist/types/hooks/useStopEvent.d.ts +2 -0
- package/dist/types/index.d.ts +21 -0
- package/dist/types/plugins/__tests__/reactKeys.test.d.ts +1 -0
- package/dist/types/plugins/beforeInputPlugin.d.ts +2 -0
- package/dist/types/plugins/reactKeys.d.ts +23 -0
- package/dist/types/props.d.ts +1173 -0
- package/dist/types/refs.d.ts +2 -0
- package/dist/types/testing/editorViewTestHelpers.d.ts +24 -0
- package/dist/types/testing/setupProseMirrorView.d.ts +2 -0
- package/dist/types/tiptap/ReactProseMirrorNodeView.d.ts +15 -0
- package/dist/types/tiptap/TiptapEditor.d.ts +6 -0
- package/dist/types/tiptap/TiptapEditorContent.d.ts +28 -0
- package/dist/types/tiptap/TiptapEditorView.d.ts +16 -0
- package/dist/types/tiptap/contexts/TiptapEditorContext.d.ts +6 -0
- package/dist/types/tiptap/extensions/ReactProseMirror.d.ts +9 -0
- package/dist/types/tiptap/extensions/ReactProseMirrorCommands.d.ts +2 -0
- package/dist/types/tiptap/extensions/commands/updateAttributes.d.ts +24 -0
- package/dist/types/tiptap/hooks/useEditor.d.ts +38 -0
- package/dist/types/tiptap/hooks/useIsInReactProseMirror.d.ts +6 -0
- package/dist/types/tiptap/hooks/useTiptapEditor.d.ts +11 -0
- package/dist/types/tiptap/hooks/useTiptapEditorEffect.d.ts +21 -0
- package/dist/types/tiptap/hooks/useTiptapEditorEventCallback.d.ts +13 -0
- package/dist/types/tiptap/index.d.ts +9 -0
- package/dist/types/tiptap/tiptapNodeView.d.ts +50 -0
- package/dist/types/viewdesc.d.ts +179 -0
- package/package.json +167 -0
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import { EditorState } from "prosemirror-state";
|
|
2
|
+
import { Decoration, DirectEditorProps, EditorProps, EditorView } from "prosemirror-view";
|
|
3
|
+
import { AbstractEditorView, NodeViewSet } from "./AbstractEditorView.js";
|
|
4
|
+
import { DOMNode, DOMSelection, DOMSelectionRange } from "./dom.js";
|
|
5
|
+
import { NodeViewDesc, ViewDesc } from "./viewdesc.js";
|
|
6
|
+
interface DOMObserver {
|
|
7
|
+
observer: MutationObserver | null;
|
|
8
|
+
queue: MutationRecord[];
|
|
9
|
+
start(): void;
|
|
10
|
+
stop(): void;
|
|
11
|
+
onSelectionChange(): void;
|
|
12
|
+
setCurSelection(): void;
|
|
13
|
+
disconnectSelection(): void;
|
|
14
|
+
connectSelection(): void;
|
|
15
|
+
flush(): void;
|
|
16
|
+
lastChangedTextNode: Text | null;
|
|
17
|
+
}
|
|
18
|
+
interface InputState {
|
|
19
|
+
composing: boolean;
|
|
20
|
+
compositionID: number;
|
|
21
|
+
compositionNode: Text | null;
|
|
22
|
+
compositionEndedAt: number;
|
|
23
|
+
compositionNodes: ViewDesc[];
|
|
24
|
+
compositionPendingChanges: number;
|
|
25
|
+
hideSelectionGuard: (() => void) | null;
|
|
26
|
+
lastClick: {
|
|
27
|
+
time: number;
|
|
28
|
+
x: number;
|
|
29
|
+
y: number;
|
|
30
|
+
type: string;
|
|
31
|
+
button: number;
|
|
32
|
+
};
|
|
33
|
+
lastFocus: number;
|
|
34
|
+
lastIOSEnter: number;
|
|
35
|
+
lastSelectionOrigin: string | null;
|
|
36
|
+
lastSelectionTime: number;
|
|
37
|
+
lastTouch: number;
|
|
38
|
+
mouseDown: {
|
|
39
|
+
allowDefault: boolean;
|
|
40
|
+
delayedSelectionSync: boolean;
|
|
41
|
+
} | null;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Extends EditorView to make prop and state updates pure, remove the DOM
|
|
45
|
+
* Mutation Observer, and use a custom document view managed by React.
|
|
46
|
+
*
|
|
47
|
+
* @privateRemarks
|
|
48
|
+
*
|
|
49
|
+
* The implementation relies on the base class using a private member to store
|
|
50
|
+
* the committed props and having a public getter that we override to return the
|
|
51
|
+
* latest, uncommitted props. The base class can then be told to update when the
|
|
52
|
+
* React effects are commit an update, applying the pending, uncommitted props.
|
|
53
|
+
*/
|
|
54
|
+
export declare class ReactEditorView extends EditorView implements AbstractEditorView {
|
|
55
|
+
cursorWrapper: {
|
|
56
|
+
dom: DOMNode;
|
|
57
|
+
deco: Decoration;
|
|
58
|
+
} | null;
|
|
59
|
+
nodeViews: NodeViewSet;
|
|
60
|
+
lastSelectedViewDesc: ViewDesc | undefined;
|
|
61
|
+
docView: NodeViewDesc;
|
|
62
|
+
input: InputState;
|
|
63
|
+
domObserver: DOMObserver;
|
|
64
|
+
domSelectionRange: () => DOMSelectionRange;
|
|
65
|
+
domSelection: () => DOMSelection | null;
|
|
66
|
+
private nextProps;
|
|
67
|
+
private prevState;
|
|
68
|
+
private _destroyed;
|
|
69
|
+
cursorWrapped: boolean;
|
|
70
|
+
constructor(place: {
|
|
71
|
+
mount: HTMLElement;
|
|
72
|
+
}, props: DirectEditorProps);
|
|
73
|
+
get props(): DirectEditorProps;
|
|
74
|
+
/**
|
|
75
|
+
* @privateremarks
|
|
76
|
+
*
|
|
77
|
+
* We override this getter because the base implementation
|
|
78
|
+
* relies on checking `docView === null`, but we unconditionally
|
|
79
|
+
* set view.docView in a layout effect in the DocNodeView.
|
|
80
|
+
* This has the effect of "un-destroying" the EditorView,
|
|
81
|
+
* making it impossible to determine whether it's been destroyed.
|
|
82
|
+
*/
|
|
83
|
+
get isDestroyed(): boolean;
|
|
84
|
+
setProps(props: Partial<DirectEditorProps>): void;
|
|
85
|
+
update(props: DirectEditorProps): void;
|
|
86
|
+
updateState(state: EditorState): void;
|
|
87
|
+
someProp<PropName extends keyof EditorProps, Result>(propName: PropName, f: (value: NonNullable<EditorProps[PropName]>) => Result): Result | undefined;
|
|
88
|
+
someProp<PropName extends keyof EditorProps>(propName: PropName): NonNullable<EditorProps[PropName]> | undefined;
|
|
89
|
+
destroy(): void;
|
|
90
|
+
/**
|
|
91
|
+
* Commit effects by appling the pending props and state.
|
|
92
|
+
*
|
|
93
|
+
* Ensures the DOM selection is correct and updates plugin views.
|
|
94
|
+
*
|
|
95
|
+
* @privateRemarks
|
|
96
|
+
*
|
|
97
|
+
* The correctness of this depends on the pure update function ensuring that
|
|
98
|
+
* the node view set is up to date so that it does not try to redraw.
|
|
99
|
+
*/
|
|
100
|
+
commitPendingEffects(): void;
|
|
101
|
+
}
|
|
102
|
+
export {};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { EditorState } from "prosemirror-state";
|
|
2
|
+
import { DirectEditorProps, EditorProps } from "prosemirror-view";
|
|
3
|
+
import { AbstractEditorView, NodeViewSet } from "./AbstractEditorView.js";
|
|
4
|
+
export declare class StaticEditorView implements AbstractEditorView {
|
|
5
|
+
props: DirectEditorProps;
|
|
6
|
+
readonly nodeViews: NodeViewSet;
|
|
7
|
+
constructor(props: DirectEditorProps);
|
|
8
|
+
get composing(): boolean;
|
|
9
|
+
get dom(): null;
|
|
10
|
+
get editable(): boolean;
|
|
11
|
+
get state(): EditorState;
|
|
12
|
+
get isDestroyed(): boolean;
|
|
13
|
+
setProps(props: Partial<DirectEditorProps>): void;
|
|
14
|
+
update(props: DirectEditorProps): void;
|
|
15
|
+
updateState(state: EditorState): void;
|
|
16
|
+
someProp<PropName extends keyof EditorProps, Result>(propName: PropName, f: (value: NonNullable<EditorProps[PropName]>) => Result): Result | undefined;
|
|
17
|
+
someProp<PropName extends keyof EditorProps>(propName: PropName): NonNullable<EditorProps[PropName]> | undefined;
|
|
18
|
+
destroy(): void;
|
|
19
|
+
domSelectionRange(): {
|
|
20
|
+
anchorNode: null;
|
|
21
|
+
anchorOffset: number;
|
|
22
|
+
focusNode: null;
|
|
23
|
+
focusOffset: number;
|
|
24
|
+
};
|
|
25
|
+
domSelection(): null;
|
|
26
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export declare const browser: {
|
|
2
|
+
ie: boolean;
|
|
3
|
+
ie_version: any;
|
|
4
|
+
gecko: boolean;
|
|
5
|
+
gecko_version: number | false;
|
|
6
|
+
chrome: boolean;
|
|
7
|
+
chrome_version: number;
|
|
8
|
+
safari: boolean;
|
|
9
|
+
ios: boolean;
|
|
10
|
+
mac: boolean;
|
|
11
|
+
windows: boolean;
|
|
12
|
+
android: boolean;
|
|
13
|
+
webkit: boolean;
|
|
14
|
+
webkit_version: number;
|
|
15
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Command, EditorState, Transaction } from "prosemirror-state";
|
|
2
|
+
import { EditorView } from "prosemirror-view";
|
|
3
|
+
/**
|
|
4
|
+
* Create a command function that reorders the adjacent nodes starting
|
|
5
|
+
* at the provided position.
|
|
6
|
+
*
|
|
7
|
+
* @param pos - The `start` position of the parent of the nodes being reordered
|
|
8
|
+
* @param order - The new order for the nodes, expressed as an array of indices. For
|
|
9
|
+
* example, to swap the first two nodes in a set of three, `order`
|
|
10
|
+
* would be set to `[1, 0, 2]`. To move the first node to the end,
|
|
11
|
+
* and keep the other two in relative order, set `order` to `[1, 2, 0]`.
|
|
12
|
+
*/
|
|
13
|
+
export declare function reorderSiblings(pos: number, order: number[]): Command;
|
|
14
|
+
export declare function reorderSiblingsOnTransaction(pos: number, order: number[], tr: Transaction, state: EditorState, dispatch?: EditorView["dispatch"]): boolean;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Node } from "prosemirror-model";
|
|
2
|
+
import { Decoration, DecorationSource } from "prosemirror-view";
|
|
3
|
+
import React from "react";
|
|
4
|
+
export declare function wrapInDeco(reactNode: JSX.Element | string, deco: Decoration): React.DetailedReactHTMLElement<React.HTMLProps<HTMLElement>, HTMLElement> | React.FunctionComponentElement<any>;
|
|
5
|
+
export declare const ChildNodeViews: React.MemoExoticComponent<({ getPos, node, innerDecorations, }: {
|
|
6
|
+
getPos: () => number;
|
|
7
|
+
node: Node | undefined;
|
|
8
|
+
innerDecorations: DecorationSource;
|
|
9
|
+
}) => React.JSX.Element | null>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React, { ReactNode } from "react";
|
|
2
|
+
interface RegistrarProps {
|
|
3
|
+
children: ReactNode;
|
|
4
|
+
}
|
|
5
|
+
export declare function EditorStateSelectorsRegistrar({ children }: RegistrarProps): React.JSX.Element;
|
|
6
|
+
interface ProviderProps {
|
|
7
|
+
children: JSX.Element | null;
|
|
8
|
+
}
|
|
9
|
+
export declare function EditorStateSelectorsProvider({ children }: ProviderProps): JSX.Element | null;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
export interface LayoutGroupProps {
|
|
3
|
+
children: React.ReactNode;
|
|
4
|
+
}
|
|
5
|
+
/**
|
|
6
|
+
* Provides a boundary for grouping layout effects.
|
|
7
|
+
*
|
|
8
|
+
* Descendant components can invoke the `useLayoutGroupEffect` hook to register
|
|
9
|
+
* effects that run after all descendants within the group have processed their
|
|
10
|
+
* regular layout effects.
|
|
11
|
+
*/
|
|
12
|
+
export declare function LayoutGroup({ children }: LayoutGroupProps): React.JSX.Element;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { DOMOutputSpec } from "prosemirror-model";
|
|
2
|
+
import React, { HTMLProps, ReactNode, Ref } from "react";
|
|
3
|
+
type Props = HTMLProps<HTMLElement> & {
|
|
4
|
+
outputSpec: DOMOutputSpec;
|
|
5
|
+
isMark?: boolean;
|
|
6
|
+
children?: ReactNode;
|
|
7
|
+
contentDOMRef: Ref<HTMLElement | null>;
|
|
8
|
+
};
|
|
9
|
+
declare const ForwardedOutputSpec: React.MemoExoticComponent<React.ForwardRefExoticComponent<Omit<Props, "ref"> & React.RefAttributes<HTMLElement>>>;
|
|
10
|
+
export { ForwardedOutputSpec as OutputSpec };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import React, { ComponentType, ReactNode } from "react";
|
|
2
|
+
import { UseEditorOptions } from "../hooks/useEditor.js";
|
|
3
|
+
import { MarkViewComponentProps } from "./marks/MarkViewComponentProps.js";
|
|
4
|
+
import { NodeViewComponentProps } from "./nodes/NodeViewComponentProps.js";
|
|
5
|
+
export type Props = UseEditorOptions & {
|
|
6
|
+
children?: ReactNode;
|
|
7
|
+
nodeViewComponents?: {
|
|
8
|
+
[nodeType: string]: ComponentType<NodeViewComponentProps>;
|
|
9
|
+
};
|
|
10
|
+
markViewComponents?: {
|
|
11
|
+
[markType: string]: ComponentType<MarkViewComponentProps>;
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
export declare function ProseMirror(props: Props): React.JSX.Element;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Node } from "prosemirror-model";
|
|
2
|
+
import { Decoration, DecorationSource } from "prosemirror-view";
|
|
3
|
+
import React, { ElementType, HTMLProps } from "react";
|
|
4
|
+
export interface DocNodeViewContextValue {
|
|
5
|
+
node: Node;
|
|
6
|
+
getPos: () => number;
|
|
7
|
+
decorations: readonly Decoration[];
|
|
8
|
+
innerDecorations: DecorationSource;
|
|
9
|
+
setMount: (mount: HTMLElement | null) => void;
|
|
10
|
+
}
|
|
11
|
+
export declare const DocNodeViewContext: React.Context<DocNodeViewContextValue>;
|
|
12
|
+
interface Props extends Omit<HTMLProps<HTMLElement>, "as"> {
|
|
13
|
+
as?: ElementType;
|
|
14
|
+
}
|
|
15
|
+
export declare const ProseMirrorDoc: React.ForwardRefExoticComponent<Omit<Props, "ref"> & React.RefAttributes<HTMLElement>>;
|
|
16
|
+
export {};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { Node } from "prosemirror-model";
|
|
2
|
+
import { Decoration } from "prosemirror-view";
|
|
3
|
+
import { Component, MutableRefObject } from "react";
|
|
4
|
+
import { AbstractEditorView } from "../AbstractEditorView.js";
|
|
5
|
+
import { TextViewDesc, ViewDesc } from "../viewdesc.js";
|
|
6
|
+
type Props = {
|
|
7
|
+
view: AbstractEditorView;
|
|
8
|
+
node: Node;
|
|
9
|
+
getPos: () => number;
|
|
10
|
+
siblingsRef: MutableRefObject<ViewDesc[]>;
|
|
11
|
+
parentRef: MutableRefObject<ViewDesc | undefined>;
|
|
12
|
+
decorations: readonly Decoration[];
|
|
13
|
+
};
|
|
14
|
+
export declare class TextNodeView extends Component<Props> {
|
|
15
|
+
viewDescRef: MutableRefObject<TextViewDesc | null>;
|
|
16
|
+
create(): TextViewDesc | null;
|
|
17
|
+
update(): boolean;
|
|
18
|
+
destroy(): void;
|
|
19
|
+
updateEffect(): void;
|
|
20
|
+
shouldComponentUpdate(nextProps: Props): boolean;
|
|
21
|
+
constructor(props: Props);
|
|
22
|
+
componentDidMount(): void;
|
|
23
|
+
componentDidUpdate(): void;
|
|
24
|
+
componentWillUnmount(): void;
|
|
25
|
+
render(): JSX.Element;
|
|
26
|
+
}
|
|
27
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { ReactWidgetDecoration } from "../decorations/ReactWidgetType.js";
|
|
3
|
+
type Props = {
|
|
4
|
+
widget: ReactWidgetDecoration;
|
|
5
|
+
getPos: () => number;
|
|
6
|
+
};
|
|
7
|
+
export declare function WidgetView({ widget, getPos }: Props): React.JSX.Element;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { AllHTMLAttributes, LegacyRef } from "react";
|
|
2
|
+
import { ReactWidgetDecoration } from "../decorations/ReactWidgetType.js";
|
|
3
|
+
export type WidgetViewComponentProps<Attributes = AllHTMLAttributes<HTMLElement>> = Attributes & {
|
|
4
|
+
widget: ReactWidgetDecoration;
|
|
5
|
+
getPos: () => number;
|
|
6
|
+
ref: LegacyRef<any>;
|
|
7
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import "@wdio/types";
|
|
2
|
+
declare global {
|
|
3
|
+
namespace WebdriverIO {
|
|
4
|
+
interface Browser {
|
|
5
|
+
imeSetComposition(params: {
|
|
6
|
+
text: string;
|
|
7
|
+
selectionStart?: number;
|
|
8
|
+
selectionEnd?: number;
|
|
9
|
+
replacementStart?: number;
|
|
10
|
+
replacementEnd?: number;
|
|
11
|
+
}): Promise<void>;
|
|
12
|
+
imeInsertText(params: {
|
|
13
|
+
text: string;
|
|
14
|
+
}): Promise<void>;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The `stableContexts` option relies on a `useSyncExternalStore` consumer
|
|
3
|
+
* landing in the same commit as its parent's state update when the store is
|
|
4
|
+
* notified inside flushSync. The pure-React cases pin that down; the editor
|
|
5
|
+
* cases are the invariants the option must keep, run with it off and on.
|
|
6
|
+
*/
|
|
7
|
+
declare global {
|
|
8
|
+
var IS_REACT_ACT_ENVIRONMENT: boolean | undefined;
|
|
9
|
+
}
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Mark } from "prosemirror-model";
|
|
2
|
+
import React, { ReactNode } from "react";
|
|
3
|
+
type Props = {
|
|
4
|
+
mark: Mark;
|
|
5
|
+
inline: boolean;
|
|
6
|
+
getPos: () => number;
|
|
7
|
+
children: ReactNode;
|
|
8
|
+
};
|
|
9
|
+
export declare const MarkView: React.MemoExoticComponent<(props: Props) => React.JSX.Element>;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Mark } from "prosemirror-model";
|
|
2
|
+
import { AllHTMLAttributes, LegacyRef, Ref } from "react";
|
|
3
|
+
export type MarkViewComponentProps<Attributes = AllHTMLAttributes<HTMLElement>> = Attributes & {
|
|
4
|
+
markProps: {
|
|
5
|
+
mark: Mark;
|
|
6
|
+
inline: boolean;
|
|
7
|
+
getPos: () => number;
|
|
8
|
+
contentDOMRef: Exclude<Ref<any>, null>;
|
|
9
|
+
};
|
|
10
|
+
ref: LegacyRef<any>;
|
|
11
|
+
};
|
|
@@ -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 MarkViewConstructorView: React.MemoExoticComponent<({ constructor, mark, inline, getPos, children, }: Props) => React.JSX.Element>;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Mark } from "prosemirror-model";
|
|
2
|
+
import React, { ComponentType, ReactNode } from "react";
|
|
3
|
+
import { MarkViewComponentProps } from "./MarkViewComponentProps.js";
|
|
4
|
+
interface Props {
|
|
5
|
+
component: ComponentType<MarkViewComponentProps>;
|
|
6
|
+
mark: Mark;
|
|
7
|
+
getPos: () => number;
|
|
8
|
+
inline: boolean;
|
|
9
|
+
children: ReactNode;
|
|
10
|
+
}
|
|
11
|
+
export declare const ReactMarkView: React.MemoExoticComponent<({ component: Component, mark, inline, getPos, children, }: Props) => React.JSX.Element>;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Node } from "prosemirror-model";
|
|
2
|
+
import { Decoration, DecorationSource } from "prosemirror-view";
|
|
3
|
+
import React, { ElementType, HTMLProps } from "react";
|
|
4
|
+
export interface DocNodeViewProps extends Omit<HTMLProps<HTMLElement>, "as"> {
|
|
5
|
+
as?: ElementType;
|
|
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,14 @@
|
|
|
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
|
+
forceRemount: () => void;
|
|
10
|
+
};
|
|
11
|
+
export declare const NodeView: React.MemoExoticComponent<({ forceRemount, ...props }: Props) => JSX.Element | null>;
|
|
12
|
+
export declare const GetPosContext: React.Context<() => number>;
|
|
13
|
+
export declare function RemountableNodeView(props: Omit<Props, "forceRemount">): React.JSX.Element;
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Node } from "prosemirror-model";
|
|
2
|
+
import { Decoration, DecorationSource } from "prosemirror-view";
|
|
3
|
+
import { AllHTMLAttributes, LegacyRef, Ref } from "react";
|
|
4
|
+
export type NodeViewComponentProps<Attributes = AllHTMLAttributes<HTMLElement>> = Attributes & {
|
|
5
|
+
nodeProps: {
|
|
6
|
+
decorations: readonly Decoration[];
|
|
7
|
+
innerDecorations: DecorationSource;
|
|
8
|
+
node: Node;
|
|
9
|
+
getPos: () => number;
|
|
10
|
+
contentDOMRef: Exclude<Ref<any>, null>;
|
|
11
|
+
};
|
|
12
|
+
ref: LegacyRef<any>;
|
|
13
|
+
};
|
|
@@ -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 NodeViewConstructorView: React.MemoExoticComponent<({ constructor, node, getPos, innerDeco, outerDeco, }: Props) => React.FunctionComponentElement<any>>;
|
|
12
|
+
export {};
|
|
@@ -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 "../nodes/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.MemoExoticComponent<({ component: Component, outerDeco, getPos, node, innerDeco, }: Props) => React.JSX.Element>;
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { MutableRefObject } from "react";
|
|
2
|
+
import { ViewDesc } from "../viewdesc.js";
|
|
3
|
+
export type ChildDescriptionsContextValue = {
|
|
4
|
+
parentRef: MutableRefObject<ViewDesc | undefined>;
|
|
5
|
+
siblingsRef: MutableRefObject<ViewDesc[]>;
|
|
6
|
+
};
|
|
7
|
+
export declare const ChildDescriptionsContext: import("react").Context<ChildDescriptionsContextValue>;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { DOMEventMap } from "prosemirror-view";
|
|
2
|
+
import { MutableRefObject } from "react";
|
|
3
|
+
import { AbstractEditorView } from "../AbstractEditorView.js";
|
|
4
|
+
import type { EventHandler } from "../hooks/useComponentEventListeners.js";
|
|
5
|
+
export interface EditorContextValue {
|
|
6
|
+
view: AbstractEditorView;
|
|
7
|
+
flushSyncRef: MutableRefObject<boolean>;
|
|
8
|
+
registerEventListener<EventType extends keyof DOMEventMap>(eventType: EventType, handler: EventHandler<EventType>): void;
|
|
9
|
+
unregisterEventListener<EventType extends keyof DOMEventMap>(eventType: EventType, handler: EventHandler<EventType>): void;
|
|
10
|
+
isStatic: boolean;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Provides the EditorView, as well as the current
|
|
14
|
+
* EditorState. Should not be consumed directly; instead
|
|
15
|
+
* see `useEditorState`, `useEditorViewEvent`, and
|
|
16
|
+
* `useEditorViewLayoutEffect`.
|
|
17
|
+
*/
|
|
18
|
+
export declare const EditorContext: import("react").Context<EditorContextValue>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { EditorState } from "prosemirror-state";
|
|
2
|
+
export interface EditorStateStore {
|
|
3
|
+
getState: () => EditorState;
|
|
4
|
+
subscribe: (listener: () => void) => () => void;
|
|
5
|
+
setState: (state: EditorState) => void;
|
|
6
|
+
notifyListeners: () => void;
|
|
7
|
+
}
|
|
8
|
+
export declare function createEditorStateStore(): EditorStateStore;
|
|
9
|
+
export declare const EditorStateStoreContext: import("react").Context<EditorStateStore>;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { MarkView, NodeView, ViewMutationRecord } from "prosemirror-view";
|
|
2
|
+
export type IgnoreMutation = (this: NodeView | MarkView, mutation: ViewMutationRecord) => boolean;
|
|
3
|
+
type IgnoreMutationtContextValue = (ignoreMutation: IgnoreMutation) => void;
|
|
4
|
+
export declare const IgnoreMutationContext: import("react").Context<IgnoreMutationtContextValue>;
|
|
5
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ComponentType } from "react";
|
|
2
|
+
import { NodeViewSet } from "../AbstractEditorView.js";
|
|
3
|
+
import { MarkViewComponentProps } from "../components/marks/MarkViewComponentProps.js";
|
|
4
|
+
import { NodeViewComponentProps } from "../components/nodes/NodeViewComponentProps.js";
|
|
5
|
+
export type NodeViewContextValue = {
|
|
6
|
+
components: Record<string, ComponentType<NodeViewComponentProps> | ComponentType<MarkViewComponentProps>>;
|
|
7
|
+
constructors: NodeViewSet;
|
|
8
|
+
};
|
|
9
|
+
export declare const NodeViewContext: import("react").Context<NodeViewContextValue>;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { EditorState } from "prosemirror-state";
|
|
2
|
+
import type { DocNodeViewContextValue } from "../components/ProseMirrorDoc.js";
|
|
3
|
+
/**
|
|
4
|
+
* Backs the `stableContexts` option. With it on, EditorStateContext and
|
|
5
|
+
* DocNodeViewContext keep their values across a transaction dispatched
|
|
6
|
+
* through flushSync, so React does not scan every memoised node view for
|
|
7
|
+
* their consumers. The consumers subscribe here instead: `announce` runs
|
|
8
|
+
* inside that flushSync, before React renders, so they re-render in the same
|
|
9
|
+
* commit as the doc and read the values ProseMirrorInner wrote during its
|
|
10
|
+
* render.
|
|
11
|
+
*/
|
|
12
|
+
export interface RenderStore {
|
|
13
|
+
state: EditorState | null;
|
|
14
|
+
doc: DocNodeViewContextValue | null;
|
|
15
|
+
/** Set by `announce`, consumed by the next ProseMirrorInner render. */
|
|
16
|
+
announced: boolean;
|
|
17
|
+
getVersion: () => number;
|
|
18
|
+
subscribe: (listener: () => void) => () => void;
|
|
19
|
+
announce: () => void;
|
|
20
|
+
}
|
|
21
|
+
export declare const createRenderStore: () => RenderStore;
|
|
22
|
+
export declare const RenderStoreContext: import("react").Context<RenderStore | null>;
|
|
23
|
+
/** Subscribes to announced transactions; null when `stableContexts` is off. */
|
|
24
|
+
export declare const useRenderStore: () => RenderStore | null;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export type SelectNode = () => void;
|
|
2
|
+
export type DeselectNode = () => void;
|
|
3
|
+
type SelectNodeContextValue = (selectNode: SelectNode, deselectNode: DeselectNode) => void;
|
|
4
|
+
export declare const SelectNodeContext: import("react").Context<SelectNodeContextValue>;
|
|
5
|
+
export {};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { NodeView } from "prosemirror-view";
|
|
2
|
+
export type StopEvent = (event: Event) => boolean;
|
|
3
|
+
type StopEventContextValue = (stopEvent: (this: NodeView, event: Event) => boolean) => void;
|
|
4
|
+
export declare const StopEventContext: import("react").Context<StopEventContextValue>;
|
|
5
|
+
export {};
|