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

Custom Dialog Links

2 Answers 47 Views
Editor
This is a migrated thread and some comments may be shown as answers.
Peter Bulloch
Top achievements
Rank 1
Peter Bulloch asked on 28 Aug 2013, 09:47 PM
Greetings, using the sample found here
http://www.telerik.com/community/forums/aspnet-ajax/editor/custom-dialogs-not-working.aspx
We have been able to add custom links to our HTML content. 

The problem is, if our link has any other formatting (bold or italics is clicked) , the sample script will not pickup the link applied and will not return  the already set href.  It has something to do with the nested tags.  For example, this works fine, we can read the href:
<A href="site.aspx">A Staffing Request Form</A>

But this does not, the editor inserts some nested formatting tags and we can cannot get the parent tag href any longer:
<A href="site.aspx"><FONT color=#0000ff><STRONG>A Staffing Request Form</STRONG></FONT></A>

We cannot ask our users to change the HTML, please advise on how to read the href here and change it, based on the sample we have downloaded (or something we have missed).

Thank you.

2 Answers, 1 is accepted

Sort by
0
Ianko
Telerik team
answered on 02 Sep 2013, 02:57 PM
Hello Peter,

The encountered issue is happening because with the current custom implementation of this link manager the selected element is considered as an Anchor HTML element, however in the problematic scenario it is a strong HTML element, which does not have a href attribute.

Currently I could suggest you two possible solutions:

  • If the nested elements are build from custom logic in your project then you could consider using the additional tags outside the Anchor element, so that it does not have any child elements.
    <FONT color=#0000ff><STRONG><A href="site.aspx">A Staffing Request Form</A></STRONG></FONT>
  • Other possibility is to implement further the logic of the custom link manager and more specifically to check if the received element is an Anchor and if it is not, to get its parent element. The following code sample will get you started with this approach:
    var elem = editor.getSelectedElement();
     
    while(elem && elem.tagName != "A")
    {
        elem = elem.parentElement;
    }
     
Regards,
Ianko
Telerik
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to the blog feed now.
0
Peter Bulloch
Top achievements
Rank 1
answered on 02 Sep 2013, 04:25 PM
Thank you
Tags
Editor
Asked by
Peter Bulloch
Top achievements
Rank 1
Answers by
Ianko
Telerik team
Peter Bulloch
Top achievements
Rank 1
Share this question
or