import { useRef, useEffect } from 'react'; import { Handle, Position } from 'reactflow'; import ReactQuill from 'react-quill-new'; import 'react-quill-new/dist/quill.snow.css'; import '../styles/quill-dark.css'; function TextNode({ data }) { const quillRef = useRef(null); useEffect(() => { const editor = quillRef.current?.getEditor?.(); const editorRoot = editor?.root; if (editorRoot) { const stopKey = (e) => { // fix for spacebar and prevent ReactFlow stealing key if (e.key === ' ' || e.key === 'ArrowLeft' || e.key === 'ArrowRight') { e.stopPropagation(); } }; editorRoot.addEventListener('keydown', stopKey); return () => { editorRoot.removeEventListener('keydown', stopKey); }; } }, [data.editing]); // reapply listener only when editing mode is toggled return (