react-ace icon indicating copy to clipboard operation
react-ace copied to clipboard

Why can't ArrowUp, ArrowDown, and Backspace trigger in keyboard events

Open zhengdechang opened this issue 8 months ago • 0 comments

Problem

Detail the problem here, including any possible solutions.

Sample code to reproduce your issue

  const latexRef = useRef(null);

 useEffect(() => {
        const editor = editorRef.current.editor;
        editor.session.selection.on('changeCursor', handleCursorChange);
        editor.container.addEventListener('keydown', handleKeyDown);

        return () => {
            editor.session.selection.off('changeCursor', handleCursorChange);
            editor.container.removeEventListener('keydown', handleKeyDown);
        };
    }, []);
    
    const handleKeyDown = (event) => {
            console.log(event.key, 'event.key')
    }

 <AceEditor
        mode="latex"
        name="aceEditor"
        height="100%"
        width="100%"
        fontSize="16px"
        editorProps={{ $blockScrolling: true }}
                ref={latexRef}
      ></AceEditor>

References

Progress on: #

zhengdechang avatar Jun 16 '24 14:06 zhengdechang