Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
// readOnly: false,
// theme: "vs-dark"
// }
// );
//
// var editor2 = monaco.editor.create(document.getElementById('editor2'), {
// value: [
// '\tconsole.log("MaxiLib Output");'
// ].join('\n'),
// language: 'javascript'
// });
var myCondition1 = editor1.createContextKey(/*key name*/'myCondition1', /*default value*/false);
var myCondition2 = editor1.createContextKey(/*key name*/'myCondition2', /*default value*/false);
editor1.addCommand(monaco.KeyMod.Shift | monaco.KeyCode.Enter, function() {
// services available in `ctx`
var text = editor1.getValue();
var selection = editor1.getSelection(); //[2,1 -> 2,34]
var valueInSelection = editor1.getModel().getValueInRange(selection); //[2,1 -> 2,34]
// const parser = new nearley.Parser(nearley.Grammar.fromCompiled(processor));
//
// parser.feed(input);
//
//
alert("Text: " + text + '\n\n'
+ "Selection: " + selection + '\n\n'
const handleEditorDidMount = (
editor: monacoEditor.editor.IStandaloneCodeEditor
) => {
editorRef.current = editor
editor.addAction({
id: 'runTests',
label: 'Run tests',
keybindings: [monacoEditor.KeyCode.F2],
run: onRunTests,
})
editor.addAction({
id: 'submit',
label: 'Submit',
keybindings: [monacoEditor.KeyCode.F3],
run: onSubmit,
})
MonacoServices.install(editor)
editor.setModel(filesRef.current[0].model)
// Fix a custom code font rendering bug
// See https://github.com/exercism/website/issues/742#issuecomment-816806513
private onKeyUp = (e: monacoEditor.IKeyboardEvent) => {
if (e.shiftKey && e.keyCode === monacoEditor.KeyCode.Enter) {
// Shift enter was hit
e.stopPropagation();
e.preventDefault();
}
}
const handleEditorDidMount = (
editor: monacoEditor.editor.IStandaloneCodeEditor
) => {
editorRef.current = editor
editor.addAction({
id: 'runTests',
label: 'Run tests',
keybindings: [monacoEditor.KeyCode.F2],
run: onRunTests,
})
editor.addAction({
id: 'submit',
label: 'Submit',
keybindings: [monacoEditor.KeyCode.F3],
run: onSubmit,
})
MonacoServices.install(editor)
editor.setModel(filesRef.current[0].model)
// Fix a custom code font rendering bug
// See https://github.com/exercism/website/issues/742#issuecomment-816806513
document.fonts.ready.then(() => monacoEditor.editor.remeasureFonts())
editorDidMount({ getFiles, setFiles, openPalette })
}
setTimeout(() => {
this.editor!.addCommand(monaco.KeyMod.CtrlCmd | monaco.KeyCode.KEY_S, () => this.props.onDidSave(), '')
})
setTimeout(() => {
if (MonacoSettingsEditor.isStandaloneCodeEditor(editor)) {
editor.addCommand(
monaco.KeyMod.CtrlCmd | monaco.KeyCode.KEY_S,
() => {
if (this.props.onDidSave) {
this.props.onDidSave()
}
},
''
)
}
})
}
editor.onKeyDown(e => {
if (e.keyCode === monacoEditor.KeyCode.Enter) {
editor.updateOptions({ readOnly: false });
}
});
editor.getAction('editor.action.formatDocument').run();
const handleEditorDidMount = (
editor: monacoEditor.editor.IStandaloneCodeEditor
) => {
editorRef.current = editor
editor.addAction({
id: 'runTests',
label: 'Run tests',
keybindings: [monacoEditor.KeyCode.F2],
run: onRunTests,
})
MonacoServices.install(editor)
editorDidMount(editor)
}