Skip to content
This repository has been archived by the owner on Apr 6, 2022. It is now read-only.

yar2001/cpp-editor

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Getting Started with Cpp Editor

A REALLY SIMPLE package which packaging monaco-editor and React.

This project was created by yar2001.

How to use it?

Create a new editor and render it

import {
    CppEditor
} from "cpp-editor"

const renderEditor = async function() {
    let editor = new CppEditor(document.getElementId("root"));
    await editor.render();
}
renderEditor();

Get and set code

editor.setCode("#include <string>");
console.log(editor.getCode());

Enable and disable darkmode

editor.setDarkMode(true);
setTimeout(() => {
    editor.setDarkMode(false);
}, 1000);

Destroy the editor

editor.unmount();