replace jQuery.ui.keyCode.X with EGW_KEY_X

This commit is contained in:
ralf 2022-04-30 10:32:58 +02:00
parent 813cd6924e
commit e4c2432f4c
4 changed files with 17 additions and 13 deletions

View File

@ -23,6 +23,7 @@ import {et2_IResizeable} from "./et2_core_interfaces";
import {et2_evalBool, et2_no_init} from "./et2_core_common";
import {et2_url} from "./et2_widget_url";
import {egw} from "../jsapi/egw_global";
import {EGW_KEY_ARROW_DOWN, EGW_KEY_ENTER} from "../egw_action/egw_action_constants";
/**
* Tag list widget
*
@ -528,13 +529,13 @@ export class et2_taglist extends et2_selectbox implements et2_IResizeable
*/
private _keyup(e, taglist, event)
{
if(event.which === jQuery.ui.keyCode.ENTER
if(event.which === EGW_KEY_ENTER
&& taglist.combobox.find('.ms-res-item.ms-res-item-active').length==0
&& this.getType() !== 'taglist-email')
{
// Change keycode to abort the validation process
// This means enter does not add a tag
event.keyCode = jQuery.ui.keyCode.DOWN;
event.keyCode = EGW_KEY_ARROW_DOWN;
this._query_server = true;
this.taglist.collapse();
@ -1545,4 +1546,4 @@ et2_register_widget(et2_taglist_ro, ["taglist_ro","taglist_email_ro", "taglist_a
// Require css
// included via etemplate2.css
//if(typeof egw == 'function') egw(window).includeCSS(egw.webserverUrl + "/api/js/jquery/magicsuggest/magicsuggest.css");
//if(typeof egw == 'function') egw(window).includeCSS(egw.webserverUrl + "/api/js/jquery/magicsuggest/magicsuggest.css");

View File

@ -19,6 +19,7 @@ import {et2_createWidget} from "../etemplate/et2_core_widget";
import {Et2Dialog} from "../etemplate/Et2Dialog/Et2Dialog";
import {et2_nextmatch} from "../etemplate/et2_extension_nextmatch";
import {et2_favorites} from "../etemplate/et2_widget_favorites";
import {EGW_KEY_ENTER} from "../egw_action/egw_action_constants";
/**
* Common base class for application javascript
@ -897,17 +898,17 @@ export const AppJS = (function(){ "use strict"; return Class.extend(
});
// Bind handler for enter keypress
this.favorite_popup.off('keydown').on('keydown', jQuery.proxy(function(e) {
this.favorite_popup.off('keydown').on('keydown', function(e) {
var tagName = e.target.tagName.toLowerCase();
tagName = (tagName === 'input' && e.target.type === 'button') ? 'button' : tagName;
if(e.keyCode == jQuery.ui.keyCode.ENTER && tagName !== 'textarea' && tagName !== 'select' && tagName !=='button')
if(e.keyCode == EGW_KEY_ENTER && tagName !== 'textarea' && tagName !== 'select' && tagName !=='button')
{
e.preventDefault();
jQuery('button[default]',this.favorite_popup.parent()).trigger('click');
return false;
}
},this));
}.bind(this));
return false;
},
@ -2063,4 +2064,4 @@ export const AppJS = (function(){ "use strict"; return Class.extend(
});
}
});}).call(window);
});}).call(window);

View File

@ -20,6 +20,7 @@ import Sortable from 'sortablejs/modular/sortable.complete.esm.js';
import {et2_valueWidget} from "../etemplate/et2_core_valueWidget";
import {nm_action} from "../etemplate/et2_extension_nextmatch_actions";
import {Et2Dialog} from "../etemplate/Et2Dialog/Et2Dialog";
import {EGW_KEY_ENTER} from "../egw_action/egw_action_constants";
/**
* Type for push-message
@ -1132,18 +1133,18 @@ export abstract class EgwApp
});
// Bind handler for enter keypress
this.favorite_popup.off('keydown').on('keydown', jQuery.proxy(function(e)
this.favorite_popup.off('keydown').on('keydown', function(e)
{
var tagName = e.target.tagName.toLowerCase();
tagName = (tagName === 'input' && e.target.type === 'button') ? 'button' : tagName;
if(e.keyCode == jQuery.ui.keyCode.ENTER && tagName !== 'textarea' && tagName !== 'select' && tagName !== 'button')
if(e.keyCode == EGW_KEY_ENTER && tagName !== 'textarea' && tagName !== 'select' && tagName !== 'button')
{
e.preventDefault();
jQuery('button[default]', this.favorite_popup.parent()).trigger('click');
return false;
}
}, this));
}.bind(this));
return false;
}

View File

@ -52,6 +52,7 @@ import {et2_grid} from "../../api/js/etemplate/et2_widget_grid";
import {Et2Textbox} from "../../api/js/etemplate/Et2Textbox/Et2Textbox";
import "./SidemenuDate";
import {parseDate} from "../../api/js/etemplate/Et2Date/Et2Date";
import {EGW_KEY_PAGE_UP,EGW_KEY_PAGE_DOWN} from "../../api/js/egw_action/egw_action_constants";
/**
* UI for calendar
@ -223,8 +224,8 @@ export class CalendarApp extends EgwApp
}
this.sidebox_hooked_templates = [];
egw_unregisterGlobalShortcut(jQuery.ui.keyCode.PAGE_UP, false, false, false);
egw_unregisterGlobalShortcut(jQuery.ui.keyCode.PAGE_DOWN, false, false, false);
egw_unregisterGlobalShortcut(EGW_KEY_PAGE_UP, false, false, false);
egw_unregisterGlobalShortcut(EGW_KEY_PAGE_DOWN, false, false, false);
// Stop autorefresh
if(this._autorefresh_timer)
@ -1354,7 +1355,7 @@ export class CalendarApp extends EgwApp
scroll_animate.call(this,"up", -1);
return true;
}, this);
egw_registerGlobalShortcut(jQuery.ui.keyCode.PAGE_DOWN, false, false, false, function() {
egw_registerGlobalShortcut(EGW_KEY_PAGE_DOWN, false, false, false, function() {
if(app.calendar.state.view == 'listview')
{
return false;