* Get Block API object by any child html element * * @param element - html element to get Block by
(element: HTMLElement)
| 116 | * @param element - html element to get Block by |
| 117 | */ |
| 118 | public getBlockByElement(element: HTMLElement): BlockAPIInterface | undefined { |
| 119 | const block = this.Editor.BlockManager.getBlock(element); |
| 120 | |
| 121 | if (block === undefined) { |
| 122 | _.logLabeled('There is no block corresponding to element `' + element + '`', 'warn'); |
| 123 | |
| 124 | return; |
| 125 | } |
| 126 | |
| 127 | return new BlockAPI(block); |
| 128 | } |
| 129 | |
| 130 | /** |
| 131 | * Call Block Manager method that swap Blocks |