TextEditor

TextEditor

A collection of helper functions and utility methods related to the rich text editor

Constructor

new TextEditor()

Source:

Methods

Source:

Replace a matched Entity Link with an actual HTML link to that entity Be failure-tolerant, allowing for the possibility that the entity does not exist

Parameters:
Name Type Description
match string

The full matched string

id string

The Entity ID or name

name name

A custom text name to display

Returns:

The replacement string

Type
string
Source:

Replace a matched Entity Link with an actual HTML link to that entity Be failure-tolerant, allowing for the possibility that the entity does not exist

Parameters:
Name Type Description
match string

The full matched string

entityType string

The named type of Entity being embedded

id string

The Entity ID or name

name name

A custom text name to display

Returns:

The replacement string

Type
string
Source:

Replace a hyperlink-like string with an actual HTML tag

Returns:

The replacement string

Type
string

(static) _replaceInlineRolls(match, command, formula, rollData) → {string}

Source:

Replace an inline roll formula with a rollable button or an eagerly evaluated roll result

Parameters:
Name Type Description
match string

The matched string

command string

An optional command

formula string

The matched formula

rollData Object

The data object providing context for inline rolls

Returns:

The replaced match

Type
string

(static) create(options, content) → {tinyMCE.Editor}

Source:

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}

Source:

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, secrets, entities, links, rolls, rollData) → {String}

Source:

Enrich HTML content by replacing or augmenting components of it

Parameters:
Name Type Description
content string

The original HTML content (as a string)

secrets boolean

Remove secret tags?

entities boolean

Replace dynamic entity links?

links boolean

Replace hyperlink content?

rolls boolean

Replace inline dice rolls?

rollData Object

The data object providing context for inline rolls

Returns:

The enriched HTML content

Type
String

(static) previewHTML(content, length) → {string}

Source:

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