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

Customize Format Block Tool - support nested Blocks

1 Answer 61 Views
WebParts for SharePoint
This is a migrated thread and some comments may be shown as answers.
mayerh2
Top achievements
Rank 1
mayerh2 asked on 13 Jul 2007, 07:50 PM
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">
                <h4>Lorem.</h4>
                <p>Companies that ..</p>
                <p class="next">Lorem ipsum....</p>
            </div>
            <div class="subsection next">
                <h4>Lorem ipsum dolor...</h4>
                <p>Duis nec mauris...</p>
            </div>
So we defined the following Paragraphs in the file toolsfile.xml:
  <paragraphs>
    <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>" />
  </paragraphs>

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.

Hugo


1 Answer, 1 is accepted

Sort by
0
Lini
Telerik team
answered on 16 Jul 2007, 12:43 PM
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:

<snippets>
  <snippet name="subsection snippet">
<![CDATA[
<div class="subsection">
 <h4>Heading</h4>
 <p>Paragraph</p>
 <p class="next">Paragraph next</p>
</div>
]]>
  </snippet>
</snippets>

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 (http://www.telerik.com/help/aspnet/editor/?AddingYourOwnButtons.html).

Greetings,
Lini
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
Tags
WebParts for SharePoint
Asked by
mayerh2
Top achievements
Rank 1
Answers by
Lini
Telerik team
Share this question
or