未验证 提交 264a2d54 编写于 作者: F Francois Campbell 提交者: GitHub

[JENKINS-63342] Fix JavaScript errors in Script Console on Mac (#4901)

* Fix JavaScript errors in Script Console on Mac

Fixes errors related to keyevent handling in the script console when using a browser on a Mac.

* Partial revert of #4818

Reverts a change in #4818 that changed the scope of some variables that breaks the Script Console on a Mac

* Fix indentation
上级 09b9e96d
......@@ -795,33 +795,6 @@ function getParentForm(element) {
return getParentForm(element.parentNode);
}
function saveAndSubmit() {
editor.save();
getParentForm(e).submit();
event.stop();
}
function textAreaScriptEditorOnKeyEvent(editor, event){
// Mac (Command + Enter)
if (navigator.userAgent.indexOf('Mac') > -1) {
if (event.type == 'keydown' && isCommandKey()) {
cmdKeyDown = true;
}
if (event.type == 'keyup' && isCommandKey()) {
cmdKeyDown = false;
}
if (cmdKeyDown && isReturnKeyDown()) {
saveAndSubmit();
return true;
}
// Windows, Linux (Ctrl + Enter)
} else {
if (event.ctrlKey && isReturnKeyDown()) {
saveAndSubmit();
return true;
}
}
}
// figure out the corresponding end marker
function findEnd(e) {
......@@ -964,7 +937,34 @@ function rowvgStartEachRow(recursive,f) {
lineNumbers: true,
matchBrackets: true,
readOnly: readOnly,
onKeyEvent: textAreaScriptEditorOnKeyEvent
onKeyEvent: function (editor, event){
function saveAndSubmit() {
editor.save();
getParentForm(e).submit();
event.stop();
}
// Mac (Command + Enter)
if (navigator.userAgent.indexOf('Mac') > -1) {
if (event.type == 'keydown' && isCommandKey()) {
cmdKeyDown = true;
}
if (event.type == 'keyup' && isCommandKey()) {
cmdKeyDown = false;
}
if (cmdKeyDown && isReturnKeyDown()) {
saveAndSubmit();
return true;
}
// Windows, Linux (Ctrl + Enter)
} else {
if (event.ctrlKey && isReturnKeyDown()) {
saveAndSubmit();
return true;
}
}
}
}).getWrapperElement();
w.setAttribute("style","border:1px solid black; margin-top: 1em; margin-bottom: 1em")
})();
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册