Describe the bug
When copying some text and then pasting it into a block, it is pasted with a space before and a space after with the normal Windows Paste operation.
When using PureText to paste a text-only version of the clipboard, no leading or trailing spaces are added.
To reproduce
Steps to reproduce the behavior:
Expected behavior
Exact copy of text pasted.
Desktop (please complete the following information):
Additional context
This is happening to me to, every time, and makes editing a big hassle. Steps to reproduce listed above will always result in an extra space before and after the pasted text. This happens for any length of text within a block (words or complete sentences).
Operating System | Windows 10 64-bit
-- | --
Browser | Chrome 76.0.3809.100
WP Version 5.2.2
I'm unable to reproduce this issue when checked out to the latest version of the editor in my development environment (master
at f198997e2c8e377423beb230ce5283914076d396).
It doesn't seem to happen in a classic block, but it does in a paragraph block and list block, so please check those (there may be others).
When I test copying and pasting between Classic and List blocks, the difference is in the pasting operation, not the copying, i.e. the contents of the clipboard are correct. In fact, I can confirm this using a clipboard application.
@galbaras I didn't mean to sound dismissive of your original report, sorry if that's how it came across. WordPress 5.2.2 is running the equivalent I think of v5.3 of the Gutenberg plugin. The plugin itself though is now on v6.4 (and soon v6.5), so there have been lots of changes and bug fixes in the code base. I'm trying to establish whether it has been fixed in more recent versions.
If you're able to test with the Gutenberg plugin installed and activated that would be useful. Here's a demo of my test:
I didn't take your reply as dismissive. You'd need to replicate the problem in order to help.
Your capture looks good, but...
I've installed Gutenberg 6.4 and tested. The problem is still there. I can confirm that the scripts on the editor page were those of the plugin while I tested.
If this is fixed in 6.5, I can test again. However, can you please take a look at the code for pasting text and compare Classic with, say, Paragraph? That may help isolate the problem.
Sorry, I'm no good with React, so can't help :(
Nope, not at all! :| I have just manually force-installed the development version of Gutenberg:
over production version of Gutenberg in my Wordpress 5.2.3. And either the development version was ignored / overloaded (after network activation of the plugin) by build-in production version of Gutenberg or the issue is still not fixed in Gutenberg 6.5.0.
Anyway, I still see these two damn surrounding spaces around each pasted text.
This bug is in effect in the current Gutenberg version (6.5).
What do you mean by "in effect"? Is it fixed? Is it still not fixed in G6.5 or what? :>
The bug made it to the production version. It is still there. Sorry, english is a second language for me...
Thank you. Now, everything is clear! :> So, we're still waiting for the fix.
No worries, we are all making mistakes. And that makes our lives really interesting. All the best to you.
Sorry, to say this, but I find this feature extremely annoying. I am moving a lot of texts between many sources, so copy-paste is the key operation for me in Gutenberg. The fact that I have to stop and manually remove trailing and ending space _with each and every paste_ influences performance of my work very negatively.
This is an important bug (appears in many scenarios and affects most of, if not all of Gutenberg users). Yet it should be very small to fix -- an addition of training and ending space during is a very unusual, artificial operation, so narrowing the responsible piece of code shouldn't be a problem.
Can we have _any_ estimate when this will be fixed?
@trejder Are you also on Windows?
@ellatrix Yes! :>
Am I the only one who has an even bigger problem with pasting? For me Gutenberg adds additional spaces completely randomly. Randomly meaning, while pasting the same text always at the same positions, but with (for me at least) no logical reason why exactly at those positions.
I double checked and there are no double spaces in the source text.
The exact same text pasted into the Classic element (within Gutenberg): No spaces. See here an example:
PS: Sorry if this isn't helpful, first time posting here ;-)
Since we're talking about editor that produces texts for website / blogs (where double spaces and all white characters are ignored) I think that the solution for problems all of us called up here would be a simple code that replaces all double spaces into single ones when pasting.
Am I the only one who has an even bigger problem with pasting? For me Gutenberg adds additional spaces completely randomly. Randomly meaning, while pasting the same text always at the same positions, but with (for me at least) no logical reason why exactly at those positions.
I double checked and there are no double spaces in the source text.
I've seen that in pasts versions of Gutenberg. @michaelbruetsch What version are you using?
@nicpelletier I'm using the current WordPress version 5.2.4. I read in this thread that WP uses a different version than the Gutenberg plugin itself here. So maybe that will be already fixed with the coming 5.3 update? Maybe I'm wrong in this thread. As I said, I'm new here ;-)
I don't know how about @michaelbruetsch and pasting double spaces in random places. But, for the initial entry -- adding spaces in the beginning and end of each pasted text -- nothing changed so far.
I have just updated to the newest stable / production version of Gutenberg 6.7.0 and still spaces are being added as you paste any text.
Do we have any priorities for bugs and functionalities in Gutenberg development?
Yesterday an update to Gutenberg inside Wordpress was released (version 6.7.0) and some breath-taking functionalities (sarcasm intended) like gradients in blocks were added. Yet, still no resolution on something as stupid (and in the same time affecting millions) as adding spaces when pasting text.
Any estimate when can this bug be taken into consideration by the dev team?
@trejder Please note that there's an etiquette guide - https://wordpress.org/about/etiquette/ - it specifically mentions unwelcoming behaviour. We're all smart enough here to understand what your sarcasm means, and it's not acceptable.
Please be professional in future. I understand you desperately want to raise the profile of this bug and that it's important to you, but it's just as important that you're respectful to those who work hard and contribute to this project—after all, they're the ones who you want to encourage to help solve this.
Thank you for pointing out that my behaviour and wording may not be acceptable by some. True apologies for those that felt offended.
Yet, case remains unanswered. Are there any priorities, severity levels etc. or other ways or tools to rise awareness over a bug affected by most likely every user of Gutenberg and bring it closer to the resolution than some fancy new functionalities?
Are there any ways to estimate, at least at highest level when and who can take over this particular issue? After all we are talking about a bug which resolution should take less than a half an hour (plus testing), because it only covers a tiny pasting functionality (my unconfirmed, possibly wrong assumptions).
If any, be it internal or public, roadmaps, priorities etc. suggest that fix to this tiny, yet very painful bug is like months away in front of us (because team is occupied with adding new functionalities rather than fixing obvious bugs) then many of us will surely decide to give Gutenberg go. I don't imagine working with (otherwise perfect) editor which causes me to get a near-to-heartbreak state 300 times per hour, each time I am pasting some text.
Am I the only one who has an even bigger problem with pasting? For me Gutenberg adds additional spaces completely randomly. Randomly meaning, while pasting the same text always at the same positions, but with (for me at least) no logical reason why exactly at those positions.
@michaelbruetsch Same problem here, WP 5.2.4 :-(
Are there any priorities, severity levels etc. or other ways or tools to rise awareness over a bug affected by most likely every user of Gutenberg and bring it closer to the resolution than some fancy new functionalities?
As you probably know, this is an open source project, so we rely on contributions. The hard part is that there are a lot of people creating issues, but only a limited number of people helping to organise/triage those issues. It's unfortunate that there weren't more responses to the Needs Testing
label on this issue (not for over two months), as those responses would have helped bring this to attention.
Anyway, I've done some digging and I think there are two separate issues related to the way different browsers and operating systems handle pasting.
When copy/pasting from another web page on Firefox (both in Windows and Mac OS X) it's noticeable that there are extra spaces within the text that occur exactly where the html from the event's clipboardData
wraps. In Chrome, this wrapping isn't present so the issue doesn't occur:
Clipboard value from JS paste event
Text in paragraph block
When copy/pasting text on Windows, the HTML from the clipboard event has new lines \n
within it, which aren't removed by any of the filtering the editor does. I think this is where the spaces the OP mentioned come from.
This happens in Firefox and Chrome on Windows (haven't tested Edge or IE11, but I assume it's the same)—note the new lines next to the html
and body
tags which don't occur on a Mac:
Firefox, Windows
Chrome, Windows
Firefox, Mac OS
Chrome, Mac OS
The block editor is exciting to develop, and much less exciting to support, so thank you, @talldan , for taking the time and analysing.
What would you suggest? By "which aren't removed by any of the filtering the editor does", I'm guessing you meant "currently". Is this a matter of adding some filtering before adding the text to the block?
What would you suggest? By "which aren't removed by any of the filtering the editor does", I'm guessing you meant "currently". Is this a matter of adding some filtering before adding the text to the block?
I think I have an idea on how to fix the second issue. It looks like stripping out the new lines that are outside of those <!--StartFragment-->
and <!--EndFragment-->
comments, where they exist, should resolve that. I think it could be done in a fairly browser/platform agnostic way. I'll work on a pull request.
The first one seems trickier, as there are potentially cases where newlines should be preserved in pasted text. @ellatrix might know more on how it works.
Thank you @talldan for providing such a great review of this issue. However, there's one thing that I must correct (emphasis mine):
When copy/pasting from another web page on Firefox (both in Windows and Mac OS X) it's noticeable that there are extra spaces within the text that occur exactly where the html from the event's clipboardData wraps. In Chrome, this wrapping isn't present so the issue doesn't occur.
The above statement is not true, at least not in my environment (Chrome 78 + Windows 10 Pro), where this issue does exist and is observable by me with every text paste into Gutenberg.
I have just performed a quick test of pasting text into Gutenberg editor from:
In all three cases the issue could be observed. All three pieces of text, even though carefully selected to not have any space in the beginning and in the end and though copied in the middle of the text, were pasted with spaces surrounding them.
Before pasting:
After pasting:
I think #17470 might fix these issues. I was hoping to get that in WP 5.3, but it didn't get any reviews.
I think #17470 might fix these issues. I was hoping to get that in WP 5.3, but it didn't get any reviews.
It really sounds like #17470 could fix #16172 (and probably some more issues). Keeping fingers crossed to get these changes ASAP.
Who can review changes? Who, and under what conditions, can become a reviewer / accepting entity? From browsing quite a large number of issues reported here it clearly seems that you have a fixture for a really impressive number of bugfixes, but you seems to be lacking reviewer a lat. And many, really important issues and fixtures is currently dangling waiting for someone to review it.
The Gutenberg core team (excluding the PR creator) gives a final review, but it really helps final reviewers when any involved party tests the PR, gives feedback, and perhaps reviews the code. So anyone can review, which facilitates a required final check by the core team.
The above statement is not true, at least not in my environment (Chrome 78 + Windows 10 Pro)
@trejder Yes, that's the second issue I described. The spaces within pasted text isn't an issue in Chrome (Issue 1), but the spaces around text is still an issue in Windows, including Chrome (Issue 2).
@ellatrix maybe the core team will help if you put a call out to them. The block editor is now core, after all
Issue still exists in WordPress 5.3 (Windows 10 & Chrome 78.0.3904.97). As Chinese / Japanese language do not have spaces between words or sentences, this problem is more annoying under CJK languages.
Hi all,
Is there anything we can do to help with this???
Or do we have to wait for #14170?
Editor is unsuable in this state, and I'm OK to participate coding/debugging/reviewing.
My cients are so p...ed with this, and I don't know what to tell them ;-)
Thx, Yan
My cients are so p...ed with this, and I don't know what to tell them ;-)
I'm not Yan's client but those extra spaces in pasted text are really Annoying
On windows 10 copying --any text-- produce the same effect in Gutenberg for WordPress 5.3
Edit:
In fact this phenomenon happenned to me with HTML text originally pasted from a MS Outlook text into a HTML Cleaner
By copy/pasting this text to then from my favorite Text Editor, Gutenberg doesn't Add those extra spaces
I've tested in the latest version of the plugin (v7.0) and I'm no longer seeing either of the issues identified above (spaces before and after pasted content, double spaces within pasted content). Looks like #17470 might have solved both of them.
Would be great if someone else can confirm.
For me, after update to Gutenberg 7.0, this issue is only partially solved:
Quick test:
This is a test!
becomes:
This is a tetestst!
when test
is copied from Notepad and pasted into Gutenberg and in:
This is a te test st!
when test
is copied from Gutenberg and pasted back to it.
I am not sure if update to 7.0 did change anything, because I think that "spaces problem" when pasting from external source was already resolved with some prior update. But, I may be wrong as I am unsure here.
Installed Gutenberg 7.0 via plugin, still the same issue (https://github.com/WordPress/gutenberg/issues/16172#issuecomment-554668296).
Hi @galbaras, @kerilynnengel, @trejder, @nicpelletier, @yankiara, @Coxxs and @gaelgerard! Thank you very much for the reports.
Could any of you share what the console is logging for you when you paste?
I'm looking for this:
Please copy the text and paste it in between backticks:
````
````
I'm looking for information with Gutenberg 7.0.
With this information, I believe can identify and fix it quicker.
Thank you!
Hey @ellatrix, thanks for the interest on that bugfix.
Examples copy/paste to my blog with the latest version of WordPress (5.3 FR):
Could any of you share what the console is logging for you when you paste?
1st example by copy/pasting from this page on github it adds a space at the begining and at the end of the text:
Received HTML:
<html><body>
<!--StartFragment-->Could any of you share what the console is logging for you when you paste?<!--EndFragment-->
</body>
</html> rich-text.min.js:6:30524
Received plain text:
Could any of you share what the console is logging for you when you paste? rich-text.min.js:6:30567
Processed inline HTML:
Could any of you share what the console is logging for you when you paste?
2nd example with the same text transformed in Heading 1 in LibreOffice Writer (Word). Still the extra space but only at the beginning:
```Received HTML:
Could any of you share what the console is logging for you when you paste? rich-text.min.js:6:30567
Processed HTML piece:
3rd example with a longer text from [Lorem ipsum generator](https://fr.lipsum.com/feed/html), here exta spaces at the begining and end of the text + between random words
```Received HTML:
<html><body>
<!--StartFragment-->Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent a elit
eget tortor molestie egestas. Donec pretium urna vitae mattis
imperdiet. Praesent et lorem iaculis, volutpat odio vitae, ornare lacus.
Donec ut felis tristique, pharetra erat id, viverra justo. Integer sit
amet elementum arcu, eget pharetra felis. In malesuada enim est, sed
placerat nulla feugiat at. Vestibulum feugiat vitae elit sit amet
tincidunt. Pellentesque finibus sed dolor non facilisis. Curabitur
accumsan ante ac hendrerit vestibulum.
<!--EndFragment-->
</body>
</html> rich-text.min.js:6:30524
Received plain text:
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent a elit eget tortor molestie egestas. Donec pretium urna vitae mattis imperdiet. Praesent et lorem iaculis, volutpat odio vitae, ornare lacus. Donec ut felis tristique, pharetra erat id, viverra justo. Integer sit amet elementum arcu, eget pharetra felis. In malesuada enim est, sed placerat nulla feugiat at. Vestibulum feugiat vitae elit sit amet tincidunt. Pellentesque finibus sed dolor non facilisis. Curabitur accumsan ante ac hendrerit vestibulum. rich-text.min.js:6:30567
Processed inline HTML:
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent a elit
eget tortor molestie egestas. Donec pretium urna vitae mattis
imperdiet. Praesent et lorem iaculis, volutpat odio vitae, ornare lacus.
Donec ut felis tristique, pharetra erat id, viverra justo. Integer sit
amet elementum arcu, eget pharetra felis. In malesuada enim est, sed
placerat nulla feugiat at. Vestibulum feugiat vitae elit sit amet
tincidunt. Pellentesque finibus sed dolor non facilisis. Curabitur
accumsan ante ac hendrerit vestibulum.
Not sure I have to do the test with Writer/Word just let me know, I will do.
Hope it will help.
Thanks a lot, that's very useful.
I'm fairly confident that #19043 fixes some of the issues described here.
Maybe too late, but just in case, this is for copying and pasting the word "become" in a paragraph block:
Received HTML:
<html>
<body>
<!--StartFragment--><span style="color: rgb(25, 30, 35); font-family: "Noto Serif"; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: pre-wrap; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255); text-decoration-style: initial; text-decoration-color: initial; display: inline !important; float: none;">become</span><!--EndFragment-->
</body>
</html>
11:41:05.777 rich-text.min.js?ver=3.7.2:6 Received plain text:
become
11:41:05.785 blocks.min.js?ver=6.7.2:2 Processed inline HTML:
become
@galbaras That case should be fixed now and the fix will be in Gutenberg 7.2.
@ellatrix Why you're closing a ticket, if you said for yourself that "_that #19043 fixes some of the issues described here_"? What about issues that remains unfixed? How they're going to be fixed, if ticket reporting them is closed?
Adding console dumps in step-by-step process of copying and pasting example piece of text from Visual Editor into Visual Editor.
Step 1. Page / Visual Editor load on some draft article:
JQMIGRATE: Migrate is installed, version 1.4.1
index.js?ver=ffee04a5c015601fa7840a747e107e8b:1 wp.editor.InspectorControls is deprecated. Please use wp.blockEditor.InspectorControls instead.
c @ index.js?ver=ffee04a5c015601fa7840a747e107e8b:1
index.js?ver=ffee04a5c015601fa7840a747e107e8b:1 wp.editor.PlainText is deprecated. Please use wp.blockEditor.PlainText instead.
Step 2. Selecting and copying sometimes used by non-developers,
text (unformatted, so looks the same in Code Editor):
index.js?ver=ffee04a5c015601fa7840a747e107e8b:1 `wp.data.select( 'core/editor' ).getSelectedBlock` is deprecated. Please use `wp.data.select( 'core/block-editor' ).getSelectedBlock` instead.
c @ index.js?ver=ffee04a5c015601fa7840a747e107e8b:1
(anonymous) @ index.js?ver=048001dcf6f0304c9176abd5f3efa063:11
e @ index.js?ver=1797bf8784ed2f6cc0feedc1ac56d5dd:1
(anonymous) @ index.js?ver=1797bf8784ed2f6cc0feedc1ac56d5dd:1
r @ index.js?ver=1797bf8784ed2f6cc0feedc1ac56d5dd:1
(anonymous) @ common.min.js?ver=20191211:1
(anonymous) @ index.js?ver=1797bf8784ed2f6cc0feedc1ac56d5dd:1
_t @ index.js?ver=1797bf8784ed2f6cc0feedc1ac56d5dd:1
(anonymous) @ index.js?ver=1797bf8784ed2f6cc0feedc1ac56d5dd:1
je @ react-dom.min.b694e242.js?ver=16.9.0:78
ph @ react-dom.min.b694e242.js?ver=16.9.0:215
lh @ react-dom.min.b694e242.js?ver=16.9.0:126
O @ react-dom.min.b694e242.js?ver=16.9.0:121
ze @ react-dom.min.b694e242.js?ver=16.9.0:118
(anonymous) @ react-dom.min.b694e242.js?ver=16.9.0:53
unstable_runWithPriority @ react.min.0212dc62.js?ver=16.9.0:26
Ma @ react-dom.min.b694e242.js?ver=16.9.0:52
mg @ react-dom.min.b694e242.js?ver=16.9.0:52
V @ react-dom.min.b694e242.js?ver=16.9.0:52
Be @ react-dom.min.b694e242.js?ver=16.9.0:119
xi @ react-dom.min.b694e242.js?ver=16.9.0:39
index.js?ver=ffee04a5c015601fa7840a747e107e8b:1 wp.editor.RichTextToolbarButton is deprecated. Please use wp.blockEditor.RichTextToolbarButton instead.
Step 3. Pasting above copied text into some other place (new paragraph at the end of text) in Visual Editor.
Getting sometimes used by non-developers,
in Visual Editor (with surrounding two spaces).
Received HTML:
<html>
<body>
<!--StartFragment--><span style="color: rgb(25, 30, 35); font-family: "Noto Serif"; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: pre-wrap; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255); text-decoration-style: initial; text-decoration-color: initial; display: inline !important; float: none;">sometimes used by non-developers,</span><!--EndFragment-->
</body>
</html>
index.js?ver=7c6c2221add49d82b0166792f2b184c4:6 Received plain text:
sometimes used by non-developers,
index.js?ver=4a81ccc4ccb8f6c45e1b07eaec152198:2 Processed inline HTML:
sometimes used by non-developers,
I maybe missing something, but it seems that console dump logs in both cases a text without any surrounding spaces in both _Received HTML_ and _Processed inline HTML_. It only gets spaces added in _Received plain text_.
Please, reopen the ticket. Reported issue is not solved in Gutenberg 7.0. Thank you.
@trejder have you tried #19043? The original reported issue is fixed. If you have any remaining issues after #19043, please create a new report.
@ellatrix thank you. How can I test / check #19043 on my side? It doesn't seems to be included in Gutenberg 7.0 production. Shall I fetch dev code, overwrite production code with it and see, if the issue is resolved?
And even, if yes, then what? Shall I revert back to production? Is there any plan, in which production version of Gutenberg #19043 will be released?
@trejder One way I think you should be able to test without going through all those steps is using the block editor in the playground:
https://wordpress.github.io/gutenberg/?path=/story/playground-block-editor--default
This is a stripped-down version of the block editor which is missing some functionality, but the copy/paste handling should be the same as in the plugin and WordPress core.
The playground is updated every time a pull request is merged, so it has all the latest fixes, including #19043.
Thanks for the tip @talldan !
And I can confirm, on this playground I can paste long texts without any extra space appearing.
👏 Good Game @ellatrix for the bug fix 💪
Do you know when it will be part of WP core version?
@talldan Thank you!
@ellatrix Confirmed. Works fine and ready to go. The question remains -- when #19043 is planned to be released to the wild world (production version)?
It will be in the next Gutenberg plugin version, 7.2.0 I think, and the next WP release, 5.4 I believe.
So annoying. And still there mid Jan 2020, almost half a year since when the issue was raised. Any chances for a fix before the next ice age?
Gutenberg 7.2 has fixed the issue: https://wordpress.org/plugins/gutenberg/
Seems true. I have just updated to Gutenberg 7.2 and it seems that I finally cannot reproduce this issue anymore. Thank you, t h a n k y o u, THANK YOU !!!
Gutenberg 7.2 has fixed the issue: https://wordpress.org/plugins/gutenberg/
Indeed it has, thank a million! My blogging life suddenly became slightly less annoying ;)
Gutenberg 7.2 has fixed the issue: https://wordpress.org/plugins/gutenberg/
In the current version 7.5, the old leading and trailing spaces problem doesn't appear. However, it seems to be solving it by merely trimming the _pasted_ text. Doing so causes _pasting_ spaces to be impossible. I would say this is still a buggy behavior.
Gutenberg 7.2 has fixed the issue: https://wordpress.org/plugins/gutenberg/
In the current version 7.5, the old leading and trailing spaces problem doesn't appear. However, it seems to be solving it by merely trimming the _pasted_ text. Doing so causes _pasting_ spaces to be impossible. I would say this is still a buggy behavior.
Agreed. But it's the lesser evil. In most cases I copy-paste stuff without leading/trailing spaces.
On contrary to xpil, I disagree. If something is adding spaces (during copy) in front and in back of copied text (where original text does not include them) then solution by no means should be to stop that thing from adding these spaces rather than stripping spaces. This is up-side down solution, unfortunately.
On contrary to xpil, I disagree. If something is adding spaces (during copy) in front and in back of copied text (where original text does not include them) then solution by no means should be to stop that thing from adding these spaces rather than stripping spaces. This is up-side down solution, unfortunately.
Again, I agree on the principle. It's better to fix a bug at source rather than blanketing it with an extra operation. No doubts here.
But.
For me as the end-user it's more important to use a feature that works correctly in 99% cases than to have a permanently broken one. End-users don't care about internals as long as they get the right outputs.
With that clarification I can't do anything else than agree with you.
I think that we may safely assume that there are approx. 90-95% of users not having spaces around copied text and only 5-10% intentionally coping text with spaces in the beginning or end.
I think that we may safely assume that there are approx. 90-95% of users not having spaces around copied text and only 5-10% intentionally copying text with spaces in the beginning or end.
For me as the end-user it's more important to use a feature that works correctly in 99% cases than to have a permanently broken one. End-users don't care about internals as long as they get the right outputs.
I agree that the current behavior is less bad than before, simply because adding spaces is easier than moving the cursor and removing them, not because it is a good solution. On the other hand, I can even argue for trimming the spaces: selecting a word by double-clicking also selects the trailing space which is usually unwanted and trimming removes it, which is good. But both behaviors break a fundamental user interaction principle: The software should do exactly what it is supposed to do. In this case, it is pasting exactly what the user has copied. For this kind of basic operation it is supposed to be 100% correct in all cases for 100% users. It took me quite a while to realize that it wasn't me who copied extra spaces around the sentences, but the software who was making them.
The problem seems to be unrelated to the Gutenberg code. The browser is passing padded text to Gutenberg, by which time, the only course of action is either to remove them or to leave them.
Also, if you look above, you'll see that I've checked the copied text in the Windows clipboard and it appeared to be correct.
Removing is likely to provide better user experience than keeping the extra spaces.
Not sure if this is any help, @talldan & @ellatrix , but looking back at our communication, I see that this only happens when pasting formatted text, not plain text, and there seems to be a clear difference between the Classic block and others.
Can you confirm there's no other option here that will get us to 100%?
@YukinoHayakawa I noticed this even happens when copying from one paragraph block and pasting into another.
My feeling is that what's pasted should be as close as possible to what was copied. Would you be willing to open a new issue for this?
I've opened #20310, would be great to add any further comments there.
I've opened #20310, would be great to add any further comments there.
Appreciate your help in opening the new issue thread very much. I was hesitating about how to describe the problem in a good way.
Most helpful comment
Sorry, to say this, but I find this feature extremely annoying. I am moving a lot of texts between many sources, so copy-paste is the key operation for me in Gutenberg. The fact that I have to stop and manually remove trailing and ending space _with each and every paste_ influences performance of my work very negatively.
This is an important bug (appears in many scenarios and affects most of, if not all of Gutenberg users). Yet it should be very small to fix -- an addition of training and ending space during is a very unusual, artificial operation, so narrowing the responsible piece of code shouldn't be a problem.
Can we have _any_ estimate when this will be fixed?