MCPcopy Index your code
hub / github.com/codex-team/editor.js / getBlockByElement

Method getBlockByElement

src/components/modules/api/blocks.ts:118–128  ·  view source on GitHub ↗

* Get Block API object by any child html element * * @param element - html element to get Block by

(element: HTMLElement)

Source from the content-addressed store, hash-verified

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

Callers 1

methodsMethod · 0.95

Calls 1

getBlockMethod · 0.80

Tested by

no test coverage detected