Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

vue-monaco

Package Overview
Dependencies
Maintainers
1
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vue-monaco

MonacoEditor component for Vue.js

  • 0.1.4
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

vue-monaco

NPM version NPM downloads CircleCI donate

Monaco Editor is the code editor that powers VS Code.

Install

yarn add vue-monaco

Usage

You need to include monaco-editor first.
<script src="/path/to/monaco-editor/min/vs/loader.js"></script>
<script>
  require.config({ 
    paths: { 
      vs: '/path/to/monaco-editor/min/vs'
    }
  })
</script>

Then use the component:

<template>
  <monaco-editor
    class="editor"
    v-model="code"
    language="javascript">
  </monaco-editor>
</template>

<script>
import MonacoEditor from 'vue-monaco'

export default {
  components: {
    MonacoEditor
  },

  data() {
    return {
      code: 'const noop = () => {}'
    }
  }
}
</script>

<style>
.editor {
  width: 600px;
  height: 800px;
}
</style>

Props

  • code
  • language
  • theme
  • options
  • placeholder: Display a placeholder until the monaco editor is loaded. Could a string or vNode.

Events

EventIStandaloneCodeEditor EventParameters
editorMountIStandaloneCodeEditor
contextMenuonContextMenuIEditorMouseEvent
bluronDidBlurEditor
blurTextonDidBlurEditorText
configurationonDidBlurEditorTextIConfigurationChangedEvent
positiononDidChangeCursorPositionICursorPositionChangedEvent
selectiononDidChangeCursorSelectionICursorSelectionChangedEvent
modelonDidChangeModelIModelChangedEvent
changeonDidChangeModelContentvalue: string, e: IModelContentChangedEvent
modelDecorationsonDidChangeModelDecorationsIModelDecorationsChangedEvent
modelLanguageonDidChangeModelLanguageIModelLanguageChangedEvent
modelOptionsonDidChangeModelOptionsIModelOptionsChangedEvent
afterDisposeonDidDispose
focusonDidFocusEditor
focusTextonDidFocusEditorText
layoutonDidLayoutChangeEditorLayoutInfo
scrollonDidScrollChangeIScrollEvent
keydownonKeyDownIKeyboardEvent
keyuponKeyUpIKeyboardEvent
mouseDownonMouseDownIEditorMouseEvent
mouseLeaveonMouseLeaveIEditorMouseEvent
mouseMoveonMouseMoveIEditorMouseEvent
mouseUponMouseUpIEditorMouseEvent

Methods

Use ref to interact with the MonacoEditor component in order to access methods: <MonacoEditor ref="editor"></MonacoEditor>, then this.$refs.editor.getMonaco() will be available.

Contributing

  1. Fork it!
  2. Create your feature branch: git checkout -b my-new-feature
  3. Commit your changes: git commit -am 'Add some feature'
  4. Push to the branch: git push origin my-new-feature
  5. Submit a pull request :D

Author

vue-monaco © egoist, Released under the MIT License.
Authored and maintained by egoist with help from contributors (list).

egoist.moe · GitHub @egoist · Twitter @_egoistlily

FAQs

Package last updated on 03 Sep 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc