codex-team / codex-team/editor.js
How to retrieve block data?
- Dominant language
- TypeScript
- Stars
- 31.9k
- Forks
- 2.2k
- Avg merge
- 1d 1h
- Merged PRs (30d)
- 1
Description
// Retrieve block details once and use throughout
const block = this.api.blocks.getBlockByIndex(blockIndex);
console.log('Block data:', block.data, 'Block index:', blockIndex);
if (!block || !block.id) {
throw new Error('No valid ID for the current block.');
}
const originalText = block.data?.text; // Using optional chaining for safety
console.log(block);
Block data is undefined, how do I retrieve the contents of a block, such as the text of a paragraph of heading? Or a list content?
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.