Class sap.ui.richtexteditor.RichTextEditorModule: sap/ui/richtexteditor/RichTextEditor
The RichTextEditor-Control is used to enter formatted text.
Disclaimer:Since version 1.6.0. The RichTextEditor of SAPUI5 contains a third party component TinyMCE provided by Moxiecode Systems AB. The SAP license agreement covers the development of applications with RichTextEditor of SAPUI5 (as of May 2014).
sClassName
and enriches it with the information contained in oClassInfo
.fnFunction
to the beforeEditorInit
event of this sap.ui.richtexteditor.RichTextEditor
.fnFunction
to the change
event of this sap.ui.richtexteditor.RichTextEditor
.fnFunction
to the ready
event of this sap.ui.richtexteditor.RichTextEditor
.fnFunction
from the beforeEditorInit
event of this sap.ui.richtexteditor.RichTextEditor
.fnFunction
from the change
event of this sap.ui.richtexteditor.RichTextEditor
.fnFunction
from the ready
event of this sap.ui.richtexteditor.RichTextEditor
.The RichTextEditor uses a third party component, which might in some cases not be completely compatible with the way UI5's (re-)rendering mechanism works. If you keep hidden instances of the control (instances which are not visible in the DOM), you might run into problems with some browser versions. In this case please make sure you destroy the RichTextEditor instance instead of hiding it and create a new one when you show it again.
Accepts an object literal mSettings
that defines initial property values, aggregated and associated objects as well as event handlers. See sap.ui.base.ManagedObject for a general description of the syntax of the settings object.
The supported settings are:
- Properties
- value : string (default: )
- textDirection : sap.ui.core.TextDirection (default: Inherit)
- width : sap.ui.core.CSSSize
- height : sap.ui.core.CSSSize
- editorType : string (default: TinyMCE)
- editorLocation : string (default: js/tiny_mce/tiny_mce_src.js)
- editable : boolean (default: true)
- showGroupFontStyle : boolean (default: true)
- showGroupTextAlign : boolean (default: true)
- showGroupStructure : boolean (default: true)
- showGroupFont : boolean (default: false)
- showGroupClipboard : boolean (default: true)
- showGroupInsert : boolean (default: false)
- showGroupLink : boolean (default: false)
- showGroupUndo : boolean (default: false)
- wrapping : boolean (default: true)
- required : boolean (default: false)
- sanitizeValue : boolean (default: true)
- plugins : object[] (default: [])
- useLegacyTheme : boolean (default: true)
- buttonGroups : object[] (default: [])
- Events
- change : fnListenerFunction or [fnListenerFunction, oListenerObject] or [oData, fnListenerFunction, oListenerObject]
- ready : fnListenerFunction or [fnListenerFunction, oListenerObject] or [oData, fnListenerFunction, oListenerObject]
- beforeEditorInit : fnListenerFunction or [fnListenerFunction, oListenerObject] or [oData, fnListenerFunction, oListenerObject]
In addition, all settings applicable to the base type sap.ui.core.Control can be used as well.
{string} | sId? | id for the new control, generated automatically if no id is given |
{object} | mSettings? | initial settings for the new control |
{sap.ui.base.Event} | oControlEvent | |
{sap.ui.base.EventProvider} | oControlEvent.getSource | |
{object} | oControlEvent.getParameters |
{sap.ui.base.Event} | oControlEvent | |
{sap.ui.base.EventProvider} | oControlEvent.getSource | |
{object} | oControlEvent.getParameters | |
{string} | oControlEvent.getParameters.newValue | The new control value. |
{sap.ui.base.Event} | oControlEvent | |
{sap.ui.base.EventProvider} | oControlEvent.getSource | |
{object} | oControlEvent.getParameters |
sClassName
and enriches it with the information contained in oClassInfo
. oClassInfo
might contain the same kind of information as described in sap.ui.core.Control.extend.
{string} | sClassName | Name of the class being created |
{object} | oClassInfo? | Object literal with information about the class |
{function} | FNMetaImpl? | Constructor function for the metadata object; if not given, it defaults to sap.ui.core.ElementMetadata |
{function} | Created class / constructor function |
{sap.ui.base.Metadata} | Metadata object describing this class |
{map|string} | mGroup? | Name/ID of a single button or map containing the group information |
{string[]} | mGroup.buttons? | Array of name/IDs of the buttons in the group |
{string} | mGroup.name? | Name/ID of the group. |
{boolean} | mGroup.visible?, Default: true | (optional) The priority of the button group. Lower priorities are added first. |
{int} | mGroup.row? | (optional) Row number in which the button should be |
{int} | mGroup.priority?, Default: 10 | (optional) The priority of the button group. Lower priorities are added first. |
{object} | Control instance (for method chaining) |
{map|string} | mPlugin? | A map with the property name containing the plugin IDs/name or an object with the property "name". |
{object} | Control instance (for method chaining) |
fnFunction
to the beforeEditorInit
event of this sap.ui.richtexteditor.RichTextEditor
. When called, the context of the event handler (its this
) will be bound to oListener
if specified, otherwise it will be bound to this sap.ui.richtexteditor.RichTextEditor
itself.
This event is fired right before the TinyMCE instance is created and can be used to change the settings object that will be given to TinyMCE. The parameter "configuration" is the javascript oject that will be given to TinyMCE upon first instantiation. The configuration parameter contains a map that can be changed in the case of TinyMCE.
{object} | oData? | An application-specific payload object that will be passed to the event handler along with the event object when firing the event |
{function} | fnFunction | The function to be called when the event occurs |
{object} | oListener? | Context object to call the event handler with. Defaults to this sap.ui.richtexteditor.RichTextEditor itself |
{sap.ui.richtexteditor.RichTextEditor} | Reference to this in order to allow method chaining |
fnFunction
to the change
event of this sap.ui.richtexteditor.RichTextEditor
. When called, the context of the event handler (its this
) will be bound to oListener
if specified, otherwise it will be bound to this sap.ui.richtexteditor.RichTextEditor
itself.
Event is fired when the text in the field has changed AND the focus leaves the editor or when the Enter key is pressed.
{object} | oData? | An application-specific payload object that will be passed to the event handler along with the event object when firing the event |
{function} | fnFunction | The function to be called when the event occurs |
{object} | oListener? | Context object to call the event handler with. Defaults to this sap.ui.richtexteditor.RichTextEditor itself |
{sap.ui.richtexteditor.RichTextEditor} | Reference to this in order to allow method chaining |
fnFunction
to the ready
event of this sap.ui.richtexteditor.RichTextEditor
. When called, the context of the event handler (its this
) will be bound to oListener
if specified, otherwise it will be bound to this sap.ui.richtexteditor.RichTextEditor
itself.
Fired when the used editor is loaded and ready (its HTML is also created).
{object} | oData? | An application-specific payload object that will be passed to the event handler along with the event object when firing the event |
{function} | fnFunction | The function to be called when the event occurs |
{object} | oListener? | Context object to call the event handler with. Defaults to this sap.ui.richtexteditor.RichTextEditor itself |
{sap.ui.richtexteditor.RichTextEditor} | Reference to this in order to allow method chaining |
fnFunction
from the beforeEditorInit
event of this sap.ui.richtexteditor.RichTextEditor
. The passed function and listener object must match the ones used for event registration.
{function} | fnFunction | The function to be called, when the event occurs |
{object} | oListener | Context object on which the given function had to be called |
{sap.ui.richtexteditor.RichTextEditor} | Reference to this in order to allow method chaining |
fnFunction
from the change
event of this sap.ui.richtexteditor.RichTextEditor
. The passed function and listener object must match the ones used for event registration.
{function} | fnFunction | The function to be called, when the event occurs |
{object} | oListener | Context object on which the given function had to be called |
{sap.ui.richtexteditor.RichTextEditor} | Reference to this in order to allow method chaining |
fnFunction
from the ready
event of this sap.ui.richtexteditor.RichTextEditor
. The passed function and listener object must match the ones used for event registration.
{function} | fnFunction | The function to be called, when the event occurs |
{object} | oListener | Context object on which the given function had to be called |
{sap.ui.richtexteditor.RichTextEditor} | Reference to this in order to allow method chaining |
beforeEditorInit
to attached listeners. {Map} | mArguments? | The arguments to pass along with the event |
{sap.ui.richtexteditor.RichTextEditor} | Reference to this in order to allow method chaining |
change
to attached listeners. Expects the following event parameters:
newValue
of typestring
The new control value.
{Map} | mArguments? | The arguments to pass along with the event |
{sap.ui.richtexteditor.RichTextEditor} | Reference to this in order to allow method chaining |
ready
to attached listeners. {Map} | mArguments? | The arguments to pass along with the event |
{sap.ui.richtexteditor.RichTextEditor} | Reference to this in order to allow method chaining |
buttonGroups
. An array of button configurations. These configurations contain the names of buttons as array in the property "buttons" and the name of the group in "name", they can also contain the "row" where the buttons should be placed, a "priority" and whether the buttons are "visible". See method addButtonGroup() for more details on the structure of the objects in this array.
Default value is []
.
{object[]} | Value of property buttonGroups |
editable
. Whether the editor content can be modified by the user. When set to "false" there might not be any editor toolbar.
Default value is true
.
{boolean} | Value of property editable |
editorType
. The editor implementation to use. Valid values are the ones found under sap.ui.richtexteditor.EditorType and any other editor identifier that may be introduced by other groups (hence this is not an enumeration). Any attempts to set this property after the first rendering will not have any effect.
Default value is TinyMCE
.
{string} | Value of property editorType |
height
. Height of RichTextEditor control in CSS units.
{sap.ui.core.CSSSize} | Value of property height |
{object} | The native editor object (here: The TinyMCE editor instance) |
plugins
. An array of plugin configuration objects with the obligatory property "name". Each object has to contain a property "name" which then contains the plugin name/ID.
Default value is []
.
{object[]} | Value of property plugins |
required
. Whether a value is required.
Default value is false
.
{boolean} | Value of property required |
sanitizeValue
. Whether to run the HTML sanitizer once the value (HTML markup) is applied or not. To configure allowed URLs please use the whitelist API via jQuery.sap.addUrlWhitelist
Default value is true
.
{boolean} | Value of property sanitizeValue |
showGroupClipboard
. Whether the toolbar button group containing commands like Cut, Copy and Paste is available. Changing this after the initial rendering will result in some visible redrawing.
Default value is true
.
{boolean} | Value of property showGroupClipboard |
showGroupFont
. Whether the toolbar button group containing commands like Font, Font Size and Colors is available. Changing this after the initial rendering will result in some visible redrawing.
Default value is false
.
{boolean} | Value of property showGroupFont |
showGroupFontStyle
. Whether the toolbar button group containing commands like Bold, Italic, Underline and Strikethrough is available. Changing this after the initial rendering will result in some visible redrawing.
Default value is true
.
{boolean} | Value of property showGroupFontStyle |
showGroupInsert
. Whether the toolbar button group containing commands like Insert Image and Insert Smiley is available. Changing this after the initial rendering will result in some visible redrawing.
Default value is false
.
{boolean} | Value of property showGroupInsert |
showGroupLink
. Whether the toolbar button group containing commands like Create Link and Remove Link is available. Changing this after the initial rendering will result in some visible redrawing.
Default value is false
.
{boolean} | Value of property showGroupLink |
showGroupStructure
. Whether the toolbar button group containing commands like Bullets and Indentation is available. Changing this after the initial rendering will result in some visible redrawing.
Default value is true
.
{boolean} | Value of property showGroupStructure |
showGroupTextAlign
. Whether the toolbar button group containing text alignment commands is available. Changing this after the initial rendering will result in some visible redrawing.
Default value is true
.
{boolean} | Value of property showGroupTextAlign |
showGroupUndo
. Whether the toolbar button group containing commands like Undo and Redo is available. Changing this after the initial rendering will result in some visible redrawing.
Default value is false
.
{boolean} | Value of property showGroupUndo |
textDirection
. The text direction
Default value is Inherit
.
{sap.ui.core.TextDirection} | Value of property textDirection |
useLegacyTheme
. Whether or not to use the legacy theme for the toolbar buttons. If this is set to false, the default theme for the editor will be used (which might change slightly with every update). The legacy theme has the disadvantage that not all functionality has its own icon, so using non default buttons might lead to invisible buttons with the legacy theme - use the default editor theme in this case.
Default value is true
.
{boolean} | Value of property useLegacyTheme |
value
. An HTML string representing the editor content. Because this is HTML, the value cannot be generically escaped to prevent cross-site scripting, so the application is responsible for doing so. Overwriting this property would also reset editor's Undo manager and buttons "Undo"/"Redo" would be set to their initial state.
Default value is .
{string} | Value of property value |
width
. Width of RichTextEditor control in CSS units.
{sap.ui.core.CSSSize} | Value of property width |
wrapping
. Whether the text in the editor is wrapped. This does not affect the editor's value, only the representation in the control.
Default value is true
.
{boolean} | Value of property wrapping |
buttonGroups
. An array of button configurations. These configurations contain the names of buttons as array in the property "buttons" and the name of the group in "name", they can also contain the "row" where the buttons should be placed, a "priority" and whether the buttons are "visible". See method addButtonGroup() for more details on the structure of the objects in this array.
When called with a value of null
or undefined
, the default value of the property will be restored.
Default value is []
.
{object[]} | sButtonGroups | New value for property buttonGroups |
{sap.ui.richtexteditor.RichTextEditor} | Reference to this in order to allow method chaining |
editable
. Whether the editor content can be modified by the user. When set to "false" there might not be any editor toolbar.
When called with a value of null
or undefined
, the default value of the property will be restored.
Default value is true
.
{boolean} | bEditable | New value for property editable |
{sap.ui.richtexteditor.RichTextEditor} | Reference to this in order to allow method chaining |
{string} | sEditorType? | Which editor type to be used (currently only TinyMCE 3 and 4) |
{object} | Control instance (for method chaining) |
height
. Height of RichTextEditor control in CSS units.
When called with a value of null
or undefined
, the default value of the property will be restored.
{sap.ui.core.CSSSize} | sHeight | New value for property height |
{sap.ui.richtexteditor.RichTextEditor} | Reference to this in order to allow method chaining |
plugins
. An array of plugin configuration objects with the obligatory property "name". Each object has to contain a property "name" which then contains the plugin name/ID.
When called with a value of null
or undefined
, the default value of the property will be restored.
Default value is []
.
{object[]} | sPlugins | New value for property plugins |
{sap.ui.richtexteditor.RichTextEditor} | Reference to this in order to allow method chaining |
required
. Whether a value is required.
When called with a value of null
or undefined
, the default value of the property will be restored.
Default value is false
.
{boolean} | bRequired | New value for property required |
{sap.ui.richtexteditor.RichTextEditor} | Reference to this in order to allow method chaining |
sanitizeValue
. Whether to run the HTML sanitizer once the value (HTML markup) is applied or not. To configure allowed URLs please use the whitelist API via jQuery.sap.addUrlWhitelist
When called with a value of null
or undefined
, the default value of the property will be restored.
Default value is true
.
{boolean} | bSanitizeValue | New value for property sanitizeValue |
{sap.ui.richtexteditor.RichTextEditor} | Reference to this in order to allow method chaining |
showGroupClipboard
. Whether the toolbar button group containing commands like Cut, Copy and Paste is available. Changing this after the initial rendering will result in some visible redrawing.
When called with a value of null
or undefined
, the default value of the property will be restored.
Default value is true
.
{boolean} | bShowGroupClipboard | New value for property showGroupClipboard |
{sap.ui.richtexteditor.RichTextEditor} | Reference to this in order to allow method chaining |
showGroupFont
. Whether the toolbar button group containing commands like Font, Font Size and Colors is available. Changing this after the initial rendering will result in some visible redrawing.
When called with a value of null
or undefined
, the default value of the property will be restored.
Default value is false
.
{boolean} | bShowGroupFont | New value for property showGroupFont |
{sap.ui.richtexteditor.RichTextEditor} | Reference to this in order to allow method chaining |
showGroupFontStyle
. Whether the toolbar button group containing commands like Bold, Italic, Underline and Strikethrough is available. Changing this after the initial rendering will result in some visible redrawing.
When called with a value of null
or undefined
, the default value of the property will be restored.
Default value is true
.
{boolean} | bShowGroupFontStyle | New value for property showGroupFontStyle |
{sap.ui.richtexteditor.RichTextEditor} | Reference to this in order to allow method chaining |
showGroupInsert
. Whether the toolbar button group containing commands like Insert Image and Insert Smiley is available. Changing this after the initial rendering will result in some visible redrawing.
When called with a value of null
or undefined
, the default value of the property will be restored.
Default value is false
.
{boolean} | bShowGroupInsert | New value for property showGroupInsert |
{sap.ui.richtexteditor.RichTextEditor} | Reference to this in order to allow method chaining |
showGroupLink
. Whether the toolbar button group containing commands like Create Link and Remove Link is available. Changing this after the initial rendering will result in some visible redrawing.
When called with a value of null
or undefined
, the default value of the property will be restored.
Default value is false
.
{boolean} | bShowGroupLink | New value for property showGroupLink |
{sap.ui.richtexteditor.RichTextEditor} | Reference to this in order to allow method chaining |
showGroupStructure
. Whether the toolbar button group containing commands like Bullets and Indentation is available. Changing this after the initial rendering will result in some visible redrawing.
When called with a value of null
or undefined
, the default value of the property will be restored.
Default value is true
.
{boolean} | bShowGroupStructure | New value for property showGroupStructure |
{sap.ui.richtexteditor.RichTextEditor} | Reference to this in order to allow method chaining |
showGroupTextAlign
. Whether the toolbar button group containing text alignment commands is available. Changing this after the initial rendering will result in some visible redrawing.
When called with a value of null
or undefined
, the default value of the property will be restored.
Default value is true
.
{boolean} | bShowGroupTextAlign | New value for property showGroupTextAlign |
{sap.ui.richtexteditor.RichTextEditor} | Reference to this in order to allow method chaining |
showGroupUndo
. Whether the toolbar button group containing commands like Undo and Redo is available. Changing this after the initial rendering will result in some visible redrawing.
When called with a value of null
or undefined
, the default value of the property will be restored.
Default value is false
.
{boolean} | bShowGroupUndo | New value for property showGroupUndo |
{sap.ui.richtexteditor.RichTextEditor} | Reference to this in order to allow method chaining |
textDirection
. The text direction
When called with a value of null
or undefined
, the default value of the property will be restored.
Default value is Inherit
.
{sap.ui.core.TextDirection} | sTextDirection | New value for property textDirection |
{sap.ui.richtexteditor.RichTextEditor} | Reference to this in order to allow method chaining |
{boolean} | bUseLegacyTheme? | Whether to use the legacy button theme |
{object} | Control instance (for method chaining) |
value
. An HTML string representing the editor content. Because this is HTML, the value cannot be generically escaped to prevent cross-site scripting, so the application is responsible for doing so. Overwriting this property would also reset editor's Undo manager and buttons "Undo"/"Redo" would be set to their initial state.
When called with a value of null
or undefined
, the default value of the property will be restored.
Default value is .
{string} | sValue | New value for property value |
{sap.ui.richtexteditor.RichTextEditor} | Reference to this in order to allow method chaining |
width
. Width of RichTextEditor control in CSS units.
When called with a value of null
or undefined
, the default value of the property will be restored.
{sap.ui.core.CSSSize} | sWidth | New value for property width |
{sap.ui.richtexteditor.RichTextEditor} | Reference to this in order to allow method chaining |
wrapping
. Whether the text in the editor is wrapped. This does not affect the editor's value, only the representation in the control.
When called with a value of null
or undefined
, the default value of the property will be restored.
Default value is true
.
{boolean} | bWrapping | New value for property wrapping |
{sap.ui.richtexteditor.RichTextEditor} | Reference to this in order to allow method chaining |
editorLocation
. Relative or absolute URL where the editor is available. Must be on the same server. Any attempts to set this property after the first rendering will not have any effect.
Default value is js/tiny_mce/tiny_mce_src.js
.
- Deprecated:
- Since version 1.25.0. The editorLocation is set implicitly when choosing the editorType.
{string} | Value of property editorLocation |
editorLocation
. Relative or absolute URL where the editor is available. Must be on the same server. Any attempts to set this property after the first rendering will not have any effect.
When called with a value of null
or undefined
, the default value of the property will be restored.
Default value is js/tiny_mce/tiny_mce_src.js
.
{string} | sEditorLocation | New value for property editorLocation |
- Deprecated:
- Since version 1.25.0. The editorLocation is set implicitly when choosing the editorType.
{sap.ui.richtexteditor.RichTextEditor} | Reference to this in order to allow method chaining |