Very strange problem with custom tag

2 posts, 0 answers
  1. ericc34
    ericc34 avatar
    91 posts
    Member since:
    Jul 2006

    Posted 19 May 2011 Link to this post

    In radEditor I have a custon button to set teg at begin en end of my selection like this :



    "Schedule"] = function (commandName, editor, args) {





    var selection = editor.getSelectionHtml();





    //Remove all custom tags before insert new custom tags




    var html = editor.get_html(true).replace("<ordredujour>", "");





    "</ordredujour>", "");





    var newhtml = html.replace(selection, '<ordredujour>' + selection + '</ordredujour>');








    I must remove old tag if old tag exist because i want only one <ordredujour> tag in all my html

    My problem is that in HTML tab, I don't see my custom tag around selection. Do you know why ?


  2. Rumen
    Rumen avatar
    13803 posts

    Posted 24 May 2011 Link to this post

    Hi ericc34,

    I found a mistake in your code and it is that you should assign a variable the value returned by the highlighted line:

    html = html.replace("</ordredujour>", "");

    In addition the custom tags in IE should have a namespace, e.g.<my:ordredujour> in other case the browser will modify them.

    Here is the rewritten code that works on my side:

    <telerik:RadEditor ID="RadEditor1" runat="server">
                <telerik:EditorTool Name="Schedule" />
    <script type="text/javascript">
    Telerik.Web.UI.Editor.CommandList[ "Schedule"] = function (commandName, editor, args)
        var selection = editor.getSelectionHtml(); //Remove all custom tags before insert new custom tags
        var html = editor.get_html(true).replace("<my:ordredujour>", "");
        html = html.replace("</my:ordredujour>", "");
        var newhtml = html.replace(selection, '<my:ordredujour>' + selection + '</my:ordredujour>');

    All the best,
    the Telerik team

    Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

Back to Top