Class Config
java.lang.Object
com.wontlost.ckeditor.Config
Configuration before Editor is initialized
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddExtraPlugin(Constants.Plugins plugin) voidvoidPremium feature which needs to set a license by #setLicenseKey Pagination works only for decoupled editorvoidDeprecated.use setEditingMode(EditingMode editingMode) insteadvoidDeprecated.use setEditingMode(EditingMode editingMode) insteadMap<Constants.ConfigType, tools.jackson.databind.JsonNode> voidsetAlignment(String[] options) Configuation of alignmentvoidsetBalloonToolBar(Constants.Toolbar[] balloonToolBar) voidsetBlockToolBar(Constants.Toolbar[] blockToolBar) voidCKFinder configurationsvoidsetCloudServices(String bundleVersion, String tokenUrl, String uploadUrl, String webSocketUrl) The configuration of CKEditor Cloud ServicesvoidsetCodeBlock(String indentSequence, String[][] languages) voidsetEditingMode(Constants.EditingMode editingMode) Used for restricted editingvoidsetEditorToolBar(Constants.Toolbar[] editorToolBar) voidsetEditorToolBarObject(Constants.Toolbar[] editorToolBar, Boolean shouldNotGroupWhenFull) voidsetExportPdf(String fileName, String converterUrl) The configuration of the export to PDF feature.voidsetExportWord(String fileName, String converterUrl) The configuration of the export to Word feature.voidsetFontBackgroundColor(int columns, int documentColors, Map<String, String> colors) The configuration of the font background color feature.voidsetFontColor(int columns, int documentColors, Map<String, String> colors) The configuration of the font color feature.voidsetFontFamily(boolean supportAllValues, String[] options) voidsetFontSize(boolean supportAllValues, String[] options) voidsetHeading(String[][] options) Configuration of headingvoidsetHighlight(String[][] options) Configuration of highlightvoidsetImage(String[][] resizeOptions, String resizeUnit, String[] styles, String[] toolbar, String[] uploadTypes) voidsetIndentBlock(int offset, String unit) The configuration of the block indentation feature.voidsetInitialData(String initialData) By default, the editor is initialized with the content of the element on which this editor is initialized.voidsetLanguage(Constants.Language uiLanguage, Constants.Language contentLanguage, Constants.TextPartLanguage[] textPartLanguages) voidsetLicenseKey(String license) voidsetLineHeight(List<Integer> options) The configuration of the line height feature.voidThe configuration of the link feature.voidsetMediaEmbed(Boolean previewsInData, List<String> providers, List<String> extraProviders, List<String> removeProviders, List<String> toolbar) The configuration of the media embed features.voidsetMention(MentionConfig mentionConfig) The configuration of the mention feature.voidsetPagination(String pageWidth, String pageHeight, String top, String left, String bottom, String right) Defaulted to A4 papervoidvoidsetPlaceHolder(String placeHolder) voidsetPluginStatus(Constants.Plugins plugin, boolean active) All plugins are enabled by defaultvoidsetRemovePlugins(List<Constants.Plugins> plugins) The list of plugins which should not be loaded despite being available in an editor build.voidsetRestrictedEditing(List<String> allowedAttributes, List<String> allowedCommands) The configuration of the restricted editing mode feature.voidsetSimpleUpload(String uploadUrl, Boolean withCredentials, List<String> headers) voidsetTable(List<String> contentToolbar, List<String> tableToolbar, tools.jackson.databind.node.ObjectNode tableCellProperties, tools.jackson.databind.node.ObjectNode tableProperties) The configuration of the table feature.voidThe configuration of the title feature.voidsetTyping(int undo, tools.jackson.databind.node.ObjectNode transformations) The configuration of the title feature.voidsetUILanguage(Constants.Language uiLanguage) voidsetUiViewportOffset(Double... viewportOffsets) Viewport offset can be used to constrain balloons or other UI elements into an element smaller than the viewport.voidsetWordCount(String container, Boolean displayCharacters, Boolean displayWords, tools.jackson.databind.node.ObjectNode onUpdate) The configuration of the word count feature.voidsetWproofReaderCloud(String serviceId, String srcUrl) If you are going to use WproofReader, you have to add this config or WproofReaderServer.voidsetWproofReaderServer(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.
-
Constructor Details
-
Config
public Config()
-
-
Method Details
-
addExtraPlugin
-
getConfigs
-
setPlaceHolder
- Parameters:
placeHolder- Place holder of Editor
-
setEditorToolBar
- 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
- Parameters:
uiLanguage- Language of user interface, refer to enum @Language
-
setLanguage
public void setLanguage(Constants.Language uiLanguage, Constants.Language contentLanguage, Constants.TextPartLanguage[] textPartLanguages) -
setAlignment
Configuation of alignment- Parameters:
options- The available options are: 'left', 'right', 'center' and 'justify'. Other values are ignored.
-
setBalloonToolBar
- Parameters:
balloonToolBar- BalloonToolbar of Editor, refer to enum @Constants.Toolbar. Contextual toolbar configuration. Used by the BalloonToolbar feature.
-
setBlockToolBar
- Parameters:
blockToolBar- BlockToolbar of Editor, refer to enum @Constants.Toolbar. The block toolbar configuration. Used by the BlockToolbar feature.
-
setCKFinder
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
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
- 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
-
setExportWord
-
setFontBackgroundColor
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
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
- 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 trueoptions- 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
- 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 trueoptions- Available font size options. Expressed as predefined presets, numerical "pixel" values
-
setHeading
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
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
The configuration of the block indentation feature.- Parameters:
offset- The size of indentation units for each indentation step. Default 40unit- The unit used for indentation offset.
-
setInitialData
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
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.extraProviderstoolbar- Items to be placed in the media embed toolbar. This option requires adding MediaEmbedToolbar to the plugin list.
-
setMention
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
The list of plugins which should not be loaded despite being available in an editor build.- Parameters:
plugins- names of plugin
-
setRestrictedEditing
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
- 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
-
setTitle
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 20transformations- Transformations
-
setWproofReaderCloud
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
All plugins are enabled by default- Parameters:
plugin- Pluginactive- Plugin status
-
enableStandardMode
Deprecated.use setEditingMode(EditingMode editingMode) insteadUse 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
Used for restricted editing- Parameters:
editingMode-
-
enableRestrictedMode
Deprecated.use setEditingMode(EditingMode editingMode) insteadUse 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
-
setPaginationA4
public void setPaginationA4() -
setLicenseKey
-