Skip to content
Permalink
Browse files

[FIXED JENKINS-23151, JENKINS-23026] Save CodeMirror editor when it l…

…oses focus

* Save CM editor when it loses focus to ensure that test is saved back to textarea
* Turn on again CM editor for shell scripts
  • Loading branch information
vjuranek committed Jan 16, 2015
1 parent e9aeaf1 commit 4e48eaa05ca3a76fcb0e1eee307fd20f222079bc
@@ -25,6 +25,5 @@ package hudson.tasks.Shell;
f=namespace(lib.FormTagLib)

f.entry(title:_("Command"),description:_("description",rootURL)) {
// TODO JENKINS-23151 'codemirror-mode': 'shell' is broken
f.textarea(name: "command", value: instance?.command, class: "fixed-width")
f.textarea(name: "command", value: instance?.command, class: "fixed-width", 'codemirror-mode': 'shell', 'codemirror-config': "mode: 'text/x-sh'")
}
@@ -10,7 +10,8 @@ Behaviour.specify("TEXTAREA.codemirror", 'textarea', 0, function(e) {
}

var h = e.clientHeight || getTextareaHeight();
var config = e.getAttribute("codemirror-config") || "";
var config = e.getAttribute("codemirror-config");
config += (config ? ", " : " ") + "onBlur: function(editor){editor.save()}";
config = eval('({'+config+'})');
var codemirror = CodeMirror.fromTextArea(e,config);
e.codemirrorObject = codemirror;

0 comments on commit 4e48eaa

Please sign in to comment.