mirror of
https://github.com/johannesjo/super-productivity.git
synced 2026-07-26 09:23:50 +00:00
Two issues hit when the gutter "+" inserts a paragraph and then opens the slash menu, and when clicks land on a hovered block that has already been re-rendered: - Slash menu landed in the top-left corner because the anchor used getRangeAt(0).getBoundingClientRect(), which returns a zero rect at (0, 0) for empty blocks (which is what we just inserted). Switch the slash-menu anchor to editor.view.coordsAtPos(selection.from) via a new caretRect() helper — ProseMirror always returns real coords there. The same helper is now used by the slash-menu keyboard handlers (arrow keys, backspace, typing filter) so the menu stays anchored consistently. - Uncaught "Position -1 out of range" came from editor.view.posAtDOM(hoveredBlock, 0) returning -1 when the hovered block was unmapped between hover and click (e.g. doc re-rendered, block replaced). The gutter "+" and openBlockMenu both blindly passed that value to doc.resolve, which threw. Bail when pos < 0, and also when the resolved position has depth 0 (no enclosing block, no nodePos to compute). |
||
|---|---|---|
| .. | ||
| scripts | ||
| src | ||
| .gitignore | ||
| package-lock.json | ||
| package.json | ||
| tsconfig.json | ||