diff --git a/types/prosemirror-view/index.d.ts b/types/prosemirror-view/index.d.ts index 3a367b8e81..b3a5c9156e 100644 --- a/types/prosemirror-view/index.d.ts +++ b/types/prosemirror-view/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for prosemirror-view 1.9 +// Type definitions for prosemirror-view 1.11 // Project: https://github.com/ProseMirror/prosemirror-view // Definitions by: Bradley Ayers // David Hahn @@ -234,6 +234,10 @@ export class EditorView { * should not directly interfere with its content.) */ dom: Element; + /** + * Indicates whether the editor is currently [editable](#view.EditorProps.editable). + */ + editable: boolean; /** * When editor content is being dragged, this object contains * information about the dragged slice and whether it is being @@ -546,7 +550,7 @@ export interface EditorProps { [name: string]: ( node: ProsemirrorNode, view: EditorView, - getPos: () => number, + getPos: (() => number) | boolean, decorations: Decoration[] ) => NodeView; } | null; @@ -683,11 +687,17 @@ export interface NodeView { /** * Called when a DOM * [mutation](https://developer.mozilla.org/en-US/docs/Web/API/MutationObserver) - * happens within the view. Return false if the editor should + * or a selection change happens within the view. When the change is + * a selection change, the record will have a `type` property of + * `"selection"` (which doesn't occur for native mutation records). + * Return false if the editor should re-read the selection or * re-parse the range around the mutation, true if it can safely be * ignored. */ - ignoreMutation?: ((p: MutationRecord) => boolean) | null; + ignoreMutation?: ((p: MutationRecord | { + type: 'selection'; + target: Element; + }) => boolean) | null; /** * Called when the node view is removed from the editor or the whole * editor is destroyed.