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

Method getBlockIndex

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

* Returns the index of Block by id; * * @param id - block id

(id: string)

Source from the content-addressed store, hash-verified

65 * @param id - block id
66 */
67 public getBlockIndex(id: string): number | undefined {
68 const block = this.Editor.BlockManager.getBlockById(id);
69
70 if (!block) {
71 _.logLabeled('There is no block with id `' + id + '`', 'warn');
72
73 return;
74 }
75
76 return this.Editor.BlockManager.getBlockIndex(block);
77 }
78
79 /**
80 * Returns BlockAPI object by Block index

Callers 1

methodsMethod · 0.95

Calls 2

getBlockByIdMethod · 0.80
getBlockIndexMethod · 0.65

Tested by

no test coverage detected