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

File Block: file name needs to use PlainText component #10967

Closed
ocean90 opened this issue Oct 23, 2018 · 17 comments
Closed

File Block: file name needs to use PlainText component #10967

ocean90 opened this issue Oct 23, 2018 · 17 comments
Labels
[Block] File Affects the File Block Good First Issue An issue that's suitable for someone looking to contribute for the first time [Status] In Progress Tracking issues with work in progress [Type] Bug An existing feature does not function as intended

Comments

@ocean90
Copy link
Member

ocean90 commented Oct 23, 2018

Describe the bug
formattingControls of RichText should be honored in pasting within the block.`

To Reproduce

  1. Add a file block
  2. Copy this text: File name
  3. Paste text into file name
  4. Note that there's no way to remove the link
  5. Save post and reload page
  6. Block is now invalid "This block contains unexpected or invalid content."

Expected behavior
No formatting should be applied if formattingControls is empty.

Screenshots
If applicable, add screenshots to help explain your problem.
image

Additional context

@ocean90 ocean90 added [Type] Bug An existing feature does not function as intended [Feature] Rich Text Related to the Rich Text component that allows developers to render a contenteditable labels Oct 23, 2018
@ocean90
Copy link
Member Author

ocean90 commented Oct 25, 2018

Noting that all the keyboard shortcuts for text formatting are also working here. Maybe this shouldn't be a RichText field in the first place? Or what about introducing a plain prop which disallows any formatting?

/cc: @iseulde

@ellatrix
Copy link
Member

Why can't we just use the PlainText component for this? :)

@nitishkaila
Copy link
Contributor

@ocean90, I have created a PR for solution of above issue. Kindly review it.

@ellatrix
Copy link
Member

Worth noting that PlainText is an enhanced textarea element. I don't know what's more suitable here. You could also use an input control.

@ellatrix
Copy link
Member

ellatrix commented Oct 26, 2018

(From what I understand, RichText was only used here for how it looks, not for its functionality. :/)

@mtias mtias added the [Block] File Affects the File Block label Nov 12, 2018
@mtias mtias added this to the WordPress 5.0 RC milestone Nov 12, 2018
@mtias mtias added the Good First Issue An issue that's suitable for someone looking to contribute for the first time label Nov 16, 2018
@prajapatisagar
Copy link
Contributor

@ocean90 and @iseulde Is there any update about this ticket? I have also tested this patch and it is working fine.

@ellatrix ellatrix changed the title File Block: Pasting text with link into RichText for file name makes block invalid Nov 26, 2018
@ellatrix ellatrix removed the [Feature] Rich Text Related to the Rich Text component that allows developers to render a contenteditable label Nov 26, 2018
@jorgefilipecosta jorgefilipecosta added the [Status] In Progress Tracking issues with work in progress label Dec 3, 2018
@talldan
Copy link
Contributor

talldan commented Jul 18, 2019

In the latest version of Gutenberg it looks like you can remove the link, but that's because the file block now has link formatting. That seems like a new issue that needs to be solved.
Screen Shot 2019-07-18 at 9 28 57 am

The same problem is also present with the download button.

@skorasaurus skorasaurus removed the [Status] In Progress Tracking issues with work in progress label Feb 9, 2021
@paaljoachim
Copy link
Contributor

WordPress 5.7 beta 3 and Gutenberg plugin 10.
Twenty Twenty One.

Added a file block. Removed the text link.
This is what I see in the backend.

Screen Shot 2021-02-21 at 00 29 33

Is the issue still valid based on what was reported?
@ocean90

@glendaviesnz
Copy link
Contributor

I just retested with WP5.8 and Gutenberg 11.3 and there is still no way to edit/remove a link if linked text is pasted into the filename field.

file-name-link

@aurooba
Copy link
Member

aurooba commented Jan 25, 2022

^ Working on it!

@paaljoachim
Copy link
Contributor

Thank you @aurooba
I went ahead and assigned the issue to you.

@paaljoachim
Copy link
Contributor

Should the file name, button, and the file become inner blocks?
I assume so as each would have their own properties/options. As the user would then also be able to move each around, and align each as they would like.

I will also bring in this somewhat associated issue (which also could use a closer look):
PDF thumbnail preview
#15097

@aurooba
Copy link
Member

aurooba commented Jan 25, 2022

@paaljoachim I'm going to try two things today: innerBlocks is a good idea, you're right, why can't we make the block more flexible? Also I'm not sure the PlainText component is correct, I think RichText is still the right way to go with the link functionality exposed so it can be changed/edited. I have to test a bit more, because obviously we don't want the initial issue @ocean90 reported to be a thing.

#15097 definitely feels related. I'm going to tackle this issue first, and then I can start some explorations around the PDF issue as well. :)

@paaljoachim
Copy link
Contributor

That is great! Thank you @aurooba

@carolinan carolinan removed this from the WordPress 5.x milestone Jul 8, 2022
@skorasaurus skorasaurus added the [Status] In Progress Tracking issues with work in progress label Jan 20, 2023
@carolinan
Copy link
Contributor

I am no longer able to reproduce the issue.
In WordPress 6.2, it is possible to remove both the text and the link, and there are no validation errors when the content is saved and the page reloaded.

@paaljoachim
Copy link
Contributor

paaljoachim commented May 8, 2023

It is now possible to click into the file name and adjust it directly in the Gutenberg canvas/document area.
Screenshot 2023-05-08 at 09 16 32

We should now be able to close this issue.

@aurooba it would be very helpful if you have a chance to look at the
PDF thumbnail preview issue
#15097
Thanks!

@akasunil
Copy link
Member

Closing this as can't reproduce with gutenberg 18.5.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Block] File Affects the File Block Good First Issue An issue that's suitable for someone looking to contribute for the first time [Status] In Progress Tracking issues with work in progress [Type] Bug An existing feature does not function as intended