fix: add CreateNodeFromContentOptions to insertContent (#1678)
* ✨ Add CreateNodeFromContentOptions to insertContent * 📝 Add it to the doc
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import { CreateNodeFromContentOptions } from '../helpers/createNodeFromContent'
|
||||
import { RawCommands, Content } from '../types'
|
||||
|
||||
declare module '@tiptap/core' {
|
||||
@@ -6,11 +7,11 @@ declare module '@tiptap/core' {
|
||||
/**
|
||||
* Insert a node or string of HTML at the current position.
|
||||
*/
|
||||
insertContent: (value: Content) => ReturnType,
|
||||
insertContent: (value: Content, options?: CreateNodeFromContentOptions) => ReturnType,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export const insertContent: RawCommands['insertContent'] = value => ({ tr, commands }) => {
|
||||
return commands.insertContentAt({ from: tr.selection.from, to: tr.selection.to }, value)
|
||||
export const insertContent: RawCommands['insertContent'] = (value, options) => ({ tr, commands }) => {
|
||||
return commands.insertContentAt({ from: tr.selection.from, to: tr.selection.to }, value, options)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user