Static
Private
#decoderA singleton text area used for HTML decoding.
Static
Private
_PARAGRAPH_A list of elements that are retained when truncating HTML.
Static
createCreate a Rich Text Editor. The current implementation uses TinyMCE
Configuration options provided to the Editor init
Which rich text editor engine to use, "tinymce" or "prosemirror". TinyMCE is deprecated and will be removed in a later version.
Initial HTML or text content to populate the editor with
The editor instance.
Static
decodeHTMLStatic
enrichHTMLEnrich HTML content by replacing or augmenting components of it
The original HTML content (as a string)
Optional
options: EnrichmentOptions = {}Additional options which configure how HTML is enriched
The enriched HTML content
Static
previewHTMLStatic
truncateHTMLStatic
truncateTruncate a fragment of text to a maximum number of characters.
The original text fragment that should be truncated to a maximum length
Optional
options: { Options which affect the behavior of text truncation
The maximum allowed length of the truncated string.
Whether to truncate by splitting on white space (if true) or breaking words.
A suffix string to append to denote that the text was truncated.
The truncated text string
Static
createStatic
activateStatic
getStatic
getGiven 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
Optional
options: { Additional options to configure link creation.
A document to generate the link relative to.
A custom label to use instead of the document's name.
Static
_uploadStatic
Protected
_createProtected
Create a TinyMCE editor instance.
Optional
options: object = {}Configuration options passed to the editor.
Optional
content: string = ""Initial HTML or text content to populate the editor with.
The TinyMCE editor instance.
Static
Protected
_primeStatic
Protected
_enrichProtected
Convert text of the form @UUID[uuid]{name} to anchor elements.
The existing text content
Optional
options: EnrichmentOptions = {}Options provided to customize text enrichment
Whether any content links were replaced and the text nodes need to be updated.
Static
Protected
_enrichProtected
Handle embedding Document content with @Embed[uuid]{label} text.
The existing text content.
Optional
options: EnrichmentOptions = {}Options provided to customize text enrichment.
Whether any embeds were replaced and the text nodes need to be updated.
Static
Protected
_enrichProtected
Convert URLs into anchor elements.
The existing text content
Optional
options: EnrichmentOptions = {}Options provided to customize text enrichment
Whether any hyperlinks were replaced and the text nodes need to be updated
Static
Protected
_enrichProtected
Convert text of the form [[roll]] to anchor elements.
The data object providing context for inline rolls.
The existing text content.
Whether any inline rolls were replaced and the text nodes need to be updated.
Static
Protected
_applyProtected
Match any custom registered regex patterns and apply their replacements.
The custom enricher configuration.
The existing text content.
Optional
options: EnrichmentOptionsOptions provided to customize text enrichment
Whether any replacements were made, requiring the text nodes to be updated.
Static
Protected
_createProtected
Create a dynamic document link from a regular expression match
The regular expression match
Optional
options: { Additional options to configure enrichment behaviour
A document to resolve relative UUIDs against.
An HTML element for the document link.
Static
Protected
_embedProtected
Embed content from another Document.
The regular expression match.
Optional
options: EnrichmentOptions = {}Options provided to customize text enrichment.
A representation of the Document as HTML content, or null if the Document could not be embedded.
Static
Protected
_parseProtected
Parse the embed configuration to be passed to ClientDocument#toEmbed. The return value will be an object of any key=value pairs included with the configuration, as well as a separate values property that contains all the options supplied that were not in key=value format. If a uuid key is supplied it is used as the Document's UUID, otherwise the first supplied UUID is used.
The raw matched config string.
Optional
options: object = {}Options forwarded to parseUuid.
TextEditor._parseEmbedConfig('uuid=Actor.xyz caption="Example Caption" cite=false');
// Returns: { uuid: "Actor.xyz", caption: "Example Caption", cite: false, values: [] }
TextEditor._parseEmbedConfig('Actor.xyz caption="Example Caption" inline');
// Returns: { uuid: "Actor.xyz", caption: "Example Caption", values: ["inline"] }
Static
Protected
_createProtected
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. Returns null if the contained command is not a valid roll expression.
Static
Protected
_onStatic
Private
_getStatic
Private
_replacePrivate
Facilitate the replacement of text node content using a matching regex rule and a provided replacement function.
The text nodes to match and replace.
The provided regular expression for matching and replacement
The replacement function
Optional
options: TextReplacementOptions = {}Options to configure text replacement behavior.
Whether a replacement was made.
Static
Private
_replacePrivate
Replace a matched portion of a Text node with a replacement Node
The Text node containing the match.
The regular expression match.
The replacement Node.
Optional
options: TextReplacementOptions = {}Options to configure text replacement behavior.
Static
Private
_createPrivate
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.
Static
Private
_createStatic
Private
_onStatic
Private
_onStatic
Private
_onStatic
Private
_on
A collection of helper functions and utility methods related to the rich text editor