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

Strange pasteHtml() issue

1 Answer 55 Views
Editor
This is a migrated thread and some comments may be shown as answers.
Fotis
Top achievements
Rank 1
Fotis asked on 09 Dec 2008, 05:56 PM
I'm using the code below to paste a link in the Editor from a custom dialog.

 

var elem = editor.getSelectedElement();
.
.

 

var

 

insertLinkCallBack = function(sender, args) {

 

    editor.pasteHtml(

"<a href=\"" + args.href + "\">" + args.html+ "</a>");
}

When I select a piece of text wrapped in <div> the pasted html is wrapped the div twice (?)

Before paste: 

<div id="myid">my content<br />
<br /></div>

After paste:

<div id="myid"> <a href="http://mylink">
<div id="myid">my content<br />
<br />
</div></a></div>

1 Answer, 1 is accepted

Sort by
0
Tervel
Telerik team
answered on 12 Dec 2008, 05:23 PM
Hello Fotis,

I tried to reproduce the problem in IE and FF, but unfortunately I was not able to. In my test the selected DIV would always get completely replaced by the link. Also, if the div was not selected - but the text cursor was inside of it, the link would be properly paste into the DIV as well.

Is it possible to open a support ticket and send us your custom dialog - e.g. a simple project that we are able to run and try to reproduce the problem locally. Once we succeed in that, we will get back to you with a solution.

All the best,
Tervel
the Telerik team

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