Skip to content

How to get the current most outer parent node type in focus? #3787

Discussion options

You must be logged in to vote

I found the way to get the parent node from current selection:

const state = editor.view.state;
const from = state.selection.from;
const pos = state.doc.resolve(from);
const parent = pos.node(pos.depth - 1);

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@TPLCarloTaleon
Comment options

Answer selected by nperez0111
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
3 participants