Richtext validation
Before the rich-text is stored in the database it will by validated relating to text formattings (in other words "tags"). By default all tags are supported which are defined as so called "text features".
Text features
The text features are predefined format templates which can be applied to the rich-text while editing. There is a set of standard text features which are created first time the text features are used.
NOTE: the initial creation of the standard text features is performed for the language of the client which requests the first time the text features. After the initial creation is done, the standard text features are only available in this one language. There is already an "idea" for this issue: HPM-20684
Additional to the standard text features there is a possibility to define custom text features.
To create a custom text feature just click on the button "New text feature" within the "Text features" dialog. The select the custom template from the drop-down list and put the required tag information.
After the custom text feature is created it can be used e.g. while rich-text editing. All custom text features appear in the corresponding drop-down list within the RichText-Editor:
Validation of text formattings
While editing the rich-text within the RichText-Editor it can happen that unsupported text formattings are applied (maybe by Copy&Paste some text from a web page or from a "Word" document). On saving of the rich-text all text formattings are checked whether they are "valid". Following text formattins are valid:
Standard text features (like "Bold", "Italic" etc.) which are created automatically on first use
Custom text features created by the user within the "Text features" dialog
Those tags which are determined as "supported" tags by any contributed RichTextValidator (see the corresponding section about RichTextValidators)
If any text fromattings are found which are not supported, they will be removed from the rich-text. In this case a confirmation dialog will be shown. The user can decide whether this "unsopported" formatting should be removed from the text:
If the user confirms with "Yes" the corresponding formattings will be removed from the rich-text before saving.
RichTextValidators extension point
Sometimes it is necessary to support specific text formattings although they are not defined as a text feature. For example all text formattings which contain any attributes within the start-tag, are not supported by defualt. In this case you can contribute a custom RichTextValidator which will be requested every time the rich-text validation is perfomed. The RichTextValidator implements only one method: isSupportedTag(). This method will by called for both tags: start-tag and end-tag. So if you implement your custom RichTextValidator ensure that it returns true for both tags.
Here is an example of a custom RichTextValidator which supports all <font> tags:
public
class
CustomRichTextValidator
implements
RichTextValidator
{
@Override
public
boolean
isSupportedTag( String tag )
{
return
( tag.startsWith(
"<font"
) || tag.startsWith(
"</font>"
) );
//$NON-NLS-1$ //$NON-NLS-2$
}
}
To register this custom RichTextValidator just use the new extension point com.heiler.ppm.richtext.core.richTextValidators:
<
extension
point
=
"com.heiler.ppm.richtext.core.richTextValidators"
>
<
richTextValidator
class
=
"com.heiler.ppm.customizing.ckeditor.internal.CustomRichTextValidator"
id
=
"hlr.customizing.ckeditor.customRichTextValidator"
>
</
richTextValidator
>
</
extension
>
NOTE:
the extension point "com.heiler.ppm.richtext.core.richTextValidators" is available since PIM 7.1.02
the custom RichTextValidator should be registred on the PIM Client since the rich-text validation is performed on the client-side