Unhide Drupal Core's preview button

Created on 1 May 2023, over 1 year ago
Updated 8 June 2023, over 1 year ago

Problem/Motivation

In our initial effort, we endeavored to take over preview functionality. We hide Drupal Core's preview button and provided our own. Instead of launching a new window we launch the preview dialog.

We didn't want to override Drupal core's handling of how the preview button launches a new window with the preview. It was easier to add our own button instead of modifying an existing one.

We've made the decision to change our strategy here, we now want to:

Show Drupal core's preview button
When that button is clicked, our same page preview is opened instead of opening the preview in a new window.
The current checkbox will be moved into the gear checkbox.

Steps to reproduce

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

✨ Feature request
Status

Fixed

Version

2.0

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
  • Assigned to brianperry
  • πŸ‡ΊπŸ‡ΈUnited States brianperry
  • @brianperry opened merge request.
  • πŸ‡ΊπŸ‡ΈUnited States brianperry

    Opened a draft MR with a first pass at this. It works, but only with js not aggregated for some reason. I suspect that this is somehow related to my local environment - will try to figure out what is going on there, but need to set this aside for now.

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

    I'll test this manually today.

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

    Brian this works for me, with css aggregation / caching on. I do get a strange and seemingly unrelated error though. Is this what you're seeing?

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

    @cosmicdreams - I haven't seen the error in your screenshot. When I aggregate JS I see the following error in the browser console:

    An error occurred during the execution of the Ajax response: TypeError: Cannot read properties of null (reading 'src')

    As a result of this error, when I click on the preview button the panel doesn't expand due to the broken JS.

    I've duped this on another machine, so I don't think this was related to my local being hosed. Will take another shot at figuring out what is going on here.

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

    I'm now confident that this is actually related to my local environment and not this module. Examining the aggregated JS I wasn't seeing the changes I expected. I eventually went nuclear and blew away all JS files manually. When the JS was re-built I saw the changes I expected, and the error went away. Doing the same thing for the CSS also resolved the CSS strangeness we have been seeing.

    I'm using Lando - in digging around for related Lando issues I found these:

    https://github.com/lando/drupal/pull/48
    https://github.com/lando/drupal/pull/57

    Apparently aggregation changed in some non-trivial ways in 10.1: https://www.drupal.org/node/2888767 β†’

    @cosmicdreams - If you agree with the assessment here I think this one would now be resolved by the 2.1 branch.

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

    Marking as fixed since this has been merged into 2.1.x.

  • Automatically closed - issue fixed for 2 weeks with no activity.

Production build 0.71.5 2024