@handlewithcare/react-prosemirror 2.4.12 → 2.5.0
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/AbstractEditorView.js +4 -0
- package/dist/cjs/ReactEditorView.js +156 -0
- package/dist/cjs/StaticEditorView.js +86 -0
- package/dist/cjs/components/ChildNodeViews.js +59 -30
- package/dist/cjs/components/CustomNodeView.js +9 -25
- package/dist/cjs/components/DocNodeView.js +6 -15
- package/dist/cjs/components/MarkView.js +1 -2
- package/dist/cjs/components/NativeWidgetView.js +2 -3
- package/dist/cjs/components/NodeView.js +1 -1
- package/dist/cjs/components/ProseMirror.js +11 -14
- package/dist/cjs/components/ReactNodeView.js +3 -4
- package/dist/cjs/components/SeparatorHackView.js +1 -2
- package/dist/cjs/components/TextNodeView.js +4 -5
- package/dist/cjs/components/TrailingHackView.js +1 -2
- package/dist/cjs/components/WidgetView.js +2 -4
- package/dist/cjs/constants.js +33 -0
- package/dist/cjs/hooks/useEditor.js +32 -228
- package/dist/cjs/hooks/useEditorEffect.js +2 -2
- package/dist/cjs/hooks/useEditorEventCallback.js +8 -5
- package/dist/cjs/hooks/useNodeViewDescriptor.js +10 -10
- package/dist/cjs/hooks/useReactKeys.js +1 -1
- package/dist/cjs/testing/editorViewTestHelpers.js +0 -2
- package/dist/cjs/viewdesc.js +10 -9
- package/dist/esm/AbstractEditorView.js +1 -0
- package/dist/esm/ReactEditorView.js +156 -0
- package/dist/esm/StaticEditorView.js +76 -0
- package/dist/esm/components/ChildNodeViews.js +60 -32
- package/dist/esm/components/CustomNodeView.js +9 -25
- package/dist/esm/components/DocNodeView.js +6 -15
- package/dist/esm/components/MarkView.js +1 -2
- package/dist/esm/components/NativeWidgetView.js +2 -3
- package/dist/esm/components/NodeView.js +1 -1
- package/dist/esm/components/ProseMirror.js +11 -14
- package/dist/esm/components/ReactNodeView.js +3 -4
- package/dist/esm/components/SeparatorHackView.js +1 -2
- package/dist/esm/components/TextNodeView.js +4 -5
- package/dist/esm/components/TrailingHackView.js +1 -2
- package/dist/esm/components/WidgetView.js +2 -4
- package/dist/esm/constants.js +15 -0
- package/dist/esm/hooks/useEditor.js +28 -217
- package/dist/esm/hooks/useEditorEffect.js +2 -2
- package/dist/esm/hooks/useEditorEventCallback.js +8 -5
- package/dist/esm/hooks/useNodeViewDescriptor.js +10 -10
- package/dist/esm/hooks/useReactKeys.js +1 -1
- package/dist/esm/testing/editorViewTestHelpers.js +0 -2
- package/dist/esm/viewdesc.js +3 -2
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types/AbstractEditorView.d.ts +27 -0
- package/dist/types/ReactEditorView.d.ts +79 -0
- package/dist/types/StaticEditorView.d.ts +24 -0
- package/dist/types/components/ChildNodeViews.d.ts +2 -2
- package/dist/types/components/CustomNodeView.d.ts +2 -2
- package/dist/types/components/DocNodeView.d.ts +2 -5
- package/dist/types/components/MarkView.d.ts +2 -2
- package/dist/types/components/NativeWidgetView.d.ts +2 -2
- package/dist/types/components/NodeView.d.ts +2 -2
- package/dist/types/components/ReactNodeView.d.ts +2 -2
- package/dist/types/components/SeparatorHackView.d.ts +2 -2
- package/dist/types/components/TextNodeView.d.ts +4 -3
- package/dist/types/components/TrailingHackView.d.ts +2 -2
- package/dist/types/components/WidgetView.d.ts +2 -2
- package/dist/types/constants.d.ts +4 -0
- package/dist/types/contexts/EditorContext.d.ts +6 -4
- package/dist/types/decorations/computeDocDeco.d.ts +3 -2
- package/dist/types/decorations/viewDecorations.d.ts +3 -2
- package/dist/types/hooks/useEditor.d.ts +5 -46
- package/dist/types/hooks/useNodeViewDescriptor.d.ts +1 -1
- package/dist/types/hooks/useReactKeys.d.ts +1 -1
- package/dist/types/props.d.ts +3 -3
- package/dist/types/viewdesc.d.ts +6 -5
- package/package.json +6 -2
- package/dist/cjs/components/Editor.js +0 -28
- package/dist/cjs/components/NodeViews.js +0 -73
- package/dist/cjs/components/__tests__/LayoutGroup.test.js +0 -141
- package/dist/cjs/components/__tests__/ProseMirror.test.js +0 -255
- package/dist/cjs/contexts/NodeViewsContext.js +0 -10
- package/dist/cjs/hooks/__tests__/useEditorViewLayoutEffect.test.js +0 -107
- package/dist/cjs/hooks/__tests__/useNodeViews.test.js +0 -159
- package/dist/cjs/hooks/useEditorView.js +0 -100
- package/dist/cjs/hooks/useNodePos.js +0 -69
- package/dist/cjs/hooks/useNodeViews.js +0 -100
- package/dist/cjs/nodeViews/createReactNodeViewConstructor.js +0 -244
- package/dist/cjs/nodeViews/phrasingContentTags.js +0 -57
- package/dist/cjs/plugins/__tests__/react.test.js +0 -139
- package/dist/cjs/plugins/react.js +0 -71
- package/dist/cjs/selection/SelectionDOMObserver.js +0 -171
- package/dist/cjs/selection/hasFocusAndSelection.js +0 -35
- package/dist/cjs/selection/selectionFromDOM.js +0 -77
- package/dist/cjs/selection/selectionToDOM.js +0 -226
- package/dist/cjs/ssr.js +0 -85
- package/dist/esm/components/Editor.js +0 -15
- package/dist/esm/components/NodeViews.js +0 -26
- package/dist/esm/components/__tests__/LayoutGroup.test.js +0 -98
- package/dist/esm/components/__tests__/ProseMirror.test.js +0 -207
- package/dist/esm/contexts/NodeViewsContext.js +0 -9
- package/dist/esm/hooks/__tests__/useEditorViewLayoutEffect.test.js +0 -98
- package/dist/esm/hooks/__tests__/useNodeViews.test.js +0 -116
- package/dist/esm/hooks/useEditorView.js +0 -99
- package/dist/esm/hooks/useNodePos.js +0 -16
- package/dist/esm/hooks/useNodeViews.js +0 -53
- package/dist/esm/nodeViews/createReactNodeViewConstructor.js +0 -214
- package/dist/esm/nodeViews/phrasingContentTags.js +0 -49
- package/dist/esm/plugins/__tests__/react.test.js +0 -135
- package/dist/esm/plugins/react.js +0 -64
- package/dist/esm/selection/SelectionDOMObserver.js +0 -161
- package/dist/esm/selection/hasFocusAndSelection.js +0 -17
- package/dist/esm/selection/selectionFromDOM.js +0 -59
- package/dist/esm/selection/selectionToDOM.js +0 -196
- package/dist/esm/ssr.js +0 -82
- package/dist/types/components/Editor.d.ts +0 -7
- package/dist/types/components/NodeViews.d.ts +0 -6
- package/dist/types/components/__tests__/LayoutGroup.test.d.ts +0 -1
- package/dist/types/contexts/NodeViewsContext.d.ts +0 -19
- package/dist/types/hooks/__tests__/useEditorViewLayoutEffect.test.d.ts +0 -1
- package/dist/types/hooks/__tests__/useNodeViews.test.d.ts +0 -1
- package/dist/types/hooks/useEditorView.d.ts +0 -23
- package/dist/types/hooks/useNodePos.d.ts +0 -9
- package/dist/types/hooks/useNodeViews.d.ts +0 -5
- package/dist/types/nodeViews/createReactNodeViewConstructor.d.ts +0 -48
- package/dist/types/nodeViews/phrasingContentTags.d.ts +0 -1
- package/dist/types/plugins/__tests__/react.test.d.ts +0 -1
- package/dist/types/plugins/react.d.ts +0 -21
- package/dist/types/selection/SelectionDOMObserver.d.ts +0 -33
- package/dist/types/selection/hasFocusAndSelection.d.ts +0 -3
- package/dist/types/selection/selectionFromDOM.d.ts +0 -4
- package/dist/types/selection/selectionToDOM.d.ts +0 -9
- package/dist/types/ssr.d.ts +0 -19
package/dist/esm/ssr.js
DELETED
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
/* eslint-disable @typescript-eslint/no-empty-function */ /**
|
|
2
|
-
* @fileoverview
|
|
3
|
-
*
|
|
4
|
-
* Stubs for ProseMirror View during SSR. These are extremely
|
|
5
|
-
* barebones, because they _do not need to actually work_. They
|
|
6
|
-
* just need to prevent errors from being thrown when ProseMirror
|
|
7
|
-
* View attemps to access these APIs while constructing the
|
|
8
|
-
* initial EditorView. None of these APIs are necessary for SSR to
|
|
9
|
-
* work properly, so it's fine that they're all no-ops.
|
|
10
|
-
*/ let ClassList = class ClassList {
|
|
11
|
-
add() {}
|
|
12
|
-
remove() {}
|
|
13
|
-
};
|
|
14
|
-
let ElementStub = class ElementStub {
|
|
15
|
-
get parent() {
|
|
16
|
-
return new ElementStub();
|
|
17
|
-
}
|
|
18
|
-
get parentNode() {
|
|
19
|
-
return new ElementStub();
|
|
20
|
-
}
|
|
21
|
-
nodeName = "div";
|
|
22
|
-
appendChild() {
|
|
23
|
-
return new ElementStub();
|
|
24
|
-
}
|
|
25
|
-
setAttribute() {}
|
|
26
|
-
hasAttribute() {
|
|
27
|
-
return false;
|
|
28
|
-
}
|
|
29
|
-
insertBefore() {}
|
|
30
|
-
get classList() {
|
|
31
|
-
return new ClassList();
|
|
32
|
-
}
|
|
33
|
-
get ownerDocument() {
|
|
34
|
-
return new DocumentStub();
|
|
35
|
-
}
|
|
36
|
-
style = {};
|
|
37
|
-
addEventListener() {}
|
|
38
|
-
removeEventListener() {}
|
|
39
|
-
replaceChildren() {}
|
|
40
|
-
};
|
|
41
|
-
let DocumentStub = class DocumentStub {
|
|
42
|
-
createElement() {
|
|
43
|
-
return new ElementStub();
|
|
44
|
-
}
|
|
45
|
-
addEventListener() {}
|
|
46
|
-
removeEventListener() {}
|
|
47
|
-
get documentElement() {
|
|
48
|
-
return new ElementStub();
|
|
49
|
-
}
|
|
50
|
-
};
|
|
51
|
-
/**
|
|
52
|
-
* Sets up tiny no-op stubs for the global window and document.
|
|
53
|
-
* These are used to prevent errors from being thrown when ProseMirror's
|
|
54
|
-
* EditorView attempts to access the DOM in its constructor during SSR.
|
|
55
|
-
*
|
|
56
|
-
* Returns a cleanup function that resets the window and document back
|
|
57
|
-
* to their original values (undefined).
|
|
58
|
-
*/ export function setSsrStubs() {
|
|
59
|
-
const prevWindow = globalThis.window;
|
|
60
|
-
// @ts-expect-error HACK - EditorView checks for window.MutationObserver
|
|
61
|
-
// in its constructor, which breaks SSR. We temporarily set window
|
|
62
|
-
// to an empty object to prevent an error from being thrown, and then
|
|
63
|
-
// clean it up so that other isomorphic code doesn't get confused about
|
|
64
|
-
// whether there's a functioning global window object
|
|
65
|
-
globalThis.window ??= {
|
|
66
|
-
visualViewport: null
|
|
67
|
-
};
|
|
68
|
-
const prevDocument = globalThis.document;
|
|
69
|
-
// @ts-expect-error HACK: This is only used during SSR, and only
|
|
70
|
-
// to prevent outright errors when ProseMirror View attempts to
|
|
71
|
-
// access document properties either on import or when constructing
|
|
72
|
-
// the EditorView.
|
|
73
|
-
globalThis.document ??= new DocumentStub();
|
|
74
|
-
return function cleanupSsrStubs() {
|
|
75
|
-
if (globalThis.window !== prevWindow) {
|
|
76
|
-
globalThis.window = prevWindow;
|
|
77
|
-
}
|
|
78
|
-
if (globalThis.document !== prevDocument) {
|
|
79
|
-
globalThis.document = prevDocument;
|
|
80
|
-
}
|
|
81
|
-
};
|
|
82
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import type { ReactNode } from "react";
|
|
2
|
-
import type { UseEditorViewOptions } from "../hooks/useEditorView.js";
|
|
3
|
-
export interface EditorProps extends UseEditorViewOptions {
|
|
4
|
-
mount: HTMLElement | null;
|
|
5
|
-
children?: ReactNode | null;
|
|
6
|
-
}
|
|
7
|
-
export declare function Editor({ mount, children, ...options }: EditorProps): JSX.Element;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import type { ReactPortal } from "react";
|
|
2
|
-
import type { NodeKey } from "../plugins/react";
|
|
3
|
-
type NodeViewRegistration = {
|
|
4
|
-
getPos: () => number;
|
|
5
|
-
portal: ReactPortal;
|
|
6
|
-
};
|
|
7
|
-
export interface NodeViewsContextValue {
|
|
8
|
-
[key: NodeKey]: NodeViewRegistration[];
|
|
9
|
-
}
|
|
10
|
-
/**
|
|
11
|
-
* A context containing a map of node view keys to portals.
|
|
12
|
-
*
|
|
13
|
-
* Each node view registers a portal under its parent's
|
|
14
|
-
* key. Each can then retrieve the list of portals under their
|
|
15
|
-
* key, allowing portals to be rendered with the appropriate
|
|
16
|
-
* hierarchy.
|
|
17
|
-
*/
|
|
18
|
-
export declare const NodeViewsContext: import("react").Context<NodeViewsContextValue>;
|
|
19
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { EditorState } from "prosemirror-state";
|
|
2
|
-
import type { Plugin, Transaction } from "prosemirror-state";
|
|
3
|
-
import { EditorView } from "prosemirror-view";
|
|
4
|
-
import type { EditorProps } from "prosemirror-view";
|
|
5
|
-
import type { EditorContextValue } from "../contexts/EditorContext.js";
|
|
6
|
-
import type { ReactNodeViewConstructor } from "../nodeViews/createReactNodeViewConstructor.js";
|
|
7
|
-
export interface UseEditorViewOptions extends EditorProps {
|
|
8
|
-
nodeViews?: Record<string, ReactNodeViewConstructor>;
|
|
9
|
-
defaultState?: EditorState;
|
|
10
|
-
state?: EditorState;
|
|
11
|
-
plugins?: Plugin[];
|
|
12
|
-
view?: EditorView | null;
|
|
13
|
-
dispatchTransaction?(this: EditorView, tr: Transaction): void;
|
|
14
|
-
}
|
|
15
|
-
/**
|
|
16
|
-
* Creates, mounts, and manages a ProseMirror `EditorView`.
|
|
17
|
-
*
|
|
18
|
-
* All state and props updates are executed in a layout effect.
|
|
19
|
-
* To ensure that the EditorState and EditorView are never out of
|
|
20
|
-
* sync, it's important that the EditorView produced by this hook
|
|
21
|
-
* is only accessed through the provided hooks.
|
|
22
|
-
*/
|
|
23
|
-
export declare function useEditorView<T extends HTMLElement = HTMLElement>(mount: T | null, options: UseEditorViewOptions): EditorContextValue;
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import type { ReactNode } from "react";
|
|
2
|
-
import type { NodeKey } from "../plugins/react.js";
|
|
3
|
-
type Props = {
|
|
4
|
-
nodeKey: NodeKey;
|
|
5
|
-
children: ReactNode;
|
|
6
|
-
};
|
|
7
|
-
export declare function NodePosProvider({ nodeKey, children }: Props): JSX.Element;
|
|
8
|
-
export declare function useNodePos(): number;
|
|
9
|
-
export {};
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import type { Node } from "prosemirror-model";
|
|
2
|
-
import type { Decoration, DecorationSource, EditorView, NodeView, NodeViewConstructor } from "prosemirror-view";
|
|
3
|
-
import type { ComponentType, ReactNode, ReactPortal } from "react";
|
|
4
|
-
import type { NodeKey } from "../plugins/react.js";
|
|
5
|
-
export interface NodeViewComponentProps {
|
|
6
|
-
decorations: readonly Decoration[];
|
|
7
|
-
node: Node;
|
|
8
|
-
children: ReactNode;
|
|
9
|
-
isSelected: boolean;
|
|
10
|
-
}
|
|
11
|
-
export type UnregisterElement = () => void;
|
|
12
|
-
export type RegisterPortal = (view: EditorView, getPos: () => number, portal: ReactPortal) => UnregisterElement;
|
|
13
|
-
export type ReactNodeView = NodeView & {
|
|
14
|
-
component?: ComponentType<NodeViewComponentProps>;
|
|
15
|
-
};
|
|
16
|
-
export type ReactNodeViewConstructor = (...args: Parameters<NodeViewConstructor>) => ReactNodeView;
|
|
17
|
-
/**
|
|
18
|
-
* Identifies a node view constructor as having been created
|
|
19
|
-
* by @nytimes/react-prosemirror
|
|
20
|
-
*/
|
|
21
|
-
export declare const REACT_NODE_VIEW: unique symbol;
|
|
22
|
-
/**
|
|
23
|
-
* Searches upward for the nearest node with a node key,
|
|
24
|
-
* returning the first node key it finds associated with
|
|
25
|
-
* a React node view.
|
|
26
|
-
*
|
|
27
|
-
* Returns the root key if no ancestor nodes have node keys.
|
|
28
|
-
*/
|
|
29
|
-
export declare function findNodeKeyUp(editorView: EditorView, pos: number): NodeKey;
|
|
30
|
-
/**
|
|
31
|
-
* Factory function for creating nodeViewConstructors that
|
|
32
|
-
* render as React components.
|
|
33
|
-
*
|
|
34
|
-
* `NodeView` can be any React component that takes
|
|
35
|
-
* `NodeViewComponentProps`. It will be passed all of the
|
|
36
|
-
* arguments to the `nodeViewConstructor` except for
|
|
37
|
-
* `editorView`. NodeView components that need access
|
|
38
|
-
* directly to the EditorView should use the
|
|
39
|
-
* `useEditorViewEvent` and `useEditorViewLayoutEffect`
|
|
40
|
-
* hooks to ensure safe access.
|
|
41
|
-
*
|
|
42
|
-
* For contentful Nodes, the NodeView component will also
|
|
43
|
-
* be passed a `children` prop containing an empty element.
|
|
44
|
-
* ProseMirror will render content nodes into this element.
|
|
45
|
-
*/
|
|
46
|
-
export declare function createReactNodeViewConstructor(nodeViewConstructor: ReactNodeViewConstructor, registerPortal: RegisterPortal): ((node: Node, editorView: EditorView, getPos: () => number, decorations: readonly Decoration[], innerDecorations: DecorationSource) => NodeView) & {
|
|
47
|
-
[REACT_NODE_VIEW]: boolean;
|
|
48
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const phrasingContentTags: string[];
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { Plugin, PluginKey } from "prosemirror-state";
|
|
2
|
-
/**
|
|
3
|
-
* This is a stand-in for the doc node itself, which doesn't have a
|
|
4
|
-
* unique position to map to.
|
|
5
|
-
*/
|
|
6
|
-
export declare const ROOT_NODE_KEY: unique symbol;
|
|
7
|
-
export type NodeKey = string | symbol;
|
|
8
|
-
export declare function createNodeKey(): string;
|
|
9
|
-
export type ReactPluginState = {
|
|
10
|
-
posToKey: Map<number, string>;
|
|
11
|
-
keyToPos: Map<NodeKey, number>;
|
|
12
|
-
};
|
|
13
|
-
export declare const reactPluginKey: PluginKey<ReactPluginState>;
|
|
14
|
-
/**
|
|
15
|
-
* Tracks a unique key for each (non-text) node in the
|
|
16
|
-
* document, identified by its current position. Keys are
|
|
17
|
-
* (mostly) stable across transaction applications. The
|
|
18
|
-
* key for a given node can be accessed by that node's
|
|
19
|
-
* current position in the document, and vice versa.
|
|
20
|
-
*/
|
|
21
|
-
export declare function react(): Plugin<ReactPluginState>;
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { EditorView } from "prosemirror-view";
|
|
2
|
-
import { DOMSelectionRange } from "../dom.js";
|
|
3
|
-
declare class SelectionState {
|
|
4
|
-
anchorNode: Node | null;
|
|
5
|
-
anchorOffset: number;
|
|
6
|
-
focusNode: Node | null;
|
|
7
|
-
focusOffset: number;
|
|
8
|
-
set(sel: DOMSelectionRange): void;
|
|
9
|
-
clear(): void;
|
|
10
|
-
eq(sel: DOMSelectionRange): boolean;
|
|
11
|
-
}
|
|
12
|
-
export declare class SelectionDOMObserver {
|
|
13
|
-
readonly view: EditorView;
|
|
14
|
-
flushingSoon: number;
|
|
15
|
-
currentSelection: SelectionState;
|
|
16
|
-
suppressingSelectionUpdates: boolean;
|
|
17
|
-
constructor(view: EditorView);
|
|
18
|
-
connectSelection(): void;
|
|
19
|
-
disconnectSelection(): void;
|
|
20
|
-
stop(): void;
|
|
21
|
-
start(): void;
|
|
22
|
-
suppressSelectionUpdates(): void;
|
|
23
|
-
setCurSelection(): void;
|
|
24
|
-
ignoreSelectionChange(sel: DOMSelectionRange): true | undefined;
|
|
25
|
-
registerMutation(): void;
|
|
26
|
-
flushSoon(): void;
|
|
27
|
-
updateSelection(): void;
|
|
28
|
-
selectionToDOM(): void;
|
|
29
|
-
flush(): void;
|
|
30
|
-
forceFlush(): void;
|
|
31
|
-
onSelectionChange(): void;
|
|
32
|
-
}
|
|
33
|
-
export {};
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import { ResolvedPos } from "prosemirror-model";
|
|
2
|
-
import { EditorView } from "prosemirror-view";
|
|
3
|
-
export declare function selectionBetween(view: EditorView, $anchor: ResolvedPos, $head: ResolvedPos, bias?: number): import("prosemirror-state").Selection;
|
|
4
|
-
export declare function selectionFromDOM(view: EditorView, origin?: string | null): import("prosemirror-state").Selection | null;
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { Selection } from "prosemirror-state";
|
|
2
|
-
import { EditorView } from "prosemirror-view";
|
|
3
|
-
export declare const isEquivalentPosition: (node: Node, off: number, targetNode: Node, targetOff: number) => boolean;
|
|
4
|
-
export declare function hasBlockDesc(dom: Node): boolean | null | undefined;
|
|
5
|
-
export declare const domIndex: (node: Node) => number;
|
|
6
|
-
export declare function nodeSize(node: Node): number;
|
|
7
|
-
export declare function syncNodeSelection(view: EditorView, sel: Selection): void;
|
|
8
|
-
export declare function hasSelection(view: EditorView): boolean;
|
|
9
|
-
export declare function selectionToDOM(view: EditorView, force?: boolean): void;
|
package/dist/types/ssr.d.ts
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @fileoverview
|
|
3
|
-
*
|
|
4
|
-
* Stubs for ProseMirror View during SSR. These are extremely
|
|
5
|
-
* barebones, because they _do not need to actually work_. They
|
|
6
|
-
* just need to prevent errors from being thrown when ProseMirror
|
|
7
|
-
* View attemps to access these APIs while constructing the
|
|
8
|
-
* initial EditorView. None of these APIs are necessary for SSR to
|
|
9
|
-
* work properly, so it's fine that they're all no-ops.
|
|
10
|
-
*/
|
|
11
|
-
/**
|
|
12
|
-
* Sets up tiny no-op stubs for the global window and document.
|
|
13
|
-
* These are used to prevent errors from being thrown when ProseMirror's
|
|
14
|
-
* EditorView attempts to access the DOM in its constructor during SSR.
|
|
15
|
-
*
|
|
16
|
-
* Returns a cleanup function that resets the window and document back
|
|
17
|
-
* to their original values (undefined).
|
|
18
|
-
*/
|
|
19
|
-
export declare function setSsrStubs(): () => void;
|