Open2

react-monaco-editor

izszzzizszzz

addCommand

const editorRef = useRef(null)
const [editorText, setEditorText] = useState("")

useEffect(() => {
  const editor = editorRef.current?.editor;
  editor.addCommand(
    monaco.KeyMod.CtrlCmd | monaco.KeyCode.KEY_S,
    console.log(editoText)
  );
}, [editorText]);// editorTextが更新されるたびにアップデート

return(
  <MonacoEditor
    ref={editorRef}
    onChange={setEditorText} 
  />
)
izszzzizszzz

Cannot find namespace 'monaco'.

import Editor, { Monaco, useMonaco, } from "@monaco-editor/react";
import * as monaco from 'monaco-editor';

function handleEditorDidMount(editor: monaco.editor.IStandaloneCodeEditor, monaco: Monaco) {
}