Customize Format Block Tool - support nested Blocks

2 posts, 0 answers
  1. mayerh2
    mayerh2 avatar
    14 posts
    Member since:
    Jun 2007

    Posted 13 Jul 2007 Link to this post

    As far as we found out, the current functionality of the format block cannot handle nested blocks. We have to get the following HTML:
                <div class="subsection">
                    <p>Companies that ..</p>
                    <p class="next">Lorem ipsum....</p>
                <div class="subsection next">
                    <h4>Lorem ipsum dolor...</h4>
                    <p>Duis nec mauris...</p>
    So we defined the following Paragraphs in the file toolsfile.xml:
        <paragraph name="&lt;div class=&quot;subsection&quot;>Subsection&lt;/div>" value="&lt;div class=&quot;subsection&quot;>" />
        <paragraph name="&lt;div class=&quot;subsection next&quot;>Subsection-next&lt;/div>" value="&lt;div class=&quot;subsection next&quot;>" />
        <paragraph name="&lt;p>Normal&lt;/p>" value="&lt;p" />
        <paragraph name="&lt;h4>Sub Heading&lt;/h4>" value="&lt;h4>" />

    We enter a header line, and assign the format "Sub Heading" to this line. Then we enter two text sentences and assign the format "Normal" to them.
    At last we want to select the header and the two sentences and assign the format "Subsection" to this block. The inner formats should not be removed, opposed to what RadEditor does now.

    Is there a way to achieve this,  or is there any other RadEditor functionality to be used for this ??

    Thank you for support.


  2. Lini
    Lini avatar
    2144 posts

    Posted 16 Jul 2007 Link to this post

    Hi Hugo,

    You are correct - the paragraphs tool does not work with nested elements. This is done for a reason - the main purpose of this tool is to set headings. This means that you cannot have nested elements, because this would interfere with the headings - for example if you have <h3>text</h3> and you want to use the format block tool to change it to H4. If the format block tool did not strip the old tag (h3), then the result will not be correct (<h4><h3>text</h3></h4>).

    If you want to create content in nested tags, then you need to use another approach. For example, you can use the InsertSnippet tool and create a snippet with your code. Here is an example that you can put in the editor's tools file:

      <snippet name="subsection snippet">
    <div class="subsection">
     <p class="next">Paragraph next</p>

    This way your users can insert the snippet and then just enter text at the appropriate locations.

    Another approach would be to create a custom tool that will wrap the current selection in a <div class="subsection"> tag. The current version of the MOSS editor does not allow you to do this, but we will be releasing an updated build soon, which will allow custom tools. For more information about the editor custom tools you can check out the editor online examples or the documentation (

    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
Back to Top