API > @blocksuite/blocks > getPreviousBlock
Function: getPreviousBlock ​
getPreviousBlock(
model
):BaseBlockModel
|null
Parameters ​
Parameter | Type |
---|---|
model | BaseBlockModel < object > |
Returns ​
BaseBlockModel
| null
Example ​
md
page
- note
- paragraph <- 5
- note <- 4 (will be skipped)
- paragraph <- 3
- child <- 2
- child <- 1
- paragraph <- when invoked here, the traverse order will be above
page
- note
- paragraph <- 5
- note <- 4 (will be skipped)
- paragraph <- 3
- child <- 2
- child <- 1
- paragraph <- when invoked here, the traverse order will be above
NOTE: this method will just return blocks with content
role
Defined In ​
packages/blocks/src/_common/utils/query.ts:94