You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Next »

DEPRECATED

This rich text field definition has been deprecated since Magnolia 6.0. It is part of the Magnolia 5 UI framework.

For the updated implementation, see Rich text field for Magnolia 6 UI instead.

RichTextFieldDefinition renders a rich text editor. This is a custom Magnolia field that implements the CKEditor component.

class: info.magnolia.ui.form.field.definition.RichTextFieldDefinition

fieldType: richText

Rich Text field properties

Simple rich text field definition.

form:
  tabs:
    - name: tabText
      label: Text
      fields:
        - name: text
          fieldType: richText
          tables: true
          height: 500
          label: Text Editor

Node name

Value

 
form


 
tabs


 
tabText


 
fields


 
text


 
fieldType

richText

 
tables

true

 
height

500

 
label

Text Editor



Unable to render {include} The included page could not be found.

Field-specific properties:

alignment

optional, default is false

Text alignment for paragraphs. When set to true, this option adds alignment buttons (left, center, right, justify) in the toolbar.

colors

optional

Colors displayed in the color selectors. Comma-separated a string of hexadecimal color codes without the # prefix, for example 00923E,F8C100,28166F . See CKEditor documentation for more.

configJsFile

optional

Location of a custom CKEditor configuration file, e.g. /.resources/ckeditor/config-magnolia.js. You can link to a file in the resources workspace, filesystem or classpath. See Origins and loading order for more. 

The default configuration files can be found in magnolia-ui-framework/src/main/resources/mgnl-resources/ckeditor/ 

  • config-magnolia.js (Git): Magnolia default configuration file.
  • config-default.js (Git): CKEditor configuration file.

(warning) If you use a custom configuration file Magnolia will ignore all other configured properties.

A custom configuration allows you control over the config.extraPlugins setting, but also means you need to the magnolialink and magnoliaFileBrowser plugins into your file. See the default config-magnolia.js for how to include the plugins.

fonts

optional

List of font names displayed in the Font selector in the toolbar, for example Arial/Arial,sans-serif;Times New Roman/Times New Roman,serif . Separate entries with a  semi-colon (;). It's possible to have more than one font for each entry separated by comma. A display name may be optionally defined by prefixing the entries with the name and the slash character. See

CKEditor documentation for more.

fontSizes

optional

List of fonts size displayed in the Font selector in the toolbar, for example 16/16px;24/24px;48/48px. Separate entries with a semi-colon (;). Any CSS-supported size can be used: 12px, 2.3em, 130%, larger or x-small. A display name may be optionally defined by prefixing the entries with the name and the slash character. For example, Bigger Font/14px will be displayed as Bigger Font in the list, but will be outputted as 14px. See CKEditor documentation for more.

height

optional, default is 300

The height of the editing area, including the toolbar, for example 500. This configuration option accepts an integer (to denote a value in pixels) or any CSS-defined length unit except percent (%) values.

images

optional, default is false

Allows images to be added from the DAM. When set to true, this option adds an image button in the toolbar. A user can define the size and alignment of the image, and some metadata.

lists

optional, default is true

Allows bulleted and numbered lists. When set to false, this option removes list buttons from the toolbar.

source

optional, default is false

Allows toggling between text and HTML editing. When set to true, this option adds a source button to the toolbar.

tables

optional, default is false

Allows tables to be added. When set to true, this option adds a tables button in the toolbar.

Common field properties:

Unable to render {include} The included page could not be found.

Link buttons

There are three link buttons:

  •  Links to external pages
  •  Links to internal pages
  •  Links to documents in the DAM

Loading order for custom configuration

(warning) Note that any configuration done in a RichTextFieldFactory will override configuration settings from the config.js file. This is why we ignore other properties in the field definition as soon as a configJsFile is configured.

Decode text

CKEditor produces HTML such as <p> elements for paragraphs. However, text stored in JCR usually escapes HTML code. To render text which originates from a rich text field you need to decode the stored content to make sure the HTML tags are rendered properly again.

Decode the content object and then get the desired property from it:

${cmsfn.decode(content).text!""}

See cmsfn decodeHtml.

Impact on the search index

Keep in mind that using the RTE introduces HTML into your content. The impact of this is that the HTML will be indexed along with the content.

#trackbackRdf ($trackbackUtils.getContentIdentifier($page) $page.title $trackbackUtils.getPingUrl($page))
  • No labels