Class WysiwygUtils


  • public final class WysiwygUtils
    extends java.lang.Object
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static com.fasterxml.jackson.databind.ObjectMapper getObjectMapper()
      Returns the ObjectMapper.
      static java.lang.String getWysiwygMatchedLanguage​(java.lang.String lang)
      Returns the WYSIWYG language from the JCMS language.
      static boolean isAutoConvertWiki2Wysiwyg​(javax.servlet.http.HttpServletRequest request)
      Checks if the wiki fields must be converted automatically to wysiwyg fields.
      static void writeTinyMCELangFile​(java.lang.String jcmsLang, java.util.Map<java.lang.String,​java.lang.String> i18nMap, java.io.File outDirectory)
      Write a TinyMCE javascript language file, from the specified map of I18N properties.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • writeTinyMCELangFile

        public static void writeTinyMCELangFile​(java.lang.String jcmsLang,
                                                java.util.Map<java.lang.String,​java.lang.String> i18nMap,
                                                java.io.File outDirectory)
                                         throws java.io.IOException
        Write a TinyMCE javascript language file, from the specified map of I18N properties.
        Parameters:
        jcmsLang - the JCMS language code for which file is written
        i18nMap - a map of I18N properties
        outDirectory - the directory in which file must be writen
        Throws:
        java.io.IOException - if file could not be written
      • getWysiwygMatchedLanguage

        public static java.lang.String getWysiwygMatchedLanguage​(java.lang.String lang)
        Returns the WYSIWYG language from the JCMS language. If the mapping is not found, it returns the JCMS language.
        Parameters:
        lang - JCMS language
        Returns:
        WYSIWYG language
      • getObjectMapper

        public static com.fasterxml.jackson.databind.ObjectMapper getObjectMapper()
        Returns the ObjectMapper.
        Returns:
        ObjectMapper
      • isAutoConvertWiki2Wysiwyg

        public static boolean isAutoConvertWiki2Wysiwyg​(javax.servlet.http.HttpServletRequest request)
        Checks if the wiki fields must be converted automatically to wysiwyg fields.

        The wiki fields are converted automatically to wysiwyg fields if the given request has the parameter WysiwygConstants.AUTO_CONVERT_WIKI_2_WYSIWYG or the property 'wiki.auto-convert-to-wysiwyg' is true.

        Parameters:
        request - HttpServletRequest
        Returns:
        true if the wiki fields are converted to wysiwyg fields, false instead