-
-
Notifications
You must be signed in to change notification settings - Fork 57
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Issue with TinyMCE not re-initialising #123
Comments
Not 100% sure on this. It happens when they hover the custom block or just any blocks quickly? Could it be |
That was a great question, I had actually disabled the default blocks. Having turned them back on, I can confirm it's hovering over the custom blocks that is causing the issue. Unfortunately, I've emptied the block views and the error persists. But I expect you're right, it will have something to do with $this->preview. I've just tried rolling back to previous versions of acf-composer, all the way back to v1.5.5 and the error remains. If you have any more thoughts on how to possibly resolve this, please do let me know. Much appreciated. |
What's your block look like right now? Does it happen if you remove all custom blocks and just use the default list block generated with |
So, I removed all custom blocks only to leave the default blocks. I generated an Example block using acf:block. To my page, I then added a gutenberg classic block, as this utilises TinyMCE. I then hovered over the default block icons and repeatedly over the newly generated Example block's icon – this did not break the tinyMCE of the classic block. Finally, I reintroduced one of my custom blocks that uses tinyMCE. Hovered repeatedly over the existing block's icons and then the Example block's icon. Hovering over the Example block's icon broke the TinyMCE of my custom block, but the classic block continued to function as expected. This is what the view looks like for one of my affected blocks: For another test, I've also rendered my preview block using a separate view – in each view is a simple snippet of HTML. This hasn't resolved it either. Here's an example Appreciate your help with this, thanks. |
can you set |
It appears acorns logging isn't working for me. I've tried adding I even forced a error by recreating the Example block, where I received this error in my terminal: But I could not find any log files with their error. |
Hey Brandon, As a test, I've made a completely fresh install of Bedrock and Sage. I have only installed.
and
My environment is: I generated the example block:
And made one single change, from this:
To this:
So now within the Block Inserter, we have the default gutenberg blocks and our new custom Example block. I repeated the experiment by adding one default Classic Block and the new Example block – both having a TinyMCE editor. I hovered quickly over the default block icons with no problem, but when hovering quickly over the Example block's icon the TinyMCE editor in the Example block broke, whereas the Classic Block continued to work as expected. I've uploaded a screen recording for you to see: https://youtu.be/kX3iJR73YhA |
haha that is ... an interesting bug. there's no dev console feedback whatsoever when it breaks?? I have no idea how that'd have anything to do with what ACF Composer does. the only thing other than preview I can think of is maybe TinyMCE needs a few defaults that aren't getting set? can you try just registering a block like this with plain PHP using https://www.advancedcustomfields.com/resources/acf_register_block_type/ ? ACF Composer isn't really doing any magic when it comes to registering the block. 😕 I can try to reproduce your issue later tonight. |
It's so weird right?! So I've registered a block using plain PHP using acf_register_block_type as advised. Quickly hovering over that block's icon, everything works as expected and all instances of TinyMCE continue to function. The moment I quickly hover over icons for blocks registered using [acf-composer], TinyMCE crashes for all blocks. Either registered via acf_register_block_type or acf-composer. I've take a few screen shots, but have had to blur some of the content due to an NDA. I'd be really interested to see whether you can replicate the issues I'm having. Thanks again. |
I'm able to reproduce it, just not sure what's causing it. It seems the TinyMCE editor in the sidebar is no longer in it's iFrame after it happens and also weirdly has its text color set to white: Re-selecting the block also seems to fix the issue so the block its self isn't erroring out in the editor. I'm not getting any console logs or PHP/Acorn logs when it happens. |
I narrowed it down to being an example preview bug. If I comment out https://github.com/Log1x/acf-composer/blob/master/src/Block.php#L261-L266 it doesn't appear to happen. Can you test adding an example to the test block you made with PHP and see if it errors? |
Yes, the iFrame disappears entirely. This happens to the TinyMCE editor wherever it's positioned, whether in the main copy or the sidebar. I believe the white text is used to hide the textarea and the copy once TinyMCE is initialised. I've found it you switch to preview mode and back to edit, TinyMCE reinitialises successfully. |
Yeah, really weird. Can you try the above? I feel like this might be an ACF issue with |
Also happens if I set |
Looks like you're on the money. I've added an example preview to the block registered with PHP and that now breaks TinyMCE too. I expect that's why I wasn't experiencing this issue with sage-acf-wp-blocks – that doesn't generate an example preview by default. Think you're right, looks like a possible issue with ACF. |
I can push a fix to ACF Composer so you can set In the mean time, I'd confirm that the bug doesn't happen on the latest ACF (or 6.0 beta) and then maybe file a bug report. |
That would be amazing, the ability to set example to [] or false would be a huge help. I'll take a look into 6.0 beta and if that still occurs, I'll report a bug and link them to this issue. Thank you for your help and time, I really appreciate it. |
Can confirm this is still an issue with the latest version and 6.0 beta. Will file a bug report with them. |
:( unfortunately this still happens when another ACF block has an example/preview set. i can still push the ability to not pass |
very strange one-off bug that I'm sure they'll be super stoked to hear about. lol |
Yes please, if you could push your change, I'd very much appreciate it. I'm still on the fence about example previews, so I don't mind disabling this entirely for the moment. |
Would you mind giving |
I've tested I didn't have to set example to [] or false though – it's disabled them by default. |
o_O did you remove |
Yes I did remove $this->example entirely. You know what, originally I totally misunderstood what $this->example was being used for. I thought it was purely for test data – my bad! Anyway, I can confirm |
Thanks for testing! Published v2.0.8 that you can swap over too. |
Many thanks Brandon, you've been a huge help – very much appreciated! Keep up the awesome work :) |
Going to push a small change to this – you will have to explicitly set |
Thanks for the update Brandon, I've updated my project and can confirm it's working as expected. |
Hi Brandon,
Absolutely love your work, big fan.
I'm experiencing the most unusual bug, and I'll describe it the best I can:
When the Block Inserter is open and the user quickly hovers over the gutenberg block icons, any instances of the TinyMCE editor are destroyed and do not reinitialise. I have tested this on two installs and seeing consistent behaviour.
I've included a couple of screen shots to demonstrate:
[https://snipboard.io/4Kgz9W.jpg]
Then after hovering over the icons quickly:
[https://snipboard.io/Mpm57B.jpg]
I believe I've narrowed it down to log1x/acf-composer or StoutLogic/acf-builder
Previously, I've been building gutenberg blocks using mwdelaney/sage-acf-gutenberg-blocks with no problem. So as a test, I made a copy of my current project, uninstalled acf-composer and recreated a number of blocks using mwdelaney/sage-acf-gutenberg-blocks – this resolved the issue.
I really would like to continue using your acf-composer but this is causing me quite the problem. I could migrate back to sage-acf-gutenberg-blocks but I don't fancy rebuilding all those blocks again.
If you have a moment, could you run a test yourself to see whether you can replicate the bug?
Any ideas / thoughts on how to resolve this would be welcome.
All the best,
Jon
The text was updated successfully, but these errors were encountered: