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

Ensure ace edit history is reset after initialisation

This commit is contained in:
Nick O'Leary 2015-05-07 21:12:46 +01:00
parent cf25b2866e
commit ce5c9da107
4 changed files with 13 additions and 9 deletions

View File

@ -916,13 +916,14 @@ RED.editor = (function() {
createEditor: function(options) {
var editor = ace.edit(options.id);
editor.setTheme("ace/theme/tomorrow");
var session = editor.getSession();
if (options.mode) {
editor.getSession().setMode(options.mode);
session.setMode(options.mode);
}
if (options.foldStyle) {
editor.getSession().setFoldStyle(options.foldStyle);
session.setFoldStyle(options.foldStyle);
} else {
editor.getSession().setFoldStyle('markbeginend');
session.setFoldStyle('markbeginend');
}
if (options.options) {
editor.setOptions(options.options);
@ -933,6 +934,9 @@ RED.editor = (function() {
});
}
editor.$blockScrolling = Infinity;
if (options.value) {
session.setValue(options.value,-1);
}
return editor;
}
}

View File

@ -115,9 +115,9 @@
this.editor = RED.editor.createEditor({
id: 'node-input-func-editor',
mode: 'ace/mode/javascript'
mode: 'ace/mode/javascript',
value: $("#node-input-func").val()
});
this.editor.setValue($("#node-input-func").val(),-1);
RED.library.create({
url:"functions", // where to get the data from

View File

@ -98,9 +98,9 @@
});
this.editor = RED.editor.createEditor({
id: 'node-input-template-editor',
mode: 'ace/mode/html'
mode: 'ace/mode/html',
value: $("#node-input-template").val()
});
this.editor.setValue($("#node-input-template").val(),-1);
RED.library.create({
url:"functions", // where to get the data from
type:"function", // the type of object the library is for

View File

@ -86,9 +86,9 @@
});
this.editor = RED.editor.createEditor({
id: 'node-input-info-editor',
mode: 'ace/mode/markdown'
mode: 'ace/mode/markdown',
value: $("#node-input-info").val()
});
this.editor.setValue($("#node-input-info").val(),-1);
this.editor.focus();
},
oneditsave: function() {