Class Config

java.lang.Object
com.wontlost.ckeditor.Config

public class Config extends Object
Configuration before Editor is initialized
  • Constructor Details

    • Config

      public Config()
  • Method Details

    • addExtraPlugin

      public void addExtraPlugin(Constants.Plugins plugin)
    • getConfigs

      public Map<Constants.ConfigType, tools.jackson.databind.JsonNode> getConfigs()
    • setPlaceHolder

      public void setPlaceHolder(String placeHolder)
      Parameters:
      placeHolder - Place holder of Editor
    • setEditorToolBar

      public void setEditorToolBar(Constants.Toolbar[] editorToolBar)
      Parameters:
      editorToolBar - Toolbar of Editor, refer to enum @Constants.Toolbar
    • setEditorToolBarObject

      public void setEditorToolBarObject(Constants.Toolbar[] editorToolBar, Boolean shouldNotGroupWhenFull)
      Parameters:
      editorToolBar - Toolbar of Editor, refer to enum @Constants.Toolbar
    • setUILanguage

      public void setUILanguage(Constants.Language uiLanguage)
      Parameters:
      uiLanguage - Language of user interface, refer to enum @Language
    • setLanguage

      public void setLanguage(Constants.Language uiLanguage, Constants.Language contentLanguage, Constants.TextPartLanguage[] textPartLanguages)
    • setAlignment

      public void setAlignment(String[] options)
      Configuation of alignment
      Parameters:
      options - The available options are: 'left', 'right', 'center' and 'justify'. Other values are ignored.
    • setBalloonToolBar

      public void setBalloonToolBar(Constants.Toolbar[] balloonToolBar)
      Parameters:
      balloonToolBar - BalloonToolbar of Editor, refer to enum @Constants.Toolbar. Contextual toolbar configuration. Used by the BalloonToolbar feature.
    • setBlockToolBar

      public void setBlockToolBar(Constants.Toolbar[] blockToolBar)
      Parameters:
      blockToolBar - BlockToolbar of Editor, refer to enum @Constants.Toolbar. The block toolbar configuration. Used by the BlockToolbar feature.
    • setCKFinder

      public void setCKFinder(String openerMethod, String uploadUrl, Map<String,String> options)
      CKFinder configurations
      Parameters:
      openerMethod - The type of the CKFinder opener method. Supported types are: 'modal' – Opens CKFinder in a modal, 'popup' – Opens CKFinder in a new "pop-up" window. Defaults to 'modal'.
      uploadUrl - The path (URL) to the connector which handles the file upload in CKFinder file manager. When specified, it enables the automatic upload of resources such as images inserted into the content. Used by the upload adapter.
      options - Configuration settings for CKFinder. Not fully integrated with ckfinder
    • setCloudServices

      public void setCloudServices(String bundleVersion, String tokenUrl, String uploadUrl, String webSocketUrl)
      The configuration of CKEditor Cloud Services
      Parameters:
      bundleVersion - An optional parameter used for integration with CKEditor Cloud Services when uploading the editor build to cloud services. Whenever the editor build or the configuration changes, this parameter should be set to a new, unique value to differentiate the new bundle (build + configuration) from the old ones.
      tokenUrl - A token URL which should be a URL to the security token endpoint in your application. The role of this endpoint is to securely authorize the end users of your application to use CKEditor Cloud Services only if they should have access e.g. to upload files with Easy Image or to use the Collaboration service.
      uploadUrl - The endpoint URL for CKEditor Cloud Services uploads. This option must be set for Easy Image to work correctly. The upload URL is unique for each customer and can be found in the CKEditor Ecosystem customer dashboard after subscribing to the Easy Image service. To learn how to start using Easy Image, check the Easy Image - Quick start documentation. Note: Make sure to also set the tokenUrl configuration option.
      webSocketUrl - The URL for web socket communication, used by the RealTimeCollaborativeEditing plugin. Every customer (organization in the CKEditor Ecosystem dashboard) has their own, unique URLs to communicate with CKEditor Cloud Services. The URL can be found in the CKEditor Ecosystem customer dashboard.
    • setUiViewportOffset

      public void setUiViewportOffset(Double... viewportOffsets)
      Viewport offset can be used to constrain balloons or other UI elements into an element smaller than the viewport. This can be useful if there are any other absolutely positioned elements that may interfere with editor UI.
      Parameters:
      viewportOffsets - [top, right, bottom, left]
    • setCodeBlock

      public void setCodeBlock(String indentSequence, String[][] languages)
      Parameters:
      indentSequence - A sequence of characters inserted or removed from the code block lines 、 when its indentation is changed by the user, for instance, using Tab and Shift+Tab keys. The default value is a single tab character (" ", in Unicode). This configuration is used by indentCodeBlock and outdentCodeBlock commands (instances of IndentCodeBlockCommand). Note: Setting this configuration to false will disable the code block indentation commands and associated keystrokes.
      languages - The list of code languages available in the user interface to choose for a particular code block. [ { language: 'plaintext', label: 'Plain text', class: '' }, { language: 'php', label: 'PHP', class: 'php-code' } ] class is optional updated by Thomas Kohler (tko@hp23.at)
    • setExportPdf

      public void setExportPdf(String fileName, String converterUrl)
      The configuration of the export to PDF feature.
      Parameters:
      fileName - The name of the generated PDF file.
      converterUrl - A URL to the HTML to PDF converter.
    • setExportWord

      public void setExportWord(String fileName, String converterUrl)
      The configuration of the export to Word feature.
      Parameters:
      fileName - The name of the generated Word file.
      converterUrl - A URL to the HTML to Word converter.
    • setFontBackgroundColor

      public void setFontBackgroundColor(int columns, int documentColors, Map<String,String> colors)
      The configuration of the font background color feature.
      Parameters:
      columns - Represents the number of columns in the font background color dropdown. Defaults to 5.
      documentColors - Determines the maximum number of available document colors. Setting it to 0 will disable the document colors feature. By default it equals to the columns value.
      colors - Available font background colors defined as an array of strings or objects. colors: [ { color: 'hsl(0, 0%, 0%)', label: 'Black' }, { color: 'hsl(0, 0%, 30%)', label: 'Dim grey' } ]
    • setFontColor

      public void setFontColor(int columns, int documentColors, Map<String,String> colors)
      The configuration of the font color feature.
      Parameters:
      columns - Represents the number of columns in the font background color dropdown. Defaults to 5.
      documentColors - Determines the maximum number of available document colors. Setting it to 0 will disable the document colors feature. By default it equals to the columns value.
      colors - Available font background colors defined as an array of strings or objects. colors: [ { color: 'hsl(0, 0%, 0%)', label: 'Black' }, { color: 'hsl(0, 0%, 30%)', label: 'Dim grey' } ]
    • setFontFamily

      public void setFontFamily(boolean supportAllValues, String[] options)
      Parameters:
      supportAllValues - By default the plugin removes any font-family value that does not match the plugin's configuration. It means that if you paste content with font families that the editor does not understand, the font-family attribute will be removed and the content will be displayed with the default font. You can preserve pasted font family values by switching the supportAllValues option to true
      options - Available font family options defined as an array of strings. The default value is: 'default', 'Arial, Helvetica, sans-serif', 'Courier New, Courier, monospace', 'Georgia, serif', 'Lucida Sans Unicode, Lucida Grande, sans-serif', 'Tahoma, Geneva, sans-serif', 'Times New Roman, Times, serif', 'Trebuchet MS, Helvetica, sans-serif', 'Verdana, Geneva, sans-serif'
    • setFontSize

      public void setFontSize(boolean supportAllValues, String[] options)
      Parameters:
      supportAllValues - By default the plugin removes any font-size value that does not match the plugin's configuration. It means that if you paste content with font sizes that the editor does not understand, the font-size attribute will be removed and the content will be displayed with the default size. You can preserve pasted font size values by switching the supportAllValues option to true
      options - Available font size options. Expressed as predefined presets, numerical "pixel" values
    • setHeading

      public void setHeading(String[][] options)
      Configuration of heading
      Parameters:
      options - The available heading options. [ { model: 'paragraph', title: 'Paragraph', class: 'ck-heading_paragraph' }, { model: 'heading1', view: 'h2', title: 'Heading 1', class: 'ck-heading_heading1' }, { model: 'heading2', view: 'h3', title: 'Heading 2', class: 'ck-heading_heading2' }, { model: 'heading3', view: 'h4', title: 'Heading 3', class: 'ck-heading_heading3' } ] updated by Thomas Kohler (tko@hp23.at)
    • setHighlight

      public void setHighlight(String[][] options)
      Configuration of highlight
      Parameters:
      options - The available highlight options. [ { model: 'yellowMarker', class: 'marker-yellow', title: 'Yellow marker', color: 'var(--ck-highlight-marker-yellow)', type: 'marker' }, { model: 'greenMarker', class: 'marker-green', title: 'Green marker', color: 'var(--ck-highlight-marker-green)', type: 'marker' } ]
    • setImage

      public void setImage(String[][] resizeOptions, String resizeUnit, String[] styles, String[] toolbar, String[] uploadTypes)
      Parameters:
      resizeOptions - The image resize options. resizeOptions: [ { name: 'imageResize:original', value: null }, { name: 'imageResize:50', value: '50' } ]
      resizeUnit - The available options are 'px' or '%'.
      styles - Available image styles. The default value is: const imageConfig = { styles: [ 'full', 'side' ] };
      toolbar - Items to be placed in the image toolbar. three toolbar items will be available in ComponentFactory: 'imageStyle:full', 'imageStyle:side', and 'imageTextAlternative' so you can configure the toolbar like this: const imageConfig = { toolbar: [ 'imageStyle:full', 'imageStyle:side', '|', 'imageTextAlternative' ] };
      uploadTypes - The image upload configuration. The list of accepted image types. The accepted types of images can be customized to allow only certain types of images: // Allow only JPEG and PNG images: const imageUploadConfig = { types: [ 'png', 'jpeg' ] }; updated by Thomas Kohler (tko@hp23.at)
    • setIndentBlock

      public void setIndentBlock(int offset, String unit)
      The configuration of the block indentation feature.
      Parameters:
      offset - The size of indentation units for each indentation step. Default 40
      unit - The unit used for indentation offset.
    • setInitialData

      public void setInitialData(String initialData)
      By default, the editor is initialized with the content of the element on which this editor is initialized.
      Parameters:
      initialData - The initial editor data to be used instead of the provided element's HTML content.
    • setLink

      public void setLink(String defaultProtocol, Boolean addTargetToExternalLinks)
      The configuration of the link feature.
      Parameters:
      defaultProtocol - When set, the editor will add the given protocol to the link when the user creates a link without one. For example, when the user is creating a link and types ckeditor.com in the link form input, during link submission the editor will automatically add the http:// protocol, so the link will look as follows: http://ckeditor.com. The feature also provides email address auto-detection. When you submit hello@example.com, the plugin will automatically change it to mailto:hello@example.com.
      addTargetToExternalLinks - When set to true, the target="blank" and rel="noopener noreferrer" attributes are automatically added to all external links in the editor. "External links" are all links in the editor content starting with http, https, or //.
    • setMediaEmbed

      public void setMediaEmbed(Boolean previewsInData, List<String> providers, List<String> extraProviders, List<String> removeProviders, List<String> toolbar)
      The configuration of the media embed features.
      Parameters:
      previewsInData - Controls the data format produced by the feature.
      providers - The default media providers supported by the editor.
      extraProviders - The additional media providers supported by the editor. This configuration helps extend the default providers.
      removeProviders - The list of media providers that should not be used despite being available in config.mediaEmbed.providers and config.mediaEmbed.extraProviders
      toolbar - Items to be placed in the media embed toolbar. This option requires adding MediaEmbedToolbar to the plugin list.
    • setMention

      public void setMention(MentionConfig mentionConfig)
      The configuration of the mention feature. refer to https://ckeditor.com/docs/ckeditor5/latest/api/module_mention_mention-MentionConfig.html
      Parameters:
      mentionConfig - configuration on mention.
    • setRemovePlugins

      public void setRemovePlugins(List<Constants.Plugins> plugins)
      The list of plugins which should not be loaded despite being available in an editor build.
      Parameters:
      plugins - names of plugin
    • setRestrictedEditing

      public void setRestrictedEditing(List<String> allowedAttributes, List<String> allowedCommands)
      The configuration of the restricted editing mode feature.
      Parameters:
      allowedAttributes - The text attribute names allowed when pasting content ot non-restricted areas.
      allowedCommands - The command names allowed in non-restricted areas of the content. Defines which feature commands should be enabled in the restricted editing mode. The commands used for typing and deleting text ('input', 'delete' and 'forwardDelete') are allowed by the feature inside non-restricted regions and do not need to be defined. Note: The restricted editing mode always allows to use the restricted mode navigation commands as well as 'undo' and 'redo' commands.
    • setSimpleUpload

      public void setSimpleUpload(String uploadUrl, Boolean withCredentials, List<String> headers)
      Parameters:
      uploadUrl - The path (URL) to the server (application) which handles the file upload. When specified, enables the automatic upload of resources (images) inserted into the editor content.
      withCredentials - This flag enables the withCredentials property of the request sent to the server during the upload. It affects cross-site requests only and, for instance, allows credentials such as cookies to be sent along with the request.
      headers - An object that defines additional headers sent with the request to the server during the upload. This is the right place to implement security mechanisms like authentication and CSRF protection.
    • setTable

      public void setTable(List<String> contentToolbar, List<String> tableToolbar, tools.jackson.databind.node.ObjectNode tableCellProperties, tools.jackson.databind.node.ObjectNode tableProperties)
      The configuration of the table feature. Used by the table feature in the
      Parameters:
      contentToolbar - Items to be placed in the table content toolbar. The TableToolbar plugin is required to make this toolbar work.
      tableToolbar - Items to be placed in the table toolbar. The TableToolbar plugin is required to make this toolbar work.
      tableCellProperties - The configuration of the table cell properties user interface (balloon).
      tableProperties - The configuration of the table properties user interface (balloon)
    • setLineHeight

      public void setLineHeight(List<Integer> options)
      The configuration of the line height feature.
      Parameters:
      options - Items to be placed in the line height toolbar
    • setTitle

      public void setTitle(String placeholder)
      The configuration of the title feature.
      Parameters:
      placeholder - Defines a custom value of the placeholder for the title field.
    • setTyping

      public void setTyping(int undo, tools.jackson.databind.node.ObjectNode transformations)
      The configuration of the title feature.
      Parameters:
      undo - Default to 20
      transformations - Transformations
    • setWproofReaderCloud

      public void setWproofReaderCloud(String serviceId, String srcUrl)
      If you are going to use WproofReader, you have to add this config or WproofReaderServer.
      Parameters:
      serviceId - After signing up for a trial or paid version, you will receive your service ID which is used to activate the service.
      srcUrl - Default: https://svc.webspellchecker.net/spellcheck31/wscbundle/wscbundle.js
    • setWproofReaderServer

      public void setWproofReaderServer(String serviceProtocol, String serviceHost, Integer servicePort, String servicePath, String srcUrl)
      If you are going to use WproofReader, you have to add this config or WproofReaderCloud.
      Parameters:
      serviceProtocol - Default to 'https'.
      serviceHost - Default to localhost.
      servicePort - Default to 8080.
      servicePath - Default to '/'.
      srcUrl - String like 'https://host_name/virtual_directory/wscbundle/wscbundle.js'
    • setPluginStatus

      public void setPluginStatus(Constants.Plugins plugin, boolean active)
      All plugins are enabled by default
      Parameters:
      plugin - Plugin
      active - Plugin status
    • enableStandardMode

      @Deprecated public void enableStandardMode()
      Deprecated.
      use setEditingMode(EditingMode editingMode) instead
      Use standard editing mode by invoking this method
    • enablePagination

      public void enablePagination()
      Premium feature which needs to set a license by #setLicenseKey Pagination works only for decoupled editor
    • enableMinimap

      public void enableMinimap()
    • setEditingMode

      public void setEditingMode(Constants.EditingMode editingMode)
      Used for restricted editing
      Parameters:
      editingMode -
    • enableRestrictedMode

      @Deprecated public void enableRestrictedMode()
      Deprecated.
      use setEditingMode(EditingMode editingMode) instead
      Use restricted editing mode by invoking this method
    • setWordCount

      public void setWordCount(String container, Boolean displayCharacters, Boolean displayWords, tools.jackson.databind.node.ObjectNode onUpdate)
      The configuration of the word count feature.
      Parameters:
      container - Allows for providing the HTML element that the word count container will be appended to automatically.
      displayCharacters - This option allows for hiding the character counter. The element obtained through wordCountContainer will only preserve the words part. Character counter is displayed by default when this configuration option is not defined.
      displayWords - This option allows for hiding the word counter. The element obtained through wordCountContainer will only preserve the characters part. Word counter is displayed by default when this configuration option is not defined.
      onUpdate - This configuration takes a function that is executed whenever the word count plugin updates its values. This function is called with one argument, which is an object with the words and characters keys containing the number of detected words and characters in the document.
    • setPagination

      public void setPagination(String pageWidth, String pageHeight, String top, String left, String bottom, String right)
      Defaulted to A4 paper
      Parameters:
      pageWidth - default 21cm
      pageHeight - default 29.7cm
      top - default 20mm
      left - default 12mm
      bottom - defalt 20mm
      right - default 12mm
    • setPaginationA4

      public void setPaginationA4()
    • setLicenseKey

      public void setLicenseKey(String license)