Constructor
new TextEditor()
Methods
(static) _createInlineRoll(match, command, formula, closing, labelopt) → {HTMLAnchorElement|null}
Replace an inline roll formula with a rollable <a> element or an eagerly evaluated roll result
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
match |
string | The matched string |
|
command |
string | An optional command |
|
formula |
string | The matched formula |
|
closing |
string | The closing brackets for the inline roll |
|
label |
string |
<optional> |
An optional label which configures the button text |
Returns:
The replaced match
- Type
- HTMLAnchorElement | null
(async, static) create(options, content) → {tinyMCE.Editor}
Create a Rich Text Editor. The current implementation uses TinyMCE
Parameters:
Name | Type | Description |
---|---|---|
options |
Object | Configuration options provided to the Editor init |
content |
string | Initial HTML or text content to populate the editor with |
Returns:
The editor instance.
- Type
- tinyMCE.Editor
(static) decodeHTML(html) → {string}
Safely decode an HTML string, removing invalid tags and converting entities back to unicode characters.
Parameters:
Name | Type | Description |
---|---|---|
html |
string | The original encoded HTML string |
Returns:
The decoded unicode string
- Type
- string
(static) enrichHTML(content, optionsopt) → {string}
Enrich HTML content by replacing or augmenting components of it
Parameters:
Name | Type | Attributes | Default | Description | ||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
content |
string | The original HTML content (as a string) |
||||||||||||||||||||||||||||||||
options |
object |
<optional> |
{}
|
Additional options which configure how HTML is enriched Properties
|
Returns:
The enriched HTML content
- Type
- string
(static) previewHTML(content, length) → {string}
Preview an HTML fragment by constructing a substring of a given length from its inner text.
Parameters:
Name | Type | Default | Description |
---|---|---|---|
content |
string | The raw HTML to preview |
|
length |
number |
250
|
The desired length |
Returns:
The previewed HTML
- Type
- string
(static) truncateHTML(html, maxLengthopt, splitWordsopt, suffixopt) → {HTMLElement}
Truncate an HTML fragment to a maximum number of text content characters, removing any unused elements.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
html |
HTMLElement | The root HTML element. |
||
maxLength |
number |
<optional> |
50
|
The maximum allowed length of the text content. |
splitWords |
boolean |
<optional> |
Whether to truncate by splitting on white space (if true) or breaking words. |
|
suffix |
string |
<optional> |
"…"
|
A suffix string to append to denote that the text was truncated. |
Returns:
- Type
- HTMLElement
(static) truncateText(text, maxLengthopt, splitWordsopt, suffixopt) → {*}
Truncate a fragment of text to a maximum number of characters.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
text |
string | The original text fragment that should be truncated to a maximum length |
|
maxLength |
number |
<optional> |
The maximum allowed length of the truncated string. |
splitWords |
boolean |
<optional> |
Whether to truncate by splitting on white space (if true) or breaking words. |
suffix |
string | null |
<optional> |
A suffix string to append to denote that the text was truncated. |
Returns:
- Type
- *