Skip to content

Run the embedded editor on WordPress' jQuery and jQuery UI - #150

Closed
erseco wants to merge 1 commit into
feature/enqueue-embed-behaviorfrom
feature/editor-core-jquery
Closed

erseco wants to merge 1 commit into
feature/enqueue-embed-behaviorfrom
feature/editor-core-jquery

Conversation

@erseco

@erseco erseco commented Sep 26, 2026

Copy link
Copy Markdown
Contributor

Stacked on #125 (both touch admin/views/editor-bootstrap.php).

Why

Plugin Directory guideline 13: plugins must use the libraries WordPress already ships. The embedded editor loads its own jQuery 3.7.1 and jQuery UI 1.14.1 from dist/static/libs/.

Change

The editor page swaps the bundle's two tags for WordPress' own copies:

  • jquery-core, without jquery-migrate, which the editor never ran with.
  • Every jquery-ui-* and jquery-effects-* handle core registers. Their dependency order is resolved by a private WP_Scripts instance, so the page queue is untouched, and core's wp-a11y/i18n dependencies are skipped because no jQuery UI file uses them.
  • Core's jQuery calls noConflict(), so a one-line inline shim (window.$ = window.jQuery;) restores the global $ the editor and iDevices use.

The logic lives in ExeLearning_Editor::core_jquery_tags(). AGENTS.md documents it.

What stays bundled, and why

dist/static/libs/jquery and libs/jquery-ui remain in the package. The editor is also an exporter: it embeds those files in every SCORM, IMS, EPUB and web package it generates, and those packages run offline and without WordPress, so they cannot use wp-includes. Inside WordPress the editor no longer loads them. CodeMirror (TinyMCE codemagic) and the old jQuery copy in exemindmap are being removed in the editor itself (exelearning/exelearning).

Verification

  • In the browser (wp-env, WordPress 7.1), the editor loads with core jQuery 3.7.1 and jQuery UI 1.14.2, $ === jQuery, and sortable, draggable, droppable, tooltip, dialog, resizable and slider are all available. No bundled jQuery is requested.
  • I opened a project, switched pages and added the dragdrop iDevice. There are no console errors beyond those main already shows: 403/404 on TinyMCE content_css paths and duplicated tabs in that iDevice's form. Both are identical with the bundled jQuery, so they are pre-existing and out of scope here.
  • New EditorBootstrapPageTest case. PHPUnit: OK (900 tests).

Plugin Directory guideline 13 asks plugins to use the libraries WordPress
already ships. The editor bundle loads its own jQuery 3.7.1 and jQuery UI
1.14.1; the editor page now replaces those two tags with core's copies:
jQuery (without Migrate, which the editor never ran with) and every jQuery UI
and effects handle core registers, in dependency order, resolved from a
private WP_Scripts so the page queue is untouched. Core's jQuery calls
noConflict(), so a one-line shim restores the global $ the editor expects.

The bundled copies stay in dist/static/libs/: the editor embeds them in the
SCORM, IMS, EPUB and web packages it exports, which must run without
WordPress.
@github-actions

Copy link
Copy Markdown
Contributor

Test in WordPress Playground

Test the plugin with the code from this branch:

Preview in WordPress Playground

ℹ️ The eXeLearning editor is fetched from the shared release and unpacked into the plugin when the playground boots, so the first load may take a few extra seconds. ELP upload, shortcode, Gutenberg block and preview work normally.

@codecov-commenter

codecov-commenter commented Sep 26, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 96.38%. Comparing base (1f4ebf8) to head (3fb4c4e).

Additional details and impacted files
@@                         Coverage Diff                          @@
##             feature/enqueue-embed-behavior     #150      +/-   ##
====================================================================
+ Coverage                             96.36%   96.38%   +0.02%     
- Complexity                              813      823      +10     
====================================================================
  Files                                    36       36              
  Lines                                  4240     4264      +24     
====================================================================
+ Hits                                   4086     4110      +24     
  Misses                                  154      154              
Flag Coverage Δ
javascript 95.47% <ø> (ø)
php 96.70% <100.00%> (+0.02%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
admin/views/editor-bootstrap.php 92.85% <100.00%> (+0.64%) ⬆️
includes/class-exelearning-editor.php 93.98% <100.00%> (+0.61%) ⬆️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@erseco

erseco commented Sep 26, 2026

Copy link
Copy Markdown
Contributor Author

Closing: the embedded eXeLearning editor is a self-contained application that is built and tested against its own jQuery/jQuery UI versions, and it also embeds those same files in every package it exports (which must run without WordPress). Swapping in core's copies would tie the editor to whatever version each site runs (WordPress 6.1 ships jQuery 3.6 / jQuery UI 1.13), for no reduction in package contents. This will be explained to the plugin reviewers instead.

@erseco erseco closed this Sep 26, 2026
@erseco
erseco deleted the feature/editor-core-jquery branch September 26, 2026 10:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants