Rich Text Editors (RTE)
abstract
Rich Text Editors (RTEs) are iframes/divs whose designMode or contentEditable property is set to true.
Such components allow input of text and formatting them (making text bold, inserting images etc.)
Rich Text Editors do not respond to regular events and need to be handled specifically.
Identification
_rte
| Since: | Sahi Pro | Desktop Add-On | Mobile Add-On | SAP Add-On | AI Assist Add-On |
| 3.5 | NA | NA | NA | NA |
Available for modes: Browser
_rte($identifier[, $relation])
Arguments
| $identifier | string | Can be name, id or index of iframe which houses the RTE. |
| $relation | relation optional | Relation APIs |
Returns
| null |
Sahi Pro Flowcharts Action :Rte
Details
_rte("editor") // using id
_rte(0, _in(_div("editorDiv"))) // using index and _in
info
_rte is the same as _iframe.
warning
Sahi does NOT identify iframes on CTRL-Hover.
Use the browser's Developer Tools to identify some element inside the RTE, and look up in the heirarchy to find the relevant iframe.
"View Source" will not help identify iframes in most cases because, RTEs are mostly built dynamically at run time and replace existing textareas.
RTE Fetch APIs
_rteText
| Since: | Sahi Pro | Desktop Add-On | Mobile Add-On | SAP Add-On | AI Assist Add-On |
| 3.5 | NA | NA | NA | NA |
Available for modes: Browser
_rteText($el)
Arguments
| $el | HTML DOM element | Element which is content editable (eg. _rte(0)) |
Returns
| string | Text inside a rich text editor (without the html formatting) |
Sahi Pro Flowcharts Action :Rte Text
Details
// get the rich text editor's text content
var $rteText = _rteText(_rte("rteId"));
// $rteText may look like "Hi there"
_rteHTML
| Since: | Sahi Pro | Desktop Add-On | Mobile Add-On | SAP Add-On | AI Assist Add-On |
| 3.5 | NA | NA | NA | NA |
Available for modes: Browser
_rteHTML($el)
Arguments
| $el | HTML DOM element | Element which is content editable (eg. _rte(0)) |
Returns
| string | HTML content inside a rich text editor (without the html formatting) |
Sahi Pro Flowcharts Action :Rte HTML
Details
// get the rich text editor's HTML content
var $rteHTML = _rteHTML(_rte("rteId"));
// $rteHTML may look like "Hi <b>there</b>"
RTE Action APIs
_rteWrite
| Since: | Sahi Pro | Desktop Add-On | Mobile Add-On | SAP Add-On | AI Assist Add-On |
| 3.5 | NA | NA | NA | NA |
Available for modes: Browser
_rteWrite($rte, $html)
Arguments
| $rte | HTML DOM element | RTE to write into |
| $html | string | html to write |
Returns
| null |
Sahi Pro Flowcharts Action :Rte Write
Details
Replaces the content of the RTE with given HTML. Note that this does not simulate all events like other Sahi APIs. _rteWrite only replaces the content of the iframe.
Replaces the content of the RTE with given HTML. Note that this does not simulate all events like other Sahi APIs. _rteWrite only replaces the content of the iframe.
_rteWrite(_rte("editor"), "Hi <b>user</b>");