Skip to content

Instantly share code, notes, and snippets.

@grindpride
Created April 2, 2020 11:46
Show Gist options
  • Save grindpride/ce8a7b7d94f8c8d797262dc278607682 to your computer and use it in GitHub Desktop.
Save grindpride/ce8a7b7d94f8c8d797262dc278607682 to your computer and use it in GitHub Desktop.
declare module 'tiptap-commands' {
import { EditorView } from "prosemirror-view";
import { Transaction, EditorState, Plugin } from "prosemirror-state";
import { InputRule } from "prosemirror-inputrules";
import { NodeType, MarkType } from "prosemirror-model";
export interface DispatchFn {
(tr: Transaction): boolean
}
export interface Command {
(...params: any[]): CommandFunction;
}
export interface CommandFunction {
(state: EditorState, dispatch: DispatchFn | undefined, view: EditorView): boolean;
}
export function toggleWrap(type: NodeType): Command
export function wrappingInputRule(
regexp: RegExp,
nodeType: NodeType,
getAttrs?: (arg: {} | string[]) => object | undefined,
joinPredicate?: (strs: string[], node: Node) => boolean
): InputRule
export function toggleMark(type: MarkType, attrs?: { [key: string]: any }): Command
export function pasteRule(regexp: RegExp, type: string, getAttrs: (() => { [key: string]: any }) | { [key: string]: any }): Plugin;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment