Conversation
Every shortcode and block preview printed its own <script> block, and a
percentage height added an inline <style> plus a ResizeObserver on top. That is
what WordPress.org rejects, and it also shipped the same handful of lines once
per embed on the page.
The behavior now lives in assets/js/exelearning-embed.js, enqueued once through
wp_enqueue_script() and delegated from the document, so it serves every embed on
the page -- including one inserted later -- and the markup carries no script at
all. The embed a click belongs to is found by walking up to the nearest ancestor
holding an .exelearning-iframe, which keeps several embeds on one page
independent without per-instance ids.
Percentage heights are pure CSS now: height="75%" renders as
`aspect-ratio: 100 / 75`, which says exactly what the attribute means ("75% as
tall as the embed is wide") and is resolved by the browser on every resize.
ExeLearning_Viewer_Enhancements existed only to script that and is deleted.
Contributor
Test in WordPress PlaygroundTest the plugin with the code from this branch:
|
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #125 +/- ##
============================================
- Coverage 96.87% 96.83% -0.04%
+ Complexity 864 851 -13
============================================
Files 39 40 +1
Lines 4323 4333 +10
============================================
+ Hits 4188 4196 +8
- Misses 135 137 +2
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
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.
Shortcode and block embeds previously printed behavior scripts per instance, and percentage heights required an inline style and ResizeObserver. The standalone editor and export bootstrap also inserted integration scripts directly.
Both embed renderers now enqueue one delegated behavior script. CSS aspect-ratio handles percentage heights. Controls are scoped to the nearest shortcode/block container, so an embed with a missing frame cannot fullscreen its neighbor.
The editor and export documents now enqueue their WordPress bridge and attach bootstrap code with wp_add_inline_script(). The editor stylesheet uses wp_add_inline_style(). Explicit handles are printed into the standalone HTML with wp_print_scripts()/wp_print_styles(), without printing the theme's asset queue. This retains WordPress 6.1 compatibility and leaves the upstream editor's own dependency loading unchanged. The bridge initializes on DOMContentLoaded; the export script no longer needs a manually emitted defer attribute.
Validation after the review corrections:
The separate WordPress.org findings concerning bundled libraries and remote resources still require review of the final editor build and release ZIP.