tomjn / Frontenberg

A WP theme providing a read only demo of the post block editor on the frontend, provided as is, no support.
https://frontenberg.tomjn.com/
135 stars 30 forks source link

doesn't work with Gutenberg 4.9 #10

Closed ancom32 closed 5 years ago

ancom32 commented 5 years ago

Hi,

I use Frontenberg on my website and it works great with Gutenberg 4.8. However, when I updated Gutenberg to version 4.9, Frontenberg didn’t work anymore. I got this error in php_errorlog:

PHP Fatal error:  Uncaught Error: Call to undefined function get_current_screen() in /wp-content/plugins/gutenberg/lib/client-assets.php:1338
Stack trace:
/wp-includes/class-wp-hook.php(286): gutenberg_editor_scripts_and_styles('')
/wp-includes/class-wp-hook.php(310): WP_Hook->apply_filters(NULL, Array)
/wp-includes/plugin.php(453): WP_Hook->do_action(Array)
/wp-includes/script-loader.php(2231): do_action('wp_enqueue_scri...')
/wp-includes/class-wp-hook.php(286): wp_enqueue_scripts('')
/wp-includes/class-wp-hook.php(310): WP_Hook->apply_filters(NULL, Array)
/wp-includes/plugin.php(453): WP_Hook->do_action(Array)
/wp-includes/general-template.php(2614): do_action('wp_head')
/wp-content/themes/Frontenberg-master/header.php(7): wp_head()
/wp-content/plugins/gutenberg/lib/client-assets.php on line 1338

Do you have any idea? I don’t know if I am the only person having this issue with Gutenberg 4.9. Please, try to check if you have the same issue with the new version of Gutenberg.

Thanks.

tomjn commented 5 years ago

If you ever see something like this, the problem lies in Gutenberg and you should raise an issue there, I'm surprised you had 4.8 working, 4.8 complains about a missing post lock check function for me.

If you're using the latest Frontenberg, your best bet is to deactivate gutenberg and let it fall back to the built in block editor. Just be aware it won't work with pages for unknown reasons ( see #9 )

ancom32 commented 5 years ago

Ok, thanks. I'm going to raise this issue in Gutenberg.

ancom32 commented 5 years ago

Hi, I got this response from Gutenberg forum:

Hi there! Seems like a frontenberg issue as get_current_screen is not defined in the frontend by default. you might need (or frontenberg) to import these functions properly to make it work on the frontend.

tomjn commented 5 years ago

@ancom32 do you have the ticket number/url handy?

ancom32 commented 5 years ago

https://github.com/WordPress/gutenberg/issues/13529

tomjn commented 5 years ago

This should be fixed via https://github.com/tomjn/Frontenberg/commit/a39e19280e9137d0f4204bf585751738ca4b6fdf

Thanks for raising the gutenberg issue too, I know it got closed but it's good to make them aware this affects people

ancom32 commented 5 years ago

Hi, Thanks for sharing your solution. I downloaded the last version of the function.php file (fix the get current screen issue for WP CLI commands). I tested on Opera browser and Frontenberg worked pretty well. However, when I tested on Mozilla, Chrome and Microsoft Edge I got an error (this time is not related to getting current screen issue), this was the message:

Uncaught TypeError: Object(...) is not a function at Object.217 (index.js:9) at n (index.js:1) at wp.blockLibrary.0 (index.js:1) at index.js:1 wp-content/plugins/gutenberg/build/block-library/index.js

Uncaught TypeError: Cannot read property 'registerCoreBlocks' of undefined at Object.$n (index.js:9) at HTMLDocument. wp-content/plugins/gutenberg/build/edit-post/index.js:9:67680

I’m sorry for bothering, maybe it's a mistake on my site settings, but I just want to know if you had the same errors when you tested your code. I don’t know why it works with Opera but it doesn’t with the other web browsers. Any idea?

Thanks.

tomjn commented 5 years ago

I don't have an answer for that one, Frontenberg is mostly PHP. It worked fine here in Chrome and Firefox, but I'll do some more checks in a few hours.

In the mean time, flush any server and browser caches you might have

On Mon, 28 Jan 2019 at 22:11, ancom32 notifications@github.com wrote:

Hi, Thanks for sharing your solution. I downloaded the last version of the function.php file (fix the get current screen issue for WP CLI commands). I tested on Opera browser and Frontenberg worked pretty well. However, when I tested on Mozilla, Chrome and Microsoft Edge I got an error (this time is not related to getting current screen issue), this was the message:

Uncaught TypeError: Object(...) is not a function at Object.217 (index.js:9) at n (index.js:1) at wp.blockLibrary.0 (index.js:1) at index.js:1 wp-content/plugins/gutenberg/build/block-library/index.js

Uncaught TypeError: Cannot read property 'registerCoreBlocks' of undefined at Object.$n (index.js:9) at HTMLDocument. wp-content/plugins/gutenberg/build/edit-post/index.js:9:67680

I’m sorry for bothering, maybe it's a mistake on my site settings, but I just want to know if you had the same errors when you tested your code. I don’t know why it works with Opera but it doesn’t with the other web browsers. Any idea?

Thanks.

— You are receiving this because you modified the open/close state.

Reply to this email directly, view it on GitHub https://github.com/tomjn/Frontenberg/issues/10#issuecomment-458410113, or mute the thread https://github.com/notifications/unsubscribe-auth/AADl5zXUmmIKXTG4al66m2JzY6w5tmdzks5vH9gQgaJpZM4aUfKV .

ancom32 commented 5 years ago

Ok, thanks for your advice. You were alright! It was a problem with the caching settings of my server. Now, Frontend works pretty fine on every browser.