-
Hi, I am trying to select the nearest block based on the cursor position. Example:
If the cursor is in the Paragraph block, I'd like to be able to select the full element. Note that I cannot use the nearest Node as there could be marks like bold/italic/text color. I haven't found a utility method for this. Thanks! |
Beta Was this translation helpful? Give feedback.
Answered by
12joan
May 12, 2023
Replies: 1 comment 1 reply
-
You can use |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
wfortin
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You can use
getAboveNode(editor, { match: /* ... */ })
to get the nearest ancestor matching a condition, andisBlock(editor, node)
to determine if a node is a block.