The render method of ReactRenderer is called every time I type, which causes the editor to lag. Is there a way to improve this? Also, is it possible to add a viewport judgment inside the NodeViewContent to determine whether to render it or not to optimize performance?
import React from 'react';
import { Node } from '@tiptap/core';
import { NodeViewContent, NodeViewProps, NodeViewWrapper, ReactNodeViewRenderer } from '@tiptap/react';
export const CardView: React.FC<NodeViewProps> = ({ editor, node, getPos }) => {
return (
<NodeViewWrapper>
{/* {some other element} */}
<NodeViewContent />
</NodeViewWrapper>
);
};
export const Card = Node.create({
name: 'card',
group: 'card',
content: 'block+',
inline: false,
isolating: true,
marks: '',
addNodeView() {
return ReactNodeViewRenderer(CardView);
},
});
Document.extend({ content: `card+` })
Which packages did you experience the bug in?
react
What Tiptap version are you using?
2.0.1
What’s the bug you are facing?
The render method of ReactRenderer is called every time I type, which causes the editor to lag. Is there a way to improve this? Also, is it possible to add a viewport judgment inside the NodeViewContent to determine whether to render it or not to optimize performance?
What browser are you using?
Chrome
Code example
No response
What did you expect to happen?
improve performence
Anything to add? (optional)
No response
Did you update your dependencies?
Are you sponsoring us?