Paragraph style names don't match config

2 posts, 0 answers
  1. Dan Hibbert
    Dan Hibbert avatar
    7 posts
    Member since:
    Oct 2009

    Posted 04 Mar 2010 Link to this post

    In order to be the same as our word styles, we have limited the number of paragraph styles down to

    <paragraphs>
        <paragraph name="&lt;P>Normal&lt;/P>" value="&lt;P>" />
        <paragraph name="&lt;H2>Head&lt;/H2>" value="&lt;H2>" />
        <paragraph name="&lt;H3>Head 1&lt;/H3>" value="&lt;H3>" />
        <paragraph name="&lt;H4>Head 2&lt;/H4>" value="&lt;H4>" />
        <paragraph name="&lt;H5>Head 3&lt;/H5>" value="&lt;H5>" />
      </paragraphs>

    because of the branding on the site we have also had to make the title of the headings different to the actual heading number e.g. Head = H2, Head 1 = H3, etc.  When you open the editor, this is all working fine - see pic 1.  However, when you highlight a piece of text e.g.  <h5>this is a H5</h5> it is showing up "Heading 5" rather than "Head 3" as we have named our paragraph style.  It is possible to change this behaviour so that,when text is highlighted, H5 would be mapped to our description.

  2. Stanimir
    Admin
    Stanimir avatar
    1653 posts

    Posted 05 Mar 2010 Link to this post

    Hi Dan,

    Here is one custom solution of the problem.

    1. Set the OnClientSelectionChange property in the respective ConfigFile.mxl or ListConfigFile.xml files. Add the following element:
    <property name="OnClientSelectionChange">OnClientSelectionChange</property>

    2. Add the following javascript code to the MOSSEditorTools.js file, which is located in the /Program Files/Common Files/Microsoft Shared/web server extensions/wpresources/RadEditorSharePoint/5.x.x.0__1f131a624888eeed/Resources/ folder.
    function OnClientSelectionChange(editor, args)
    {
        var tool = editor.getToolByName("FormatBlock");
        if (tool)
        {
            setTimeout(function()
            {
                var value = tool.get_value();
                switch (value)
                {
                    case "Heading 2":
                        value = value.replace("Heading 2", "Head");
                        break;
                    case "Heading 3":
                        value = value.replace("Heading 3", "Head 1");
                        break;
                    case "Heading 4":
                        value = value.replace("Heading 4", "Head 2");
                        break;
                    case "Heading 5":
                        value = value.replace("Heading 5", "Head 3");
                        break;
                }
     
                tool.set_value(value);
            }, 0);
        }
    }


    Greetings,
    Stanimir
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.

Back to Top