Add iFrame of the preview

Created on 19 February 2023, over 1 year ago
Updated 23 February 2023, over 1 year ago

Problem/Motivation

We intend to modify the behavior of the preview button so that it will display a preview of the node. This preview will use Drupal's existing process for generating the preview, we'll just display it in the iFrame

Proposed resolution

Implementation details:
* Get the unique url of the preview.
* Assign that url to the url of the iFrame on page render.
* Ensure that the preview renders "properly" (basically the same as it currently does)

Remaining tasks

All the above.

User interface changes

New iFrame

✨ Feature request
Status

Fixed

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States cosmicdreams Minneapolis/St. Paul

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @cosmicdreams
  • First commit to issue fork.
  • @brianperry opened merge request.
  • πŸ‡ΊπŸ‡ΈUnited States brianperry

    Added a few small tweaks here to get this slightly closer to reality.

    This actually kinda sorta almost works in the current state.

    * Create a new basic page.
    * The iframe will display a 404.
    * Fill out necessary form fields.
    * Click the preview button (you don't have to save the node)
    * You'll navigate to what I'm now going to lovingly call 'different page preview'
    * Click the 'back to content editing' button.
    * You'll be back on the edit form, but the iframe will now contain the current preview.
    * You can even change the view mode within the iframe to preview different view modes without navigating away from the form.

    Depending on how this evolves, I think we'll have to remove the 'back to content editing' button from the iframe. But keeping it for now as it makes the process above possible.

  • πŸ‡ΊπŸ‡ΈUnited States cosmicdreams Minneapolis/St. Paul

    Going to test this manually

  • πŸ‡ΊπŸ‡ΈUnited States cosmicdreams Minneapolis/St. Paul

    Let's move the TODO about 10.1.0 above the whole Form API of html_tag to give a better indication of what would be replaced once we target 10.1

    Also what is the dependency you are referring to on line 10?

    Other than that, looks like a simple improvement. Approved.

  • πŸ‡ΊπŸ‡ΈUnited States cosmicdreams Minneapolis/St. Paul

    During manual testing, the toolbar still seems to be included. Was the adminstrative toolbar supposed to be excluded?

  • πŸ‡ΊπŸ‡ΈUnited States brianperry

    Re #7 - I've seen that happen when clicking the 'Return to content editing' button in the iframe. At that point it is iframe inception and all bets are off :) If it isn't that, I'll have to try it out in Umami. I was testing in Olivero.

    > Also what is the dependency you are referring to on line 10?

    That was a note to say 'we should do this with dependency injection' rather that a static call. But that might not be possible in this procedural code at the moment.

  • πŸ‡ΊπŸ‡ΈUnited States cosmicdreams Minneapolis/St. Paul

    What's missing from my screenshot was how it was displaying a "Page Not Found" page. That got cut off. So it's not actually showing the preview.

  • Status changed to RTBC over 1 year ago
  • πŸ‡ΊπŸ‡ΈUnited States cosmicdreams Minneapolis/St. Paul

    Propose that we RTBC this since we have an iFrame in the node edit form.

  • Status changed to Fixed over 1 year ago
  • πŸ‡ΊπŸ‡ΈUnited States brianperry

    Merged and marking as fixed.

    Surprised to see that it is actually possible to compile the preview for a node that hasn't even been created yet :) That simplifies a few things.

  • πŸ‡ΊπŸ‡ΈUnited States brianperry
Production build 0.69.0 2024