@@ -51,8 +51,8 @@ define([
51
51
/**
52
52
* Click handler.
53
53
*/
54
- click : function ( ) {
55
- this . closeModal ( ) ;
54
+ click : function ( event ) {
55
+ this . closeModal ( event ) ;
56
56
}
57
57
} , {
58
58
text : $ . mage . __ ( 'OK' ) ,
@@ -61,8 +61,8 @@ define([
61
61
/**
62
62
* Click handler.
63
63
*/
64
- click : function ( ) {
65
- this . closeModal ( true ) ;
64
+ click : function ( event ) {
65
+ this . closeModal ( event , true ) ;
66
66
}
67
67
} ]
68
68
} ,
@@ -75,7 +75,7 @@ define([
75
75
this . options . validation = this . options . validation && this . options . validationRules . length ;
76
76
this . _super ( ) ;
77
77
this . modal . find ( this . options . modalContent ) . append ( this . getFormTemplate ( ) ) ;
78
- this . modal . find ( this . options . modalCloseBtn ) . off ( ) . on ( 'click' , _ . bind ( this . closeModal , this , false ) ) ;
78
+ this . modal . find ( this . options . modalCloseBtn ) . off ( ) . on ( 'click' , _ . bind ( this . closeModal , this ) ) ;
79
79
80
80
if ( this . options . validation ) {
81
81
this . setValidationClasses ( ) ;
@@ -152,21 +152,23 @@ define([
152
152
/**
153
153
* Close modal window
154
154
*/
155
- closeModal : function ( result ) {
155
+ closeModal : function ( event , result ) {
156
156
var value ;
157
157
158
+ result = result || false ;
159
+
158
160
if ( result ) {
159
161
if ( this . options . validation && ! this . validate ( ) ) {
160
162
return false ;
161
163
}
162
164
163
165
value = this . modal . find ( this . options . promptField ) . val ( ) ;
164
- this . options . actions . confirm . call ( this , value ) ;
166
+ this . options . actions . confirm . call ( event , value ) ;
165
167
} else {
166
- this . options . actions . cancel . call ( this , result ) ;
168
+ this . options . actions . cancel . call ( event , result ) ;
167
169
}
168
170
169
- this . options . actions . always ( ) ;
171
+ this . options . actions . always ( event ) ;
170
172
this . element . bind ( 'promptclosed' , _ . bind ( this . _remove , this ) ) ;
171
173
172
174
return this . _super ( ) ;
@@ -177,3 +179,4 @@ define([
177
179
return $ ( '<div class="prompt-message"></div>' ) . html ( config . content ) . prompt ( config ) ;
178
180
} ;
179
181
} ) ;
182
+
0 commit comments