0.1.6 • Published 3 years ago

cpp-editor v0.1.6

Weekly downloads
-
License
MulanPSL
Repository
github
Last release
3 years ago

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();