feat: add setMeta command

This commit is contained in:
Philipp Kühn
2021-06-02 10:50:10 +02:00
parent b3b297f5ce
commit 36dad2bbae
4 changed files with 44 additions and 0 deletions

View 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
}