JavaScript API
Feature origin: Tint
The public interface of a <tint-editor> element.
Editor properties
| Property | Description |
|---|---|
value, defaultValue | Current Markdown and reset value, respectively. |
toolbar | Reads the current commands and separators. Assign a string, array, or null. |
selectionStart, selectionEnd, selectionDirection | Read selection offsets and direction from the textarea. |
name, readOnly, required, disabled, placeholder, rows | Reflected field settings. |
form, labels, validity, validationMessage, willValidate | Native form association and validation state. |
Editor methods
| Method | Description |
|---|---|
getMarkdown(), setMarkdown(text) | Read or set the current Markdown. |
exec(name, url?) | Run a command. A link or image opens a dialog when called without a URL. |
insertText(text), insertImage(url, alt?) | Replace the current selection with text or an image reference. |
focus(), getSelectedText(), setSelectionRange(start, end, direction?) | Focus the textarea and work with its selection. |
isActive(name, options?) | Check formatting around the selection. For a heading level, use isActive("heading", { level: 2 }). |
checkValidity(), reportValidity() | Check constraints or report them through the browser. |
Events
Listen for input and change as described in Events.
Package export
The module registers the tag when imported and exports TintEditor.