1.10.15 • Published 3 years ago

@vanillawc/wc-monaco-editor v1.10.15

Weekly downloads
26
License
MIT
Repository
github
Last release
3 years ago

Installation

Installation

npm i @vanillawc/wc-monaco-editor

Import from NPM

<script type="module" src="node_modules/@vanillawc/wc-monaco-editor/index.js"></script>

Import from CDN

<script type="module" src="https://cdn.jsdelivr.net/gh/vanillawc/wc-monaco-editor@1/index.js"></script>

Demo

Try it out here

Usage

Attributes

  • id - the editor id (default editor)
  • src - load the source from an external file
  • language - set the source language
  • font-size - set the font size (default 14px);
  • tab-size - set the tab size (in spaces) (default 2)
  • style - CSS styling (default height: 100%; width: 100%;)
  • no-minimap - disables the source minimap when present
  • word-wrap - enables word wrapping when present
  • wrap-indent - set the indent ['none','same','indent','deepindent'] for word wrapped lines (default none)

Note: The ID attribute is required if there are multiple editors

Properties

  • editor - the Monaco editor instance
  • src - get/set the src attribute from JS
  • value - get/set the editor's contents
  • tabSize - get/set the tab-index attribute from JS

Basic Usage

To edit plaintext

<wc-monaco-editor></wc-monaco-editor>

Language Support

Language support enables syntax highlighting, code completion, etc.

<wc-monaco-editor language="javascript"></wc-monaco-editor>

External Source

Load an external source file with the src attribute

<wc-monaco-editor src="sample.js" language="javascript"></wc-monaco-editor>

Advanced Configuration

A config can be provided for advanced use cases that require the full spectrum of Monaco Editor options.

<wc-monaco-editor config="config.json"></wc-monaco-editor>

config.json

{
  "language": "javascript",
  "minimap": {
    "enabled": false
  },
  "tabSize": 2,
  "fontSize": 16,
  "wordWrap": "on",
  "lineNumbersMinChars": 3,
  "wrappingIndent": "same",
  "mouseWheelZoom": true,
  "copyWithSyntaxHighlighting": false
}

Note: See the EditorOptions official documentation for all available options.

Contributing

See CONTRIBUTING.md

1.10.15

3 years ago

1.10.13

3 years ago

1.10.14

3 years ago

1.10.12

4 years ago

1.10.11

4 years ago

1.10.10

4 years ago

1.10.9

4 years ago

1.10.8

4 years ago

1.10.7

4 years ago

1.10.5

4 years ago

1.10.6

4 years ago

1.10.4

4 years ago

1.10.3

4 years ago

1.10.2

4 years ago

1.10.1

4 years ago

1.10.0

4 years ago

1.9.0

4 years ago

1.8.2

4 years ago

1.8.1

4 years ago

1.8.0

4 years ago

1.7.0

4 years ago

1.6.0

4 years ago

1.5.1

4 years ago

1.5.0

4 years ago

1.4.9

4 years ago

1.4.8

4 years ago

1.4.7

4 years ago

1.4.6

4 years ago

1.4.5

4 years ago

1.4.4

4 years ago

1.4.3

4 years ago

1.4.2

4 years ago

1.4.1

4 years ago

1.4.0

4 years ago

1.3.0

4 years ago

1.2.4

4 years ago

1.2.0

4 years ago

1.2.3

4 years ago

1.2.2

4 years ago

1.2.1

4 years ago

1.1.9

4 years ago

1.1.8

4 years ago

1.1.7

4 years ago

1.1.6

4 years ago

1.1.5

4 years ago

1.1.4

4 years ago

1.1.3

4 years ago

1.1.2

4 years ago

1.1.2-pre0

4 years ago

1.1.1

4 years ago

1.0.0

5 years ago

1.0.0-rc3

5 years ago

1.0.0-rc2

5 years ago

1.0.0-rc1

5 years ago