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

Paragraph to Blockquote using format sets?

2 Answers 135 Views
Editor
This is a migrated thread and some comments may be shown as answers.
Rob
Top achievements
Rank 1
Rob asked on 25 Oct 2012, 07:35 PM
We previously used the following in a ToolsFile.xml to allow users to change the current paragraph to a blockquote.

<paragraphs>
    <paragraph name="<blockquote>Block Quote (Full)</blockquote>" value="<blockquote>" />
    <paragraph name="<blockquote class='floatright'>Block Quote (Float Right)</blockquote>" value="<blockquote class='floatright'>" />
    <paragraph name="<blockquote class='floatright'>Block Quote (Float Left)</blockquote>" value="<blockquote class='floatleft'>" />
</paragraphs>

We're moving everything over to format sets in a new ToolsFile.xml. I thought the following would work, but the blockquote options do not appear in the format sets drop-down when a paragraph is selected.

<formatSets>
    <formatSet tag="blockquote" title="<blockquote>Block Quote (Full)</blockquote>" />
    <formatSet tag="blockquote" title="<blockquote>Block Quote (Float Right)</blockquote>">
        <attributes>
            <item name="class" value="floatright" />
        </attributes>
    </formatSet>
    <formatSet tag="blockquote" title="<blockquote>Block Quote (Float Left)</blockquote>">
        <attributes>
            <item name="class" value="floatleft" />
        </attributes>
    </formatSet>
</formatSets>

Is there a way to allow users to change a paragraph to a blockquote using RadEditor?

2 Answers, 1 is accepted

Sort by
0
Accepted
Rumen
Telerik team
answered on 30 Oct 2012, 12:00 PM
Hi,

The FormatBlock and the FormatSets are quite different tools. The FormatBlock dropdown always shows static information in its dropdown, whilst the FormatSets popup is dynamically updated according to the selected tag in the content area. If you select a P tag in the content area, the FormatSets dropdown will display only formatting items which could be applied to the paragraphs, if you select a blockquote in the content area, the dropdown will show you specific Block Quote (Full), Block Quote (Float Right) and Block Quote (Float Left) items.

To achieve your goal you should override the formatSetBlockElements array using this code:

<telerik:RadEditor ID="RadEditor1" runat="server" ToolsFile="ToolsFile.xml">
    <Content><p>dsaasdasd</p><blockquote>sample content</blockquote></Content>
</telerik:RadEditor>
<script type="text/javascript">
    $T = Telerik.Web.UI;
    $T.Editor.formatSetBlockElements = [
    "p",
    "h1",
    "h2",
    "h3",
    "h4",
    "h5",
    "h6",
    "menu",
    "pre",
    "address",
    "blockquote"
];
</script>

and predefine the format sets for all block elements in the ToolsFile.xml file:

<formatSets>
    <formatSet tag="h1" title="&lt;h1>Heading 1&lt;/h1>">
        <attributes>
            <item name="class" value="headingstyle" />
        </attributes>
    </formatSet>
    <formatSet tag="p" title="&lt;p>Paragraph&lt;/p>">
        <attributes>
            <item name="class" value="parastyle" />
        </attributes>
    </formatSet>
    <formatSet tag="blockquote" title="&lt;blockquote>Block Quote (Full)&lt;/blockquote>" />
    <formatSet tag="blockquote" title="&lt;blockquote>Block Quote (Float Right)&lt;/blockquote>">
        <attributes>
            <item name="class" value="floatright" />
        </attributes>
    </formatSet>
    <formatSet tag="blockquote" title="&lt;blockquote>Block Quote (Float Left)&lt;/blockquote>">
        <attributes>
            <item name="class" value="floatleft" />
        </attributes>
    </formatSet>
</formatSets>

All the best,
Rumen
the Telerik team
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 their blog feed now.
0
Rob
Top achievements
Rank 1
answered on 30 Oct 2012, 02:48 PM
Rumen,

Thanks, it worked perfectly!

Rob
Tags
Editor
Asked by
Rob
Top achievements
Rank 1
Answers by
Rumen
Telerik team
Rob
Top achievements
Rank 1
Share this question
or