-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
No Paste as Text button on Paragraph block #6132
Comments
I've found myself doing Command+Shift+V many times. |
I am not totally sure we need to add a 'paste as' button if pasting works. It actually does in most cases and where it doesn't we should focus on iterating on copying and pasting over adding a button to cover those issues. |
Noting was closing to get an issue to not focus on the button, but let's carry on discussion here looking at what 'non-button' things we can do. I am sure we can do better with some considering. |
Some past things we have discussed:
This is very similar to what Ulysses does for Command+Shift+V: |
@karmatosed Just because pasting works in some cases that's not a good enough reason to ignore the cases where it doesn't work. Copying content from other websites (or other formatted sources) is extremely common. It's going to be incredibly frustrating and tedious if pasting text into your page ends up creating multiple blocks that you don't want. WordPress currently provides users with the ability to Paste as Text. There's no reason why Gutenberg shouldn't also provide this functionality. I'm confident in saying that very few people know about Command+Shift+V (Ctrl+Shift+V) and is it even guaranteed to work in every single OS/Browser combination? 99% of people will simply use Ctrl+C Ctrl+V to Copy and Paste. If you're adamant about not adding a Paste as Text button then you should simply strip everything and always paste as plain text no matter whether it's one word, two words, a whole sentence or multiple paragraphs. |
@maddisondesigns my point was whether a button is the best option, not one of ignoring what is an issue. I totally see how this is a hitch and actually really like the suggestion by @mtias. What do you think of that? It's not a button and has some awesome options. |
I'm not a big fan of the contextual menu after pasting. I think that would be confusing for users. Using my example from above, would it create a Header block for the Most people expect that they'll have to re-format content that they paste from another source. If they're copying a sentence and they specifically want it as a Header, then they're more than likely going to paste it into a header block anyway. It seems pretty obvious that if you paste something into a paragraph block, then you actually want it as paragraph text. Pasting should default to the type of block that you're pasting into;
|
@maddisondesigns Sounds good to me, though I would add that pasting into an empty Paragraph block would paste things as whatever they are (headings to Heading blocks, paragraphs to Paragraph blocks, lists to List blocks, etc.), since an empty Paragraph block does not really imply any particular block is desired yet (hence why the quick-add buttons and slash commands are used in them). |
@SuperGeniusZeb I disagree with that. That's just going to get us back to the exact same issue I had in the first place, the inability to paste content into a paragraph block. When copying content from another source, there's a very good chance that I'd want it copied into a new paragraph so I would create a new Paragraph block first. If I specifically wanted it pasted as a heading, then I'd most likely create a heading block and then paste in the content. If I paste something into a Paragraph block, either paste everything as plain text or give me a Paste as Text button. |
@maddisondesigns I don't agree that we should always paste as the block the user pasted into, and strip all formatting, especially if it's a paragraph. I think we're doing quite good already in stripping all that is not semantic content, so it shouldn't bother the user as much as it does in the old editor. I think pasting as plain text would be a bad default if the user is pasting from e.g. Google Docs, Word, or even a larger piece of an article on the web. In this particular case it seems you're pasting one line of text and expected an "inline" paste. We could consider always pasting content as inline text if there is only one block that needs to be created. Does this sound like a good solution? In addition we could also display some options before or after paste when the user is pasting HTML. I'm happy to look for a solution once #5966 is merged. |
@iseulde I disagree that what you're currently doing works well. I just tried the example you suggested in #5966 and the content that it pasted in was an absolute mess. For starters, if I happen to hit paste whilst the cursor is in the main page title, it simply pastes the whole content within the title block. After that didn't work, I added my own page title and then tried pasting the content into a paragraph block. What I ended up with would take considerably more effort to fix than what it would've been to reformat from plain text. Some of the content is pasted in paragraph blocks and then there's other content pasted into a Classic Block. Why!? There's a list block with all the Share links. Why would I want that? You're pasting in content which is visibly hidden, such as "Continue reading the main story" and "Share this Page" text. Why on earth would I want to paste content that A) I don't know exists, and B) is actually hidden so I cant see it? The main title for the poem is a If this is what pasting content in Gutenberg is going to result in, then you've just made it considerably more difficult to work with because now we'll have to paste it into a text editor first to strip everything ourselves, and then paste into Gutenberg. At least with the current TinyMCE editor it does some form of cleanup and then if we find after pasting there's still some rubbish content, we have a Paste as Text button to fallback on. Can you please format the text to the type of block that I'm pasting into or if you're going to keep pasting this mess, at the very minimum, give us a Paste as Text button. |
And I forgot to mention after all that, your #5966 PR still isn't going to resolve my original issue, which is trying to paste some simple text into a paragraph block. Without a Paste as Text button you've basically made it impossible. Just because I copy some text which happens to be formatted as a header (or even when its in multiple formats), doesn't mean that I automatically want it formatted exactly the same way in my own content. More than likely, if someone is pasting content from another site into their own content, they're going to want to reformat it so it matches the source content, not keep it as the original format. |
Did you try #5966 with on the branch (with the patch applied)? I don't think so as it's impossible to to get a Classic block there.
So you expect to always get plain text from paste, but are not happy with this result? Are you are happy with this result? I can't tell.
Can't happen on #5966. The branch fixes that issue.
I don't think pasting as plain text will make this any better. You'll still be left with all the text from it and will have to delete it. I would actually prefer these to be isolated in a list so it can be easily deleted if copied by accident.
Pasting as plain text is not going to solve that. I have a few ideas to filter screen reader content, you're solution won't help here at all.
This is fixed in #5966...
The current TinyMCE editor does less cleanup than Gutenberg does. Try pasting the poem in the current editor, go to text mode, and you'll see a lot more rubbish. :)
I didn't say this will solve your issue. I said "I'm happy to look for a solution once #5966 is merged". That pull request as nothing to do with this ticket, I just mentioned that I'll wait to work on a solution until this pull request (big refactor) is merged. What do you think of the solution I did propose? #6132 (comment) This will only fix smaller pieces that are pasted, but I think it's generally better behaviour. I don't see a solution for large pieces of content, because in some cases you'll want to preserve the HTML, in other text, so that's why I mentioned that we could have the option before or after paste, if HTML is being pasted. |
Lots of insights and thinking in this thread. I am going to try and summarise a little, see if we can get to a solution point. As @matias showed I still think this is a great option forward of having similar to what Ulyssess does for Command+shift+V. Whilst I understand the caution it really using it feels like a vast improvement over a button. I do agree 100% with @iseulde in that pasting plain text as a default is not the best user experience. I think the offer there to look at a solution is a sound one and now #5966 is in let's move onto that. |
You're right, I didn't try the new updates since they weren't currently merged into the plugin at the time. My point was to show that you weren't currently doing a good job of pasting after you specifically said "I think we're doing quite good already". I've just tried the new updates now that it's been merged, and honestly, it's not much better. Copying content from this page, you've somehow managed to inject a whole bunch of carriage returns and spaces into the content, that wasn't present in the source page. On top of that, you've also stripped out images and h2 tags.
My point was to show the inconsistency. The Title block is just another block, isn't it? When I paste content in to that block, why is it treating the content differently to every other block.
I'm still not a fan of that contextual popup. What happens when pasting mixed content? e.g. Say a heading, a paragraph and an unordered list of links? Does it show 3 popups for the three different types of content or just one, for the whole lot? This whole issue could be resolved simply by having a Paste as Text button. For those that are happy with the results of the default pasting and the multiple blocks that it creates, then nothing changes. The rest of us that just want a way to insert plain text, we'll have a button that provides us with that option. If the only option is having that contextual popup, then so be it. At least it gives us a way to insert plain text. For a 'new and improved' editor, Gutenberg sure is making editing your content more difficult! |
@maddisondesigns Actually, those carriage returns were always there. The editor just stripped out various HTML tags (like That is some ugly and confusing indentation/spacing in the website markup, but the editor should probably clean that up on paste and not leave empty lines of whitespace after stripping tags. Some thoughts on the contextual pop-up idea: Maybe the contextual pop-up should appear before actually pasting the content. Doing it after the paste sounds like it might be tricky to implement. So the workflow would be:
If a “Paste as Text” button is added, it does not belong in a block toolbar, as it really should not be specific to any one block. The button should be put in the top bar of the editor next to the Undo and Redo buttons. Actually, if there is going to be a button at all, it might as well be a “Paste as…” button that opens a modal/pop-up when pressed allowing you to select how the content is pasted (much like the contextual pop-up mentioned above, which would probably be unnecessary if a button was added). That said, I am not sure that pasting as plain text is something that is used enough to warrant a dedicated button in the UI, since you can already use Ctrl/⌘+Shift+V to paste as plain text, and doing it via the keyboard is always going to be faster anyway. Maybe I am wrong and it does need a dedicated button, but I personally do not feel the need for one. |
@SuperGeniusZeb I've never once used |
@maddisondesigns I am used to using the shortcut frequently since it exists in WordPress in the Classic Editor, Microsoft Office, LibreOffice, Gmail, and a multitude of other programs. I thought it was fairly common knowledge since the shortcut seems to be so ubiquitous in programs with formatted text entry. |
We currently don't support nested blocks inside lists so this is why.
Sure, we can change it so that it behaves just the same as other blocks. |
I haven't used Gutenburg very long but I must agree with maddisondesigns that the paste function is not acceptable. I had a word document that I wanted to add to a post - nothing fancy just one header and several paragraphs of text. I created a header in the post and typed in the text then created an empty paragraph block and pasted the text from the word document into it. It appeared to work but the paragraph block didn't display when I previewed the post or when I published it. It was only visible in the edit mode. My work around was to paste the text into notepad then copy the text and paste into the text block. Even so there were some odd things going on with carriage returns. 11/4/2018 |
I have just seen a client of mine make a royal mess of their content by pasting in content with hidden linebreaks. They don't show up unless you edit the block as HTML. It's not very clear that there is a keyboard shortcut to paste in as text (Control / Command + Shift + V). And I don't expect that a lot of clients would know what it meant to paste in without formatting. Not sure what the most elegant solution is but I am simply agreeing there is a problem with this. |
I have recently stumbled across an odd issue when pasting from Word which is any reason a paste-as-text option would be immensely useful. I have a Word doc containing a mixture of standard paragraph, bold and underlined text etc. It is a working document which has has been edited by many people as is typical with many Word documents when preparing copy for a web site. When copy and pasting into Gutenberg it is styling many of the standard paragraph bits of text as bold. On investigating further, I saved the Word doc directly as HTML to see what was being produced and found many of the standard paragraphs were markup up like this:
For some reason Word has marked up a normal paragraph to include There is no indication in Word that this paragraph should be marked as bold or is wrapped in bold styling in any way - the B button is not highlighted and there is no indication that the text has any other custom styling. I cannot explain why Word would markup content in this way - certainly if I recreate the paragraph in a new Word doc from scratch by typing, I can copy and paste fine so I imagine this is something that can occasional happen in Word after various iterations of text being styled, bolded and unbolded etc. I don't expect this is a scenario that is fixable, but it does highlight the need for a user to optionally be able to paste as text if they would prefer to start from some clean pasted text. |
Could someone give an update on this issue? |
An update showing the newest version of WordPress 5.7 beta 3 and Gutenberg plugin 10.0. I went into a Google Document copied a H2 text into a Paragraph block. Paste-h2-into-Paragraph-block.mp4Is there any other actionable item we need for this issue? Can we go ahead and close it? |
@paaljoachim Please don't close this issue. It still doesn't resolve the original issue that I raised about the lack of a Paste as Text button, or provide an adequate reason as to why there isn't one (especially considering this functionality has existed for years in the Classic Editor). Here's a very simple test with the latest Gutenberg plugin (9.9.3). If I copy content that has multiple formats and then paste that into my page, I end up with multiple blocks. When you're copying content from another source, very rarely do you want it pasted with the same formatting. Even when I copy content from other pages in my own site, rarely do I want it pasted with the same formatting. As I mentioned above, if I paste content into a Paragraph block, I want ALL the content pasted into a paragraph block. I don't want Gutenberg creating blocks for me. If I wanted a Heading block I would've created a Heading block myself and pasted the content into it. Screen+Recording+2021-02-16+at+02.33.11+pm.mp4At the moment, pasting content into Gutenberg is horrible. It's reminiscent of editors back in the 90's. I have to open a text editor, paste in my content to remove the formatting, then copy that again, and finally paste into Gutenberg. It's such a painful experience. |
You can use Shift+Ctrl+V (or Shift+Cmd+V on mac) to remove the formatting when pasting text. That works the same as just about any other content editor, and in most workflows it's quicker than hunting around for a button in a toolbar. |
When I use Ctrl + Shift + V to paste without formatting Gutenberg ends up adding |
Almost 3.5 years and still no resolution to this issue. Why is there such a reluctance to add a simple "Paste as text" button to fix the many issues with pasting text into Gutenberg Blocks? Constantly saying "you can just use Shift+Cmd+V" is not an adequate solution as not everyone knows that you can do that because it's so hidden. The Paste as Text button was available in the Classic Editor. It's almost 3 years since Gutenberg was introduced in WP5.0 and it still doesn't fulfill the promise of doing everything the Classic Editor can do. You can't paste as text because there's no "Paste as text" button. You can't insert special characters (¢€£¥ ©®™ ¼½¾) as there's no "Special characters" button. You can't insert Audio Playlists because the Audio Block in inadequate. Replicating every single feature of the Classic Editor should've been a priority from day one and should've been in Gutenberg before it was even added to Core. |
In my opinion a contextual menu or button which appears before pasting would really help users who don't use Gutenberg frequently. I know many end users who only open their WordPress site once every few months to add a piece of text which they copied from old web pages, word or a random pdf. They won't remember the shortcut. Our clients always inserted their copied content within the text-mode of the classic editor which automatically pasted their content as plain text. They don't know that there is an option to paste as plain text via keyboard shortcut in Gutenberg. And apparently this shortcut differs? For example I can only paste plain text in Gutenberg (in Safari / Firefox) with the keyboard shortcut Cmd + Option + Shift + V - The mentioned shortcut cmd + shit + v doesn't work on my system (MacBook M1 pro / macOS Monterey 12.5.1 (21G83) ) |
This is standard. I don't expect there will be a "Paste as text" button added to the paragraph block; it'll be more confusing than necessary for all the times you paste something into that isn't just text. I'll close at not planned for the time being. |
@richtabor Gutenberg has multiple icons/buttons to help with block selection because simply selecting the exact block you want with your mouse is so horribly implemented, yet you think that adding a simple "Paste as text" button to a single block is going to be confusing for the end user. A button which has existed within the standard WordPress editor for 15+ years, since at least WP v2.5. What absolute rubbish! It's a real shame that Gutenberg has failed to live up to its promise to provide the exact same functionality that users were familiar with prior to WP5.0. |
Just for reference (as I was experiencing this issue). On macOS 14 the suggested combinations did not work for me. |
Issue Overview
I wanted to copy some text into a paragraph block. The text was a
h2
header from another site. Instead of stripping the html and pasting as text, it created a new Header block. This means that it's going to be incredibly difficult, and in some cases impossible, to copy formatted text from other sources into your content in the way that you actually want it.This gets even worse when the text you're copying contains multiple formats, such as a header and some paragraph text. Not only does it insert a Header block but it also inserts another paragraph block with the remaining text as well.
Steps to Reproduce (for bugs)
Expected Behavior
I expect to be able to copy any text I want into a paragraph block
Current Behavior
Pasting text doesn't strip html and automatically creates unwanted blocks
Possible Solution
Add a Paste as Text toolbar button to the Paragraph block so that people can paste content from other sources and strip the html
Gutenberg 2.6.0
WordPress 4.9.5
Firefox Quantum 59.0.2 (64-bit)
The text was updated successfully, but these errors were encountered: