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

Paragraph style names don't match config

1 Answer 176 Views
WebParts for SharePoint
This is a migrated thread and some comments may be shown as answers.
Dan Hibbert
Top achievements
Rank 1
Dan Hibbert asked on 04 Mar 2010, 11:35 AM
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.

1 Answer, 1 is accepted

Sort by
0
Stanimir
Telerik team
answered on 05 Mar 2010, 02:10 PM
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.
Tags
WebParts for SharePoint
Asked by
Dan Hibbert
Top achievements
Rank 1
Answers by
Stanimir
Telerik team
Share this question
or