摩纳哥编辑器 删除 2 个字符

Monaco Editor Delete 2 characters

提问人:jin_eu 提问时间:10/16/2023 更新时间:10/16/2023 访问量:30

问:

我在我的 React 项目中使用 monaco-editor,当我在 monaco-editor 中删除数据时,它会删除 2 个字符。

这是我的代码:

   useEffect(() => {
    const editorContainer = document.getElementById('monaco-mermaid');
    const monacoEditor = monaco.editor.create(editorContainer, {
        language: 'mermaid',
        minimap: {
            enabled: false
        },
        fontWeight: '600',
        fontSize: '14px',
        overviewRulerLanes: 0,
        quickSuggestions: false,
    });

    let isChangePending = false;

    monacoEditor.onDidChangeModelContent(() => {
        if (!isChangePending) {
            isChangePending = true;
            setTimeout(() => {
                const newValue = monacoEditor.getValue();
                handleChangeCode(newValue);
                isChangePending = false;
            }, 0);
        }
    });

    monaco.editor.setTheme('mermaid')
    initEditor(monaco);
},[])

请帮我!!

ReactJS 摩纳哥编辑器 Mermaid

评论

0赞 Saiansh Singh 10/31/2023
该怎么办?handleChangeCode

答: 暂无答案