Skip to content

Commit

Permalink
[FIXED JENKINS-23151, JENKINS-23026] Save CodeMirror editor when it l…
Browse files Browse the repository at this point in the history
…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 4e48eaa
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
3 changes: 1 addition & 2 deletions core/src/main/resources/hudson/tasks/Shell/config.groovy
Expand Up @@ -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'")
}
3 changes: 2 additions & 1 deletion core/src/main/resources/lib/form/textarea/textarea.js
Expand Up @@ -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;
Expand Down

0 comments on commit 4e48eaa

Please sign in to comment.