From e4c2432f4ca39ef2c86623bfa5c001b525dd2d5a Mon Sep 17 00:00:00 2001 From: ralf Date: Sat, 30 Apr 2022 10:32:58 +0200 Subject: [PATCH] replace jQuery.ui.keyCode.X with EGW_KEY_X --- api/js/etemplate/et2_widget_taglist.ts | 7 ++++--- api/js/jsapi/app_base.js | 9 +++++---- api/js/jsapi/egw_app.ts | 7 ++++--- calendar/js/app.ts | 7 ++++--- 4 files changed, 17 insertions(+), 13 deletions(-) diff --git a/api/js/etemplate/et2_widget_taglist.ts b/api/js/etemplate/et2_widget_taglist.ts index b29c261105..88328dd4d8 100644 --- a/api/js/etemplate/et2_widget_taglist.ts +++ b/api/js/etemplate/et2_widget_taglist.ts @@ -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"); \ No newline at end of file diff --git a/api/js/jsapi/app_base.js b/api/js/jsapi/app_base.js index 4bb1f029a0..095f27f19e 100644 --- a/api/js/jsapi/app_base.js +++ b/api/js/jsapi/app_base.js @@ -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); \ No newline at end of file diff --git a/api/js/jsapi/egw_app.ts b/api/js/jsapi/egw_app.ts index fc704a3f53..f61563e57c 100644 --- a/api/js/jsapi/egw_app.ts +++ b/api/js/jsapi/egw_app.ts @@ -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; } diff --git a/calendar/js/app.ts b/calendar/js/app.ts index d0c47c5b49..0a4564925d 100644 --- a/calendar/js/app.ts +++ b/calendar/js/app.ts @@ -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;