Class WysiwygRenderer

java.lang.Object
com.jalios.jcms.wysiwyg.WysiwygRenderer
All Implemented Interfaces:
JcmsConstants, JaliosConstants

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

    • processWysiwyg

      public static String processWysiwyg(String wysiwyg, 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 String processWysiwyg(String wysiwyg, 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 String processWysiwygBaseUrl(String wysiwyg, 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 String relativeToAbsoluteAnchors(String contentHtml, 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 String getWysiwygEditorInfosAsJson(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