All Projects β†’ jaywcjlove β†’ react-monacoeditor

jaywcjlove / react-monacoeditor

Licence: other
Monaco Editor component for React.

Programming Languages

typescript
32286 projects
Less
1899 projects
HTML
75241 projects

Projects that are alternatives of or similar to react-monacoeditor

use-monaco
Use πŸ—’οΈ monaco-editor in any βš›οΈ React app with simple hooks 🎣
Stars: ✭ 85 (-55.5%)
Mutual labels:  ide, monaco-editor
wide
A lightweight web IDE (mostly a coding editor) based in monaco-editor (with a one-file server made in php). It allows to navigate the server with commands.
Stars: ✭ 42 (-78.01%)
Mutual labels:  ide, monaco-editor
Orchestra
One language to be RegExp's Successor. Visually readable and rich, technically safe and extended, naturally scalable, advanced, and optimized
Stars: ✭ 103 (-46.07%)
Mutual labels:  ide, monaco-editor
amake
A very simple Arduino command line interface for linux
Stars: ✭ 35 (-81.68%)
Mutual labels:  ide
telenium
Automation for Kivy Application
Stars: ✭ 56 (-70.68%)
Mutual labels:  ide
vscode
The Visual Studio Code Extension for the Erlang Language Server
Stars: ✭ 62 (-67.54%)
Mutual labels:  ide
AndroidStudio-ChineseLanguagePackage
AndroidStudio δΈ­ζ–‡ζ±‰εŒ–εŒ…
Stars: ✭ 48 (-74.87%)
Mutual labels:  ide
stack-editor
[Deprecated, prefer calcit-editor]
Stars: ✭ 93 (-51.31%)
Mutual labels:  ide
arduino
required (and optional) source files for the Arduino development environment, specifically the hardware/arduino sub-directory, to support xmega processors
Stars: ✭ 18 (-90.58%)
Mutual labels:  ide
bundle
An online tool to quickly bundle & minify your projects, while viewing the compressed gzip/brotli bundle size, all running locally on your browser.
Stars: ✭ 475 (+148.69%)
Mutual labels:  monaco-editor
sprite
πŸ–Œ Draw charts in code. Render in real-time. Embed anywhere as .png.
Stars: ✭ 202 (+5.76%)
Mutual labels:  monaco-editor
dillinger
The last Markdown editor, ever.
Stars: ✭ 7,533 (+3843.98%)
Mutual labels:  ide
eclipse
Eclipse For Bazel (deprecated, see https://github.com/salesforce/bazel-eclipse instead)
Stars: ✭ 31 (-83.77%)
Mutual labels:  ide
DIV
ReconstrucciΓ³n y posible fork de DIV Games Studio 2.0
Stars: ✭ 41 (-78.53%)
Mutual labels:  ide
Neovim-Studio
Neovim turned full-blown IDE
Stars: ✭ 30 (-84.29%)
Mutual labels:  ide
Juggernaut
The unstoppable programmers editor written in Rust and Javascript
Stars: ✭ 28 (-85.34%)
Mutual labels:  ide
AppleScript-IDEA
AppleScript support for IntelliJ IDEs
Stars: ✭ 21 (-89.01%)
Mutual labels:  ide
Operational-Transformation
A collection of Algorithms to Synchronise changes across multiple clients using Operational Transformation
Stars: ✭ 25 (-86.91%)
Mutual labels:  monaco-editor
intellij-zig
The IntelliJ IDEA plugin for the Zig programming language β”—πŸ˜ƒβ”› β”πŸ˜ƒβ”“ β”—πŸ˜ƒβ”› β”πŸ˜ƒβ”“
Stars: ✭ 85 (-55.5%)
Mutual labels:  ide
vscode-liquid
πŸ’§Liquid language support for VS Code
Stars: ✭ 137 (-28.27%)
Mutual labels:  ide

react-monacoeditor

CI jsDelivr CDN Downloads Open in unpkg npm version

Monaco Editor component for React. demo @jaywcjlove.github.io/react-monacoeditor/

Installation

npm install @uiw/react-monacoeditor --save

Using

Open in CodeSandbox

import React from 'react';
import MonacoEditor from '@uiw/react-monacoeditor';

<MonacoEditor
  language="html"
  value="<h1>I β™₯ react-monacoeditor</h1>"
  options={{
    theme: 'vs-dark',
  }}
/>

Using with Webpack

import React from 'react';
import { render } from 'react-dom';
import MonacoEditor from '@uiw/react-monacoeditor';

const code = `import React, { PureComponent } from 'react';
import MonacoEditor from '@uiw/react-monacoeditor';

export default class App extends PureComponent {
  render() {
    return (
      <MonacoEditor
        language="html"
        value="<h1>I β™₯ react-codemirror2</h1>"
        options={{
          selectOnLineNumbers: true,
          roundedSelection: false,
          cursorStyle: 'line',
          automaticLayout: false,
          theme: 'vs-dark',
        }}
      />
    );
  }
}
`;

class App extends React.Component {
  constructor(props) {
    super(props);
    this.state = {
      code: '// type your code...',
    }
  }
  editorDidMount(editor, monaco) {
    console.log('editorDidMount', editor, monaco);
    editor.focus();
  }
  onChange(newValue, e) {
    console.log('onChange', newValue, e);
  }
  render() {
    const options = {
      selectOnLineNumbers: true,
      roundedSelection: false,
      readOnly: false,
      cursorStyle: 'line',
      automaticLayout: false,
      theme: 'vs-dark',
      scrollbar: {
        // Subtle shadows to the left & top. Defaults to true.
        useShadows: false,
        // Render vertical arrows. Defaults to false.
        verticalHasArrows: true,
        // Render horizontal arrows. Defaults to false.
        horizontalHasArrows: true,
        // Render vertical scrollbar.
        // Accepted values: 'auto', 'visible', 'hidden'.
        // Defaults to 'auto'
        vertical: 'visible',
        // Render horizontal scrollbar.
        // Accepted values: 'auto', 'visible', 'hidden'.
        // Defaults to 'auto'
        horizontal: 'visible',
        verticalScrollbarSize: 17,
        horizontalScrollbarSize: 17,
        arrowSize: 30,
      },
    };
    return (
      <MonacoEditor
        height="500px"
        language="javascript"
        editorDidMount={this.editorDidMount.bind(this)}
        onChange={this.onChange.bind(this)}
        value={code}
        options={options}
      />
    );
  }
}

render(
  <App />,
  document.getElementById('root')
);

Add the Monaco Editor Webpack Loader Plugin monaco-editor-webpack-plugin to your webpack.config.js:

const MonacoWebpackPlugin = require('monaco-editor-webpack-plugin');
module.exports = {
  plugins: [
    new MonacoWebpackPlugin()
  ]
};

Properties

If you specify value property, the component behaves in controlled mode. Otherwise, it behaves in uncontrolled mode.

  • width width of editor. Defaults to 100%.
  • height height of editor. Defaults to 100%.
  • value value of the auto created model in the editor.
  • defaultValue the initial value of the auto created model in the editor.
  • language the initial language of the auto created model in the editor.
  • theme the theme of the editor vs, vs-dark, hc-black
  • options refer to Monaco interface IEditorConstructionOptions.
  • editorDidMount(editor, monaco) an event emitted when the editor has been mounted (similar to componentDidMount of React).
  • onChange(newValue, event) an event emitted when the content of the current model has changed.
  • autoComplete?: (model: monaco.editor.ITextModel, position: monaco.Position) => languages.CompletionItem[]; User provided extension function provider for auto-complete. #47

Events & Methods

Refer to Monaco interface IEditor.

Related

Contributors

As always, thanks to our amazing contributors!

Made with github-action-contributors.

License

Licensed under the MIT License.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].