"integrity": "sha1-0jM6NtnncXyK0vfKyv7HwytERmQ=", | "integrity": "sha1-0jM6NtnncXyK0vfKyv7HwytERmQ=", | ||||
"dev": true | "dev": true | ||||
}, | }, | ||||
"lodash.throttle": { | |||||
"version": "4.1.1", | |||||
"resolved": "https://registry.npmjs.org/lodash.throttle/-/lodash.throttle-4.1.1.tgz", | |||||
"integrity": "sha1-wj6RtxAkKscMN/HhzaknTMOb8vQ=" | |||||
}, | |||||
"loglevel": { | "loglevel": { | ||||
"version": "1.6.1", | "version": "1.6.1", | ||||
"resolved": "https://registry.npmjs.org/loglevel/-/loglevel-1.6.1.tgz", | "resolved": "https://registry.npmjs.org/loglevel/-/loglevel-1.6.1.tgz", | ||||
"resolved": "https://registry.npmjs.org/monaco-editor-webpack-plugin/-/monaco-editor-webpack-plugin-1.5.4.tgz", | "resolved": "https://registry.npmjs.org/monaco-editor-webpack-plugin/-/monaco-editor-webpack-plugin-1.5.4.tgz", | ||||
"integrity": "sha512-9YmWYQdZoAoZ1RLy/uvoDbCcb0EKy5O2qoMQn+UIVQxk+VTCXfJDgANczDIWko+UOzg0MY0P+sA8bl4XI14RJg==" | "integrity": "sha512-9YmWYQdZoAoZ1RLy/uvoDbCcb0EKy5O2qoMQn+UIVQxk+VTCXfJDgANczDIWko+UOzg0MY0P+sA8bl4XI14RJg==" | ||||
}, | }, | ||||
"monaco-emacs": { | |||||
"version": "0.1.1", | |||||
"resolved": "https://registry.npmjs.org/monaco-emacs/-/monaco-emacs-0.1.1.tgz", | |||||
"integrity": "sha512-8+iCglLDLd/RAdQKP6+XXaIkbrM2wTEzlMHC5f6nVhtPrVQl0cMe99a5kD6eFimFnFQSq1Qx7DAclewgwhoHBQ==", | |||||
"requires": { | |||||
"lodash.throttle": "^4.1.1", | |||||
"monaco-editor": "^0.14.0" | |||||
} | |||||
}, | |||||
"monaco-themes": { | "monaco-themes": { | ||||
"version": "0.2.5", | "version": "0.2.5", | ||||
"resolved": "https://registry.npmjs.org/monaco-themes/-/monaco-themes-0.2.5.tgz", | "resolved": "https://registry.npmjs.org/monaco-themes/-/monaco-themes-0.2.5.tgz", |
"lodash": "^4.17.11", | "lodash": "^4.17.11", | ||||
"monaco-editor": "^0.14.3", | "monaco-editor": "^0.14.3", | ||||
"monaco-editor-webpack-plugin": "^1.5.4", | "monaco-editor-webpack-plugin": "^1.5.4", | ||||
"monaco-emacs": "^0.1.1", | |||||
"monaco-themes": "^0.2.5", | "monaco-themes": "^0.2.5", | ||||
"monaco-vim": "0.0.7", | "monaco-vim": "0.0.7", | ||||
"vue": "^2.5.17", | "vue": "^2.5.17", |
</ul> | </ul> | ||||
</div> | </div> | ||||
<editor-component v-model="cpp_code" name="cpp" language="cpp" height="50vh" :vim_mode="vim_mode" /> | |||||
<editor-component v-model="cpp_code" name="cpp" language="cpp" height="50vh"/> | |||||
</div> | </div> | ||||
<div class="row"> | <div class="row"> | ||||
<li class="is-active"><a>HTML</a></li> | <li class="is-active"><a>HTML</a></li> | ||||
</ul> | </ul> | ||||
</div> | </div> | ||||
<editor-component v-model="html_code" name="html" language="html" height="50vh" :vim_mode="vim_mode" /> | |||||
<editor-component v-model="html_code" name="html" language="html" height="50vh"/> | |||||
</div> | </div> | ||||
</div> | </div> | ||||
<li class="is-active"><a>Javascript</a></li> | <li class="is-active"><a>Javascript</a></li> | ||||
</ul> | </ul> | ||||
</div> | </div> | ||||
<editor-component v-model="js_code" name="js" language="javascript" height="50vh" :vim_mode="vim_mode" /> | |||||
<editor-component v-model="js_code" name="js" language="javascript" height="50vh"/> | |||||
</div> | </div> | ||||
<div class="row"> | <div class="row"> | ||||
<div class="tabs"> | <div class="tabs"> | ||||
export default { | export default { | ||||
props: { | props: { | ||||
vim_mode: { | |||||
type: Boolean, | |||||
default: true | |||||
}, | |||||
cpp_code: { | cpp_code: { | ||||
type: String, | type: String, | ||||
default: cpp_code, | default: cpp_code, | ||||
}); | }); | ||||
}, | }, | ||||
run() { | run() { | ||||
console.log('running..'); | |||||
this.update_iframe('myIframe'); | this.update_iframe('myIframe'); | ||||
}, | }, | ||||
}, | }, |
<div class="tags has-addons"> | <div class="tags has-addons"> | ||||
<span class="tag"><label class="checkbox"> | <span class="tag"><label class="checkbox"> | ||||
<input type="checkbox" v-model="vim_mode">VIM</label> | <input type="checkbox" v-model="vim_mode">VIM</label> | ||||
<input type="checkbox" v-model="emacs_mode">EMACS</label> | |||||
</span> | </span> | ||||
<span class="tag is-primary" :id="`${name}_status`"></span> | <span class="tag is-primary" :id="`${name}_status`"></span> | ||||
</div> | </div> | ||||
<script> | <script> | ||||
import { initVimMode } from 'monaco-vim'; | import { initVimMode } from 'monaco-vim'; | ||||
import { EmacsExtension } from 'monaco-emacs'; | |||||
export default { | export default { | ||||
props: { | props: { | ||||
vim_mode: { | vim_mode: { | ||||
type: Boolean, | type: Boolean, | ||||
default: false, | |||||
required: true | |||||
}, | |||||
emacs_mode: { | |||||
type: Boolean, | |||||
default: false, | |||||
required: true | required: true | ||||
}, | }, | ||||
name: { | name: { | ||||
} | } | ||||
}); | }); | ||||
this.vimMode_1 = initVimMode(this.editor, document.getElementById(this.name + "_status")) | |||||
// this.vimMode_1 = initVimMode(this.editor, document.getElementById(this.name + "_status")) | |||||
}, | }, | ||||
watch: { | watch: { | ||||
value(new_val) { | value(new_val) { | ||||
}, | }, | ||||
vim_mode(new_val) { | vim_mode(new_val) { | ||||
if (new_val) { | if (new_val) { | ||||
this.emacs_mode = false; | |||||
this.vimMode_1 = initVimMode(this.editor, document.getElementById(this.name + "_status")) | this.vimMode_1 = initVimMode(this.editor, document.getElementById(this.name + "_status")) | ||||
} else { | } else { | ||||
this.vimMode_1.dispose(); | this.vimMode_1.dispose(); | ||||
document.getElementById(this.name + "_status").innerHTML = ''; | document.getElementById(this.name + "_status").innerHTML = ''; | ||||
} | } | ||||
}, | |||||
emacs_mode(new_val) { | |||||
var statusNode = document.getElementById(this.name + "_status"); | |||||
if (new_val) { | |||||
this.vim_mode = false; | |||||
this.emacsMode = new EmacsExtension(this.editor); | |||||
this.emacsMode.onDidMarkChange(function (ev) { | |||||
statusNode.textContent = ev ? 'Mark Set!' : 'Mark Unset'; | |||||
}); | |||||
this.emacsMode.onDidChangeKey(function (str) { | |||||
statusNode.textContent = str; | |||||
}); | |||||
this.emacsMode.start(); | |||||
} else { | |||||
if (this.emacsMode) this.emacsMode.dispose(); | |||||
document.getElementById(this.name + "_status").innerHTML = ''; | |||||
} | |||||
} | } | ||||
} | } | ||||
} | } |