Core Class
src/ui/react/src/adapter/alloy-editor.js:4
AlloyEditor main class. Creates instance of the editor and provides the user configuration to the UI.
Constructor
Core
()
Index
Methods
Methods
_addReadOnlyLinkClickListener
-
editor
Method to set default link behavior
Parameters:
-
editor
Object
_clearSelections
()
protected
Clear selections from window object
_defaultReadOnlyClickFn
-
event
Called on click
event when the editor is in read only mode. Navigates to link's URL or opens
the link in a new window.
Parameters:
-
event
ObjectThe fired
click
event payload
_getNativeEditor
()
Object
protected
Retrieves the native CKEditor instance. Having this, the developer may use the API of CKEditor OOTB.
Returns:
The current instance of CKEditor.
_onReadOnlyChange
-
event
Fired when readonly value is changed. Adds click event listener to handle links in readonly mode.
Parameters:
-
event
ObjectThe fired event
_redirectLink
-
href
-
target
Redirects the browser to a given link
Parameters:
-
href
StringThe href to take the browser to
-
target
String=Specifies where to display the link
_renderUI
()
protected
Renders the specified from the user toolbars.
_toElement
-
value
The function returns an HTML element from the passed value. If the passed value is a string, it should be the Id of the element which have to be retrieved from the DOM. If an HTML Element is passed, the element itself will be returned.
Parameters:
-
value
!(String | HTMLElement)String, which have to correspond to an HTML element from the DOM, or the HTML element itself. If Id is passed, the HTML element will be retrieved from the DOM.
Returns:
An HTML element.
_validateAllowedContent
-
The
Validates the allowed content attribute. Look here for more information about the supported values.
Parameters:
-
The
Anyvalue to be checked
Returns:
True if the current value is valid configuration, false otherwise
_validateToolbars
-
The
Validates the value of toolbars attribute
Parameters:
-
The
Anyvalue to be checked
Returns:
True if the current value is valid toolbars configuration, false otherwise
destructor
()
protected
Destructor lifecycle implementation for the AlloyEdtor class. Destroys the CKEditor instance and destroys all created toolbars.
initializer
-
config
Initializer lifecycle implementation for the AlloyEditor class. Creates a CKEditor instance, passing it the provided configuration attributes.
Parameters:
-
config
ObjectConfiguration object literal for the editor.
Properties
allowedContent
Boolean, String, Object
Configures the allowed content for the current instance of AlloyEditor. Look on the official CKEditor API for more information about the valid values.
Default: true
enableContentEditable
Boolean
Specifies whether AlloyEditor set the contenteditable attribute to "true" on its srcNode.
Default: true
eventsDelay
Number
The delay (timeout), in ms, after which events such like key or mouse events will be processed.
extraPlugins
String
Specifies the extra plugins which have to be loaded to the current CKEditor instance in order to make AlloyEditor to work properly.
Default: 'uicore,selectionregion,dragresize,addimages,placeholder,tabletools,tableresize,autolink'
nativeEditor
Object
Retrieves the native CKEditor instance. Having this, the developer may use the full API of CKEditor.
placeholderClass
String
Specifies the class, which should be added by Placeholder plugin {{#crossLink "CKEDITOR.plugins.ae_placeholder}}{{/crossLink}} when editor is not focused.
Default: 'ae-placeholder'
removePlugins
String
Specifies the plugins, which come by default with CKEditor, but which are not needed by AlloyEditor. These plugins add the default UI for CKeditor, which is no more needed. Please note that AlloyEdtor comes with its own highly optimized copy of CKEditor (just customized via their official download page). This version does not come with the unneeded plugins, so the value of this property won't be needed. However, if you decide to go with the OOTB version of CKEditor, you will have to remove some of the plugins if you decide to use AlloyEditor. Keep in mind that removing these plugins doesn't remove them entirely from CKEditor. It just removes them from its current instance, in which you will use different UI - those of AlloyEditor. You will be fully able to use both OOTB CKEditor and AlloyEditor on the same page!
Default: 'contextmenu,toolbar,elementspath,resize,liststyle,link'
selectionKeystrokes
Array
Array of manual selection triggers. They can be configured to manually show a specific selection toolbar by forcing the selection type. A selectionKeystroke item consists of a keys property with a CKEditor keystroke definition and a selection property with the selection name to trigger.
srcNode
String | Node
The Node ID or HTMl node, which AlloyEditor should use as an editable area.
toolbars
Object
The toolbars configuration for this editor instance
uiNode
String | Node
The Node ID or HTMl node, where AlloyEditor's UI should be rendered.