Skip to content

Commit 9705908

Browse files
committed
Temp workaround for issue-150
1 parent 679ff9f commit 9705908

File tree

2 files changed

+17
-8
lines changed

2 files changed

+17
-8
lines changed

assets/js/gutenblock.js

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -174,17 +174,24 @@
174174
* Create the div container, add an overlay so the user can interact
175175
* with the form in Gutenberg, then render the iframe with form
176176
*/
177-
if( '' === formID ) {
177+
if( '' === formID ) {
178178
children.push( el( 'div', {style : {width: '100%'}},
179179
el( 'img', { className: 'weforms-block-logo', src: weFormsBlock.block_logo}),
180180
el ( 'div', null, 'weForms Forms'),
181181
inputFilterMain
182182
) );
183+
} else if( '0' === weFormsBlock.did_wp_head_run ) {
184+
children.push(
185+
el( 'div', { className: 'weforms-iframe-container' },
186+
el( 'div', { className: 'weforms-iframe-overlay' } ),
187+
el( 'span', null, 'Currently weForm is not able to be previewed in the Block-Based page builder. To preview use the page preview button after saving.' ),
188+
)
189+
)
183190
} else {
184191
children.push(
185192
el( 'div', { className: 'weforms-iframe-container' },
186193
el( 'div', { className: 'weforms-iframe-overlay' } ),
187-
el( 'iframe', { src: weFormsBlock.siteUrl + '?weforms_preview=1&weforms_iframe&form_id=' + formID, height: '0', width: '500', scrolling: 'no' })
194+
el( 'iframe', { src: weFormsBlock.siteUrl + '/?weforms_preview=1&weforms_iframe&form_id=' + formID, height: '0', width: '500', scrolling: 'no' })
188195
)
189196
)
190197
}

includes/admin/class-gutenblock.php

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -57,14 +57,16 @@ public function weforms_form_block() {
5757
];
5858
}
5959

60-
$block_logo = WEFORMS_ASSET_URI . '/images/icon-weforms.png';
61-
$thumbnail_logo = WEFORMS_ASSET_URI . '/images/icon-weforms.png';
60+
$block_logo = WEFORMS_ASSET_URI . '/images/icon-weforms.png';
61+
$thumbnail_logo = WEFORMS_ASSET_URI . '/images/icon-weforms.png';
62+
$did_wp_head_run = did_action( 'wp_head' );
6263

6364
wp_localize_script( 'weforms-forms-block', 'weFormsBlock', [
64-
'forms' => $forms,
65-
'siteUrl' => get_home_url(),
66-
'block_logo' => $block_logo,
67-
'thumbnail_logo' => $thumbnail_logo,
65+
'forms' => $forms,
66+
'siteUrl' => get_home_url(),
67+
'block_logo' => $block_logo,
68+
'thumbnail_logo' => $thumbnail_logo,
69+
'did_wp_head_run' => $did_wp_head_run,
6870
] );
6971
wp_enqueue_style( 'weforms-forms-block-style' );
7072
wp_enqueue_style( 'weforms-forms-block-editor' );

0 commit comments

Comments
 (0)