Skip to content

fix: show Edit button in popup/new/open/frame display modes#46

Open
erseco wants to merge 3 commits into
mainfrom
43-cant-edit-content-in-popup-or-new-window
Open

fix: show Edit button in popup/new/open/frame display modes#46
erseco wants to merge 3 commits into
mainfrom
43-cant-edit-content-in-popup-or-new-window

Conversation

@erseco
Copy link
Copy Markdown
Collaborator

@erseco erseco commented Apr 29, 2026

Summary

Fixes #43.

  • Render the mod_exeweb/action_bar template (which carries the eXeLearning Online / embedded editor Edit button) in exeweb_print_workaround() and in the FRAME-mode top frame. Previously the Edit button only existed in embed_general.mustache, so any teacher whose activity used In popup / Open / New window / In frame had no way to edit the package from the activity view.
  • Make the embedded editor modal attach to the topmost same-origin window. When the Edit button is invoked from inside a small frame (e.g. the FRAME-mode top frame or another embedded iframe), the overlay was created inside that cramped frame, which is what the issue describes as the dialog getting "stuck at the bottom and hard to close". The modal now spans the full viewport.

Test plan

  • In a course as a teacher, create an exeweb activity with Display = In pop-up and confirm the Edit button is visible on the activity view and opens the editor modal.
  • Repeat with Display = New window.
  • Repeat with Display = Open.
  • Repeat with Display = In frame: Edit button appears in the top frame; opening it shows a full-viewport editor modal whose Save/Close buttons are clickable.
  • Confirm Display = Embed still works as before.
  • Confirm a non-editing user (student) does not see the Edit button in any mode.

Moodle Playground Preview

The changes in this pull request can be previewed and tested using a Moodle Playground instance.

Preview in Moodle Playground

⚠️ The embedded eXeLearning editor is not included in this preview. You can install it from Modules > eXeLearning Web > Configure using the "Download & Install Editor" button. All other module features (ELPX upload, viewer, preview) work normally.

Copy link
Copy Markdown
Collaborator

@ignaciogros ignaciogros left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the "Iframe" options, the fullscreen and the "Edit in eXeLearning" button are not working.

I don’t really see what this option adds, because "Embed" also uses an iframe. Should we remove it?

If we decide to keep it, I'llfix a few minor presentation issues once the functionality is fixed.

Thanks.

@erseco erseco requested a review from ignaciogros May 9, 2026 12:12
- Render the action bar (eXeLearning Edit button) in the workaround
  view used by Display = In pop-up, Open and New window. The button
  was previously only available in Embed mode, leaving teachers no
  way to edit the package from any of these display modes.
- Remove the legacy In frame (HTML4 frameset) display option per
  reviewer feedback. The mode duplicated Embed (which already uses an
  iframe) and made the editor modal and fullscreen control unusable.
  Existing activities saved with display=FRAME are migrated to EMBED
  on upgrade and the orphan framesize admin setting is dropped.
@erseco erseco force-pushed the 43-cant-edit-content-in-popup-or-new-window branch from 309f147 to bb0ae30 Compare May 9, 2026 12:30
@erseco
Copy link
Copy Markdown
Collaborator Author

erseco commented May 9, 2026

I've updated the branch to address @ignaciogros' review. The new approach follows your suggestion to drop the In frame display mode instead of trying to repair it: as you pointed out, Embed already covers the same need via <iframe>, and the HTML4 frameset was the very reason the editor modal got stuck and the fullscreen control didn't work.

What changed

  • Edit button on In pop-up, Open and New windowlocallib.php (exeweb_print_workaround) now renders mod_exeweb/action_bar before the click-to-open link, mirroring embed_general.mustache. This is the actual fix for issue Can't edit content in popup or new window #43.
  • Removed the In frame (HTML4 frameset) display option:
    • settings.php: dropped RESOURCELIB_DISPLAY_FRAME from displayoptions and removed the orphan framesize admin setting.
    • view.php: the case RESOURCELIB_DISPLAY_FRAME branch falls through to EMBED as a runtime safety net for legacy activities.
    • locallib.php: deleted exeweb_display_frame() and exeweb_require_teacher_mode_hider_for_content_frame().
    • mod_form.php and lib.php: cleaned up the RESOURCELIB_DISPLAY_FRAME references (printintro is now stored only for EMBED).
    • db/upgrade.php: new migration that rewrites existing display = FRAME rows to EMBED and drops the framesize plugin config.
    • lang/{ca,en,es,eu,gl}/exeweb.php: removed the framesize, configframesize strings and the In frame bullet from displayselect_help.
  • Reverted the changes in amd/src/editor_modal.js and its build — the trick of mounting the overlay on the topmost window was a workaround for surviving inside the frameset; once that case is gone, the modal goes back to the original document.body implementation.
  • CHANGELOG.md: new Unreleased entry describing the fix and the mode removal.

Test plan

  • In pop-up: Edit button is visible and the modal opens full-screen.
  • New window / Open: same.
  • Embed still behaves as before.
  • A student (no edit capability) does not see the button in any mode.
  • Existing activities with display = FRAME are migrated to EMBED after running the module upgrade (savepoint 2026050900).

Sibling PR with the analogous fix on the SCORM side: exelearning/mod_exescorm#59.

erseco added a commit to exelearning/mod_exescorm that referenced this pull request May 9, 2026
When the embedded eXeLearning editor modal is opened from inside a
small frame (e.g. a popup-mode launcher or any embedded iframe), the
overlay was previously appended to that cramped frame's body. The
result was a dialog "stuck at the bottom" of the frame with the
Save/Close buttons rendered out of reach.

Walk up the window chain to the topmost same-origin window before
mounting, so the overlay always covers the full viewport. Cross-origin
parents fall back to the current window.

Mirrors exelearning/mod_exeweb#46.
Copy link
Copy Markdown
Collaborator

@ignaciogros ignaciogros left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After updating the plugin, a SCORM package displayed in an iframe still shows the iframe option in the activity Settings dropdown (and it remains selected):

Image

But even with that value selected, saving the changes renders the content correctly as if the iframe option did not exist, and it can be edited without problems.

What is missing is the automatic conversion from the iframe type to the expected one.

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.

Can't edit content in popup or new window

2 participants