Create a Rich Text Editor. The current implementation uses TinyMCE
Configuration options provided to the Editor init
Initial HTML or text content to populate the editor with
The editor instance.
Safely decode an HTML string, removing invalid tags and converting entities back to unicode characters.
The original encoded HTML string
The decoded unicode string
Enrich HTML content by replacing or augmenting components of it
The original HTML content (as a string)
The enriched HTML content
Preview an HTML fragment by constructing a substring of a given length from its inner text.
The raw HTML to preview
The desired length
The previewed HTML
Sanitises an HTML fragment and removes any non-paragraph-style text.
The root HTML element.
Truncate a fragment of text to a maximum number of characters.
The original text fragment that should be truncated to a maximum length
Options which affect the behavior of text truncation
The truncated text string
Replace an inline roll formula with a rollable <a> element or an eagerly evaluated roll result
The regular expression match array
Provided roll data for use in roll evaluation
The replaced match, returned as a Promise if async was true and the message contained an immediate inline roll.
Activate interaction listeners for the interior content of the editor frame.
Extract JSON data from a drag/drop event.
The drag event which contains JSON data.
The extracted JSON data. The object will be empty if the DragEvent did not contain JSON-parseable data.
Given a Drop event, returns a Content link if possible such as @Actor[ABC123], else null
The parsed object of data provided by the transfer event
Upload an image to a document's asset path.
The document's UUID.
The image file to upload.
The path to the uploaded image.
Create a TinyMCE editor instance.
The TinyMCE editor instance.
Convert text of the form @UUID[uuid]{name} to anchor elements.
The existing text content
Options provided to customize text enrichment
Whether any content links were replaced and the text nodes need to be updated.
Convert URLs into anchor elements.
The existing text content
Whether any hyperlinks were replaced and the text nodes need to be updated
Convert text of the form roll to anchor elements.
The data object providing context for inline rolls.
The existing text content.
Options provided to customize text enrichment
Whether any inline rolls were replaced and the text nodes need to be updated.
Match any custom registered regex patterns and apply their replacements.
The pattern to match against.
The function that will be run for each match.
The existing text content.
Whether any replacements were made, requiring the text nodes to be updated.
Create a dynamic document link from a regular expression match
The regular expression match
Additional options to configure enrichment behaviour
An HTML element for the document link, returned as a Promise if async was true and the message contained a UUID link.
Recursively identify the text nodes within a parent HTML node for potential content replacement.
The parent HTML Element
An array of contained Text nodes
Facilitate the replacement of text node content using a matching regex rule and a provided replacement function.
The target text to replace
The provided regular expression for matching and replacement
The replacement function
Replace a matched portion of a Text node with a replacement Node
Create a dynamic document link from an old-form document link expression.
The matched document type, or "Compendium".
The requested match target (_id or name).
A customized or overridden display name for the link.
Data containing the properties of the resulting link element.
Whether the resulting link is broken or not.
Replace a hyperlink-like string with an actual HTML <a> tag
The regular expression match
An HTML element for the document link
Handle click events on Document Links
Handle left-mouse clicks on an inline roll, dispatching the formula or displaying the tooltip
The initiating click event
Begin a Drag+Drop workflow for a dynamic content link
The originating drag event
Handle dropping of transferred data onto the active rich text editor
The originating drop event which triggered the data transfer
The TinyMCE editor instance being dropped on
A singleton text area used for HTML decoding.
A list of elements that are retained when truncating HTML.
A collection of helper functions and utility methods related to the rich text editor