This is a migrated thread and some comments may be shown as answers.

PasteHtml or getSelection behaving badly

4 Answers 73 Views
Editor
This is a migrated thread and some comments may be shown as answers.
David
Top achievements
Rank 1
David asked on 14 Jan 2009, 07:10 PM
Hello,

I have created a custom button on the editor that takes the user's selection and wraps it in some custom tags.  It is working acceptably for IE but not for Firefox.  There appears to be some extra duplicated tags returned when using the editor.pasteHtml function....or perhaps something left over when calling editor.getSelection.

To reproduce, the user highlights a block of text the end of which contains a link....like below...

Non Toxic - Western Red Cedar is non toxic, making it safe for all uses.  It requires no chemical treatment which is good for you and good for the environment.  Plus wood is the ideal environmentally sound building material.


They click our custom button which guides them via an external dialog to select a tag ID, in this case 'test1'

The following callback is fired..

var myCallbackFunction = function(sender, args) 
{            
           editor.pasteHtml(String.format("<gwo:script name=\"{0}\">", args[1]));             
           editor.pasteHtml(args[0]); 
           editor.pasteHtml(String.format("<gwo:noscript>"));            

with the following values for args

args[0] =
<b>Non&nbsp;Toxic&nbsp;- </b>Western Red Cedar is non toxic, making it safe for all uses.&nbsp; It requires no chemical treatment which is good for you and good for the environment.&nbsp; <a href="http://www.wrcla.org/cedar_benefits/environment/energy_efficiency_and_biodiversity.htm" target="0">Plus wood is the ideal environmentally sound building material.</a>



args[1] =
test1



Upon returning to the page this is what the HTML looks like...

<gwo:script name="test1"></gwo:script><a target="0" href="http://www.wrcla.org/cedar_benefits/environment/energy_efficiency_and_biodiversity.htm"><strong>Non&nbsp;Toxic&nbsp;- </strong>Western Red Cedar is non toxic, making it safe for all uses.&nbsp; It requires no chemical treatment which is good for you and good for the environment.&nbsp; <target="0" href="http://www.wrcla.org/cedar_benefits/environment/energy_efficiency_and_biodiversity.htm">Plus wood is the ideal environmentally sound building material.</a><gwo:noscript></gwo:noscript></a>

as you can see it wrapped the whole thing in and extra <a> tag.  In IE it adds extra <p> and <strong> tags (which I may be able to live with).

For a test, calling editor.pasteHtml(' ') prior to the existing calls to editor.pasteHtml and examining the output of editor.get_html('false'), there exists the offending link <a target="0" href="http://www.wrcla.org/cedar_benefits/environment/energy_efficiency_and_biodiversity.htm">. 

Any Idea how I can get rid of those extra tags?

I can make a simple project to forward if necessary.

Thanks!





4 Answers, 1 is accepted

Sort by
0
David
Top achievements
Rank 1
answered on 16 Jan 2009, 03:56 PM
Any updates on this?
0
Rumen
Telerik team
answered on 19 Jan 2009, 04:20 PM
Hi Ken,

We tried to reproduce the problem using a custom button but unfortunately to no avail. Could you please, open a support ticket and send a sample working project with a custom dialog that demonstrates the problem? It will be best if you could also send a sample video demonstrating your steps.
 
Best regards,
Rumen
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
David
Top achievements
Rank 1
answered on 19 Jan 2009, 06:49 PM
I have opened a support ticket with uploaded sample project and video. Ticket:185614.

Thanks!
0
Rumen
Telerik team
answered on 20 Jan 2009, 01:23 PM
Hello Ken,

I want to notify you that we just answered your ticket. Please, see our response.

Best regards,
Rumen
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Tags
Editor
Asked by
David
Top achievements
Rank 1
Answers by
David
Top achievements
Rank 1
Rumen
Telerik team
Share this question
or