Private
constructorIs editor current focused for editing.
Access or set current link mode status.
Access or set current pinning status for editor.
Readonly
preferredReturns the current tab string is use. This could be 2 spaces, 4 spaces, or \t
depending on the editor preferences for the current syntax. Useful in actions, such as indent/outdent actions, which need to insert or remove indentation and want to match the options of the current syntax.
Access or set current typewriter scrolling status.
replaced by pinningEnabled
.
Readonly
linkedConvenience method to return the linked items in the text, as located by the syntax definitions' linkDefinitions
. In Markdown syntaxes, these map to [[wiki-style]]
cross-links.
Array of navigation markers in the text. Navigation markers are defined by the syntax definition in use in the editor, and are used in the Navigation feature.
Array of recent drafts. This is the same list as used in the navigation features of the editor, and is in reverse order, so that the first index in the array is the previous draft loaded in the editor.
Readonly
urlsConvenience method to scan the text for valid URLs, and return all found URLs as an array. This will return valid full URL strings - both for http(s)
and custom URLs found in the text.
Request focus for the editor. This will dismiss other views and show the keyboard on the currently loaded draft. Useful if an action opens user interface elements or otherwise causes the editor to resign focus and you would like to return to editing at the end of the action's execution.
Opens the arrange mode view with the passed text for arranging. Returns the arranged text if the user makes changes and taps "Done", the original text if the user cancels.
The text to arrange
String containing result of arrange. If user cancels, it will be the same as the original text passed.
Open dictation interface, and return the result as a string. The string will be empty if user cancels.
Optional
locale: stringthe preferred locale can be passed in the format "en-US" (U.S. English), "it-IT" (Italian-Italian), "es-MX" (Mexican Spanish), etc.
The accepted dictation text.
Loads an existing draft into the editor.
Expand the range provided to the nearest beginning and end of the lines it encompasses.
Get the current selected text range extended to the beginning and end of the lines it encompasses.
Get text range that was last selected.
The next navigation marker in the editor, relative to the character location. This is a convenience method to assist in navigating by marker.
The previous navigation marker in the editor, relative to the character location. This is a convenience method to assist in navigating by marker.
Generated using TypeDoc
A global
editor
object is available in all action scripts. This object allows manipulation of the main editing window in Drafts, altering the text, text selections, or loading a different draft into the editor, etc.Typically scripting actions that work like custom keyboard commands and similar will utilize the editor functions to manipulate text.
Example