File tree 1 file changed +9
-1
lines changed
1 file changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -81,7 +81,8 @@ define([
81
81
82
82
_init_handlers : function ( ) {
83
83
var $el = this . $el ;
84
- $ ( document ) . on ( "click.pat-modal" , ".close-panel" , this . destroy . bind ( this ) ) ;
84
+ $ ( document ) . on ( "click.pat-modal" , ".close-panel[type!=submit]" , this . destroy . bind ( this ) ) ;
85
+ $ ( document ) . on ( "click.pat-modal" , ".close-panel[type=submit]" , this . destroy_inject . bind ( this ) ) ;
85
86
$ ( document ) . on ( "keyup.pat-modal" , this . _onKeyUp . bind ( this ) ) ;
86
87
if ( this . options . closing . indexOf ( "outside" ) !== - 1 ) {
87
88
$ ( document ) . on ( "click.pat-modal" , this . _onPossibleOutsideClick . bind ( this ) ) ;
@@ -148,6 +149,13 @@ define([
148
149
}
149
150
} ,
150
151
destroy : function ( ) {
152
+ var $el = this . $el ;
153
+ // if working without injection, destroy right away.
154
+ $ ( document ) . off ( ".pat-modal" ) ;
155
+ $el . remove ( ) ;
156
+ $ ( 'body' ) . removeClass ( "modal-active" ) ;
157
+ } ,
158
+ destroy_inject : function ( ) {
151
159
var $el = this . $el ;
152
160
if ( $el . find ( 'form' ) . hasClass ( 'pat-inject' ) ) {
153
161
// if pat-inject in modal form, listen to patterns-inject-triggered and destroy first
You can’t perform that action at this time.
0 commit comments