Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[4.x]: The selected asset isn't replaced when saving new assets edited in image editors opened via Asset fields #11805

Closed
mmikkel opened this issue Aug 19, 2022 · 2 comments

Comments

@mmikkel
Copy link
Contributor

mmikkel commented Aug 19, 2022

What happened?

Description

Since #8974 was implemented in 6764c9a, saving an edited image as a new asset via an image editor opened via a selected image in an assets field, is supposed to replace the original, selected asset in that field.

This feature was apparently broken at some point during the beta, then fixed for Craft 4.0.0-beta.3 via 40cc20e – but it still doesn't appear to actually work as of Craft 4.2.1.1.

Unfortunately I couldn't get Craft 4.0.0-beta.3 to work, but I did test on Craft 4.0.0-RC1 and it was the same there – so not sure if this has ever worked reliably? :)

Steps to reproduce

  1. Upload an image to a volume. The volume uses a filesystem with URLs, in case that matters.
  2. Add an assets field to an entry type field layout.
  3. Create an entry, and add the image to the assets field. Save the entry.
  4. In the entry's edit page; double-click the selected asset in the assets field. Then, click the "Edit Image" button on top of the thumbnail image in the asset slideout.
  5. Edit the image (e.g. by rotating it) in the Image Editor, then click "Save as a new asset".

Expected behavior

When the image editor closes after saving the new asset, the originally selected asset in the assets field should be swapped out with the newly-saved, edited image (and a provisional draft should be created/saved for the entry containing the field).

(Sidenote: I guess ideally the asset slideout should also be updated to edit the newly-saved, edited image instead of the original asset – otherwise authors might be confused if they continue editing custom fields, alternative text etc. and it saves to the asset that is no longer selected in the field.)

Actual behavior

The original asset is retained in the asset field and slideout; i.e. it still works just like in Craft 3. No JS errors in the dev console.

Craft CMS version

4.2.1.1

PHP version

8.1.8

Operating system and version

macOS 12.4

Database type and version

10.8.3-MariaDB

Image driver and version

Imagick 3.7.0 (ImageMagick 7.1.0-29)

Installed plugins and versions

None

@brandonkelly
Copy link
Member

Doh, this feature has had a history :)

It was originally added via 6764c9a, but then had to be re-implemented for the new unified element editor via 40cc20e, but then I accidentally removed a critical part of it when implementing element auto-refreshing.

Brought that line back for the next release, and now it’s working as intended now.

@brandonkelly
Copy link
Member

4.2.2 is out now with that fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants