Skip to content

Commit

Permalink
feat: add editorWillMount event (#49)
Browse files Browse the repository at this point in the history
* Update MonacoEditor.js

An event named "beforeCreateEditor" has been added to allow developers to process the Monaco object before creating the editor,Some plug-ins need to use the Monaco object, such as "emmet-monaco-es"

* Update README.md

add new event beforeCreateEditor

* Rename the event

* oops

* Update README.md
  • Loading branch information
prodigy99 authored and egoist committed Aug 8, 2019
1 parent b1bd0d1 commit cd42afd
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
9 changes: 8 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -141,12 +141,19 @@ window.MonacoEnvironment = {

### Component Events

#### `editorWillMount`

- Params:
- `monaco`: [`monaco module`](https://microsoft.github.io/monaco-editor/api/index.html)

Called before mounting the editor.

#### `editorDidMount`

- Params:
- `editor`: [`IStandaloneCodeEditor`](https://microsoft.github.io/monaco-editor/api/interfaces/monaco.editor.istandalonecodeeditor.html) for normal editor, [`IStandaloneDiffEditor`](https://microsoft.github.io/monaco-editor/api/interfaces/monaco.editor.istandalonediffeditor.html) for diff editor.

Editor is created.
Called when the editor is mounted.

#### `change`

Expand Down
2 changes: 2 additions & 0 deletions src/MonacoEditor.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,8 @@ export default {

methods: {
initMonaco(monaco) {
this.$emit('editorWillMount', this.monaco)

const options = assign(
{
value: this.value,
Expand Down

0 comments on commit cd42afd

Please sign in to comment.