mirror of
https://github.com/node-red/node-red.git
synced 2023-10-10 13:36:53 +02:00
fix initial cursor position of init/finalize
This commit is contained in:
parent
8762d0e164
commit
d1312703c5
@ -460,7 +460,7 @@
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
var buildEditor = function(id, stateId, focus, value, defaultValue, extraLibs) {
|
var buildEditor = function(id, stateId, focus, value, defaultValue, extraLibs, offset) {
|
||||||
var editor = RED.editor.createEditor({
|
var editor = RED.editor.createEditor({
|
||||||
id: id,
|
id: id,
|
||||||
mode: 'ace/mode/nrjavascript',
|
mode: 'ace/mode/nrjavascript',
|
||||||
@ -484,14 +484,14 @@
|
|||||||
extraLibs: extraLibs
|
extraLibs: extraLibs
|
||||||
});
|
});
|
||||||
if (defaultValue && value === "") {
|
if (defaultValue && value === "") {
|
||||||
editor.moveCursorTo(defaultValue.split("\n").length - 1, 0);
|
editor.moveCursorTo(defaultValue.split("\n").length +offset, 0);
|
||||||
}
|
}
|
||||||
editor.__stateId = stateId;
|
editor.__stateId = stateId;
|
||||||
return editor;
|
return editor;
|
||||||
}
|
}
|
||||||
this.initEditor = buildEditor('node-input-init-editor', this.id + "/" + "initEditor", false, $("#node-input-initialize").val(), RED._("node-red:function.text.initialize"))
|
this.initEditor = buildEditor('node-input-init-editor', this.id + "/" + "initEditor", false, $("#node-input-initialize").val(), RED._("node-red:function.text.initialize"), undefined, 0);
|
||||||
this.editor = buildEditor('node-input-func-editor', this.id + "/" + "editor", true, $("#node-input-func").val(), undefined, that.libs || [])
|
this.editor = buildEditor('node-input-func-editor', this.id + "/" + "editor", true, $("#node-input-func").val(), undefined, that.libs || [], undefined, -1);
|
||||||
this.finalizeEditor = buildEditor('node-input-finalize-editor', this.id + "/" + "finalizeEditor", false, $("#node-input-finalize").val(), RED._("node-red:function.text.finalize"))
|
this.finalizeEditor = buildEditor('node-input-finalize-editor', this.id + "/" + "finalizeEditor", false, $("#node-input-finalize").val(), RED._("node-red:function.text.finalize"), undefined, 0);
|
||||||
|
|
||||||
RED.library.create({
|
RED.library.create({
|
||||||
url:"functions", // where to get the data from
|
url:"functions", // where to get the data from
|
||||||
|
Loading…
Reference in New Issue
Block a user