docs: update content
This commit is contained in:
20
docs/src/docPages/api/commands/for-each.md
Normal file
20
docs/src/docPages/api/commands/for-each.md
Normal file
@@ -0,0 +1,20 @@
|
||||
# forEach
|
||||
Loop through an array of items.
|
||||
|
||||
## Parameters
|
||||
`items: any[]`
|
||||
|
||||
An array of items.
|
||||
|
||||
`fn: (item: any, props: CommandProps & { index: number }) => boolean`
|
||||
|
||||
A function to do anything with your item.
|
||||
|
||||
## Usage
|
||||
```js
|
||||
const items = ['foo', 'bar', 'baz']
|
||||
|
||||
editor.commands.forEach(items, (item, { commands }) => {
|
||||
return commands.insertContent(item)
|
||||
})
|
||||
```
|
||||
@@ -157,6 +157,9 @@
|
||||
- title: focus
|
||||
link: /api/commands/focus
|
||||
type: new
|
||||
- title: forEach
|
||||
link: /api/commands/for-each
|
||||
type: new
|
||||
- title: insertContent
|
||||
link: /api/commands/insert-content
|
||||
- title: insertContentAt
|
||||
|
||||
Reference in New Issue
Block a user