The Unified and Autonomous Development Platform
fix issue of modal dialog being closed when pressing esc to close atwho view
robin shine208bb66a4f8b
diff --git a/commons.wicket/src/main/java/com/pmease/commons/wicket/assets/atwho/jquery.atwho.js b/commons.wicket/src/main/java/com/pmease/commons/wicket/assets/atwho/jquery.atwho.jsindex 9ec8deff85..2a8046f85d 100644--- a/commons.wicket/src/main/java/com/pmease/commons/wicket/assets/atwho/jquery.atwho.js+++ b/commons.wicket/src/main/java/com/pmease/commons/wicket/assets/atwho/jquery.atwho.js@@ -219,11 +219,15 @@ App = (function() {return;}switch (e.keyCode) {- case KEY_CODE.ESC:- e.preventDefault();+ // comment out below so that atWho only gets closed in keyup event of+ // ESC, so that we can check atWho's presence in ESC keydown event of+ // modal dialog+ /*case KEY_CODE.ESC:+ e.preventDefault();view.hide(e);this.$inputor.data("ignoreEsc", true);break;+ */case KEY_CODE.UP:e.preventDefault();view.prev();diff --git a/commons.wicket/src/main/java/com/pmease/commons/wicket/component/modal/modal.js b/commons.wicket/src/main/java/com/pmease/commons/wicket/component/modal/modal.jsindex dd12b97ee8..0f96a9e059 100644--- a/commons.wicket/src/main/java/com/pmease/commons/wicket/component/modal/modal.js+++ b/commons.wicket/src/main/java/com/pmease/commons/wicket/component/modal/modal.js@@ -1,26 +1,30 @@-pmease.commons.modal = {- init: function(containerId, closeCallback) {- var $modal = $("#" + containerId + ">.modal");- $modal.data("closeCallback", closeCallback);-- $modal.data("keydown", function(e) {- if (e.keyCode == 27 && $(".select2-drop:visible").length == 0 && $("body>.floating").length == 0)- pmease.commons.modal.close($modal, true);- });-- // use keydown as keypress does not work in chrome/safari- $(document).on("keydown", $modal.data("keydown"));-- $modal.modal({backdrop: "static", "keyboard": false});- },-- close: function($modal, callCloseCallback) {- if (callCloseCallback)- $modal.data("closeCallback")();-- $(document).off("keydown", $modal.data("keydown"));-- $modal.modal("hide").parent().remove();- }-+pmease.commons.modal = {+ init: function(containerId, closeCallback) {+ var $modal = $("#" + containerId + ">.modal");+ $modal.data("closeCallback", closeCallback);++ $modal.data("keydown", function(e) {+ if (e.keyCode == 27+ && $(".select2-drop:visible").length == 0+ && $("body>.floating").length == 0+ && $(".atwho-view:visible").length == 0) {+ pmease.commons.modal.close($modal, true);+ }+ });++ // use keydown as keypress does not work in chrome/safari+ $(document).on("keydown", $modal.data("keydown"));++ $modal.modal({backdrop: "static", "keyboard": false});+ },++ close: function($modal, callCloseCallback) {+ if (callCloseCallback)+ $modal.data("closeCallback")();++ $(document).off("keydown", $modal.data("keydown"));++ $modal.modal("hide").parent().remove();+ }+}\ No newline at end of file