Document [exelearning] shortcode; add teacher-mode activation and screenshot display#47
Merged
Merged
Conversation
Add a dedicated docs/SHORTCODES.md reference and close two capability gaps surfaced while documenting the [exelearning] shortcode: - teacher_mode attribute: embed content with teacher mode already active, by injecting an activation script into the same-origin preview iframe (adds the mode-teacher class, checks the toggler, sets exeTeacherMode). - screenshot attribute (no|poster|only): show the package screenshot.png shipped by eXeLearning >= 4.0.1, either as a click-to-load poster or a standalone image; detected at render time and gracefully falling back to the iframe when absent. Cross-link the new reference from README.md and AGENTS.md. Closes #46
Contributor
Test in WordPress PlaygroundTest the plugin with the code from this branch:
|
Register the new "Load interactive content" string in the POT/PO catalogs and translate it to Spanish, then rebuild the es_ES .mo.
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
Adds a dedicated shortcode reference page and closes two capability gaps surfaced while documenting the
[exelearning]shortcode.Closes #46.
Documentation
docs/SHORTCODES.mddocumenting the[exelearning]shortcode and every attribute (type, default, allowed values) with worked examples.README.mdandAGENTS.md(mirroring howdocs/HOOKS.mdis referenced).Teacher-mode activation (new)
teacher_modeattribute (default0). When enabled, the embed loads with teacher mode already active.mode-teacherclass to the iframe document, checks theteacher-mode-toggler, and setslocalStorage.exeTeacherMode='1'(all best-effort, wrapped in try/catch).teacher_mode_visible(which only controls toggle visibility).Screenshot display (new)
screenshotattribute:no(default, unchanged),poster(click-to-load lazy embed behind the image),only(standalone image, no iframe).screenshot.pngshipped at the package root by eXeLearning ≥ 4.0.1, served via the existing content-proxy uploads URL.file_exists()check; when absent,poster/onlygracefully fall back to the normal iframe embed.Implementation notes
exelearningtext domain.display_exelearning()complexity kept within the repo PHPMD thresholds by extractingrender_embed()andrender_preview_script()helpers (no thresholds raised).exelearning_shortcode_atts/exelearning_preview_url/exelearning_shortcode_outputfilters keep working unchanged.Testing
tests/unit/ShortcodesTest.php(teacher-mode on/off, screenshot only/poster, both fallbacks,screenshot=noregression).make test FILE=tests/unit/ShortcodesTest.php→ 28 tests, 49 assertions, OK.make lint→ clean.make phpmd→ no violations.make test→ only one pre-existing, unrelated environmental failure (StaticEditorInstallerTest::test_is_editor_installed_returns_false_when_missing, which also fails onmainin this environment).