I am trying to build a custom editor. I want the menu to follow the cursor. The menu should be always below the cursor. So I need some heights. Currently I have the menu moving along with the cursor:
let selection = this.editor.state.selection;
if (selection.empty) { // cursor
top = this.editor.coordsAtPos(selection.head).top - this.wrapper.getBoundingClientRect().top;
this.menu.style.top = top + 'px';
}
This is working great, but I need to add the height of the selection to top. But I can’t find a way to get the height of a node, because as I understand the nodes aren’t referenced to the dom nodes, to get the height of that.
@marijn isn’t it possible to add width and height to the return value of coordsAtPos?