Class WysiwygRenderer

  • All Implemented Interfaces:
    JcmsConstants, JaliosConstants

    public final class WysiwygRenderer
    extends java.lang.Object
    implements JcmsConstants
    This class contains a set of utility static methods to process wysiwyg text.
    Since:
    jcms-5.7.0
    • Method Detail

      • processWysiwyg

        public static java.lang.String processWysiwyg​(java.lang.String wysiwyg,
                                                      java.util.Locale locale)
        Render the specified Wysiwyg/JHTML source data into a HTML suitable for presentation to the end user.
        Parameters:
        wysiwyg - the processed wysiwyg
        locale - the userLocale
        Returns:
        the wysiwyg text processed
      • processWysiwyg

        public static java.lang.String processWysiwyg​(java.lang.String wysiwyg,
                                                      java.util.Locale locale,
                                                      WysiwygRenderingHints hints)
        Render the specified Wysiwyg/JHTML source data into a HTML suitable for presentation to the end user.
        Parameters:
        wysiwyg - the processed wysiwyg
        locale - the userLocale
        hints - the rendering options to use, if null, the default options will be used.
        Returns:
        the wysiwyg text processed
        Since:
        jcms-10.0.0
      • processWysiwygBaseUrl

        public static java.lang.String processWysiwygBaseUrl​(java.lang.String wysiwyg,
                                                             java.util.Locale locale)
        Replace the baseUrl pattern with the current base URL.

        The pattern \${?baseUrl}? is replaced with the current base URL, or the default channel base URL when rendering occurs outside an http request.

        Parameters:
        wysiwyg - the wysiwyg text
        locale - the current user Locale
        Returns:
        the wysiwyg text, modified if it was needed
      • relativeToAbsoluteAnchors

        public static java.lang.String relativeToAbsoluteAnchors​(java.lang.String contentHtml,
                                                                 java.lang.String currentUrl)
        Convert all anchor URLs inside the specified HTML content into absolute URL.

        Uses the specified URL as prefix of relative URL.

        Parameters:
        contentHtml - the HTML content in which to look for anchor
        currentUrl - the current request URL
        Returns:
        the modified content
      • getWysiwygEditorInfosAsJson

        public static java.lang.String getWysiwygEditorInfosAsJson​(java.lang.String jhtml,
                                                                   InsertionContext context)
        Retrieve the information used to initialize the WYSIWYG editor.
        Parameters:
        jhtml - JHTML content to parse
        context - Context used to retrieve the information related to the unifiedinsert plugin
        Returns:
        String in JSON format