There is a built in browser feature which already does what you want. Has nothing to do with Discourse.
Press Ctrl+Shift+V to Paste Text Without Formatting in Google Chrome. Text pasted into your browser, when using a rich text editor like the one found in Gmail, automatically takes on the formatting of the source text.
Thank you for working on this cool feature!
I’ve noticed that when you copy and paste some content from a web page that has text and images, the following happens:
the text formatting works well
however images show as a broken image icons
some time after saving such post, the “System” user makes an edit to re-upload the images and those images show up well.
It was pretty confusing to see that the images don’t show up and I tried several times, which is bad for UX.
Would it be possible to trigger image uploads immediately after pasting the text into Composer?
Yep. Here’s an example:
I copied the header and the first image and below you can see how it looks like when pasted (image doesn’t show up, only icon). Source.
Swiss Government Excellence Scholarships for Foreign Scholars and Artists for the 2018–2019 Academic Year
I am unable to reproduce it both here in meta and in my development environment. Also checked in Chrome, Firefox and IE. May I know which browser and OS you are using.
I see… I’m on MX Linux and using latest Chromium and Firefox, and I can reproduce repeatedly (here on meta too). Thanks for checking, and let me know if I can help test this otherwise.
@vinothkannans we got to look at improving internal usage, cause it really can muck stuff up when you cut and paste between posts
@vinothkannans we got to look at improving internal usage, cause it really can muck stuff up when you cut and paste between posts
[@vinothkannans](https://meta.discourse.org/u/vinothkannans) we got to look at improving internal usage, cause it really can muck stuff up when you cut and paste between posts ![:boom:](https://d11a6trkgmumsb.cloudfront.net/images/emoji/twitter/boom.png?v=5)
@vinothkannans I’ve noticed what I think is a bug in the HTML copy/paste. When I copy less than (<) and greater than (>) symbols, it pastes them as < and >. Other characters like single quote (’) and double quote (") aren’t escaped, so I found it odd that these were.
From writing this post I also realized that ampersand (&) has the same problem.
I just composed and pasted a post from Google Docs into this forum elsewhere and while it strips anything not markdown translatable, bold, italics, and links are delivered flawlessly.
Yeah, I see what you mean, for the general case. However, I have a specific case where I think it’s not ideal. When people put HTML inside of formatted text, I think it’s often so that it can be used as a template and copied and pasted unescaped. We recently had a case like this, where we were showing off the new ruby tag support. For example:
<ruby>漢<rt>かん</rt></ruby><ruby>字<rt>じ</rt></ruby>
In such a case, I think it would be appropriate to not escape it.
Current behavior on paste:
<ruby>漢<rt>かん</rt></ruby><ruby>字<rt>じ</rt></ruby>
Desired behavior on paste:
漢字
Basically, I would argue that anything in an inline code block like this or multiline code block
like this
should not be escaped when pasted. I think the average user doesn’t know about the paste as plain text option, so I don’t think it’s an acceptable workaround.