mirror of
https://github.com/Combodo/iTop.git
synced 2026-02-13 07:24:13 +01:00
run_query : replace JQuery.hotkeys by standard keys detection (#359)
Use same technique as the one in #345
This commit is contained in:
@@ -1,6 +1,12 @@
|
||||
/*jslint browser: true*/
|
||||
/*jslint jquery: true*/
|
||||
|
||||
|
||||
/**
|
||||
* @deprecated 3.1.0 use JQuery event keys instead
|
||||
* @link https://github.com/Combodo/iTop/pull/345 Ctrl+Enter shortcut added in iTop object forms
|
||||
*/
|
||||
|
||||
/*
|
||||
* jQuery Hotkeys Plugin
|
||||
* Copyright 2010, John Resig
|
||||
|
||||
@@ -177,13 +177,14 @@ try
|
||||
$oQueryTextArea->AddCSSClasses(['ibo-input-text', 'ibo-query-oql', 'ibo-is-code']);
|
||||
$oQueryForm->AddSubBlock($oQueryTextArea);
|
||||
|
||||
$oP->add_linked_script(utils::GetAbsoluteUrlAppRoot()."/js/jquery.hotkeys.js");
|
||||
$oP->add_ready_script(<<<EOF
|
||||
$oP->add_ready_script(<<<JS
|
||||
$("#expression").select();
|
||||
$("#expression").on("keydown", null, "ctrl+return", function() {
|
||||
$(this).closest("form").submit();
|
||||
$("#expression").on('keyup', function (oEvent) {
|
||||
if ((oEvent.ctrlKey || oEvent.metaKey) && oEvent.key === 'Enter') {
|
||||
$(this).closest('form').trigger('submit');
|
||||
}
|
||||
});
|
||||
EOF
|
||||
JS
|
||||
);
|
||||
|
||||
if (count($aArgs) > 0) {
|
||||
|
||||
@@ -158,13 +158,14 @@ try
|
||||
$oP->add("<form method=\"post\">\n");
|
||||
$oP->add(Dict::S('UI:RunQuery:ExpressionToEvaluate')."<br/>\n");
|
||||
$oP->add("<textarea cols=\"120\" rows=\"8\" id=\"expression\" name=\"expression\">".utils::EscapeHtml($sExpression)."</textarea>\n");
|
||||
$oP->add_linked_script(utils::GetAbsoluteUrlAppRoot()."/js/jquery.hotkeys.js");
|
||||
$oP->add_ready_script(<<<EOF
|
||||
$oP->add_ready_script(<<<JS
|
||||
$("#expression").select();
|
||||
$("#expression").on("keydown", null, "ctrl+return", function() {
|
||||
$(this).closest("form").submit();
|
||||
$("#expression").on('keyup', function (oEvent) {
|
||||
if ((oEvent.ctrlKey || oEvent.metaKey) && oEvent.key === 'Enter') {
|
||||
$(this).closest('form').trigger('submit');
|
||||
}
|
||||
});
|
||||
EOF
|
||||
JS
|
||||
);
|
||||
|
||||
if (count($aArgs) > 0)
|
||||
|
||||
Reference in New Issue
Block a user