Skip to content

Commit 605f438

Browse files
authored
gpfup-bb-cropper-modal-compat.js: Migrated from experimental folder.
1 parent e21b59b commit 605f438

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
/**
2+
* Gravity Perks // GP File Upload Pro // Prevent cropper from closing Beaver Builder modal that a form is embedded in
3+
* https://gravitywiz.com/documentation/gravity-forms-file-upload-pro/
4+
*
5+
* Experimental Snippet 🧪
6+
*
7+
* Instructions:
8+
* 1. Install our free Custom JavaScript for Gravity Forms plugin.
9+
* Download the plugin here: https://gravitywiz.com/gravity-forms-code-chest/
10+
* 2. Copy and paste the snippet into the editor of the Custom Javascript for Gravity Forms plugin.
11+
* 3. Update the form ID/field ID (e.g. GPFUP_24_1) and Beaver Builder modal ID (e.g. pp_modal_fl6amr4d57jn) accordingly.
12+
*/
13+
gform.addAction( 'gpfup_uploader_ready', function ( gpfup ) {
14+
var store = window.GPFUP_24_1.$store;
15+
16+
if ( !store ) {
17+
return;
18+
}
19+
20+
store.subscribe( function ( mutation, state ) {
21+
switch ( mutation.type ) {
22+
case 'OPEN_EDITOR':
23+
pp_modal_fl6amr4d57jn.settings.click_exit = false;
24+
break;
25+
26+
case 'REPLACE_FILE':
27+
pp_modal_fl6amr4d57jn.settings.click_exit = true;
28+
break;
29+
}
30+
} );
31+
} );

0 commit comments

Comments
 (0)