(attribute: BlockAPI | BlockAPI['id'] | number, editor: EditorModules)
| 9 | * @param editor - Editor instance |
| 10 | */ |
| 11 | export function resolveBlock(attribute: BlockAPI | BlockAPI['id'] | number, editor: EditorModules): Block | undefined { |
| 12 | if (typeof attribute === 'number') { |
| 13 | return editor.BlockManager.getBlockByIndex(attribute); |
| 14 | } |
| 15 | |
| 16 | if (typeof attribute === 'string') { |
| 17 | return editor.BlockManager.getBlockById(attribute); |
| 18 | } |
| 19 | |
| 20 | return editor.BlockManager.getBlockById(attribute.id); |
| 21 | } |
no test coverage detected