react-confirm-alert 2.7.0 → 2.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Readme.md +1 -0
- package/lib/index.js +10 -2
- package/package.json +1 -1
package/Readme.md
CHANGED
package/lib/index.js
CHANGED
|
@@ -66,9 +66,15 @@ var ReactConfirmAlert = (_temp2 = _class = function (_Component) {
|
|
|
66
66
|
}, _this.keyboardClose = function (event) {
|
|
67
67
|
var _this$props2 = _this.props,
|
|
68
68
|
closeOnEscape = _this$props2.closeOnEscape,
|
|
69
|
-
onKeypressEscape = _this$props2.onKeypressEscape
|
|
69
|
+
onKeypressEscape = _this$props2.onKeypressEscape,
|
|
70
|
+
keyCodeForClose = _this$props2.keyCodeForClose;
|
|
70
71
|
|
|
71
|
-
var
|
|
72
|
+
var keyCode = event.keyCode;
|
|
73
|
+
var isKeyCodeEscape = keyCode === 27;
|
|
74
|
+
|
|
75
|
+
if (keyCodeForClose.includes(keyCode)) {
|
|
76
|
+
_this.close();
|
|
77
|
+
}
|
|
72
78
|
|
|
73
79
|
if (closeOnEscape && isKeyCodeEscape) {
|
|
74
80
|
onKeypressEscape(event);
|
|
@@ -161,6 +167,7 @@ var ReactConfirmAlert = (_temp2 = _class = function (_Component) {
|
|
|
161
167
|
customUI: _propTypes2.default.func,
|
|
162
168
|
closeOnClickOutside: _propTypes2.default.bool,
|
|
163
169
|
closeOnEscape: _propTypes2.default.bool,
|
|
170
|
+
keyCodeForClose: _propTypes2.default.arrayOf(_propTypes2.default.number),
|
|
164
171
|
willUnmount: _propTypes2.default.func,
|
|
165
172
|
afterClose: _propTypes2.default.func,
|
|
166
173
|
onClickOutside: _propTypes2.default.func,
|
|
@@ -185,6 +192,7 @@ var ReactConfirmAlert = (_temp2 = _class = function (_Component) {
|
|
|
185
192
|
},
|
|
186
193
|
closeOnClickOutside: true,
|
|
187
194
|
closeOnEscape: true,
|
|
195
|
+
keyCodeForClose: [],
|
|
188
196
|
willUnmount: function willUnmount() {
|
|
189
197
|
return null;
|
|
190
198
|
},
|