Googlebot
Googlebot

Reputation: 15683

Copy/paste into JS rich-text editor

I am playing with the mozilla example of Ritch-Text Editor introduced HERE. Everything seems to be fine, but when copying/pasting a simple text from a webpage, it will add lots of unnecessary html tags. For example, if copying the last line of the present page; the text horribly will be

        <p><span style="color: rgb(68, 68, 68); font-family: Arial, 'Liberation Sans',
     'DejaVu Sans', sans-serif; font-size: 13px; line-height: 12px; text-align: left;
 background-color: rgb(119, 119, 119); ">site design / logo © 2012 stack exchange
     inc; user contributions licensed under&nbsp;</span><a 
href="http://creativecommons.org/licenses/by-sa/3.0/" rel="license" style="
    margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px;
     padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left:
     0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px;
     border-left-width: 0px; border-style: initial; border-color: initial; border-image:
 initial; font-size: 13px; vertical-align: baseline; background-image: initial;
     background-attachment: initial; background-origin: initial; background-clip:
     initial; background-color: rgb(119, 119, 119); color: rgb(68, 68, 68); cursor:
     pointer; font-family: Arial, 'Liberation Sans', 'DejaVu Sans', sans-serif;
     line-height: 12px; text-align: left; ">cc-wiki</a><span style="color:
     rgb(68, 68, 68); font-family: Arial, 'Liberation Sans', 'DejaVu Sans',
     sans-serif; font-size: 13px; line-height: 12px; text-align: left; background-color: 
    rgb(119, 119, 119); ">&nbsp;with&nbsp;</span><a 
    href="http://blog.stackoverflow.com/2009/06/attribution-required/" rel="license" 
style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px;
     padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px;
     border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px;
     border-left-width: 0px; border-style: initial; border-color: initial;
     border-image: initial; font-size: 13px; vertical-align: baseline; background-image:
     initial; background-attachment: initial; background-origin: initial; background-clip: 
initial; background-color: rgb(119, 119, 119); color: rgb(68, 68, 68); cursor: pointer;
     font-family: Arial, 'Liberation Sans', 'DejaVu Sans', sans-serif; line-height: 12px;
     text-align: left; ">attribution required</a></p>

This makes the text editor practically useless. How to force the editor to paste only main html tags like <b>, <a>, etc

Or alternatively paste tag-stripped text.

The issue is that this must be done before pasting into the text editor, because after sending the form, the html tags will be mixed with out edit.

Upvotes: 0

Views: 1037

Answers (1)

eric.itzhak
eric.itzhak

Reputation: 16062

Most WYSIWYG Editors have an HTML possibility ( to write in html). Check if your editor has it, and if it does just paste your data through that.

Upvotes: 1

Related Questions