1

I have a rich text field editor widget, What I need is to activate functions (bold, italic and underline styles, plus bullet and numbered lists only.)

Here is the xml of my widget:

<richtextfield
     jcr:primaryType="cq:Widget"
     fieldLabel="this is rich text field"
     name="./richtextfield"
     xtype="richtext">
     <rtePlugins jcr:primaryType="nt:unstructured">
           <subsuperscript
           jcr:primaryType="nt:unstructured"
           features="*"/>
     </rtePlugins>
 </richtextfield>

as you can see i have all features enabled here,,,but this is not i need, as i just need bold, italic and underline styles, plus bullet and numbered lists enabled only.

any suggestions? Thanks

sefirosu
  • 2,558
  • 7
  • 44
  • 69

1 Answers1

5

You need to add nodes for the feature category and enable or disable features of this category. Have a look at the documentation: http://dev.day.com/docs/en/cq/current/administering/configuring_rich_text_editor.html

Here is an example of a rather restricted RTE I am using:

<text
    jcr:primaryType="cq:Widget"
    externalStyleSheets="[/etc/designs/rtg/clientlibs/author/style/source/rte.css]"
    hideLabel="{Boolean}true"
    name="./text"
    xtype="richtext">
    <rtePlugins jcr:primaryType="nt:unstructured">
        <format
            jcr:primaryType="nt:unstructured"
            features="[bold,italic]"/>
        <justify
            jcr:primaryType="nt:unstructured"
            features=""/>
        <lists
            jcr:primaryType="nt:unstructured"
            features="[ordered,unordered]"/>
        <styles
            jcr:primaryType="nt:unstructured"
            features="*">
            <styles jcr:primaryType="cq:WidgetCollection">
                <f125
                    jcr:primaryType="nt:unstructured"
                    cssName="f125"
                    text="Font Size 125% (15px)"/>
                <f150
                    jcr:primaryType="nt:unstructured"
                    cssName="f150"
                    text="Font Size 150% (18px)"/>
            </styles>
        </styles>
    </rtePlugins>
</text>
Thomas
  • 6,325
  • 4
  • 30
  • 65
  • hi is there a way to restrict how many lines each textfield allowed? e.g my textfield is allowed 4 lines. how do i implement that? thanks – sefirosu Jul 09 '14 at 10:49
  • You could probably do it with an event listener in the dialog, by checking the length onKeyUp. But the problem with the Richtext Widget is that it could get tricky as you have to consider not only the entered text but also the tags it generates. Your requirement witht the number of lines is even trickier than just counting the characters. – Thomas Jul 09 '14 at 11:51