Doesn’t fix anything compared to the original issue or compared to my original suggestion? Does it make a difference if you increase the number in the timeout? Maybe 200, 500, or 1000?
if I am getting this correctly:
customizer refresh happens when a keyup event fires, this triggers widget duplication. All this happens for a timeout bug in TinyMCE (used by text widget) when text widget is set in customizer.
we do need to address the elephant in the room me thinks. After v3 we need to focus on editor and then find a way to refactor customizer code a little because things like that will continue to happen - fixing things for good is better than having to fix every time it breaks.
Tim, my mistake, because of my new PC at home I forgot adding define( 'SCRIPT_DEBUG', true ); to my wp-config file. And earlier today I was testing at another install.
Looks like it’s working fine now!
But when removing whole function, it seems to work fine as well?
Hmm, that’s interesting because, without that function, there’s no way for TinyMCE to set or update itself. Maybe there’s some code in another file that’s doing it.
@Guido, Back at my PC now. If I remove the function, TinyMCE doesn’t load at all for me. Which is exactly as I expected. But my fix does seem to work.
@ElisabettaCarrara The bug here is caused by the widget duplicating itself when the content syncs up with the underlying textarea. But it only happens in the Customizer. The timeout issue is that the TinyMCE editor cannot be accessed immediately that Tiny is initialized and so, in the Customizer, it is recommended to give it a timeout of 100 (as I have done here). This is a problem caused by Tiny and not the Customizer; both the bug and the timeout fix are reported by Tiny.
I don’t disagree that it would be ideal to replace the Customizer code once we have a new editor in place to replace TinyMCE version 4. But it remains unclear to me what sort of thing we might want to replace it with.
Sorry, you’re right. I overlooked the TinyMCE part of the widget.
I’ve now opened a PR at Prevent duplication of TinyMCE in the text widget in the Customizer by KTS915 · Pull Request #2125 · ClassicPress/ClassicPress · GitHub
Tim, I don’t no either. Not yet.
My brain usually is good at putting together ideas and very often it does so about a decade before I am able to act on them myself - it barely gives me the time to catch up and learn what I need and then launches me into doing them with the knowledge of a junior that knows nothing yet…
that said, in my thought process I gained some facts:
- We are all accustomed to the customizer. it’s hard to see beyond that
- The customizer has code that we know the bare minimum about, and we might not be able to maintain it. moreover it could be affected by bugs in other parts of the core like TinyMCE making spotting issues not a breeze
- If I am able to have an idea, and have a bare minimum viable product for it there are very skilled people here that can bring that to light even if it takes me ten years to do solo.
- one of the constraint is having the new system hooking into the same functions, so it stays compatible with core.
- Also a new UI would be nice - one that allows a real preview and not the stretched/compressed out that the customizer outputs now. me thinks that won’t be as easy however.
- another constraint is working on it after the editor so that it can work with that too
Some idea will pop up. I will share when it does. If someone else has an idea I am glad to help
I completely agree that a new UI would be good. I tend to think it would be best to start with what it should look like and then work from there; the necessary hooks can be added later. But I am not a designer; someone other than me needs to come up with some visuals.
I am a designer, very junior but I am. I have some “ideas” about that and found a library that could help manage the preview (alpine.js seems light and easy enough to learn).
I might end up having some field days crafting a a thing that takes some inputs and uses alpine to show the changes real time (basically that’s what customizer is). If I can get a simple thing working, the same logic could be applied to rewriting the customizer from scratch (that I think would be easier and better than refactoring it) because I would be at a loss on how to hook it to CP functions correctly considering all core facets that need to be kept into account. but I think with a little guidance and help if I start by coding a proof of concept I can be able to understand its inner workings to an extent that I am able to help.
Hello - thanks for testing this! I was running out of ways to determine if this was “just me” or not… interesting to hear about your plans for the customizer.
@timkaye I do have something we can use.
https://randoma11y.com/ this website basically manages real time preview changes with React - but it’s totally possible to use the lighter and easier Alpine.js to do that. and it basically has just a bunch of settings in a top bar (my idea is to have icons in the top bar, opening a full-width drop-down panel for customizer with the opening closing happening on click) and the page itself IS a preview of the page.
the code for the basic thing is on GitHub - can it be used/adapted?
edited to add, it seems the repo contains a voting system that was added to the site and then removed. will try to understand where their code is.
edited to add 2: GitHub - components-ai/css.gui: Visual development environment for CSS this is it (basically it is what powers randoma11y site)
uses React again - this dev is addicted to it.
and rebuilding it with Alpine means rebuilding each component so basically it means rewriting everything. BUT the logic is what we need.
and the code can be whatever to achieve the same.
the other customizer controls (the ones like file upload for logo/header background or the widgets and menu controls etc…) can then be added with same logic for the preview and they basically would work.
@createscape The fix for this has now been merged into the nightly version of ClassicPress. If you’re comfortable using that, you can switch to using it with the help of the Switch to ClassicPress plugin. Just be aware that, if you do switch to the nightly, you will be told of an update every day (although there won’t always be changes each time).
Thanks for reporting!
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.