GithubHelp home page GithubHelp logo

nilobarp / monaco-editor Goto Github PK

View Code? Open in Web Editor NEW

This project forked from timkendrick/monaco-editor

0.0 2.0 0.0 84 KB

CommonJS/Webpack compatible Monaco editor

License: MIT License

JavaScript 100.00%

monaco-editor's Introduction

@timkendrick/monaco-editor

npm version Stability

CommonJS/Webpack compatible Monaco editor

This module exports a prebuilt UMD bundle that exposes a standalone Monaco editor.

Installation

npm install @timkendrick/monaco-editor --save

Usage

The editor comes in two versions: standalone and external.

In the standalone version, the accompanying CSS and web worker scripts are all compiled into the main JavaScript bundle, avoiding the need to serve external assets separately.

In the external version, the accompanying CSS and web worker scripts are provided as separate assets that must be served separately.

Importing the standalone version

As a CommonJS module:

const monaco = require('@timkendrick/monaco-editor');

monaco.editor.create(...);

As an ECMAScript module:

import * as monaco from '@timkendrick/monaco-editor';

monaco.editor.create(...);

As a global variable:

window.monaco.editor.create(...);

Using the external version

Setup

Additional CSS and worker scripts are located in the dist/external directory. These must be loaded by the browser at runtime.

The monaco.css file must be loaded as a stylesheet, and the path to directory containing the worker scripts can be specified as window.MonacoEnvironment.baseUrl:

<html>
  <head>
    <link rel="stylesheet" href="node_modules/@timkendrick/monaco-editor/dist/external/monaco.css" />
  </head>
  <body>
    <script>
      window.MonacoEnvironment = {
        baseUrl: 'node_modules/@timkendrick/monaco-editor/dist/external',
      };
    </script>
    <script src="index.js"></script>
  </body>
</html>

Importing the external version

As a CommonJS module:

const monaco = require('@timkendrick/monaco-editor/dist/external');

monaco.editor.create(...);

As an ECMAScript module:

import * as monaco from '@timkendrick/monaco-editor/dist/external';

monaco.editor.create(...);

As a global variable:

window.monaco.editor.create(...);

Editor API

For full usage instructions, see the Monaco API Docs.

Configuration

The editor configuration is based on the AMD version in the Microsoft/monaco-editor repository.

To generate custom builds, see the @timkendrick/monaco-editor-loader Webpack loader.

Building from source

git clone https://github.com/timkendrick/monaco-editor.git
cd monaco-editor
git submodule update --init
npm install

npm run build

monaco-editor's People

Contributors

timkendrick avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.