mirror of
https://github.com/ueberdosis/tiptap.git
synced 2025-01-18 06:03:22 +08:00
add command scope
This commit is contained in:
parent
87beee25b0
commit
ca8d1a4245
@ -14,9 +14,11 @@ export interface AnnotationOptions {
|
||||
}
|
||||
|
||||
declare module '@tiptap/core' {
|
||||
interface Commands {
|
||||
addAnnotation: (content: any) => Command,
|
||||
deleteAnnotation: (id: number) => Command,
|
||||
interface AllCommands {
|
||||
annotation: {
|
||||
addAnnotation: (content: any) => Command,
|
||||
deleteAnnotation: (id: number) => Command,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -8,11 +8,13 @@ export interface IframeOptions {
|
||||
}
|
||||
|
||||
declare module '@tiptap/core' {
|
||||
interface Commands {
|
||||
/**
|
||||
* Add an iframe
|
||||
*/
|
||||
setIframe: (options: { src: string }) => Command,
|
||||
interface AllCommands {
|
||||
iframe: {
|
||||
/**
|
||||
* Add an iframe
|
||||
*/
|
||||
setIframe: (options: { src: string }) => Command,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -35,7 +35,8 @@ export default class CommandManager {
|
||||
.entries(commands)
|
||||
.map(([name, command]) => {
|
||||
const method = (...args: any) => {
|
||||
const callback = command(...args)(props)
|
||||
// TODO: fix any
|
||||
const callback = command(...args as any)(props)
|
||||
|
||||
if (!tr.getMeta('preventDispatch')) {
|
||||
view.dispatch(tr)
|
||||
@ -85,7 +86,7 @@ export default class CommandManager {
|
||||
public createCan(startTr?: Transaction): CanCommands {
|
||||
const { commands, editor } = this
|
||||
const { state } = editor
|
||||
const dispatch = false
|
||||
const dispatch = undefined
|
||||
const tr = startTr || state.tr
|
||||
const props = this.buildProps(tr, dispatch)
|
||||
const formattedCommands = Object.fromEntries(Object
|
||||
@ -118,10 +119,14 @@ export default class CommandManager {
|
||||
: undefined,
|
||||
chain: () => this.createChain(tr),
|
||||
can: () => this.createCan(tr),
|
||||
// TODO: fix
|
||||
// @ts-ignore
|
||||
get commands() {
|
||||
return Object.fromEntries(Object
|
||||
.entries(commands)
|
||||
.map(([name, command]) => {
|
||||
// TODO: fix
|
||||
// @ts-ignore
|
||||
return [name, (...args: any[]) => command(...args)(props)]
|
||||
})) as SingleCommands
|
||||
},
|
||||
|
@ -1,11 +1,13 @@
|
||||
import { Command, Commands } from '../types'
|
||||
|
||||
declare module '@tiptap/core' {
|
||||
interface Commands {
|
||||
/**
|
||||
* Removes focus from the editor.
|
||||
*/
|
||||
blur: () => Command,
|
||||
interface AllCommands {
|
||||
blur: {
|
||||
/**
|
||||
* Removes focus from the editor.
|
||||
*/
|
||||
blur: () => Command,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,11 +1,13 @@
|
||||
import { Command, Commands } from '../types'
|
||||
|
||||
declare module '@tiptap/core' {
|
||||
interface Commands {
|
||||
/**
|
||||
* Clear the whole document.
|
||||
*/
|
||||
clearContent: (emitUpdate: Boolean) => Command,
|
||||
interface AllCommands {
|
||||
clearContent: {
|
||||
/**
|
||||
* Clear the whole document.
|
||||
*/
|
||||
clearContent: (emitUpdate: Boolean) => Command,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2,11 +2,13 @@ import { liftTarget } from 'prosemirror-transform'
|
||||
import { Command, Commands } from '../types'
|
||||
|
||||
declare module '@tiptap/core' {
|
||||
interface Commands {
|
||||
/**
|
||||
* Normalize nodes to a simple paragraph.
|
||||
*/
|
||||
clearNodes: () => Command,
|
||||
interface AllCommands {
|
||||
clearNodes: {
|
||||
/**
|
||||
* Normalize nodes to a simple paragraph.
|
||||
*/
|
||||
clearNodes: () => Command,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,11 +1,13 @@
|
||||
import { Command, Commands } from '../types'
|
||||
|
||||
declare module '@tiptap/core' {
|
||||
interface Commands {
|
||||
/**
|
||||
* Define a command inline.
|
||||
*/
|
||||
command: (fn: (props: Parameters<Command>[0]) => boolean) => Command,
|
||||
interface AllCommands {
|
||||
command: {
|
||||
/**
|
||||
* Define a command inline.
|
||||
*/
|
||||
command: (fn: (props: Parameters<Command>[0]) => boolean) => Command,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2,11 +2,13 @@ import { createParagraphNear as originalCreateParagraphNear } from 'prosemirror-
|
||||
import { Command, Commands } from '../types'
|
||||
|
||||
declare module '@tiptap/core' {
|
||||
interface Commands {
|
||||
/**
|
||||
* Create a paragraph nearby.
|
||||
*/
|
||||
createParagraphNear: () => Command,
|
||||
interface AllCommands {
|
||||
createParagraphNear: {
|
||||
/**
|
||||
* Create a paragraph nearby.
|
||||
*/
|
||||
createParagraphNear: () => Command,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,11 +1,13 @@
|
||||
import { Command, Commands, Range } from '../types'
|
||||
|
||||
declare module '@tiptap/core' {
|
||||
interface Commands {
|
||||
/**
|
||||
* Delete a given range.
|
||||
*/
|
||||
deleteRange: (range: Range) => Command,
|
||||
interface AllCommands {
|
||||
deleteRange: {
|
||||
/**
|
||||
* Delete a given range.
|
||||
*/
|
||||
deleteRange: (range: Range) => Command,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2,11 +2,13 @@ import { deleteSelection as originalDeleteSelection } from 'prosemirror-commands
|
||||
import { Command, Commands } from '../types'
|
||||
|
||||
declare module '@tiptap/core' {
|
||||
interface Commands {
|
||||
/**
|
||||
* Delete the selection, if there is one.
|
||||
*/
|
||||
deleteSelection: () => Command,
|
||||
interface AllCommands {
|
||||
deleteSelection: {
|
||||
/**
|
||||
* Delete the selection, if there is one.
|
||||
*/
|
||||
deleteSelection: () => Command,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,11 +1,13 @@
|
||||
import { Command, Commands } from '../types'
|
||||
|
||||
declare module '@tiptap/core' {
|
||||
interface Commands {
|
||||
/**
|
||||
* Trigger enter.
|
||||
*/
|
||||
enter: () => Command,
|
||||
interface AllCommands {
|
||||
enter: {
|
||||
/**
|
||||
* Trigger enter.
|
||||
*/
|
||||
enter: () => Command,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2,11 +2,13 @@ import { exitCode as originalExitCode } from 'prosemirror-commands'
|
||||
import { Command, Commands } from '../types'
|
||||
|
||||
declare module '@tiptap/core' {
|
||||
interface Commands {
|
||||
/**
|
||||
* Exit from a code block.
|
||||
*/
|
||||
exitCode: () => Command,
|
||||
interface AllCommands {
|
||||
exitCode: {
|
||||
/**
|
||||
* Exit from a code block.
|
||||
*/
|
||||
exitCode: () => Command,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -5,11 +5,13 @@ import getMarkType from '../helpers/getMarkType'
|
||||
import getMarkRange from '../helpers/getMarkRange'
|
||||
|
||||
declare module '@tiptap/core' {
|
||||
interface Commands {
|
||||
/**
|
||||
* Extends the text selection to the current mark.
|
||||
*/
|
||||
extendMarkRange: (typeOrName: string | MarkType) => Command,
|
||||
interface AllCommands {
|
||||
extendMarkRange: {
|
||||
/**
|
||||
* Extends the text selection to the current mark.
|
||||
*/
|
||||
extendMarkRange: (typeOrName: string | MarkType) => Command,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,11 +1,13 @@
|
||||
import { Command, Commands } from '../types'
|
||||
|
||||
declare module '@tiptap/core' {
|
||||
interface Commands {
|
||||
/**
|
||||
* Runs one command after the other and stops at the first which returns true.
|
||||
*/
|
||||
first: (commands: Command[] | ((props: Parameters<Command>[0]) => Command[])) => Command,
|
||||
interface AllCommands {
|
||||
first: {
|
||||
/**
|
||||
* Runs one command after the other and stops at the first which returns true.
|
||||
*/
|
||||
first: (commands: Command[] | ((props: Parameters<Command>[0]) => Command[])) => Command,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -31,11 +31,13 @@ function resolveSelection(state: EditorState, position: FocusPosition = null) {
|
||||
}
|
||||
|
||||
declare module '@tiptap/core' {
|
||||
interface Commands {
|
||||
/**
|
||||
* Focus the editor at the given position.
|
||||
*/
|
||||
focus: (position?: FocusPosition) => Command,
|
||||
interface AllCommands {
|
||||
focus: {
|
||||
/**
|
||||
* Focus the editor at the given position.
|
||||
*/
|
||||
focus: (position?: FocusPosition) => Command,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -18,11 +18,13 @@ function selectionToInsertionEnd(tr: Transaction, startLen: number, bias: number
|
||||
}
|
||||
|
||||
declare module '@tiptap/core' {
|
||||
interface Commands {
|
||||
/**
|
||||
* Insert a string of HTML at the current position.
|
||||
*/
|
||||
insertHTML: (value: string) => Command,
|
||||
interface AllCommands {
|
||||
insertHTML: {
|
||||
/**
|
||||
* Insert a string of HTML at the current position.
|
||||
*/
|
||||
insertHTML: (value: string) => Command,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,11 +1,13 @@
|
||||
import { Command, Commands } from '../types'
|
||||
|
||||
declare module '@tiptap/core' {
|
||||
interface Commands {
|
||||
/**
|
||||
* Insert a string of text at the current position.
|
||||
*/
|
||||
insertText: (value: string) => Command,
|
||||
interface AllCommands {
|
||||
insertText: {
|
||||
/**
|
||||
* Insert a string of text at the current position.
|
||||
*/
|
||||
insertText: (value: string) => Command,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2,11 +2,13 @@ import { joinBackward as originalJoinBackward } from 'prosemirror-commands'
|
||||
import { Command, Commands } from '../types'
|
||||
|
||||
declare module '@tiptap/core' {
|
||||
interface Commands {
|
||||
/**
|
||||
* Join two nodes backward.
|
||||
*/
|
||||
joinBackward: () => Command,
|
||||
interface AllCommands {
|
||||
joinBackward: {
|
||||
/**
|
||||
* Join two nodes backward.
|
||||
*/
|
||||
joinBackward: () => Command,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2,11 +2,13 @@ import { joinForward as originalJoinForward } from 'prosemirror-commands'
|
||||
import { Command, Commands } from '../types'
|
||||
|
||||
declare module '@tiptap/core' {
|
||||
interface Commands {
|
||||
/**
|
||||
* Join two nodes forward.
|
||||
*/
|
||||
joinForward: () => Command,
|
||||
interface AllCommands {
|
||||
joinForward: {
|
||||
/**
|
||||
* Join two nodes forward.
|
||||
*/
|
||||
joinForward: () => Command,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -57,11 +57,13 @@ function normalizeKeyName(name: string) {
|
||||
}
|
||||
|
||||
declare module '@tiptap/core' {
|
||||
interface Commands {
|
||||
/**
|
||||
* Trigger a keyboard shortcut.
|
||||
*/
|
||||
keyboardShortcut: (name: string) => Command,
|
||||
interface AllCommands {
|
||||
keyboardShortcut: {
|
||||
/**
|
||||
* Trigger a keyboard shortcut.
|
||||
*/
|
||||
keyboardShortcut: (name: string) => Command,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -5,11 +5,13 @@ import isNodeActive from '../helpers/isNodeActive'
|
||||
import getNodeType from '../helpers/getNodeType'
|
||||
|
||||
declare module '@tiptap/core' {
|
||||
interface Commands {
|
||||
/**
|
||||
* Removes an existing wrap.
|
||||
*/
|
||||
lift: (typeOrName: string | NodeType, attributes?: AnyObject) => Command,
|
||||
interface AllCommands {
|
||||
lift: {
|
||||
/**
|
||||
* Removes an existing wrap.
|
||||
*/
|
||||
lift: (typeOrName: string | NodeType, attributes?: AnyObject) => Command,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2,11 +2,13 @@ import { liftEmptyBlock as originalLiftEmptyBlock } from 'prosemirror-commands'
|
||||
import { Command, Commands } from '../types'
|
||||
|
||||
declare module '@tiptap/core' {
|
||||
interface Commands {
|
||||
/**
|
||||
* Lift block if empty.
|
||||
*/
|
||||
liftEmptyBlock: () => Command,
|
||||
interface AllCommands {
|
||||
liftEmptyBlock: {
|
||||
/**
|
||||
* Lift block if empty.
|
||||
*/
|
||||
liftEmptyBlock: () => Command,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -4,11 +4,13 @@ import { Command, Commands } from '../types'
|
||||
import getNodeType from '../helpers/getNodeType'
|
||||
|
||||
declare module '@tiptap/core' {
|
||||
interface Commands {
|
||||
/**
|
||||
* Lift the list item into a wrapping list.
|
||||
*/
|
||||
liftListItem: (typeOrName: string | NodeType) => Command,
|
||||
interface AllCommands {
|
||||
liftListItem: {
|
||||
/**
|
||||
* Lift the list item into a wrapping list.
|
||||
*/
|
||||
liftListItem: (typeOrName: string | NodeType) => Command,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2,11 +2,13 @@ import { newlineInCode as originalNewlineInCode } from 'prosemirror-commands'
|
||||
import { Command, Commands } from '../types'
|
||||
|
||||
declare module '@tiptap/core' {
|
||||
interface Commands {
|
||||
/**
|
||||
* Add a newline character in code.
|
||||
*/
|
||||
newlineInCode: () => Command,
|
||||
interface AllCommands {
|
||||
newlineInCode: {
|
||||
/**
|
||||
* Add a newline character in code.
|
||||
*/
|
||||
newlineInCode: () => Command,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2,11 +2,13 @@ import { NodeType } from 'prosemirror-model'
|
||||
import { Command, Commands, AnyObject } from '../types'
|
||||
|
||||
declare module '@tiptap/core' {
|
||||
interface Commands {
|
||||
/**
|
||||
* Replaces text with a node.
|
||||
*/
|
||||
replace: (typeOrName: string | NodeType, attributes?: AnyObject) => Command,
|
||||
interface AllCommands {
|
||||
replace: {
|
||||
/**
|
||||
* Replaces text with a node.
|
||||
*/
|
||||
replace: (typeOrName: string | NodeType, attributes?: AnyObject) => Command,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -8,11 +8,13 @@ import {
|
||||
} from '../types'
|
||||
|
||||
declare module '@tiptap/core' {
|
||||
interface Commands {
|
||||
/**
|
||||
* Replaces text with a node within a range.
|
||||
*/
|
||||
replaceRange: (range: Range, typeOrName: string | NodeType, attributes?: AnyObject) => Command,
|
||||
interface AllCommands {
|
||||
replaceRange: {
|
||||
/**
|
||||
* Replaces text with a node within a range.
|
||||
*/
|
||||
replaceRange: (range: Range, typeOrName: string | NodeType, attributes?: AnyObject) => Command,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -4,11 +4,13 @@ import deleteProps from '../utilities/deleteProps'
|
||||
import { Command, Commands } from '../types'
|
||||
|
||||
declare module '@tiptap/core' {
|
||||
interface Commands {
|
||||
/**
|
||||
* Resets node attributes to the default value.
|
||||
*/
|
||||
resetNodeAttributes: (typeOrName: string | NodeType, attributes: string | string[]) => Command,
|
||||
interface AllCommands {
|
||||
resetNodeAttributes: {
|
||||
/**
|
||||
* Resets node attributes to the default value.
|
||||
*/
|
||||
resetNodeAttributes: (typeOrName: string | NodeType, attributes: string | string[]) => Command,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,11 +1,13 @@
|
||||
import { Command, Commands } from '../types'
|
||||
|
||||
declare module '@tiptap/core' {
|
||||
interface Commands {
|
||||
/**
|
||||
* Scroll the selection into view.
|
||||
*/
|
||||
scrollIntoView: () => Command,
|
||||
interface AllCommands {
|
||||
scrollIntoView: {
|
||||
/**
|
||||
* Scroll the selection into view.
|
||||
*/
|
||||
scrollIntoView: () => Command,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2,11 +2,13 @@ import { selectAll as originalSelectAll } from 'prosemirror-commands'
|
||||
import { Command, Commands } from '../types'
|
||||
|
||||
declare module '@tiptap/core' {
|
||||
interface Commands {
|
||||
/**
|
||||
* Select the whole document.
|
||||
*/
|
||||
selectAll: () => Command,
|
||||
interface AllCommands {
|
||||
selectAll: {
|
||||
/**
|
||||
* Select the whole document.
|
||||
*/
|
||||
selectAll: () => Command,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2,11 +2,13 @@ import { selectNodeBackward as originalSelectNodeBackward } from 'prosemirror-co
|
||||
import { Command, Commands } from '../types'
|
||||
|
||||
declare module '@tiptap/core' {
|
||||
interface Commands {
|
||||
/**
|
||||
* Select a node backward.
|
||||
*/
|
||||
selectNodeBackward: () => Command,
|
||||
interface AllCommands {
|
||||
selectNodeBackward: {
|
||||
/**
|
||||
* Select a node backward.
|
||||
*/
|
||||
selectNodeBackward: () => Command,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2,11 +2,13 @@ import { selectNodeForward as originalSelectNodeForward } from 'prosemirror-comm
|
||||
import { Command, Commands } from '../types'
|
||||
|
||||
declare module '@tiptap/core' {
|
||||
interface Commands {
|
||||
/**
|
||||
* Select a node forward.
|
||||
*/
|
||||
selectNodeForward: () => Command,
|
||||
interface AllCommands {
|
||||
selectNodeForward: {
|
||||
/**
|
||||
* Select a node forward.
|
||||
*/
|
||||
selectNodeForward: () => Command,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2,11 +2,13 @@ import { selectParentNode as originalSelectParentNode } from 'prosemirror-comman
|
||||
import { Command, Commands } from '../types'
|
||||
|
||||
declare module '@tiptap/core' {
|
||||
interface Commands {
|
||||
/**
|
||||
* Select the parent node.
|
||||
*/
|
||||
selectParentNode: () => Command,
|
||||
interface AllCommands {
|
||||
selectParentNode: {
|
||||
/**
|
||||
* Select the parent node.
|
||||
*/
|
||||
selectParentNode: () => Command,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2,11 +2,13 @@ import { TextSelection } from 'prosemirror-state'
|
||||
import { AnyObject, Command, Commands } from '../types'
|
||||
|
||||
declare module '@tiptap/core' {
|
||||
interface Commands {
|
||||
/**
|
||||
* Replace the whole document with new content.
|
||||
*/
|
||||
setContent: (content: string, emitUpdate?: Boolean, parseOptions?: AnyObject) => Command,
|
||||
interface AllCommands {
|
||||
setContent: {
|
||||
/**
|
||||
* Replace the whole document with new content.
|
||||
*/
|
||||
setContent: (content: string, emitUpdate?: Boolean, parseOptions?: AnyObject) => Command,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -4,11 +4,13 @@ import getMarkType from '../helpers/getMarkType'
|
||||
import getMarkAttributes from '../helpers/getMarkAttributes'
|
||||
|
||||
declare module '@tiptap/core' {
|
||||
interface Commands {
|
||||
/**
|
||||
* Add a mark with new attributes.
|
||||
*/
|
||||
setMark: (typeOrName: string | MarkType, attributes?: AnyObject) => Command,
|
||||
interface AllCommands {
|
||||
setMark: {
|
||||
/**
|
||||
* Add a mark with new attributes.
|
||||
*/
|
||||
setMark: (typeOrName: string | MarkType, attributes?: AnyObject) => Command,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -4,11 +4,13 @@ import { AnyObject, Command, Commands } from '../types'
|
||||
import getNodeType from '../helpers/getNodeType'
|
||||
|
||||
declare module '@tiptap/core' {
|
||||
interface Commands {
|
||||
/**
|
||||
* Replace a given range with a node.
|
||||
*/
|
||||
setNode: (typeOrName: string | NodeType, attributes?: AnyObject) => Command,
|
||||
interface AllCommands {
|
||||
setNode: {
|
||||
/**
|
||||
* Replace a given range with a node.
|
||||
*/
|
||||
setNode: (typeOrName: string | NodeType, attributes?: AnyObject) => Command,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -4,11 +4,13 @@ import { Command, Commands } from '../types'
|
||||
import getNodeType from '../helpers/getNodeType'
|
||||
|
||||
declare module '@tiptap/core' {
|
||||
interface Commands {
|
||||
/**
|
||||
* Sink the list item down into an inner list.
|
||||
*/
|
||||
sinkListItem: (typeOrName: string | NodeType) => Command,
|
||||
interface AllCommands {
|
||||
sinkListItem: {
|
||||
/**
|
||||
* Sink the list item down into an inner list.
|
||||
*/
|
||||
sinkListItem: (typeOrName: string | NodeType) => Command,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -25,11 +25,13 @@ function ensureMarks(state: EditorState) {
|
||||
}
|
||||
|
||||
declare module '@tiptap/core' {
|
||||
interface Commands {
|
||||
/**
|
||||
* Forks a new node from an existing node.
|
||||
*/
|
||||
splitBlock: (options?: { keepMarks?: boolean }) => Command,
|
||||
interface AllCommands {
|
||||
splitBlock: {
|
||||
/**
|
||||
* Forks a new node from an existing node.
|
||||
*/
|
||||
splitBlock: (options?: { keepMarks?: boolean }) => Command,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -11,11 +11,13 @@ import getNodeType from '../helpers/getNodeType'
|
||||
import getSplittedAttributes from '../helpers/getSplittedAttributes'
|
||||
|
||||
declare module '@tiptap/core' {
|
||||
interface Commands {
|
||||
/**
|
||||
* Splits one list item into two list items.
|
||||
*/
|
||||
splitListItem: (typeOrName: string | NodeType) => Command,
|
||||
interface AllCommands {
|
||||
splitListItem: {
|
||||
/**
|
||||
* Splits one list item into two list items.
|
||||
*/
|
||||
splitListItem: (typeOrName: string | NodeType) => Command,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -5,11 +5,13 @@ import findParentNode from '../helpers/findParentNode'
|
||||
import isList from '../helpers/isList'
|
||||
|
||||
declare module '@tiptap/core' {
|
||||
interface Commands {
|
||||
/**
|
||||
* Toggle between different list types.
|
||||
*/
|
||||
toggleList: (listTypeOrName: string | NodeType, itemTypeOrName: string | NodeType) => Command,
|
||||
interface AllCommands {
|
||||
toggleList: {
|
||||
/**
|
||||
* Toggle between different list types.
|
||||
*/
|
||||
toggleList: (listTypeOrName: string | NodeType, itemTypeOrName: string | NodeType) => Command,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -4,11 +4,13 @@ import getMarkType from '../helpers/getMarkType'
|
||||
import isMarkActive from '../helpers/isMarkActive'
|
||||
|
||||
declare module '@tiptap/core' {
|
||||
interface Commands {
|
||||
/**
|
||||
* Toggle a mark on and off.
|
||||
*/
|
||||
toggleMark: (typeOrName: string | MarkType, attributes?: AnyObject) => Command,
|
||||
interface AllCommands {
|
||||
toggleMark: {
|
||||
/**
|
||||
* Toggle a mark on and off.
|
||||
*/
|
||||
toggleMark: (typeOrName: string | MarkType, attributes?: AnyObject) => Command,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -4,11 +4,13 @@ import isNodeActive from '../helpers/isNodeActive'
|
||||
import getNodeType from '../helpers/getNodeType'
|
||||
|
||||
declare module '@tiptap/core' {
|
||||
interface Commands {
|
||||
/**
|
||||
* Toggle a node with another node.
|
||||
*/
|
||||
toggleNode: (typeOrName: string | NodeType, toggleTypeOrName: string | NodeType, attributes?: AnyObject) => Command,
|
||||
interface AllCommands {
|
||||
toggleNode: {
|
||||
/**
|
||||
* Toggle a node with another node.
|
||||
*/
|
||||
toggleNode: (typeOrName: string | NodeType, toggleTypeOrName: string | NodeType, attributes?: AnyObject) => Command,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -5,11 +5,13 @@ import isNodeActive from '../helpers/isNodeActive'
|
||||
import getNodeType from '../helpers/getNodeType'
|
||||
|
||||
declare module '@tiptap/core' {
|
||||
interface Commands {
|
||||
/**
|
||||
* Wraps nodes in another node, or removes an existing wrap.
|
||||
*/
|
||||
toggleWrap: (typeOrName: string | NodeType, attributes?: AnyObject) => Command,
|
||||
interface AllCommands {
|
||||
toggleWrap: {
|
||||
/**
|
||||
* Wraps nodes in another node, or removes an existing wrap.
|
||||
*/
|
||||
toggleWrap: (typeOrName: string | NodeType, attributes?: AnyObject) => Command,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2,11 +2,13 @@ import { undoInputRule as originalUndoInputRule } from 'prosemirror-inputrules'
|
||||
import { Command, Commands } from '../types'
|
||||
|
||||
declare module '@tiptap/core' {
|
||||
interface Commands {
|
||||
/**
|
||||
* Undo an input rule.
|
||||
*/
|
||||
undoInputRule: () => Command,
|
||||
interface AllCommands {
|
||||
undoInputRule: {
|
||||
/**
|
||||
* Undo an input rule.
|
||||
*/
|
||||
undoInputRule: () => Command,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,11 +1,13 @@
|
||||
import { Command, Commands } from '../types'
|
||||
|
||||
declare module '@tiptap/core' {
|
||||
interface Commands {
|
||||
/**
|
||||
* Remove all marks in the current selection.
|
||||
*/
|
||||
unsetAllMarks: () => Command,
|
||||
interface AllCommands {
|
||||
unsetAllMarks: {
|
||||
/**
|
||||
* Remove all marks in the current selection.
|
||||
*/
|
||||
unsetAllMarks: () => Command,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -4,11 +4,13 @@ import getMarkType from '../helpers/getMarkType'
|
||||
import getMarkRange from '../helpers/getMarkRange'
|
||||
|
||||
declare module '@tiptap/core' {
|
||||
interface Commands {
|
||||
/**
|
||||
* Remove all marks in the current selection.
|
||||
*/
|
||||
unsetMark: (typeOrName: string | MarkType) => Command,
|
||||
interface AllCommands {
|
||||
unsetMark: {
|
||||
/**
|
||||
* Remove all marks in the current selection.
|
||||
*/
|
||||
unsetMark: (typeOrName: string | MarkType) => Command,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3,11 +3,13 @@ import getNodeType from '../helpers/getNodeType'
|
||||
import { AnyObject, Command, Commands } from '../types'
|
||||
|
||||
declare module '@tiptap/core' {
|
||||
interface Commands {
|
||||
/**
|
||||
* Update attributes of a node.
|
||||
*/
|
||||
updateNodeAttributes: (typeOrName: string | NodeType, attributes: AnyObject) => Command,
|
||||
interface AllCommands {
|
||||
updateNodeAttributes: {
|
||||
/**
|
||||
* Update attributes of a node.
|
||||
*/
|
||||
updateNodeAttributes: (typeOrName: string | NodeType, attributes: AnyObject) => Command,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -5,11 +5,13 @@ import isNodeActive from '../helpers/isNodeActive'
|
||||
import getNodeType from '../helpers/getNodeType'
|
||||
|
||||
declare module '@tiptap/core' {
|
||||
interface Commands {
|
||||
/**
|
||||
* Wraps nodes in another node.
|
||||
*/
|
||||
wrapIn: (typeOrName: string | NodeType, attributes?: AnyObject) => Command,
|
||||
interface AllCommands {
|
||||
wrapIn: {
|
||||
/**
|
||||
* Wraps nodes in another node.
|
||||
*/
|
||||
wrapIn: (typeOrName: string | NodeType, attributes?: AnyObject) => Command,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -4,11 +4,13 @@ import { AnyObject, Command, Commands } from '../types'
|
||||
import getNodeType from '../helpers/getNodeType'
|
||||
|
||||
declare module '@tiptap/core' {
|
||||
interface Commands {
|
||||
/**
|
||||
* Wrap a node in a list.
|
||||
*/
|
||||
wrapInList: (typeOrName: string | NodeType, attributes?: AnyObject) => Command,
|
||||
interface AllCommands {
|
||||
wrapInList: {
|
||||
/**
|
||||
* Wrap a node in a list.
|
||||
*/
|
||||
wrapInList: (typeOrName: string | NodeType, attributes?: AnyObject) => Command,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -22,4 +22,4 @@ export { default as isCellSelection } from './helpers/isCellSelection'
|
||||
export { default as findParentNodeClosestToPos } from './helpers/findParentNodeClosestToPos'
|
||||
|
||||
export interface AllExtensions {}
|
||||
export interface Commands {}
|
||||
export interface AllCommands {}
|
||||
|
@ -14,9 +14,9 @@ import { Extension } from './Extension'
|
||||
import { Node } from './Node'
|
||||
import { Mark } from './Mark'
|
||||
import { Editor } from './Editor'
|
||||
import { Commands } from '.'
|
||||
import { AllCommands } from '.'
|
||||
|
||||
export { Commands }
|
||||
export { AllCommands }
|
||||
|
||||
export type Extensions = (Extension | Node | Mark)[]
|
||||
|
||||
@ -120,6 +120,13 @@ export type NodeViewRenderer = (props: NodeViewRendererProps) => (NodeView | {})
|
||||
|
||||
export type ValuesOf<T> = T[keyof T];
|
||||
export type KeysWithTypeOf<T, Type> = ({[P in keyof T]: T[P] extends Type ? P : never })[keyof T]
|
||||
export type UnionCommands = UnionToIntersection<ValuesOf<Pick<AllCommands, KeysWithTypeOf<AllCommands, {}>>>>
|
||||
|
||||
export type Commands = {
|
||||
[Item in keyof UnionCommands]: UnionCommands[Item] extends (...args: any[]) => any
|
||||
? (...args: Parameters<UnionCommands[Item]>) => Command
|
||||
: never
|
||||
}
|
||||
|
||||
export type SingleCommands = {
|
||||
[Item in keyof Commands]: Commands[Item] extends (...args: any[]) => any
|
||||
|
@ -8,19 +8,21 @@ export interface BlockquoteOptions {
|
||||
}
|
||||
|
||||
declare module '@tiptap/core' {
|
||||
interface Commands {
|
||||
/**
|
||||
* Set a blockquote node
|
||||
*/
|
||||
setBlockquote: () => Command,
|
||||
/**
|
||||
* Toggle a blockquote node
|
||||
*/
|
||||
toggleBlockquote: () => Command,
|
||||
/**
|
||||
* Unset a blockquote node
|
||||
*/
|
||||
unsetBlockquote: () => Command,
|
||||
interface AllCommands {
|
||||
blockQuote: {
|
||||
/**
|
||||
* Set a blockquote node
|
||||
*/
|
||||
setBlockquote: () => Command,
|
||||
/**
|
||||
* Toggle a blockquote node
|
||||
*/
|
||||
toggleBlockquote: () => Command,
|
||||
/**
|
||||
* Unset a blockquote node
|
||||
*/
|
||||
unsetBlockquote: () => Command,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -13,19 +13,21 @@ export interface BoldOptions {
|
||||
}
|
||||
|
||||
declare module '@tiptap/core' {
|
||||
interface Commands {
|
||||
/**
|
||||
* Set a bold mark
|
||||
*/
|
||||
setBold: () => Command,
|
||||
/**
|
||||
* Toggle a bold mark
|
||||
*/
|
||||
toggleBold: () => Command,
|
||||
/**
|
||||
* Unset a bold mark
|
||||
*/
|
||||
unsetBold: () => Command,
|
||||
interface AllCommands {
|
||||
bold: {
|
||||
/**
|
||||
* Set a bold mark
|
||||
*/
|
||||
setBold: () => Command,
|
||||
/**
|
||||
* Toggle a bold mark
|
||||
*/
|
||||
toggleBold: () => Command,
|
||||
/**
|
||||
* Unset a bold mark
|
||||
*/
|
||||
unsetBold: () => Command,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -8,11 +8,13 @@ export interface BulletListOptions {
|
||||
}
|
||||
|
||||
declare module '@tiptap/core' {
|
||||
interface Commands {
|
||||
/**
|
||||
* Toggle a bullet list
|
||||
*/
|
||||
toggleBulletList: () => Command,
|
||||
interface AllCommands {
|
||||
bulletList: {
|
||||
/**
|
||||
* Toggle a bullet list
|
||||
*/
|
||||
toggleBulletList: () => Command,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -9,15 +9,17 @@ export interface CodeBlockOptions {
|
||||
}
|
||||
|
||||
declare module '@tiptap/core' {
|
||||
interface Commands {
|
||||
/**
|
||||
* Set a code block
|
||||
*/
|
||||
setCodeBlock: (attributes?: { language: string }) => Command,
|
||||
/**
|
||||
* Toggle a code block
|
||||
*/
|
||||
toggleCodeBlock: (attributes?: { language: string }) => Command,
|
||||
interface AllCommands {
|
||||
codeBlock: {
|
||||
/**
|
||||
* Set a code block
|
||||
*/
|
||||
setCodeBlock: (attributes?: { language: string }) => Command,
|
||||
/**
|
||||
* Toggle a code block
|
||||
*/
|
||||
toggleCodeBlock: (attributes?: { language: string }) => Command,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -13,19 +13,21 @@ export interface CodeOptions {
|
||||
}
|
||||
|
||||
declare module '@tiptap/core' {
|
||||
interface Commands {
|
||||
/**
|
||||
* Set a code mark
|
||||
*/
|
||||
setCode: () => Command,
|
||||
/**
|
||||
* Toggle inline code
|
||||
*/
|
||||
toggleCode: () => Command,
|
||||
/**
|
||||
* Unset a code mark
|
||||
*/
|
||||
unsetCode: () => Command,
|
||||
interface AllCommands {
|
||||
code: {
|
||||
/**
|
||||
* Set a code mark
|
||||
*/
|
||||
setCode: () => Command,
|
||||
/**
|
||||
* Toggle inline code
|
||||
*/
|
||||
toggleCode: () => Command,
|
||||
/**
|
||||
* Unset a code mark
|
||||
*/
|
||||
unsetCode: () => Command,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -9,11 +9,13 @@ export interface CollaborationCursorOptions {
|
||||
}
|
||||
|
||||
declare module '@tiptap/core' {
|
||||
interface Commands {
|
||||
/**
|
||||
* Update details of the current user
|
||||
*/
|
||||
user: (attributes: AnyObject) => Command,
|
||||
interface AllCommands {
|
||||
collaborationCursor: {
|
||||
/**
|
||||
* Update details of the current user
|
||||
*/
|
||||
user: (attributes: AnyObject) => Command,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -7,15 +7,17 @@ import {
|
||||
} from 'y-prosemirror'
|
||||
|
||||
declare module '@tiptap/core' {
|
||||
interface Commands {
|
||||
/**
|
||||
* Undo recent changes
|
||||
*/
|
||||
undo: () => Command,
|
||||
/**
|
||||
* Reapply reverted changes
|
||||
*/
|
||||
redo: () => Command,
|
||||
interface AllCommands {
|
||||
collaboration: {
|
||||
/**
|
||||
* Undo recent changes
|
||||
*/
|
||||
undo: () => Command,
|
||||
/**
|
||||
* Reapply reverted changes
|
||||
*/
|
||||
redo: () => Command,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -6,15 +6,17 @@ type FontFamilyOptions = {
|
||||
}
|
||||
|
||||
declare module '@tiptap/core' {
|
||||
interface Commands {
|
||||
/**
|
||||
* Set the font family
|
||||
*/
|
||||
setFontFamily: (fontFamily: string) => Command,
|
||||
/**
|
||||
* Unset the font family
|
||||
*/
|
||||
unsetFontFamily: () => Command,
|
||||
interface AllCommands {
|
||||
fontFamily: {
|
||||
/**
|
||||
* Set the font family
|
||||
*/
|
||||
setFontFamily: (fontFamily: string) => Command,
|
||||
/**
|
||||
* Unset the font family
|
||||
*/
|
||||
unsetFontFamily: () => Command,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -8,11 +8,13 @@ export interface HardBreakOptions {
|
||||
}
|
||||
|
||||
declare module '@tiptap/core' {
|
||||
interface Commands {
|
||||
/**
|
||||
* Add a hard break
|
||||
*/
|
||||
setHardBreak: () => Command,
|
||||
interface AllCommands {
|
||||
hardBreak: {
|
||||
/**
|
||||
* Add a hard break
|
||||
*/
|
||||
setHardBreak: () => Command,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -11,15 +11,17 @@ export interface HeadingOptions {
|
||||
}
|
||||
|
||||
declare module '@tiptap/core' {
|
||||
interface Commands {
|
||||
/**
|
||||
* Set a heading node
|
||||
*/
|
||||
setHeading: (attributes: { level: Level }) => Command,
|
||||
/**
|
||||
* Toggle a heading node
|
||||
*/
|
||||
toggleHeading: (attributes: { level: Level }) => Command,
|
||||
interface AllCommands {
|
||||
heading: {
|
||||
/**
|
||||
* Set a heading node
|
||||
*/
|
||||
setHeading: (attributes: { level: Level }) => Command,
|
||||
/**
|
||||
* Toggle a heading node
|
||||
*/
|
||||
toggleHeading: (attributes: { level: Level }) => Command,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -14,19 +14,21 @@ export interface HighlightOptions {
|
||||
}
|
||||
|
||||
declare module '@tiptap/core' {
|
||||
interface Commands {
|
||||
/**
|
||||
* Set a highlight mark
|
||||
*/
|
||||
setHighlight: (attributes?: { color: string }) => Command,
|
||||
/**
|
||||
* Toggle a highlight mark
|
||||
*/
|
||||
toggleHighlight: (attributes?: { color: string }) => Command,
|
||||
/**
|
||||
* Unset a highlight mark
|
||||
*/
|
||||
unsetHighlight: () => Command,
|
||||
interface AllCommands {
|
||||
highlight: {
|
||||
/**
|
||||
* Set a highlight mark
|
||||
*/
|
||||
setHighlight: (attributes?: { color: string }) => Command,
|
||||
/**
|
||||
* Toggle a highlight mark
|
||||
*/
|
||||
toggleHighlight: (attributes?: { color: string }) => Command,
|
||||
/**
|
||||
* Unset a highlight mark
|
||||
*/
|
||||
unsetHighlight: () => Command,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -7,15 +7,17 @@ export interface HistoryOptions {
|
||||
}
|
||||
|
||||
declare module '@tiptap/core' {
|
||||
interface Commands {
|
||||
/**
|
||||
* Undo recent changes
|
||||
*/
|
||||
undo: () => Command,
|
||||
/**
|
||||
* Reapply reverted changes
|
||||
*/
|
||||
redo: () => Command,
|
||||
interface AllCommands {
|
||||
history: {
|
||||
/**
|
||||
* Undo recent changes
|
||||
*/
|
||||
undo: () => Command,
|
||||
/**
|
||||
* Reapply reverted changes
|
||||
*/
|
||||
redo: () => Command,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -12,11 +12,13 @@ export interface HorizontalRuleOptions {
|
||||
}
|
||||
|
||||
declare module '@tiptap/core' {
|
||||
interface Commands {
|
||||
/**
|
||||
* Add a horizontal rule
|
||||
*/
|
||||
setHorizontalRule: () => Command,
|
||||
interface AllCommands {
|
||||
horizontalRule: {
|
||||
/**
|
||||
* Add a horizontal rule
|
||||
*/
|
||||
setHorizontalRule: () => Command,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -13,11 +13,13 @@ export interface ImageOptions {
|
||||
}
|
||||
|
||||
declare module '@tiptap/core' {
|
||||
interface Commands {
|
||||
/**
|
||||
* Add an image
|
||||
*/
|
||||
setImage: (options: { src: string, alt?: string, title?: string }) => Command,
|
||||
interface AllCommands {
|
||||
image: {
|
||||
/**
|
||||
* Add an image
|
||||
*/
|
||||
setImage: (options: { src: string, alt?: string, title?: string }) => Command,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -13,19 +13,21 @@ export interface ItalicOptions {
|
||||
}
|
||||
|
||||
declare module '@tiptap/core' {
|
||||
interface Commands {
|
||||
/**
|
||||
* Set an italic mark
|
||||
*/
|
||||
setItalic: () => Command,
|
||||
/**
|
||||
* Toggle an italic mark
|
||||
*/
|
||||
toggleItalic: () => Command,
|
||||
/**
|
||||
* Unset an italic mark
|
||||
*/
|
||||
unsetItalic: () => Command,
|
||||
interface AllCommands {
|
||||
italic: {
|
||||
/**
|
||||
* Set an italic mark
|
||||
*/
|
||||
setItalic: () => Command,
|
||||
/**
|
||||
* Toggle an italic mark
|
||||
*/
|
||||
toggleItalic: () => Command,
|
||||
/**
|
||||
* Unset an italic mark
|
||||
*/
|
||||
unsetItalic: () => Command,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -14,19 +14,21 @@ export interface LinkOptions {
|
||||
}
|
||||
|
||||
declare module '@tiptap/core' {
|
||||
interface Commands {
|
||||
/**
|
||||
* Set a link mark
|
||||
*/
|
||||
setLink: (attributes: { href: string, target?: string }) => Command,
|
||||
/**
|
||||
* Toggle a link mark
|
||||
*/
|
||||
toggleLink: (attributes: { href: string, target?: string }) => Command,
|
||||
/**
|
||||
* Unset a link mark
|
||||
*/
|
||||
unsetLink: () => Command,
|
||||
interface AllCommands {
|
||||
link: {
|
||||
/**
|
||||
* Set a link mark
|
||||
*/
|
||||
setLink: (attributes: { href: string, target?: string }) => Command,
|
||||
/**
|
||||
* Toggle a link mark
|
||||
*/
|
||||
toggleLink: (attributes: { href: string, target?: string }) => Command,
|
||||
/**
|
||||
* Unset a link mark
|
||||
*/
|
||||
unsetLink: () => Command,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -8,11 +8,13 @@ export interface OrderedListOptions {
|
||||
}
|
||||
|
||||
declare module '@tiptap/core' {
|
||||
interface Commands {
|
||||
/**
|
||||
* Toggle an ordered list
|
||||
*/
|
||||
toggleOrderedList: () => Command,
|
||||
interface AllCommands {
|
||||
orderedList: {
|
||||
/**
|
||||
* Toggle an ordered list
|
||||
*/
|
||||
toggleOrderedList: () => Command,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -7,11 +7,13 @@ export interface ParagraphOptions {
|
||||
}
|
||||
|
||||
declare module '@tiptap/core' {
|
||||
interface Commands {
|
||||
/**
|
||||
* Toggle a paragraph
|
||||
*/
|
||||
setParagraph: () => Command,
|
||||
interface AllCommands {
|
||||
paragraph: {
|
||||
/**
|
||||
* Toggle a paragraph
|
||||
*/
|
||||
setParagraph: () => Command,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -13,19 +13,21 @@ export interface StrikeOptions {
|
||||
}
|
||||
|
||||
declare module '@tiptap/core' {
|
||||
interface Commands {
|
||||
/**
|
||||
* Set a strike mark
|
||||
*/
|
||||
setStrike: () => Command,
|
||||
/**
|
||||
* Toggle a strike mark
|
||||
*/
|
||||
toggleStrike: () => Command,
|
||||
/**
|
||||
* Unset a strike mark
|
||||
*/
|
||||
unsetStrike: () => Command,
|
||||
interface AllCommands {
|
||||
strike: {
|
||||
/**
|
||||
* Set a strike mark
|
||||
*/
|
||||
setStrike: () => Command,
|
||||
/**
|
||||
* Toggle a strike mark
|
||||
*/
|
||||
toggleStrike: () => Command,
|
||||
/**
|
||||
* Unset a strike mark
|
||||
*/
|
||||
unsetStrike: () => Command,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -42,25 +42,27 @@ export interface TableOptions {
|
||||
}
|
||||
|
||||
declare module '@tiptap/core' {
|
||||
interface Commands {
|
||||
insertTable: (options?: { rows?: number, cols?: number, withHeaderRow?: boolean }) => Command,
|
||||
addColumnBefore: () => Command,
|
||||
addColumnAfter: () => Command,
|
||||
deleteColumn: () => Command,
|
||||
addRowBefore: () => Command,
|
||||
addRowAfter: () => Command,
|
||||
deleteRow: () => Command,
|
||||
deleteTable: () => Command,
|
||||
mergeCells: () => Command,
|
||||
splitCell: () => Command,
|
||||
toggleHeaderColumn: () => Command,
|
||||
toggleHeaderRow: () => Command,
|
||||
toggleHeaderCell: () => Command,
|
||||
mergeOrSplit: () => Command,
|
||||
setCellAttribute: (name: string, value: any) => Command,
|
||||
goToNextCell: () => Command,
|
||||
goToPreviousCell: () => Command,
|
||||
fixTables: () => Command,
|
||||
interface AllCommands {
|
||||
table: {
|
||||
insertTable: (options?: { rows?: number, cols?: number, withHeaderRow?: boolean }) => Command,
|
||||
addColumnBefore: () => Command,
|
||||
addColumnAfter: () => Command,
|
||||
deleteColumn: () => Command,
|
||||
addRowBefore: () => Command,
|
||||
addRowAfter: () => Command,
|
||||
deleteRow: () => Command,
|
||||
deleteTable: () => Command,
|
||||
mergeCells: () => Command,
|
||||
splitCell: () => Command,
|
||||
toggleHeaderColumn: () => Command,
|
||||
toggleHeaderRow: () => Command,
|
||||
toggleHeaderCell: () => Command,
|
||||
mergeOrSplit: () => Command,
|
||||
setCellAttribute: (name: string, value: any) => Command,
|
||||
goToNextCell: () => Command,
|
||||
goToPreviousCell: () => Command,
|
||||
fixTables: () => Command,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -7,11 +7,13 @@ export interface TaskListOptions {
|
||||
}
|
||||
|
||||
declare module '@tiptap/core' {
|
||||
interface Commands {
|
||||
/**
|
||||
* Toggle a task list
|
||||
*/
|
||||
toggleTaskList: () => Command,
|
||||
interface AllCommands {
|
||||
taskList: {
|
||||
/**
|
||||
* Toggle a task list
|
||||
*/
|
||||
toggleTaskList: () => Command,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -7,15 +7,17 @@ type TextAlignOptions = {
|
||||
}
|
||||
|
||||
declare module '@tiptap/core' {
|
||||
interface Commands {
|
||||
/**
|
||||
* Set the text align attribute
|
||||
*/
|
||||
setTextAlign: (alignment: string) => Command,
|
||||
/**
|
||||
* Unset the text align attribute
|
||||
*/
|
||||
unsetTextAlign: () => Command,
|
||||
interface AllCommands {
|
||||
textAlign: {
|
||||
/**
|
||||
* Set the text align attribute
|
||||
*/
|
||||
setTextAlign: (alignment: string) => Command,
|
||||
/**
|
||||
* Unset the text align attribute
|
||||
*/
|
||||
unsetTextAlign: () => Command,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -12,11 +12,13 @@ export interface TextStyleOptions {
|
||||
}
|
||||
|
||||
declare module '@tiptap/core' {
|
||||
interface Commands {
|
||||
/**
|
||||
* Remove spans without inline style attributes.
|
||||
*/
|
||||
removeEmptyTextStyle: () => Command,
|
||||
interface AllCommands {
|
||||
textStyle: {
|
||||
/**
|
||||
* Remove spans without inline style attributes.
|
||||
*/
|
||||
removeEmptyTextStyle: () => Command,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -7,19 +7,21 @@ export interface UnderlineOptions {
|
||||
}
|
||||
|
||||
declare module '@tiptap/core' {
|
||||
interface Commands {
|
||||
/**
|
||||
* Set an underline mark
|
||||
*/
|
||||
setUnderline: () => Command,
|
||||
/**
|
||||
* Toggle an underline mark
|
||||
*/
|
||||
toggleUnderline: () => Command,
|
||||
/**
|
||||
* Unset an underline mark
|
||||
*/
|
||||
unsetUnderline: () => Command,
|
||||
interface AllCommands {
|
||||
underline: {
|
||||
/**
|
||||
* Set an underline mark
|
||||
*/
|
||||
setUnderline: () => Command,
|
||||
/**
|
||||
* Toggle an underline mark
|
||||
*/
|
||||
toggleUnderline: () => Command,
|
||||
/**
|
||||
* Unset an underline mark
|
||||
*/
|
||||
unsetUnderline: () => Command,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user