HtmlEditor :  Phorum 5 The fastest message board... ever.

This is the discussion forum for the HtmlEditor. See also the HtmlEditor home page, where you can download the control, and the Documentation Wiki, a collaborative project for documenting the control.

Goto Thread: PreviousNext
Goto: Forum ListMessage ListNew TopicSearchLog In
How to disable paste with html tags?
Posted by: Silat (---.clients.easynet.fr)
Date: Monday, 15-May-2006, 14:18:15

Hello,

Every time I paste data (CTRL+V) into your (wonderfull) component, it will embedded the text I paste with some HTML tags (font, size, ....). Is it possible to only paste the text without the HTML tags?

Cheers,

Silat.

Re: How to disable paste with html tags?
Posted by: Tim (---.gotadsl.co.uk)
Date: Monday, 15-May-2006, 14:41:59

You could intercept the paste event and grab the plain text from the clipboard.

Tim

Re: How to disable paste with html tags?
Posted by: Silat (---.clients.easynet.fr)
Date: Monday, 15-May-2006, 15:23:00

Yop, nice! You reacted very quickly ;-)

However I am not too familiar with this kind of programmation and it will be very usefull if you can send me a code snipplet?

Thanks again,

Silat.

Re: How to disable paste with html tags?
Posted by: Silat (---.clients.easynet.fr)
Date: Tuesday, 16-May-2006, 18:32:52

Finally, I use the code snipplet from
[tim.mackey.ie]
to clear my HTML.

Silat.

Re: How to disable paste with html tags?
Posted by: Prakash (---.pacific.net.in)
Date: Wednesday, 13-Dec-2006, 08:11:20

I know this thread is old but for others i think this piece can help

in the on paste of the editor or somwhere else you can do this.

return this.execCommand(MSHTMCMDID.IDM_PASTE, null, false, true);

if (Clipboard.GetDataObject().GetDataPresent(DataFormats.Text))
{
IHTMLDocument2 iDoc2 = (IHTMLDocument2)this.Document;
IHTMLTxtRange txtRange = IHTMLTxtRange)iDoc2.GetSelection().createRange();
txtRange.text = Clipboard.GetDataObject().GetData(DataFormats.Text).ToString();
return true;
}
return false;

instead of



Your Name: 
Your Email: 
Subject: 
Spam prevention:
Please, enter the code that you see below in the input field. This is for blocking bots that try to post this form automatically.
kVmm4
This is a moderated forum. Your message will remain hidden until it has been approved by a moderator or administrator
This forum powered by Phorum.