Skip to content

Latest commit

 

History

History
61 lines (41 loc) · 2.16 KB

FSXABaseRichTextElement.adoc

File metadata and controls

61 lines (41 loc) · 2.16 KB

FSXABaseRichTextElement

Introduction

The FSXABaseRichTextElement is there to have a basic component to be able to implement further rich text elements. Usually a rich text contains multiple elements like links, lists, blocks etc. It provides different attributes and methods, which should simplify the development significantly. These are described in this chapter. This component inherits all the attributes and methods of the FSXABaseComponent.

Usage

To use this base component a new class has to be created which extends the FSXABaseRichTextElement.

@Component
class Component extends FSXABaseRichTextElement {}

If you want to have type support for your data you can provide an interface and pass it as an generic like here the Data interface or extend the Link interface in case of Links.

@Component
class Component extends FSXABaseRichTextElement<Data> {}

Properties

data - Object

Returns all available data attributes, for example the data-fs-style to determinate the styling, respectively this is a Link and contains nested data that is maintained in FirstSpirit.

content - Array

Returns the available content. This property can contain multiple nested rich text elements.

editorName - String

Returns the name of the editor input component in the FirstSpirit template. This optional property enables the "Inline Editing" feature of TPP Snap

Methods

renderContent

renderContent(): string | RichTextElement | MissingRichTextComponent

Should be used to render the existing content. If the content is a string, the string will be rendered. If there a more nested elements which are implemented these will be rendered. If there a more nested elements which are not implemented and the devMode is enabled, the MissingRichTextComponent will appear. This component provides additional information which element is missing and what information it provides.

For more information see DevMode.