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,21 @@
# setMeta
Store a metadata property in the current transaction.
## Parameters
`key: string`
The name of your metadata. You can get its value at any time with [getMeta](https://prosemirror.net/docs/ref/#state.Transaction.getMeta).
`value: any`
Store any value within your metadata.
## Usage
```js
// Prevent the update event from being triggered
editor.commands.setMeta('preventUpdate', true)
// Store any value in the current transaction.
// You can get this value at any time with tr.getMeta('foo').
editor.commands.setMeta('foo', 'bar')
```

View File

@@ -208,6 +208,8 @@
- title: setMark
link: /api/commands/set-mark
type: draft
- title: setMeta
link: /api/commands/set-meta
- title: setNode
link: /api/commands/set-node
type: draft