codex-team / codex-team/editor.js

How to retrieve last focused block❓

Open
#2,171 4 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
31.9k
Forks
2.2k
Avg merge
1d 1h
Merged PRs (30d)
1

Description

**Question**

Is there way to fetch the current focused (or) last focused block?

**Context**

I have an EditorJS layout with Text and Image blocks. Depending on the block that is focused I want to invoke data load and render programmatically. Initially I relied on `getCurrentBlockIndex()` to get the selected block's index and then retrieved the block followed by `getBlockByIndex(index: number)`.

However, this does not seem to work because once the EditorJS loses focus, `getCurrentBlockIndex()` returns -1.

**Related issues**

If there are related issues which describe a bugs or features, put them here

**Comments**

Any thoughts about the question

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.