1
0
mirror of https://github.com/node-red/node-red.git synced 2023-10-10 13:36:53 +02:00

add 2 ace compatible functions

- clearSelection - blocky node
- selectAll - obvious addition
This commit is contained in:
Steve-Mcl 2021-06-16 22:36:00 +01:00
parent 1a73a27102
commit c908502644

View File

@ -31,6 +31,8 @@
function setMode(mode, cb) function setMode(mode, cb)
function getRange(); function getRange();
function replace(range, text) function replace(range, text)
function selectAll
function clearSelection
function getSelectedText() function getSelectedText()
function destroy() function destroy()
function resize() function resize()
@ -1013,11 +1015,20 @@ RED.editor.codeEditor.monaco = (function() {
} }
} }
ed.selectAll = function selectAll() {
const range = ed.getModel().getFullModelRange();
ed.setSelection(range);
}
ed.clearSelection = function clearSelection() {
ed.setPosition({column:1,lineNumber:1});
}
ed.getSelectedText = function getSelectedText() { ed.getSelectedText = function getSelectedText() {
return ed.getModel().getValueInRange(ed.getSelection()); return ed.getModel().getValueInRange(ed.getSelection());
} }
ed.insertSnippet = function editer_insertSnippet(s) { ed.insertSnippet = function insertSnippet(s) {
//https://github.com/microsoft/monaco-editor/issues/1112#issuecomment-429580604 //https://github.com/microsoft/monaco-editor/issues/1112#issuecomment-429580604
//no great way of triggering snippets! //no great way of triggering snippets!
let contribution = ed.getContribution("snippetController2"); let contribution = ed.getContribution("snippetController2");