Block Editor: Fix iframe widget field lifecycle and repeater TinyMCE#2308
Open
Block Editor: Fix iframe widget field lifecycle and repeater TinyMCE#2308
Conversation
…punch, and utils into Block Editor iframe
Closed
8 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes legacy SiteOrigin widget forms inside WordPress iframe editors by restoring the iframe asset/bootstrap path and hardening field initialization after the form DOM and cloned scripts mount asynchronously.
What Changed
iframe[name="editor-canvas"]) as well as the Site Editor canvas when resolving widget forms.sowbBlockFormInitmessages after form mount.sowsetupformfieldtriggers for visible repeater fields.data-tinymce-idattributes so IDs survive cloning/replacement.jQueryandPikadaywhen needed.Why
Iframe editors can mount widget form HTML and cloned admin scripts out of order. That left some field scripts present in the iframe but not actually initialized, and TinyMCE repeater editors after the first item could render as bare textareas because copied/replaced editors only kept transient jQuery data for their IDs.
This PR covers both layers of the fix: the original iframe asset delivery problem and the follow-up repeater field lifecycle problem from #2307.
Validation
node --check base/inc/fields/js/date-range-field.jsnode --check compat/block-editor/widget-block.jsnode --check tests/e2e/wb-form-field-site-editor.test.jsnpx playwright test tests/e2e/wb-form-field-site-editor.test.js -g "Test the Blog widget" --project="Google Chrome" --retries=0npm run test:e2e(9 passed)Reviewer Checklist
widgets.phpBlock Widgets screen: repeater and field initialization behavior regresses neither iframe nor non-iframe screens.LoadError,window.error,unhandledrejection, orsowbBlockFormInitmessage storm during normal add/open/copy flows.Notes
develop.--mount-dir-before-install;npm run testsstill calls the removed camelCase Playground CLI flag--mountDirBeforeInstallthroughsiteorigin-tests-common/playground/startPlayground.js.