mirror of
https://github.com/ueberdosis/tiptap.git
synced 2025-06-07 17:43:49 +08:00
24 lines
667 B
TypeScript
24 lines
667 B
TypeScript
import { ParseOptions } from 'prosemirror-model'
|
|
import { RawCommands, Content } from '../types'
|
|
|
|
declare module '@tiptap/core' {
|
|
interface Commands<ReturnType> {
|
|
insertContent: {
|
|
/**
|
|
* Insert a node or string of HTML at the current position.
|
|
*/
|
|
insertContent: (
|
|
value: Content,
|
|
options?: {
|
|
parseOptions?: ParseOptions,
|
|
updateSelection?: boolean,
|
|
},
|
|
) => ReturnType,
|
|
}
|
|
}
|
|
}
|
|
|
|
export const insertContent: RawCommands['insertContent'] = (value, options) => ({ tr, commands }) => {
|
|
return commands.insertContentAt({ from: tr.selection.from, to: tr.selection.to }, value, options)
|
|
}
|