提交 694cb1ef 编写于 作者: D Darío Villadiego 提交者: Oliver Gondža

[JENKINS-32027] Avoiding to refresh codemirror through the layoutUpdateCallback (#2390)

(cherry picked from commit 1e170d43)
上级 2294259b
......@@ -2,13 +2,13 @@ Behaviour.specify("TEXTAREA.codemirror", 'textarea', 0, function(e) {
//ensure, that textarea is visible, when obtaining its height, see JENKINS-25455
function getTextareaHeight() {
var p = e.parentNode.parentNode; //first parent is CodeMirror div, second is actual element which needs to be visible
var display = p.style.display;
var display = p.style.display;
p.style.display = "";
var h = e.clientHeight;
p.style.display = display;
return h;
}
var h = e.clientHeight || getTextareaHeight();
var config = e.getAttribute("codemirror-config");
config += (config ? ", " : " ") + "onBlur: function(editor){editor.save()}";
......@@ -27,16 +27,10 @@ Behaviour.specify("TEXTAREA.codemirror", 'textarea', 0, function(e) {
// the form needs to be populated before the "Apply" button
if(e.up('form')) { // Protect against undefined element
Element.on(e.up('form'),"jenkins:apply", function() {
e.value = codemirror.getValue()
})
}
//refresh CM when there are some layout updates
function refreshCM() {
codemirror.refresh();
Element.on(e.up('form'),"jenkins:apply", function() {
e.value = codemirror.getValue()
})
}
layoutUpdateCallback.add(refreshCM);
});
Behaviour.specify("DIV.textarea-preview-container", 'textarea', 100, function (e) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册