I am currently developing a paragraph node extension using tiptap, which relies on NodeView based on React. In my implementation, each paragraph node displays a sidebar menu button when hovered over, as shown in the following diagram.
However, I am facing severe performance issues with tiptap’s React-based NodeView rendering, particularly when the line count increases. The text input becomes laggy, severely affecting the user experience. The latest version of Tiptap’s NodeView has concerning performance issues.Since the progress on resolving this bug on tiptap is slow, I am considering other solutions.
I’ve studied the plugin view used in ProseMirror Tooltip example, but I am unsure if it’s feasible for my case. I need to track the top-level node where the mouse is hovering and pass this information to the plugin view, similar to how a node view can get real-time node information.
Here’s a snippet of my code:
key: new PluginKey("TestP"),
props: {
handleDOMEvents: {
mouseover: (view, event) => {
console.log("Mouse over event: ", event);
setTimeout(() => {
const targetElement = event.target;
console.log(targetElement);
event.preventDefault();
const pos = view.posAtCoords({
left: event.clientX,
top: event.clientY,
});
}, 0);
},
},
},
But I found this approach is not viable, as posAtCoords
returns the closest node based on coordinates, which might be from the previous or current line. Are there other feasible solutions to implement this feature?
What I’ve tried:
- Using tiptap’s NodeView with React, but faced performance issues.
- Tried implementing using ProseMirror Plugin View and using
handleDOMEvents
.
What I’m looking for:
- A feasible solution to implement a sidebar menu button on hover for each paragraph node without performance issues.
- An alternative to tiptap’s NodeView based on React, if possible.
Since my entire project is based on Next.js (React) + Tiptap, I can’t switch to other dependencies. (In fact, I’ve also developed a version based on Vue 3 + Tiptap, but Vue 3 falls short in terms of ecosystem richness compared to React, so I chose Next.js for its more robust ecosystem.)
Thank you for your help.