Class WysiwygContentTransformer
- java.lang.Object
-
- org.silverpeas.core.contribution.content.wysiwyg.service.WysiwygContentTransformer
-
public class WysiwygContentTransformer extends Object
This class provides method to transform wysiwyg content source into other wysiwyg formats.- Author:
- Yohann Chastagnier
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description WysiwygContentTransformer
applyMailLinkCssDirective()
Applies the Silverpeas's link completion into context of a mail content.WysiwygContentTransformer
applyOpenLinkOnBlankDirective()
Applies the opening of links into a blank page.WysiwygContentTransformer
applySanitizeDirective()
Applies HTML sanitize operations.WysiwygContentTransformer
applySilverpeasLinkCssDirective()
Applies the sp-permalink or sp-link css classes to links HTML elements.WysiwygContentTransformer
modifyImageUrlAccordingToHtmlSizeDirective()
Transforms all URL of images to take into account theirs display size.static WysiwygContentTransformer
on(String wysiwygContent)
An instance of WYSIWYG transformer on the given content.WysiwygContentTransformer
resolveVariablesDirective()
Replaces all variables element by theirs corresponding values.MailContentProcess.MailResult
toMailContent()
Transforms all referenced content links in order to be handled in mail sending.String
transform()
Default method in order to apply all the transformation directives and recover immediately the result as string.<R> R
transform(WysiwygContentTransformerProcess<R> process)
Applies all the transformation directives and finally processing the given treatment.
-
-
-
Method Detail
-
on
public static WysiwygContentTransformer on(String wysiwygContent)
An instance of WYSIWYG transformer on the given content.- Parameters:
wysiwygContent
- the wysiwyg content.- Returns:
- an instance of the transformer.
-
modifyImageUrlAccordingToHtmlSizeDirective
public WysiwygContentTransformer modifyImageUrlAccordingToHtmlSizeDirective()
Transforms all URL of images to take into account theirs display size.- Returns:
- the instance of the current
WysiwygContentTransformer
.
-
resolveVariablesDirective
public WysiwygContentTransformer resolveVariablesDirective()
Replaces all variables element by theirs corresponding values.- Returns:
- the instance of the current
WysiwygContentTransformer
.
-
applySilverpeasLinkCssDirective
public WysiwygContentTransformer applySilverpeasLinkCssDirective()
Applies the sp-permalink or sp-link css classes to links HTML elements.- Returns:
- the instance of the current
WysiwygContentTransformer
.
-
applyOpenLinkOnBlankDirective
public WysiwygContentTransformer applyOpenLinkOnBlankDirective()
Applies the opening of links into a blank page.- Returns:
- the instance of the current
WysiwygContentTransformer
.
-
applySanitizeDirective
public WysiwygContentTransformer applySanitizeDirective()
Applies HTML sanitize operations.- Returns:
- the instance of the current
WysiwygContentTransformer
.
-
applyMailLinkCssDirective
public WysiwygContentTransformer applyMailLinkCssDirective()
Applies the Silverpeas's link completion into context of a mail content.- Returns:
- the instance of the current
WysiwygContentTransformer
.
-
transform
public String transform()
Default method in order to apply all the transformation directives and recover immediately the result as string.- Returns:
- the transformed wysiwyg content.
-
transform
public <R> R transform(WysiwygContentTransformerProcess<R> process) throws org.silverpeas.kernel.SilverpeasException
Applies all the transformation directives and finally processing the given treatment.- Type Parameters:
R
- the result type of the process.- Parameters:
process
- the process to execute after all the directives.- Returns:
- the result of the process execution.
- Throws:
org.silverpeas.kernel.SilverpeasException
- on technical error.
-
toMailContent
public MailContentProcess.MailResult toMailContent() throws org.silverpeas.kernel.SilverpeasException
Transforms all referenced content links in order to be handled in mail sending. A content can be for example an attachment.
The directive set by methodmodifyImageUrlAccordingToHtmlSizeDirectiveWithImageMinWidthIfAny()
is applied.- Returns:
- the wysiwyg content transformed to be sent by mail.
- Throws:
org.silverpeas.kernel.SilverpeasException
- on technical error.
-
-