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

Method getBlockByIndex

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

* Returns BlockAPI object by Block index * * @param {number} index - index to get

(index: number)

Source from the content-addressed store, hash-verified

82 * @param {number} index - index to get
83 */
84 public getBlockByIndex(index: number): BlockAPIInterface | undefined {
85 const block = this.Editor.BlockManager.getBlockByIndex(index);
86
87 if (block === undefined) {
88 _.logLabeled('There is no block at index `' + index + '`', 'warn');
89
90 return;
91 }
92
93 return new BlockAPI(block);
94 }
95
96 /**
97 * Returns BlockAPI object by Block id

Callers 1

methodsMethod · 0.95

Calls 1

getBlockByIndexMethod · 0.65

Tested by

no test coverage detected