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