feat: add setMeta command
This commit is contained in:
18
packages/core/src/commands/setMeta.ts
Normal file
18
packages/core/src/commands/setMeta.ts
Normal file
@@ -0,0 +1,18 @@
|
||||
import { Command, RawCommands } from '../types'
|
||||
|
||||
declare module '@tiptap/core' {
|
||||
interface Commands {
|
||||
setMeta: {
|
||||
/**
|
||||
* Store a metadata property in the current transaction.
|
||||
*/
|
||||
setMeta: (key: string, value: any) => Command,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export const setMeta: RawCommands['setMeta'] = (key, value) => ({ tr }) => {
|
||||
tr.setMeta(key, value)
|
||||
|
||||
return true
|
||||
}
|
||||
Reference in New Issue
Block a user