I'm having an issue in Chrome/Safari with trying to use the selectElement and pasteHtml functions. If I click within a link in some text and then click my custom button, the new link gets inserted within the existing link rather than replacing it. In Firefox and IE the link actually gets replaced with the new link which is the desired result.
This scenario is similar to having a custom link manager when a user wants to update a link, they click within the link, click a button, and then expect the link to be replaced.
I'm using Chrome 1.0.154.53 and Safari 3.2.2. The editor version I'm using is the ASP.NET_AJAX_2009_1_402_dev_hotfix.
Before button clicked:
After button clicked:
Below is the javascript for my custom button:
This scenario is similar to having a custom link manager when a user wants to update a link, they click within the link, click a button, and then expect the link to be replaced.
I'm using Chrome 1.0.154.53 and Safari 3.2.2. The editor version I'm using is the ASP.NET_AJAX_2009_1_402_dev_hotfix.
Before button clicked:
<p>This is a <a href="http://www.google.com/">link</a> to test with</p> |
After button clicked:
<p>This is a <a href="http://www.google.com/"><a href="http://www.yahoo.com">new link</a></a> to test with</p> |
Below is the javascript for my custom button:
<input type="button" value="Paste Content" onclick="InsertNewLink();return false;" /> |
<script type="text/javascript"> |
function InsertNewLink() |
{ |
var editor = $find("<%=RadEditor1.ClientID%>"); |
var elem = editor.getSelectedElement(); |
editor.selectElement(elem); |
editor.pasteHtml("<a href='http://www.yahoo.com'>new link</a>"); |
} |
</script> |