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

Convert: Image to File - File title shows placeholder after conversion despite having title available #9350

Closed
eddhurst opened this issue Aug 25, 2018 · 3 comments · Fixed by #34256
Assignees
Labels
[Feature] Block Transforms Block transforms from one block to another [Type] Enhancement A suggestion for improvement.

Comments

@eddhurst
Copy link

eddhurst commented Aug 25, 2018

Describe the bug
When converting an image into a file component, the image stops rendering as an img tag and instead renders as an a tag. Once converted, the placeholder "Write file name..." shows. If you click the edit button on the block, then save, without amending anything, the File block will correctly show the title as expected.

To Reproduce
Steps to reproduce the behavior:

  1. Upload an image as image block.
  2. Click to Change block type to "File"
  3. Image block re-renders as file block.
  4. See placeholder, instead of file title.
  5. Click "edit file" button
  6. Click blue "select" button (image already selected and meta filled.
  7. See title update.

Expected behavior
Once an image has been changed to a file block, I would expect the image title to be used in the file title field, and to not see the placeholder text.

Screenshots
screen shot 2018-08-25 at 13 17 18

Changed image block to file block, then duplicated to show HTML. The file knows which image is selected (and the download button works) but the title isn't used.

Desktop (please complete the following information):
OS: Mac Sierra 10.12.5
Browser: Chrome
Version: 67.0.3396.99

Additional context
Gutenberg: 3.6.2

@ajitbohra ajitbohra added [Feature] Block Transforms Block transforms from one block to another [Type] Enhancement A suggestion for improvement. labels Aug 25, 2018
@j-rewerts
Copy link

Hey @eddhurst I've been able to reproduce this. I'll try to get a PR in soon.

@j-rewerts
Copy link

I have a branch here. It changes the image block to file block transformation so that it makes use of the image blocks file name. Unfortunately, I introduce an unintended side effect. In the past, Gutenberg uses the image's caption to set the name of the file, so now when we switch back from the file to the image, we have a new caption.

Image with no caption
screen shot 2018-08-28 at 9 43 15 am

Transform to file
screen shot 2018-08-28 at 9 44 16 am

Switch back to image
screen shot 2018-08-28 at 9 45 22 am

Can anyone with more experience advise as to the ideal behaviour? Maybe just using caption is the best approach?

@andrewserong
Copy link
Contributor

Resolved in #34256 (in the Image > File transform, use the image caption if available, and if not, fall back to using the image's filename).

@andrewserong andrewserong removed the [Status] In Progress Tracking issues with work in progress label Aug 25, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Block Transforms Block transforms from one block to another [Type] Enhancement A suggestion for improvement.
Projects
None yet
4 participants