Append text to the end of the current draft being edited. The original selection remains intact.
text to be inserted at the end of the editor's draft.
text to be inserted at the end of the editor's draft, before the other inserted text. Defaults to a single new line.
// Example
editor.TA_append("\- Fin -", "\n\n");
Add a string to the end of the lines at least partially in a selection, without affacting the selected range of text.
Copies the current line(s) to the clipboard. The current selection is taken, and the range for the start and end of those lines is copied to the clipboard.
// Example
editor.TA_copyLine();
Copy the next line to the clipboard. The next line is taken to be the line after the current selection, but if there is no line after, the clipboard will be set to a null string.
// Example
editor.TA_copyNextLine();
Copy the previous line to the clipboard. The previous line is taken to be the line prior to the current selection, but if there is no prior line, the clipboard will be set to a null string.
// Example
editor.TA_copyPreviousLine();
Move the cursor to after the next occurrence of an opening marker.
Given a text string that defines the start of a field, the function will locate the next occurrence after the current cursor position,
and place the cursor after the marker. If no such marker is found, then the cursor will remain in its existing position.
Returns true
if the cursor moved, and false
if it remained in place.
// Example
editor.TA_cursorMoveAfterNextOpenMarker("{{");
Move the cursor to after the previous occurence of an opening marker.
Given a text string that defines the start of a field, the function will locate the previous occurrence before the current cursor position,
and place the cursor after the marker. If no such marker is found, then the cursor will remain in its existing position.
If the cursor is already immediately after a marker, and a prior marker can be found, the cursor will be moved to that one.
Returns true
if the cursor moved, and false
if it remained in place.
// Example
editor.TA_cursorMoveAfterPreviousOpenMarker("{{");
Move the cursor to before the next occurrence of a closing marker.
Given a text string that defines the end of a field, the function will locate the next occurrence after the current cursor position,
and place the cursor before the marker. If no such marker is found, then the cursor will remain in its existing position.
If the cursor is already immediately before a marker, and a subsequent marker can be found, the cursor will be moved to that one.
Returns true
if the cursor moved, and false
if it remained in place.
// Example
editor.TA_cursorMoveBeforeNextCloseMarker("}}");
Move the cursor to before the previous occurence of a closing marker.
Given a text string that defines the end of a field, the function will locate the previous occurrence before the current cursor position,
and place the cursor before the marker. If no such marker is found, then the cursor will remain in its existing position.
Returns true
if the cursor moved, and false
if it remained in place.
// Example
editor.TA_cursorMoveBeforePreviousCloseMarker("}}");
Move the cursor to the end of the draft. Also activates the editor and returns the cursor position.
// Example
editor.TA_cursorToEnd();
Move the cursor to the end of the previous line (above). Returns the position of the cursor.
// Example
editor.TA_cursorToEndOfPreviousLine();
Move the cursor left by one or more characters. Returns the range array (position & length) for the cursor.
number of characters to move the cursor by to the left, defaults to one character.
// Example
editor.TA_cursorToLeft(3);
Move the cursor to the end of the line for the end of the current selection. Also activates the editor and returns the cursor position.
// Example
editor.TA_cursorToLineEnd();
Move the cursor to the start of the line for the start of the current selection. Also activates the editor and returns the cursor position.
// Example
editor.TA_cursorToLineStart();
With a text selection in a paragraph, move the cursor to the end of the paragraph.
See TA_selectParagraph()
for how the definition of how a paragraph is established.
Returns the position of the cursor.
// Example
editor.TA_cursorToParagraphEnd();
With a text selection in a paragraph, move the cursor to the start of the paragraph.
See TA_selectParagraph()
for how the definition of how a paragraph is established.
Returns the position of the cursor.
// Example
editor.TA_cursorToParagraphStart();
Move the cursor right by one or more characters. Returns the range array (position & length) for the cursor.
number of characters to move the cursor by to the right, defaults to one character.
// Example
editor.TA_cursorToRight(3);
Move the cursor to the end of the current selection. Also activates the editor and returns the cursor position. Returns the position of the cursor.
// Example
editor.TA_cursorToSelectionEnd();
Move the cursor to the start of the current selection. Also activates the editor and returns the cursor position. Returns the position of the cursor.
// Example
editor.TA_cursorToSelectionStart();
Move the cursor to the start of the draft. Also activates the editor and returns the cursor position.
// Example
editor.TA_cursorToStart();
Move the cursor to the start of the current sentence. Returns the position of the cursor.
// Example
editor.TA_cursorToStartOfCurrentSentence();
Move the cursor to the start of the next line (below). Returns the position of the cursor.
// Example
editor.TA_cursorToStartOfNextLine();
Move the cursor to the start of the next sentence. Returns the position of the cursor.
// Example
editor.TA_cursorToStartOfNextSentence();
Move the cursor to the start of the previous sentence. Returns the position of the cursor.
// Example
editor.TA_cursorToStartOfPreviousSentence();
Cut the current line(s) to the clipboard. The current selection is taken, and the range for the start and end of those lines is copied to the clipboard.
// Example
editor.TA_cutLine();
Cut the next line to the clipboard.
The next line is taken to be the line after the current selection, but if there is no line after, the clipboard will be set to a null string.
The function will return true
if a next line was available and cut, and false
if none was available and none were cut.
// Example
editor.TA_cutNextLine();
Cut the previous line to the clipboard.
The previous line is taken to be the line prior to the current selection, but if there is no prior line, the clipboard will be set to a null string and no line will be deleted.
The function will return true
if a previous line was available and cut, and false
if none was available and none were cut.
// Example
editor.TA_cutPreviousLine();
Deletes the current line. If more than one line is selected, the deletion will extend to all such lines. If the selection includes some of line 1, all of line 2 and some of line 3, all of lines 1, 2 and 3 will be deleted.
// Example
editor.TA_deleteCurrentLine();
Deletes the current line based on the end of any selection. If the selection includes some of line 1, all of line 2 and some of line 3, all of line 3 will be deleted.
// Example
editor.TA_deleteCurrentLineAft();
Deletes the current line based on the start of any selection. If the selection includes some of line 1, all of line 2 and some of line 3, all of line 1 will be deleted.
// Example
editor.TA_deleteCurrentLineFore();
Deletes the next character (to the right). The initial selection is retained, but this also allows for character deletion on iPhones and iPads where a delete key is not available on the soft keyboard. The function also activates the editor.
// Example
editor.TA_deleteNextChar();
Deletes the next line.
The function will return true
if a next line was available and deleted, and false
if none was available and none were deleted.
// Example
editor.TA_deleteNextLine();
Deletes the previous line.
The function will return true
if a previous line was available and deleted, and false
if none was available and none were deleted.
// Example
editor.TA_deletePreviousLine();
With a text selection in place, prefix and append a single set of characters to the line selection. If more than one line is selected, the selection will be extended to the start of the first line and the end of the last line. The initial selection is recalculated and restored, as well as the editor being activated.
specifies the string of characters to add before and after the paragraph.
// Example
editor.TA_delimitLines("\n--- SECTION BREAK ---\n");
With a text selection in a paragraph, prefix and append a single set of characters to the paragraph.
See TA_selectParagraph()
for how the definition of how a paragraph is established.
The initial selection is recalculated and restored , as well as the editor being activated.
specifies the string of characters to add before and after the paragraph.
// Example
editor.TA_delimitParagraph("\n--- SECTION BREAK ---\n");
With a text selection in place, prefix and append a single set of characters to the selection. The initial selection is recalculated and restored , as well as the editor being activated.
specifies the string of characters to add before and after the selection.
// Example
editor.TA_delimitSelection("**");
Dictate to the current selection, prefixed with a speified date format.
The date/time prefix is in the strftime
format %Y-%m-%d-%H.%M.%S
, and is followed by a colon and a new line.
It returns the inserted text or an empty string if no dictation was made.
// Example
editor.TA_dictateDateTimeStampLogEntry();
Insert a discourse hide details section around the currently selectced text.
// Example
editor.TA_discourseHideDetails();
Duplicate the current line(s) the cursor/current selection is on. At the end of processing, the cusor is placed at the end of the replacement/duplication section.
// Example
editor.TA_duplicateCurrentLine();
Duplicate the current line(s) the cursor/current selection is on a specified number of times. The number of times to duplicate is specified, so 0 would do nothing, 1 would duplicate the line once, 2 would duplicate it twice, etc. At the end of processing, the cusor is placed at the end of the replacement/duplication section.
the number of duplicates to create.
// Example
editor.TA_duplicateCurrentLineNTimes(4);
Copy the current selection, or the current line if no selection, to the clipboard. Returns the content of the clipboard.
// Example
editor.TA_extendedCopy();
Cut the current selection, or the current line is no selection, to the clipboard. Returns the content of the clipboard.
// Example
editor.TA_extendedCut();
Get the content of the line(s) the cursor/current selection is on. Returns the text of the line the cursor is on, or all lines if there is a selection that spans multiple lines. Any final, trailing newline will be included in the return.
// Example
editor.TA_getCurrentLine();
Get the content of the line(s) the cursor/current selection is on. Returns the text of the line the cursor is on, or all lines if there is a selection that spans multiple lines. Any final, trailing newline will be excluded from the return.
// Example
editor.TA_getCurrentLineNoNewLine();
Based on the current selection, returns the full text of the lines the selection partially or full includes.
// Example
alert(editor.TA_getCurrentLinesContent());
Returns the current line(s). The current selection is taken, and the range for the start and end of those lines is returned.
// Example
alert(editor.TA_getLine());
Return the content of the next line. The next line is taken to be the line after the current selection, but if there is no line after, the function will return a null string.
// Example
editor.TA_getNextLineContent();
Return the content of the previous line. The previous line is taken to be the line prior to the current selection, but if there is no prior line, the function will return a null string.
// Example
editor.TA_getPreviousLineContent();
Returns the selected text, but returns all text if there is no selection.
// Example
alert(editor.TA_getSelectionWide();
Get the URL for the link under the cursor.
The function attempts to locate a URL under the cursor, but will also work for the cursor being in an HTML tag or a Markdown styled link block too.
To work with an HTML tag, the cursor must be in the initial anchor tag. To work with a Markdown block, the cursor can be anywhere in the block. For
other links, the cursor must be in the URL.
Returns the URL or undefined
if no URL is found.
// Example
alert(editor.TA_getURLAtCursor());
Insert an indentation. If the cursor is positioned at the start of a Markdown bullet or numbered list entry (after the bullet or number), or there is a text selection, the line will have an indentation string prefixed to the start of any line in the selection. If the cursor is not positioned at the start of a Markdown bullet or numbered list entry (after the bullet or number), and there is not a text selection, the an indentation will be inserted at the curent cursor position.
the text string to be used for indentation of a line.
// Example
editor.TA_indent("\t");
Insert text at the current selection and then move the cursor to the end of the inserted text.
the text to insert.
// Example
editor.TA_insertTextPosAtEnd("foo");
Inserts a yyyy-MM-dd-hh.mm.ss format timestamp at the current editor position.
// Example
editor.TA_insertTimestampyyyyMMddhhmmss();
Checks if there is a text selection, or if the cursor has no associated selection.
Returns true
if one or more characters is selected, otherwise it returns false
.
// Example
if(!editor.TA_isTextSelected()) alert("No text selected");
Incrementally add Markdown header markers up to level 6 then wrap to level 0 for start line of current selection. The current text selection will be retained, though if you switch from level 6 to level 0 and your active text selection includes any of the hash symbols or separator that get removed, then the selection will extend to the right by the amount of the overlap. It can be coded around, but sometimes, life's too short for an edge case like this 😄
// Example
editor.TA_lineMDHeader();
Set Markdown header marker level for start line of current selection. The current text selection will be retained, though if you switch down to level 0 and your active text selection includes any of the hash symbols or separator that get removed, then the selection will extend to the right by the amount of the overlap. It can be coded around, but sometimes, life's too short for an edge case like this 😄
the level of the heading this will apply. The level corresponds to the number of prefix hash tags.
// Example
editor.TA_lineMDHeaderN(3);
Wrap content within each line in an extended selection with a pair of text strings. The function accepts three regular expression parameters that define the three sections of the line between which the two new wrapping strings should be inserted. The process is applied to each line within an extended selection (i.e. it uses all full lines for selected and partially selected lines in the editor). The resulting collection of updated lines replaces the extended selection in the editor. This function is useful for doing things like applying specific formatting to a set of lines as shown in the examples below. Note that backslashes included in the regular expressions must be escaped with a backslash.
a regular expression string to match anything before the substring.
a regular expression string to match the substring which should get wrapped.
a regular expression string to match the remainder of the string and anything that should not get matched.
the string of text to insert before the substring.
the string of text to insert after the substring and any matching post identifier.
defaults to false
, but when set to true
, will apply the case insensitive modifier to the regular expression-based matching.
// Example 1
// For an extended selection of a Markdown numbered list, bold everything after the number,
// period and space, up to and including the first colon.
editor.TA_lineSubstringWrapInsertion("^\\s*?\\d+\\. ", ".*?:", ".*", "**", "**");
// Example 2
// For an extended selection of a Markdown bulleted (with hyphens) list, code block everything
// after the initial hyphen and space to, but excluding the next hyphen space and hyphen.
editor.TA_lineSubstringWrapInsertion("^\\s*?- ", ".*?", " - .*", "`", "`");
Wrap content within each line in an extended selection with a pair of text strings based on a multi-set match.
This is a multi-set version of the editor.TA_lineSubstringWrapInsertion()
function. Instead of the function receiving one set of match
parameters, it recveives arrays of paramaters, with each index being matched across all of the parameters.
This allows more complex systems of replacement to be applied - which helps in scenarios where, for example multiple different matches could require
different replacements
Please note that the case insensitivity Boolean array is mandatory and has no default like the equivalent parameter in the
editor.TA_lineSubstringWrapInsertion()
function.
an array of regular expression strings to match anything before the substring.
an array of regular expression strings to match the substring which should get wrapped.
an array of regular expression strings to match the remainder of the string and anything that should not get matched.
an array of strings of text to insert before the substring.
an array of strings of text to insert after the substring and any matching post identifier.
an array of Booleans that when an element is set to true
, will apply the case insensitive modifier to the regular expression-based matching.
// Example
// For an extended selection of a Markdown bulleted list (any mix of hyphen, asterisk and
// plus identifiers), format everything after the number, period and space, up to and
// including the first colon, but the wrapping format varies depending upon the identifier
editor.TA_lineSubstringWrapInsertions(
["^\\s*?\\+ ", "^\\s*?\\* ", "^\\s*?- "],
[".*?", ".*?", ".*?"],
[" - .*", " - .*", " - .*"],
["**", "*", "`"],
["**", "*", "`"],
[false, false, false]);
Loads a draft, by UUID, into the editor, and activates the editor.
// Example
editor.TA_loadAcUUID("0BACEC09-708F-424B-81E3-39F3BF2A11B7");
Create and load a new empty draft. Returns the newly created draft object.
// Example
editor.TA_loadEmpty();
Loads the last created draft. Any currently applied workspace or filter has no effect on determining the last created draft. Trashed drafts are excluded, but the draft could appear in any other folder (inbox/flagged/archive). Returns the draft object for the last created draft.
// Example
editor.TA_loadLastCreatedDraft();
Loads the last created draft. Any currently applied workspace or filter has no effect on determining the last created draft. Trashed drafts are inluded, but so the draft could appear in any folder (inbox/flagged/archive/trash). Returns the draft object for the last created draft.
// Example
editor.TA_loadLastCreatedDraftIncludeTrashed();
Loads the last modified draft. Any currently applied workspace or filter has no effect on determining the last modified draft. Trashed drafts are excluded, but the draft could appear in any other folder (inbox/flagged/archive). Returns the draft object for the last modified draft.
// Example
editor.TA_loadLastModifiedDraft();
Loads the last modified draft. Any currently applied workspace or filter has no effect on determining the last modified draft. Trashed drafts are inluded, but so the draft could appear in any folder (inbox/flagged/archive/trash). Returns the draft object for the last modified draft.
// Example
editor.TA_loadLastModifiedDraftIncludeTrashed();
Create and load a new draft with specific content.
the text to use as the content of the draft.
// Example
editor.TA_loadNewDraftWithContent("# Heading\nBody of the draft");
Load a recent draft.
The function accepts a date/time range and arrays of tags as selection criteria.
If there are no drafts that match the selection criteria, no drafts will be loaded. If there is
just one draft, that will be loaded. If there is more than one draft, the user will be presented with a
prompt to choose which draft to load.
The function returns true
if it loads a draft, otherwise it returns false
.
the date/time, on or after which, a draft to be included should have been created.
the date/time, on or beforre which, a draft to be included should have been created.
the title to display on any draft list.
tan array of tag names that any matching draft should include.
tan array of tag names that any matching draft should exclude.
// Example
// Choose from todays foo/bar drafts, but not quz drafts.
editor.TA_loadRecentDraft(Date.today(), Date.today().at("23:59:59"), "Today's drafts", ["foo", "bar"], ["quz"]);
Load a draft created in the last 14 calendar days, including today.
The function accepts arrays of tags as selection criteria.
If there are no drafts that match the selection criteria, no drafts will be loaded. If there is
just one draft, that will be loaded. If there is more than one draft, the user will be presented with a
prompt to choose which draft to load.
The function returns true
if it loads a draft, otherwise it returns false
.
tan array of tag names that any matching draft should include.
tan array of tag names that any matching draft should exclude.
// Example
editor.TA_loadRecentDraftLast2Weeks(["foo", "bar"], ["quz"]);
Load a draft created in the last 28 calendar days, including today.
The function accepts arrays of tags as selection criteria.
If there are no drafts that match the selection criteria, no drafts will be loaded. If there is
just one draft, that will be loaded. If there is more than one draft, the user will be presented with a
prompt to choose which draft to load.
The function returns true
if it loads a draft, otherwise it returns false
.
tan array of tag names that any matching draft should include.
tan array of tag names that any matching draft should exclude.
// Example
editor.TA_loadRecentDraftLast4Weeks(["foo", "bar"], ["quz"]);
Load a draft created in the previous calendar month.
The function accepts arrays of tags as selection criteria.
If there are no drafts that match the selection criteria, no drafts will be loaded. If there is
just one draft, that will be loaded. If there is more than one draft, the user will be presented with a
prompt to choose which draft to load.
The function returns true
if it loads a draft, otherwise it returns false
.
tan array of tag names that any matching draft should include.
tan array of tag names that any matching draft should exclude.
// Example
editor.TA_loadRecentDraftLastMonth(["foo", "bar"], ["quz"]);
Load a draft created in the last 8 to 14 calendar days inclusive.
The function accepts arrays of tags as selection criteria.
If there are no drafts that match the selection criteria, no drafts will be loaded. If there is
just one draft, that will be loaded. If there is more than one draft, the user will be presented with a
prompt to choose which draft to load.
The function returns true
if it loads a draft, otherwise it returns false
.
tan array of tag names that any matching draft should include.
tan array of tag names that any matching draft should exclude.
// Example
editor.TA_loadRecentDraftLastWeek(["foo", "bar"], ["quz"]);
Load a draft created in the current calendar month.
The function accepts arrays of tags as selection criteria.
If there are no drafts that match the selection criteria, no drafts will be loaded. If there is
just one draft, that will be loaded. If there is more than one draft, the user will be presented with a
prompt to choose which draft to load.
The function returns true
if it loads a draft, otherwise it returns false
.
tan array of tag names that any matching draft should include.
tan array of tag names that any matching draft should exclude.
// Example
editor.TA_loadRecentDraftThisMonth(["foo", "bar"], ["quz"]);
Load a draft created in the last 7 calendar days, including today.
The function accepts arrays of tags as selection criteria.
If there are no drafts that match the selection criteria, no drafts will be loaded. If there is
just one draft, that will be loaded. If there is more than one draft, the user will be presented with a
prompt to choose which draft to load.
The function returns true
if it loads a draft, otherwise it returns false
.
tan array of tag names that any matching draft should include.
tan array of tag names that any matching draft should exclude.
// Example
editor.TA_loadRecentDraftThisWeek(["foo", "bar"], ["quz"]);
Load a draft created today.
The function accepts arrays of tags as selection criteria.
If there are no drafts that match the selection criteria, no drafts will be loaded. If there is
just one draft, that will be loaded. If there is more than one draft, the user will be presented with a
prompt to choose which draft to load.
The function returns true
if it loads a draft, otherwise it returns false
.
tan array of tag names that any matching draft should include.
tan array of tag names that any matching draft should exclude.
// Example
editor.TA_loadRecentDraftToday(["foo", "bar"], ["quz"]);
Load a draft created today or yesterday.
The function accepts arrays of tags as selection criteria.
If there are no drafts that match the selection criteria, no drafts will be loaded. If there is
just one draft, that will be loaded. If there is more than one draft, the user will be presented with a
prompt to choose which draft to load.
The function returns true
if it loads a draft, otherwise it returns false
.
tan array of tag names that any matching draft should include.
tan array of tag names that any matching draft should exclude.
// Example
editor.TA_loadRecentDraftTodayOrYesterday(["foo", "bar"], ["quz"]);
Load a draft created yesterday.
The function accepts arrays of tags as selection criteria.
If there are no drafts that match the selection criteria, no drafts will be loaded. If there is
just one draft, that will be loaded. If there is more than one draft, the user will be presented with a
prompt to choose which draft to load.
The function returns true
if it loads a draft, otherwise it returns false
.
tan array of tag names that any matching draft should include.
tan array of tag names that any matching draft should exclude.
// Example
editor.TA_loadRecentDraftYesterday(["foo", "bar"], ["quz"]);
Inserts a script fence block marker around the currently selected text. Accepts an optional parameter to set a code type for syntax highlighting.
the text to insert after the first set of triple backticks that is used to set syntax highlighting where available. Default is none.
// Example
editor.TA_mdScriptSelectedText("javascript");
Inserts a markdown link with the page title as the text using a URL on the clipboard.
// Example
editor.TA_mdTitleLinkFromClipboardURL();
Inserts a markdown link with the page title as the text using a URL selected in the editor.
// Example
editor.TA_mdTitleLinkFromSelectedURL();
Replace new lines to merge selected text into one line. Effectively concatenates multiple selected lines into one line (assuming the 'spacer' parameter does not contain a new line). The default character to concatenate lines with is a space, but can be set to any string. The function also allows an aray of exceptions to be specified, whereby if a line ends with one of those string, no spacer will be added. This can be further modified by a similar array that can specify when a line ending with a particular character string will always force a spacer to be included. The function returns the modified, merged string and replaces the selected text with it in the editor.
the string to use when joining two lines with a 'spacer'. Defaults to a single space character.
determines if lines should be trimmed of whitespace before joining. This defaults to true
.
an array of line endings where the next line should be joined to the current one with no 'spacer'. Defaults to an array including a hyphen, em dash, en dash and forward slash.
an array of line endings where the next line should always be joined to the current one with a 'spacer'. Defaults to an empty array.
editor.TA_mergeSelectedLines();
Move the line selection down by one line.
The line selection includes any line in the current selection. That group of lines is exchanged with the next line.
The function will return true
if a next line was available and false
if no exchange was possible.
// Example
editor.TA_moveLinesDown();
Move the line selection to the end of the Drafts editor.
The line selection includes any line in the current selection. That group of lines is moved to the end of the draft currently being edited.
The function will return true
if the lines were moved and false
if the selection was already at the end of the text being edited.
// Example
editor.TA_moveLinesToEnd();
Move the line selection to the start of the Drafts editor.
The line selection includes any line in the current selection. That group of lines is moved to the start of the draft currently being edited.
The function will return true
if the lines were moved and false
if the selection was already at the start of the text being edited.
// Example
editor.TA_moveLinesToStart();
Move the line selection up by one line.
The line selection includes any line in the current selection. That group of lines is exchanged with the previous line.
The function will return true
if a previous line was available and false
if no exchange was possible.
// Example
editor.TA_moveLinesUp();
Navigate to a navigation marker by name. Repositions the cursor to the named navigation marker if it exists. This function will only navigate to the first instance of a named navigation marker in the currently loaded draft.
// Example
editor.TA_navigateToMarkerByName("Conclusion");
Open the URL for the link under the cursor.
The function attempts to locate a URL under the cursor, but will also work for the cursor being in an HTML tag or a Markdown styled link block too.
To work with an HTML tag, the cursor must be in the initial anchor tag. To work with a Markdown block, the cursor can be anywhere in the block. For
other links, the cursor must be in the URL. Any found URL will be opened. If no URL is found, an error message of "No valid URL found at cursor" will be displayed.
Returns the URL or undefined
if no URL is found.
// Example
editor.TA_openURLAtCursor();
Prefix all lines in the loaded draft with a string of characters.
the string of characters to add to the start of each line in the editor.
// Example
editor.TA_prefixAllLines("-");
Prefix all non-blank lines in the loaded draft with a string of characters.
the string of characters to add to the start of each non-blank line in the editor.
// Example
editor.TA_prefixAllNonBlankLines();
Add content to the start of the editor and retain the current selection.
text to add to the start of the editor content.
// Example
editor.TA_prefixDraftEditorContent("---start---\n");
Prefix text to the start of the current draft being edited. The original selection remains intact.
text to be inserted at the start of the editor's draft.
text to be inserted at the start of the editor's draft, after the other inserted text. Defaults to a single new line.
// Example
editor.TA_prepend("# Prologue", "\n\n");
Add a string to the start of the lines at least partially in a selection, without affacting the selected range of text.
the text to add to the start of each line.
// Example
editor.TA_prependLinesRetainSelection("\t");
Process each line at least partially included in the selection with a function and replace those lines (not just the selection) with the result.
the function that should be used to process each line.
// Example
function hi(strName)
{
return "Hello " + strName;
}
editor.TA_processExtendedLinesFunctionReplace(hi);
// Process each line at least partially included in the selection with a function and return the result.
the function that should be used to process each line.
// Example
function hi(strName)
{
return "Hello " + strName;
}
alert(editor.TA_processExtendedLinesFunctionRetain(hi);;
Process the Markdown or Cross Link at the current cursor location.
The cursor is taken to be at the start of any selection and must fall within (not on) the boundary markers ("[)
" for Markdown links)
and "[[]]
" for cross links). If no valid link is found a message is displayed to the user. If a valid link is found, the
selection is adjusted to match the link construction, and the appropriate portion ot it will be processed.
The function will return true
if a link to process was identified, and false
if none was identified.
// Example
editor.TA_processMDXLink();
Process each line in the selection with a function and replace the selection with the result.
the function that should be used to process each line.
// Example
function hi(strName)
{
return "Hello " + strName;
}
editor.TA_processSelectedLinesFunctionReplace(hi);
// Process each line in the selection with a function and return the result.
the function that should be used to process each line.
// Example
function hi(strName)
{
return "Hello " + strName;
}
alert(editor.TA_processSelectedLinesFunctionRetain(hi);;
Set Drafts to not be in a persistent/focussed reading mode.
Reading mode is set by having each of the following items as true
.
false
(all three by default).sets the link mode, defaults to false
.
sets the focus mode, defaults to false
.
sets the idle disabled property, defaults to false
.
// Example
editor.TA_readingModeDisable();
Set Drafts to a persistent/focussed reading mode.
Reading mode is set by having each of the following items as true
.
// Example
editor.TA_readingModeEnable();
Determine if Drafts is in a persistent/focussed reading mode.
Reading mode is set by having each of the following items as true
.
Returns true
if reading mode is enabled, and false
if not.
// Example
editor.TA_readingModeIsEnabled();
Show the current Boolean states of the properties used to set reading mode.
The information is displayed in a simple alert, and is intended primarily for use in debugging.
Reading mode is set by having each of the following items as true
.
Returns true
if reading mode is enabled, and false
if not.
// Example
editor.TA_readingModeShowProperties();
Toggle Drafts to/from a persistent/focussed reading mode.
Reading mode is set by having each of the following items as true
.
Because the mode is defined as three truths, if any one is false, the effect is Drafts is out of reading mode.
This function allows you to set any or all three of these values to false
(all three by default).
Returns true
if reading mode is enabled, and false
if not.
// Example
editor.TA_readingModeToggle(true, false, true);
Remove a text string in the editor and retain the equivalent current selection. Even if the selected text contains text to be removed, the function accounts for this and adjusts the selection accordingly.
text to be found and replaced.
Duplicate the current line(s) the cursor/current selection is on, a prompted number of times. At the end of processing, the cusor is placed at the end of the replacement/duplication section.
the number of times to duplicate the line as initialy presented to the user. If unspecified, defaults to the value specified in the library setting duplicateLinesDefault
.
// Example
editor.TA_repeatDuplicateCurrentLineAsk(3);
Replace the content of the line(s) the cursor/current selection is on, accommodating any trailing new line. If there is a new line at the end of the final line and there isn't one at the end of the replacement text string, then a new line will be automatically appended. Returns the replacement text (including any additional new line).
the text to use as a replacement.
// Example
editor.TA_replaceCurrentLine("Replacement text goes here.");
Replace one text string with another in the editor and retain the equivalent current selection. Even if the selected text contains text to be replaced, and the resulting size and relative position within the editor content changes, the function accounts for this and adjusts the selection accordingly.
text to be found and replaced.
text to replace the found text with.
// Example
editor.TA_replaceDraftEditorContent("foo", "bar");
Replace one text string with another in a text selection.
The function is based on the core String
function, replaceAll()
, and so supports the use of regular expressions and replacement
string options that function does.
// Example
//Case sensitive replacement
editor.TA_replaceInSelection("foo", "bar");
//Case insensitive replacement based on RegEx.
editor.TA_replaceInSelection(/quz/ig, "qux");
Update a specified (by heading) section by adding text at the end of the section. The heading is the navigation marker including whatever prefix it has to identify it as a marker (e.g. a Markdown heading level), whereas the body is everything that follows up to the next marker or the end of the draft. The third parameter of the index is not the index of the section, but the index of the results that match the selection. Headings are not necessarily unique, so while it will default to the first (zero-indexed) element in the array of results returned, if you know it is not the first that you wish to use, you can specify the which element to use by specifying the index. The function returns the updated content (including both the heading, the body, and the additional text).
the heading of the section whose content should be appended to.
the text to add to the end of the specified section.
the optional index of the section match whose content should be retrieved based on the array of matched headings. The default value is 0
.
// Example
alert(editor.TA_sectionAppendByHeading("## Tasks", "Text to add to the end of the third Tasks section\n", 2));
Update a specified (by index) section by adding text at the end of the section.
The heading is the navigation marker including whatever prefix it has to identify it as a marker (e.g. a Markdown heading level),
whereas the body is everything that follows up to the next marker or the end of the draft. The indexing is zero based, so the first
section will have an index of 0
.
The function returns the updated content (including both the heading, the body, and the additional text).
the text to add to the end of the specified section.
the index of the section whose content should be retrieved based on the array of matched headings.
// Example
alert(editor.TA_sectionAppendByIndex("Text to add to the end of the third section\n", 2));
Get the body of a section based on the heading of the navigation marker in the editor.
The heading is the navigation marker including whatever prefix it has to identify it as a marker (e.g. a Markdown heading level),
whereas the body is everything that follows up to the next marker or the end of the draft.
The function returns the body, but will return undefined
if the index specified exceeds the available matched section indexes.
the heading of the section whose body should be retrieved.
the optional index of the section match whose content should be retrieved based on the array of matched headings. The default value is 0
.
// Example
alert(editor.TA_sectionBodyByHeading("## Tasks", 2));
Get the body of a section based on the index of the navigation marker in the editor.
The heading is the navigation marker including whatever prefix it has to identify it as a marker (e.g. a Markdown heading level),
whereas the body is everything that follows up to the next marker or the end of the draft.
The function returns the body, but will return undefined
if the index specified exceeds the available section indexes.
the index of the section whose heading should be retrieved.
// Example
alert(editor.TA_sectionBodyByIndex(1));
Get the content (heading and body) of a navigation marker section in the editor based on it's heading.
The heading is the navigation marker including whatever prefix it has to identify it as a marker (e.g. a Markdown heading level),
whereas the body is everything that follows up to the next marker or the end of the draft.
The second parameter of the index is not the
index of the section, but the index of the results that match the selection. Headings are not necessarily unique, so while it will default to
the first (zero-indexed) element in the array of results returned, if you know it is not the first that you wish to use, you can specify
which element to use by specifying the index.
If the index specified exceeds the index of matching sections, an undefined
result will be returned.
the heading of the section whose content should be retrieved.
the optional index of the section whose content should be retrieved based on the array of matched headings.
// Example
alert(editor.TA_sectionGetContentByHeading("## Tasks"), 0);
Get the content (heading and body) of a navigation marker section in the editor based on it's navigation marker index.
The heading is the navigation marker including whatever prefix it has to identify it as a marker (e.g. a Markdown heading level),
whereas the body is everything that follows up to the next marker or the end of the draft. The indexing is zero based, so the first
section will have an index of 0
. If the index specified exceeds the index of available sections, an undefined
result will be returned.
the index of the section whose content should be retrieved.
// Example
alert(editor.TA_sectionGetContentByIndex(2));
Get an array of section headings from the navigation markers in the editor. The heading is the navigation marker including whatever prefix it has to identify it as a marker (e.g. a Markdown heading level).
// Example
alert(editor.TA_sectionGetHeadings());
Generate an array of indexes for navigation markers in the editor with a given heading. The heading is the navigation marker including whatever prefix it has to identify it as a marker (e.g. a Markdown heading level).
the heading of the section whose content should be retrieved.
Get the heading of a section based on the index of the navigation marker in the editor.
The heading is the navigation marker including whatever prefix it has to identify it as a marker (e.g. a Markdown heading level).
The function returns the heading, but will return undefined
if the index specified exceeds the available section indexes.
the index of the section whose heading should be retrieved.
// Example
alert(editor.TA_sectionHeadingByIndex(1));
Update a specified (by heading) section by adding text between the heading and the body of the section. The heading is the navigation marker including whatever prefix it has to identify it as a marker (e.g. a Markdown heading level), whereas the body is everything that follows up to the next marker or the end of the draft. The fourth parameter of the index is not the index of the section, but the index of the results that match the selection. Headings are not necessarily unique, so while it will default to the first (zero-indexed) element in the array of results returned, if you know it is not the first that you wish to use, you can specify the which element to use by specifying the index. The function returns the updated content (including both the heading, the body, and the additional text).
the heading of the section whose content should be prepended to.
the text to add to the start of the specified section, between the heading and the body.
the optional index of the section match whose content should be retrieved based on the array of matched headings. The default value is 0
.
// Example
alert(editor.TA_sectionPrependByHeading("## Tasks", "Text to add to the start of the third Tasks section\n", 2));
Update a specified (by index) section by adding text between the heading and the body of the section.
The heading is the navigation marker including whatever prefix it has to identify it as a marker (e.g. a Markdown heading level),
whereas the body is everything that follows up to the next marker or the end of the draft. The indexing is zero based, so the first
section will have an index of 0
.
The function returns the updated content (including both the heading, the body, and the additional text).
the text to add to the start of the specified section, between the heading and the body.
the index of the section whose content should be retrieved based on the array of matched headings.
// Example
alert(editor.TA_sectionPrependByIndex("Text to add to the start of the third section\n", 2));
Update a specified (by heading) section by prepending text before the body (after the heading), and appending other text after the body. The heading is the navigation marker including whatever prefix it has to identify it as a marker (e.g. a Markdown heading level), whereas the body is everything that follows up to the next marker or the end of the draft. The fourth parameter of the index is not the index of the section, but the index of the results that match the selection. Headings are not necessarily unique, so while it will default to the first (zero-indexed) element in the array of results returned, if you know it is not the first that you wish to use, you can specify the which element to use by specifying the index. The function returns the updated content (including both the heading, the body, and the additional text).
the heading of the section whose content should be prepended/appended to.
the text to add to the start of the specified section, between the heading and the body.
the text to add to the end of the specified section.
the optional index of the section match whose content should be retrieved based on the array of matched headings. The default value is 0
.
// Example
alert(editor.TA_sectionWrapByHeading("## Tasks", "Text to add to the start of the third Tasks section\n", "Text to add to the end of the third Tasks section\n", 2));
Update a specified (by index) section by prepending text before the body (after the heading), and appending other text after the body.
The heading is the navigation marker including whatever prefix it has to identify it as a marker (e.g. a Markdown heading level),
whereas the body is everything that follows up to the next marker or the end of the draft. The indexing is zero based, so the first
section will have an index of 0
.
The function returns the updated content (including both the heading, the body, and the additional text).
the text to add to the start of the specified section, between the heading and the body.
the text to add to the end of the specified section.
the index of the section whose content should be retrieved based on the array of matched headings.
// Example
alert(editor.TA_sectionWrapByIndex("Text to add to the start of the third section\n", "Text to add to the end of the third section\n", 2));
Select all content in the editor. Returns the text in the editor.
// Example
editor.TA_selectAll();
Select the current line. If more than one line is selected, the selection will be extended to the start of the first line and the end of the last line. If the selection includes some of line 1, all of line 2 and some of line 3, all of lines 1, 2 and 3 will be selected.
option to exclude selection of the new line character at the end of the final line. Defaults to true
.
// Example
editor.TA_selectLine();
Select the current line based on the end of any selection. If the selection includes some of line 1, all of line 2 and some of line 3, all of line 3 will be selected.
// Example
editor.TA_selectLineAft();
Select the current line based on the start of any selection. If the selection includes some of line 1, all of line 2 and some of line 3, all of line 1 will be selected.
// Example
editor.TA_selectLineFore();
Select the next line. The next line is taken to be the line after the current selection, but if there is no line after, the selection will change to be the last line.
// Example
editor.TA_selectNextLine();
Select a paragraph of text based on the paragraph the cursor is currently (or ths start of a text selection).
A paragraph is defined for selection purposes as a set of characters delimited by any combination of
draft start, draft end and a sequence of two new consecutive line characters, a single newline
constituting a line break rather than a paragraph break.
Please note that there are TA_selectLine*()
functions provided should you need those instead.
Please also take note that a non-empty line containing whitespace between two text blocks is considered
for these purposes to be more content in the same paragraph and could join two otherwise dissociated
paragraphs of text into a single paragraph.
The return is the content of the selected paragraph.
// Example
editor.TA_selectParagraph();
Select the previous line. The previous line is taken to be the line prior to the current selection, but if there is no prior line, the selection will change to be the first line.
// Example
editor.TA_selectPreviousLine();
Delimit the selected lines with the specified prefix and suffix strings. Returns the range array (position & length) for the current selection.
the string of characters to add to the start of each line.
the string of characters to add to the start of each line.
// Example
editor.TA_selectedLinesDelimit();
Prefix the selected lines with the specified prefix string. Returns the range array (position & length) for the current selection.
the string of characters to add to the start of each line.
// Example
editor.TA_selectedLinesPrefix();
Suffix the selected lines with the specified prefix string. Returns the range array (position & length) for the current selection.
the string of characters to add to the start of each line.
// Example
editor.TA_selectedLinesSuffix();
Wrap the selected lines at both ends with a specified string. Returns the range array (position & length) for the current selection.
the string of characters to add to the start and end of each line.
// Example
editor.TA_selectedLinesWrap();
Append text to every word in the current selection. The editor is activated after the update.
the text to suffix each word with.
// Example
editor.TA_selectionAppendWords("**"));
Wrap text to the start and end of every word in the current selection. The editor is activated after the update.
the text to prefix and suffix each word with.
// Example
editor.TA_selectionDelimitWords("*"));
Display information about how many characters are currently selected.
// Example
editor.TA_selectionDisplayCharacterCount();
Display character, word and line count information about current selection. Returns the text displayed.
// Example
editor.TA_selectionDisplayCount();
Display information about how many lines are currently selected.
// Example
editor.TA_selectionDisplayLineCount();
Display information about how many words are currently selected.
// Example
editor.TA_selectionDisplayWordCount();
Extend the character selection left by the specified number of characters. Returns the range array (position & length) for the extended selection.
number of characters to extend the selection by to the left, defaults to one character.
// Example
editor.TA_selectionExtendLeft(3);
Extend the character selection right by the specified number of characters. Returns the range array (position & length) for the extended selection.
number of characters to extend the selection by to the left, defaults to one character.
// Example
editor.TA_selectionExtendRight(3);
Extend the current text selection to encompass a word. For the purposes of this function, a word is an unbroken alphanumeric sequence of characters, or such sequences of characters which are connected by simple hyphens (ASCII 45), en dashes (ASCII 150), em dashes (ASCII 151) or underscores (ASCII 95). A string of, or conatining, other symbols (including periods (ASCII 46) is not considered a word. The intent is that hyphenations are counted as a single word for the purposes of selection. If the cursor is placed within a single word, or the selection is a subset of characters within a word, the word will be selected. If the cursor or selection is not in a word, the selection will remain unchanged, unless it is immediately before or immediately after a word, in which case, that word will be selected. If the cursor or selection spans multiple words, the word selection will be based on the cursor being positioned at the start of the selection. Returns the range array (position & length) for the extended selection.
// Example
editor.TA_selectionExtendWord(3);
Prepend text to every word in the current selection. The editor is activated after the update.
the text to prefix each word with.
// Example
editor.TA_selectionPrependWords("**"));
Reduce the character selection to the left by the specified number of characters. Returns the range array (position & length) for the reduced selection.
number of characters to reduce the selection by to the left, defaults to one character.
// Example
editor.TA_selectionReduceLeft();
Reduce the character selection to the right by the specified number of characters. Returns the range array (position & length) for the reduced selection.
number of characters to reduce the selection by to the right, defaults to one character.
// Example
editor.TA_selectionReduceRight();
Reduce the text selection to position the cursor to the end of the selection. Returns the resulting cursor position.
// Example
editor.TA_selectionReduceToEnd();
Reduce the text selection to position the cursor to the start of the selection. Returns the resulting cursor position.
// Example
editor.TA_selectionReduceToStart();
Prefix and suffix text strings to every word in the current selection. The editor is activated after the update.
the text to prefix each word with.
the text to suffix each word with.
// Example
editor.TA_selectionWrapWords("<", ">"));
Based on the current selection, sets the full text of the lines the selection partially or full includes; any final, trailing newline will be excluded from replacement.
the text that will replace the text of the lines the selection partially or full includes.
// Example
editor.TA_setCurrentLineNoNewLine("foo");
Based on the current selection, sets the full text of the lines the selection partially or full includes.
the text that will replace the text of the lines the selection partially or full includes.
// Example
editor.TA_setCurrentLinesContent("foo");
Select all content in the editor.
// Example
editor.TA_setSelectedRangeAll();
Jump to the end of the content in the editor.
// Example
editor.TA_setSelectedRangeEnd();
Jump to the start of the content in the editor.
// Example
editor.TA_setSelectedRangeStart();
Share selection or Draft (if no selection) as HTML (from Markdown). The text is run through Drafts' Markdown conversion engine to convert the Markdown to HTML. Also activates the editor and returns the shared content.
// Example
editor.TA_shareHTML();
Share selection or Draft (if no selection) as raw text. Also activates the editor and returns the shared content.
// Example
editor.TA_shareText();
Sort all editor lines alphabetically. Returns the sorted text.
// Example
editor.TA_sortAllAlphabetic();
Sort all editor lines based on numeric value rather than alphabetic sorting. It will sort "32" before "232", unlike alphabetic. Returns the sorted text.
// Example
editor.TA_sortAllNumeric();
Sort all editor lines into a random order. Returns the sorted text.
// Example
editor.TA_sortAllRandom();
Sort all editor lines reverse alphabetically. Returns the sorted text.
// Example
editor.TA_sortAllReverseAlphabetic();
Sort all editor lines based on reverse numeric value rather than reverse alphabetic sorting. It will sort "232" before "32", unlike reverse alphabetic. Returns the sorted text.
// Example
editor.TA_sortAllReverseNumeric();
Sort selected lines alphabetically. Selection is automatically extended to include all of any lines partially selected, and the content is updated with the sorted text. The sorted text is also returned by the funtion.
// Example
editor.TA_sortSelectionAlphabetic();
Sort selected lines based on numeric value rather than alphabetic sorting. It will sort "32" before "232", unlike alphabetic. Returns the sorted text.
// Example
editor.TA_sortSelectionNumeric();
Sort the selection of lines into a random order. Returns the sorted text.
// Example
editor.TA_sortSelectionRandom();
Sort selected lines reverse alphabetically. Selection is automatically extended to include all of any lines partially selected, and the content is updated with the sorted text. The sorted text is also returned by the funtion.
// Example
editor.TA_sortSelectionReverseAlphabetic();
Sort selected lines based on reverse numeric value rather than reverse alphabetic sorting. It will sort "232" before "32", unlike reverse alphabetic. Returns the sorted text.
// Example
editor.TA_sortSelectionReverseNumeric();
Add content to the end of the editor and retain the current selection.
text to add to the end of the editor content.
// Example
editor.TA_suffixDraftEditorContent("\n---end---");
Modifies whether the current line in the editor is a Taskpaper project or not. Taskpaper project lines end with a colon. This function is specifying whether the line should end in a colon.
when set to true
forces the line to be a project.
when set to true
forces the line to not be a project.
// Example
editor.TA_taskpaperModifyCurrentLineProject();
Modifies whether the current line in the editor is a Taskpaper task or not.
Taskpaper tasks start with a hyphen and space (with any amount of whitespace preceding it).
At a basic level the function is checking for optional whitespace, a hyphen and space at the start, and
then inserting or removing one as necessary to toggle if the line is a task or not.
However, the two parameters provide overrides.
If both parameters are false
, the task status will be a simple toggle on/off.
If the parameters are true
and false
respectively, it will always be returned as a task.
If the parameters are false
and true
respectively, it will never be returned as a tasl.
If the parameters are true
and true
, the original string is returned.
when set to true
, the function always modifies to set the line to be a Taskpaper task.
when set to true
, the function always modifies to set the line to not be a Taskpaper task.
// Example
editor.TA_taskpaperModifyCurrentLineTask(false, false);
Set the current line in the editor to not be a Taskpaper project. Taskpaper project lines end with a colon. This function sets the line to not end in a colon.
// Example
editor.TA_taskpaperSetCurrentLineToNotProject();
Set the current line in the editor to not be a Taskpaper task. Taskpaper tasks start with a hyphen and space (with any amount of whitespace preceding it). The function is checking for optional whitespace, a hyphen and space at the start, and then removing as necessary to ensure that the line is not a task.
// Example
editor.TA_taskpaperSetCurrentLineToNotTask();
Set the current line in the editor to be a Taskpaper project. Taskpaper project lines end with a colon. This function sets the line to end in a colon.
// Example
editor.TA_taskpaperSetCurrentLineToProject();
Set the current line in the editor to be a Taskpaper task. Taskpaper tasks start with a hyphen and space (with any amount of whitespace preceding it). The function is checking for optional whitespace, a hyphen and space at the start, and then inserting as necessary to ensure that the line is a task.
// Example
editor.TA_taskpaperSetCurrentLineToTask();
Set the current lines, by full or partial selection, in the editor, to not be Taskpaper projects. Taskpaper project lines end with a colon. This function sets the line endings in the lines of the current selection to not end in colons.
// Example
editor.TA_taskpaperSetExtendedToNotProject();
Set the current lines, by full or partial selection, in the editor, to not be Taskpaper tasks. Taskpaper tasks start with a hyphen and space (with any amount of whitespace preceding it). The function is checking for optional whitespace, a hyphen and space at the start of each line in the extended selection, and then removing as necessary to ensure that the line is not a task.
// Example
editor.TA_taskpaperSetExtendedToNotTask();
Set the current lines, by full or partial selection, in the editor, to be Taskpaper projects. Taskpaper project lines end with a colon. This function sets the line endings in the lines of the current selection to end in colons.
// Example
editor.TA_taskpaperSetExtendedToProject();
Set the current lines, by full or partial selection, in the editor, to be Taskpaper tasks. Taskpaper tasks start with a hyphen and space (with any amount of whitespace preceding it). The function is checking for optional whitespace, a hyphen and space at the start of each line in the extended selection, and then inserting as necessary to ensure that the line is a task.
// Example
editor.TA_taskpaperSetExtendedToTask();
Set the current selection in the editor to not be Taskpaper projects. Taskpaper project lines end with a colon. This function sets the line endings in the current selection to not end in colons.
// Example
editor.TA_taskpaperSetSelectedToNotProject();
Set the current selection in the editor to not be Taskpaper tasks. Taskpaper tasks start with a hyphen and space (with any amount of whitespace preceding it). The function is checking for optional whitespace, a hyphen and space at the start of each line in the selection, and then removing as necessary to ensure that the line is not a task.
// Example
editor.TA_taskpaperSetSelectedToNotTask();
Set the current selection in the editor to be Taskpaper projects. Taskpaper project lines end with a colon. This function sets the line endings in the current selection to end in colons.
// Example
editor.TA_taskpaperSetSelectedToProject();
Set the current selection in the editor to be Taskpaper tasks. Taskpaper tasks start with a hyphen and space (with any amount of whitespace preceding it). The function is checking for optional whitespace, a hyphen and space at the start of each line in the selection, and then inserting as necessary to ensure that the line is a task.
// Example
editor.TA_taskpaperSetSelectedToTask();
Toggle whether the current line in the editor is a Taskpaper project or not. Taskpaper project lines end with a colon. This function is just toggling if the line ends in a colon.
// Example
editor.TA_taskpaperToggleCurrentLineProject();
Toggle whether the current line in the editor is a Taskpaper task or not. Taskpaper tasks start with a hyphen and space (with any amount of whitespace preceding it). The function is checking for optional whitespace, a hyphen and space at the start, and then inserting or removing the hyphen and space as necessary to toggle if the line is a task or not.
// Example
editor.TA_taskpaperToggleCurrentLineTask();
Toggle whether the current lines, by full or partial selection, in the editor, are Taskpaper projects or not. Taskpaper project lines end with a colon. This function toggles the line endings in the lines of the current selection to end in colons if they do not currently, and to not end in colons if they currently do.
// Example
editor.TA_taskpaperToggleExtendedProject();
Toggle whether the current lines, by full or partial selection, in the editor, are Taskpaper tasks or not. Taskpaper tasks start with a hyphen and space (with any amount of whitespace preceding it). The function is checking for optional whitespace, a hyphen and space at the start of each line in the extended selection, and then inserting or removing the hyphen and space as necessary to toggle if the line is a task or not.
// Example
editor.TA_taskpaperToggleExtendedTask();
Toggle whether the current selection in the editor are Taskpaper projects or not. Taskpaper project lines end with a colon. This function toggles the line endings in the current selection to end in colons if they do not currently, and to not end in colons if they currently do.
// Example
editor.TA_taskpaperToggleSelectedProject();
Toggle whether the current selection in the editor are Taskpaper tasks or not. Taskpaper tasks start with a hyphen and space (with any amount of whitespace preceding it). The function is checking for optional whitespace, a hyphen and space at the start of each line in the selection, and then inserting or removing the hyphen and space as necessary to toggle if the line is a task or not.
// Example
editor.TA_taskpaperToggleSelectedTask();
Get the text between the cursor position and the end of the line. The cursor position is taken to be the start of any selection. Returns the text between the cursor's position, and the end of the line the text is on, excluding any newline character.
// Example
alert(editor.TA_textToLineEnd());
Get the text between the cursor position and the start of the line. The cursor position is taken to be the start of any selection. Returns the text between the start of the line the cursor is on up to the cursor's position.
// Example
alert(editor.TA_textToLineStart());
Check if the current cursor position to the line start is a Markdown list or a blank.
The cursor position is taken to be the start of any selection and checks the content to the start of that line.
Returns true
if the text to the line start conforms to being a Markdown bullet, a Markdown numbered list entry, or whitespace.
Otherwise, the function returns false
.
// Example
alert(editor.TA_textToLineStartIsMDListOrBlank());
Load the previously loaded draft.
// Example
editor.TA_toggleLoadPreviousLoad();
Load the last modified draft. If the current draft is the last modified, it will look at the next one chronologically.
// Example
editor.TA_toggleLoadPreviousModified();
Remove a string from the end of the lines at least partially in a selection, without affacting the selected range of text.
the text to remove from the end of each line.
// Example
editor.TA_unappendLinesRetainSelection("[STOP]");
Remove an indentation. The lines included by the current selection will have a single indentation string removed from the start.
the text string to be used for indentation of a line.
// Example
editor.TA_unindent("\t");
Remove a string from the start of the lines at least partially in a selection, without affacting the selected range of text.
the text to remove from the start of each line.
// Example
editor.TA_unprependLinesRetainSelection("\t");
With a text selection in place, prefix and append a set of characters to the line selection. If more than one line is selected, the selection will be extended to the start of the first line and the end of the last line. The initial selection is recalculated and restored, as well as the editor being activated.
specifies the string of characters to add before the paragraph.
specifies the string of characters to add after the paragraph.
// Example
editor.TA_wrapLines("--START--\n", "\n--END--");
With a text selection in a paragraph, prefix and append a set of characters to the paragraph.
See TA_selectParagraph()
for how the definition of how a paragraph is established.
The initial selection is recalculated and restored , as well as the editor being activated.
specifies the string of characters to add before the paragraph.
specifies the string of characters to add after the paragraph.
// Example
editor.TA_wrapParagraph("--START--\n", "\n--END--");
With a text selection in place, prefix and append a set of characters to the selection. The initial selection is recalculated and restored, as well as the editor being activated.
specifies the string of characters to add before the selection.
specifies the string of characters to add after the selection.
// Example
editor.TA_wrapSelection("<strong>", "</strong>");
Editor (Drafts)
The ThoughtAsylum library includes a set of extensions to the Editor object