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

Regression in Gutenberg 11 around pasting with spaces? #33283

Closed
pansamolot opened this issue Jul 8, 2021 · 12 comments · Fixed by #33607
Closed

Regression in Gutenberg 11 around pasting with spaces? #33283

pansamolot opened this issue Jul 8, 2021 · 12 comments · Fixed by #33607
Assignees
Labels
[Feature] Paste [Status] In Progress Tracking issues with work in progress [Type] Bug An existing feature does not function as intended

Comments

@pansamolot
Copy link

pansamolot commented Jul 8, 2021

Description

Gutenberg 11.0.0 was auto-updated this morning to my blog network. And I again see problem reported a 1+ year ago about adding surrounding spaces when pasting a text.

I have a feeling that this is at least 3rd time deja vu in Gutenberg. Are there any reported regression that is causing again something that was year ago reported as resolved?

Step-by-step reproduction instructions

  1. Start a new blog post.
  2. Add a new Paragraph block.
  3. Start typing.
  4. Paste some text from the same article or from outer source.

Expected behaviour

Pasted text is exactly the same as copied from source.

Actual behaviour

Pasted text is surrounded with spaces.

Screenshots

spaces

WordPress information

  • WordPress version: 5.7.2
  • Gutenberg version: 11.0.0
  • Are all plugins except Gutenberg deactivated? No
  • Are you using a default theme (e.g. Twenty Twenty-One)? No

Device information

  • Device: Notebook PC, i7-7600U CPU, 8 GB RAM, brand new, very few apps installed, non except browser working,
  • Operating system: Windows 10.10094
  • Browser: Microsoft Edge 91.0.864.64
@pansamolot pansamolot changed the title Regressions in Gutenberg 11 around typing and pasting Regression in Gutenberg 11 around pasting with spaces? Jul 8, 2021
@getdave
Copy link
Contributor

getdave commented Jul 21, 2021

hi @pansamolot I just attempt to replicate this and was unable to succeed? What did I miss?

Screen.Capture.on.2021-07-21.at.15-33-35.mp4

Also can I verify you aren't using any WordPress Plugins, browser extensions or system level modifications that might alter your OS's pasting mechanics?

If it still happens for you, then perhaps you could try this on a clean install using a clean browser to see if that solves things? You've probably already done this but I felt it was worth checking as I've seen this be the case for other similarly reported issues.

If there is a repeated problem with this and we can replicate then we will look to cover with unit tests.

Much appreciated.

@getdave getdave added Needs Testing Needs further testing to be confirmed. [Feature] Paste labels Jul 21, 2021
@pansamolot
Copy link
Author

pansamolot commented Jul 21, 2021

I have just quickly setup as-clean-as-possible installation of Wordpress on Amazon Lightsail (to throw out any possible connections to my main hosting's configuration).

It has nothing except:

  • Wordpress 5.8
  • Twenty Twenty-One theme 1.3
  • Gutenberg plugin 11.1.0
  • single user
  • single blog post

And I can confirm that this bug exits even from the very first line of text written. At this moment I am on another device, so I cannot create an animated gif to show this, but I hope to post it in a couple of hours.

I am not aware of any system settings, browser extensions etc. that can influence my "pasting experience". Wordpress is the only web service that suffers this problem for me even though I am using the same PC, system and browser for pasting texts in dozens of services. The only other exception is Gmail, but it is a well known, years-long bug in Gmail itself that it adds spaces around pasted text.

@getdave
Copy link
Contributor

getdave commented Jul 21, 2021

Thanks for confirming - much appreciated. Let's see if we can get other folks to verify the bug and also perhaps some Windows users.

In the meantime any more detail and examples you can provide including those animated GIFs will really help.

@getdave
Copy link
Contributor

getdave commented Jul 21, 2021

I finally managed to get a BrowserStack login and gave this a spin on Windows 10 with Edge 91 and was able to replicate:

Screen.Capture.on.2021-07-21.at.17-05-19.mov

@getdave getdave added [Type] Bug An existing feature does not function as intended and removed Needs Testing Needs further testing to be confirmed. labels Jul 21, 2021
@getdave

This comment has been minimized.

@t-hamano
Copy link
Contributor

I tested in the following environment:

Development Environment

Install npm package only @wordpress/env
.wp-env is set by default as follows

{
  "core": null,
  "themes": [ "." ],
  "config": {
    "WP_DEBUG": true
  }
}

WordPress information

WordPress version: 5.8
Gutenberg version: 10.7(without Gutenberg Plugin)
Are you using a default theme (e.g. Twenty Twenty-One)? Yes

Device information

Device: Notebook PC, i5-1035G1 CPU, 16 GB RAM
Operating system: Windows 10 Home 64bit
Browser: Google Chrome 91.0.4472.164 and Microsoft Edge 91.0.864.71

Test Results

  1. Copy and paste text from the windows notepad into the windows notepad: Of course no space will be added.
  2. Copy and paste text from the windows notepad into the block editor: no space will be added.
  3. Copy and paste text from the block editor into the windows notepad: no space will be added.
  4. Copy and paste text from the block editor into the block editor: A space will be inserted at both ends of the text.
6370970b1284119195a77bf1a1e9ab6b.mp4

A space will be inserted at both ends of the text only when I copy the text in the block editor and paste it in the same block editor.
The results were also the same for both Google Chrome and Windows Edge.

@t-hamano
Copy link
Contributor

I don't know the cause as I don't have a deep understanding of Gutenberg.
However, I think that the following article may be the same case as this symptom.
I hope you find it helpful.
https://discuss.prosemirror.net/t/space-added-on-paste/1274

@pansamolot
Copy link
Author

Thank you @getdave and @t-hamano for all the tests. It seems that I don't need to add a proof from my side as this is already confirmed by you many times.

Seems that the only thing we're left with is to wait for the dev team to pick this up. Thanks for your effort.

@getdave
Copy link
Contributor

getdave commented Jul 21, 2021

You are welcome.

I think @t-hamano has it with this post which has details on that is going on with this fragment business.

https://discuss.prosemirror.net/t/space-added-on-paste/1274/7

As a member of the dev team, I'll see if I can look into a fix tomorrow.

Update: ok I lied. I have a fix PR available now in #33607. It's not ready for full review yet but it should work to fix the issue.

@pansamolot
Copy link
Author

Blasting, light speed and amazingly fast! :> Thank you! :>

@getdave
Copy link
Contributor

getdave commented Jul 23, 2021

@pansamolot Would you be able to try and test the PR for me? You can use these instructions to do this pretty easily and quickly.

@pansamolot
Copy link
Author

@getdave Just made a quick test of your PR on a brand new AWS Wordpress instance and from my perspective the issue is solved.

There are no spaces added in any scenario where they're not expected and there are spaces added when they are expected (i.e. when copy-pasting a piece of text that actually contains beginning and ending space).

Due to the limited time resources I only managed to test this by making various pieces of text around the same blog post in Wordpress. I did not had a chance to test external-to-Wordpress or Wordpress-to-external copy-paste, but that was working even previously, so I assumed that your PR did not changed anything around here.

Thank you, great job!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Paste [Status] In Progress Tracking issues with work in progress [Type] Bug An existing feature does not function as intended
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants