public class BasicWysiwygPolicyFilter extends AbstractPolicyFilter implements WysiwygPolicyFilter, PluginComponent
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
REVISION |
order
Constructor and Description |
---|
BasicWysiwygPolicyFilter() |
Modifier and Type | Method and Description |
---|---|
java.lang.String |
afterClean(java.lang.String unsafeStr,
java.lang.String safeStr,
java.util.Map<java.lang.String,java.lang.Object> contextMap)
This method is called after cleaning process of a HTML input received from the user.
|
java.lang.String |
afterRendering(java.lang.String text,
java.util.Locale userLocale)
This method is called after wysiwyg rendering
|
void |
beforeClean(java.lang.String unsafeStr,
java.util.Map<java.lang.String,java.lang.Object> contextMap)
This method is called before cleaning process of a HTML input received from the user.
|
java.lang.String |
beforeRendering(java.lang.String text,
java.util.Locale userLocale)
This method is called before wysiwyg rendering
|
boolean |
init(Plugin plugin)
Initialize the component with the given plugin configuration
|
org.jsoup.nodes.Document |
processJHTML(org.jsoup.nodes.Document document,
java.util.Locale userLocale,
WysiwygRenderingHints hints)
This method is called during JHTML processing
|
java.util.List<WysiwygConfigurationUpdate> |
updateWysiwygConfiguration(java.lang.String configId)
Returns the list of updates to perform to the wysiwyg configuration defined by the given id.
|
compareTo, equals, getOrder, setOrder
public static final java.lang.String REVISION
public boolean init(Plugin plugin)
PluginComponent
init
in interface PluginComponent
plugin
- the calling pluginPluginComponent.init(Plugin)
public java.lang.String beforeRendering(java.lang.String text, java.util.Locale userLocale)
WysiwygPolicyFilter
beforeRendering
in interface WysiwygPolicyFilter
text
- the text to be rendered.userLocale
- an optional Locale
of the user for which the text will be generatedWysiwygPolicyFilter.beforeRendering(String, Locale)
public java.lang.String afterRendering(java.lang.String text, java.util.Locale userLocale)
WysiwygPolicyFilter
afterRendering
in interface WysiwygPolicyFilter
text
- the text after the rendering.userLocale
- an optional Locale
of the user for which the text will be generatedWysiwygPolicyFilter.afterRendering(String, Locale)
public org.jsoup.nodes.Document processJHTML(org.jsoup.nodes.Document document, java.util.Locale userLocale, WysiwygRenderingHints hints)
WysiwygPolicyFilter
processJHTML
in interface WysiwygPolicyFilter
document
- the JSoup document of the HTML to be rendered.userLocale
- an optional Locale
of the user for which the text will be generatedhints
- the rendering options to use.WysiwygPolicyFilter.processJHTML(Document, Locale, WysiwygRenderingHints)
public void beforeClean(java.lang.String unsafeStr, java.util.Map<java.lang.String,java.lang.Object> contextMap)
WysiwygPolicyFilter
In current implementation, the following informations can be retrieved or modified from the context map :
Data data = (Data) contextMap.get(WysiwygManager.CLEANHTML_CTXT_DATA)
String fieldName = (String) contextMap.get(WysiwygManager.CLEANHTML_CTXT_FIELDNAME)
Whitelist whitelist = (org.jsoup.safety.Whitelist) contextMap.get(WysiwygManager.CLEANHTML_CTXT_WHITELIST)
null
to cancel the cleaning process (ie HTML parsing and cleaning), in such case,
method WysiwygPolicyFilter.afterClean(String, String, Map)
will still be invoked.
beforeClean
in interface WysiwygPolicyFilter
unsafeStr
- the input received from the usercontextMap
- the map providing information on cleaning context, NEVER nullWysiwygPolicyFilter.beforeClean(String, Map)
public java.lang.String afterClean(java.lang.String unsafeStr, java.lang.String safeStr, java.util.Map<java.lang.String,java.lang.Object> contextMap)
WysiwygPolicyFilter
In current implementation, the following informations can be retrieved or modified from the context map :
Data data = (Data) contextMap.get(WysiwygManager.CLEANHTML_CTXT_DATA);
String fieldName = (String) contextMap.get(WysiwygManager.CLEANHTML_CTXT_FIELDNAME);
Whitelist whitelist = (org.jsoup.safety.Whitelist) contextMap.get(WysiwygManager.CLEANHTML_CTXT_WHITELIST);
Document dirtyDoc = (org.jsoup.nodes.Document) contextMap.get(WysiwygManager.CLEANHTML_CTXT_DIRTYDOC);
Document cleanDoc = (org.jsoup.nodes.Document) contextMap.get(WysiwygManager.CLEANHTML_CTXT_CLEANDOC);
afterClean
in interface WysiwygPolicyFilter
unsafeStr
- the input received from the usersafeStr
- the input cleaned by JCMS (unless it was cancelled in WysiwygPolicyFilter.beforeClean(String, Map)
)contextMap
- the map providing information on cleaning context, NEVER nullWysiwygPolicyFilter.afterClean(String, String, Map)
public java.util.List<WysiwygConfigurationUpdate> updateWysiwygConfiguration(java.lang.String configId)
WysiwygPolicyFilter
updateWysiwygConfiguration
in interface WysiwygPolicyFilter
configId
- configuration idWysiwygConfigurationUpdate
WysiwygPolicyFilter.updateWysiwygConfiguration(String)
Copyright © 2001-2017 Jalios SA. All Rights Reserved.