Options
All
  • Public
  • Public/Protected
  • All
Menu

Interface Editor

Editor (Drafts)

The ThoughtAsylum library includes a set of extensions to the Editor object

Hierarchy

  • Editor

Index

Methods

Methods

TA_append

  • TA_append(p_strText: string, p_strSeparator?: string): void
  • Append text to the end of the current draft being edited. The original selection remains intact.

    Parameters

    • p_strText: string

      text to be inserted at the end of the editor's draft.

    • Optional p_strSeparator: string

      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");
      

    Returns void

TA_appendLinesRetainSelection

  • TA_appendLinesRetainSelection(p_strPrefix: string): void
  • Add a string to the end of the lines at least partially in a selection, without affacting the selected range of text.

    Parameters

    • p_strPrefix: string

    Returns void

TA_copyLine

  • TA_copyLine(): void
  • 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();
    

    Returns void

TA_copyNextLine

  • TA_copyNextLine(): void
  • 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();
    

    Returns void

TA_copyPreviousLine

  • TA_copyPreviousLine(): void
  • 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();
    

    Returns void

TA_cursorMoveAfterNextOpenMarker

  • TA_cursorMoveAfterNextOpenMarker(p_strMarkerStart: string): Boolean
  • 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("{{");
    

    Parameters

    • p_strMarkerStart: string

    Returns Boolean

TA_cursorMoveAfterPreviousOpenMarker

  • TA_cursorMoveAfterPreviousOpenMarker(p_strMarkerEnd: string): Boolean
  • 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("{{");
    

    Parameters

    • p_strMarkerEnd: string

    Returns Boolean

TA_cursorMoveBeforeNextCloseMarker

  • TA_cursorMoveBeforeNextCloseMarker(p_strMarkerEnd: string): Boolean
  • 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("}}");
    

    Parameters

    • p_strMarkerEnd: string

    Returns Boolean

TA_cursorMoveBeforePreviousCloseMarker

  • TA_cursorMoveBeforePreviousCloseMarker(p_strMarkerEnd: string): Boolean
  • 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("}}");
    

    Parameters

    • p_strMarkerEnd: string

    Returns Boolean

TA_cursorToEnd

  • TA_cursorToEnd(): number
  • Move the cursor to the end of the draft. Also activates the editor and returns the cursor position.

    // Example
    editor.TA_cursorToEnd();
    

    Returns number

TA_cursorToEndOfPreviousLine

  • TA_cursorToEndOfPreviousLine(): number
  • Move the cursor to the end of the previous line (above). Returns the position of the cursor.

    // Example
    editor.TA_cursorToEndOfPreviousLine();
    

    Returns number

TA_cursorToLeft

  • Move the cursor left by one or more characters. Returns the range array (position & length) for the cursor.

    Parameters

    • Optional p_intCharacters: number

      number of characters to move the cursor by to the left, defaults to one character.

      // Example
      editor.TA_cursorToLeft(3);
      

    Returns selectionRange

TA_cursorToLineEnd

  • TA_cursorToLineEnd(): number
  • 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();
    

    Returns number

TA_cursorToLineStart

  • TA_cursorToLineStart(): number
  • 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();
    

    Returns number

TA_cursorToParagraphEnd

  • TA_cursorToParagraphEnd(): number
  • 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();
    

    Returns number

TA_cursorToParagraphStart

  • TA_cursorToParagraphStart(): number
  • 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();
    

    Returns number

TA_cursorToRight

  • Move the cursor right by one or more characters. Returns the range array (position & length) for the cursor.

    Parameters

    • Optional p_intCharacters: number

      number of characters to move the cursor by to the right, defaults to one character.

      // Example
      editor.TA_cursorToRight(3);
      

    Returns selectionRange

TA_cursorToSelectionEnd

  • TA_cursorToSelectionEnd(): number
  • 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();
    

    Returns number

TA_cursorToSelectionStart

  • TA_cursorToSelectionStart(): number
  • 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();
    

    Returns number

TA_cursorToStart

  • TA_cursorToStart(): number
  • Move the cursor to the start of the draft. Also activates the editor and returns the cursor position.

    // Example
    editor.TA_cursorToStart();
    

    Returns number

TA_cursorToStartOfCurrentSentence

  • Move the cursor to the start of the current sentence. Returns the position of the cursor.

    // Example
    editor.TA_cursorToStartOfCurrentSentence();
    

    Returns selectionRange[]

TA_cursorToStartOfNextLine

  • TA_cursorToStartOfNextLine(): number
  • Move the cursor to the start of the next line (below). Returns the position of the cursor.

    // Example
    editor.TA_cursorToStartOfNextLine();
    

    Returns number

TA_cursorToStartOfNextSentence

  • TA_cursorToStartOfNextSentence(): number
  • Move the cursor to the start of the next sentence. Returns the position of the cursor.

    // Example
    editor.TA_cursorToStartOfNextSentence();
    

    Returns number

TA_cursorToStartOfPreviousSentence

  • TA_cursorToStartOfPreviousSentence(): number
  • Move the cursor to the start of the previous sentence. Returns the position of the cursor.

    // Example
    editor.TA_cursorToStartOfPreviousSentence();
    

    Returns number

TA_cutLine

  • TA_cutLine(): void
  • 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();
    

    Returns void

TA_cutNextLine

  • TA_cutNextLine(): Boolean
  • 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();
    

    Returns Boolean

TA_cutPreviousLine

  • TA_cutPreviousLine(): Boolean
  • 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();
    

    Returns Boolean

TA_deleteCurrentLine

  • TA_deleteCurrentLine(): void
  • 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();
    

    Returns void

TA_deleteCurrentLineAft

  • TA_deleteCurrentLineAft(): void
  • 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();
    

    Returns void

TA_deleteCurrentLineFore

  • TA_deleteCurrentLineFore(): void
  • 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();
    

    Returns void

TA_deleteNextChar

  • TA_deleteNextChar(): void
  • 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();
    

    Returns void

TA_deleteNextLine

  • TA_deleteNextLine(): Boolean
  • 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();
    

    Returns Boolean

TA_deletePreviousLine

  • TA_deletePreviousLine(): Boolean
  • 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();
    

    Returns Boolean

TA_delimitLines

  • TA_delimitLines(p_strDelimit: string): void
  • 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.

    Parameters

    • p_strDelimit: string

      specifies the string of characters to add before and after the paragraph.

      // Example
      editor.TA_delimitLines("\n--- SECTION BREAK ---\n");
      

    Returns void

TA_delimitParagraph

  • TA_delimitParagraph(p_strDelimit: string): void
  • 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.

    Parameters

    • p_strDelimit: string

      specifies the string of characters to add before and after the paragraph.

      // Example
      editor.TA_delimitParagraph("\n--- SECTION BREAK ---\n");
      

    Returns void

TA_delimitSelection

  • TA_delimitSelection(p_strDelimit: string): void
  • 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.

    Parameters

    • p_strDelimit: string

      specifies the string of characters to add before and after the selection.

      // Example
      editor.TA_delimitSelection("**");
      

    Returns void

TA_dictateDateTimeStampLogEntry

  • TA_dictateDateTimeStampLogEntry(): string
  • 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();
    

    Returns string

TA_discourseHideDetails

  • TA_discourseHideDetails(): void
  • Insert a discourse hide details section around the currently selectced text.

    // Example
    editor.TA_discourseHideDetails();
    

    Returns void

TA_duplicateCurrentLine

  • TA_duplicateCurrentLine(): void
  • 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();
    

    Returns void

TA_duplicateCurrentLineNTimes

  • TA_duplicateCurrentLineNTimes(p_intTimes: number): void
  • 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.

    Parameters

    • p_intTimes: number

      the number of duplicates to create.

      // Example
      editor.TA_duplicateCurrentLineNTimes(4);
      

    Returns void

TA_extendedCopy

  • TA_extendedCopy(): Boolean
  • Copy the current selection, or the current line if no selection, to the clipboard. Returns the content of the clipboard.

    // Example
    editor.TA_extendedCopy();
    

    Returns Boolean

TA_extendedCut

  • TA_extendedCut(): Boolean
  • Cut the current selection, or the current line is no selection, to the clipboard. Returns the content of the clipboard.

    // Example
    editor.TA_extendedCut();
    

    Returns Boolean

TA_getCurrentLine

  • TA_getCurrentLine(): string
  • 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();
    

    Returns string

TA_getCurrentLineNoNewLine

  • TA_getCurrentLineNoNewLine(): string
  • 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();
    

    Returns string

TA_getCurrentLinesContent

  • TA_getCurrentLinesContent(): string
  • Based on the current selection, returns the full text of the lines the selection partially or full includes.

    // Example
    alert(editor.TA_getCurrentLinesContent());
    

    Returns string

TA_getLine

  • TA_getLine(): string
  • 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());
    

    Returns string

TA_getNextLineContent

  • TA_getNextLineContent(): string
  • 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();
    

    Returns string

TA_getPreviousLineContent

  • TA_getPreviousLineContent(): string
  • 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 string

TA_getSelectionWide

  • TA_getSelectionWide(): string
  • Returns the selected text, but returns all text if there is no selection.

    // Example
    alert(editor.TA_getSelectionWide();
    

    Returns string

TA_getURLAtCursor

  • TA_getURLAtCursor(): string
  • 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());
    

    Returns string

TA_indent

  • TA_indent(p_strIndent: string): void
  • 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.

    Parameters

    • p_strIndent: string

      the text string to be used for indentation of a line.

      // Example
      editor.TA_indent("\t");
      

    Returns void

TA_insertTextPosAtEnd

  • TA_insertTextPosAtEnd(p_strText: string): void
  • Insert text at the current selection and then move the cursor to the end of the inserted text.

    Parameters

    • p_strText: string

      the text to insert.

      // Example
      editor.TA_insertTextPosAtEnd("foo");
      

    Returns void

TA_insertTimestampyyyyMMddhhmmss

  • TA_insertTimestampyyyyMMddhhmmss(): void
  • Inserts a yyyy-MM-dd-hh.mm.ss format timestamp at the current editor position.

    // Example
    editor.TA_insertTimestampyyyyMMddhhmmss();
    

    Returns void

TA_isTextSelected

  • TA_isTextSelected(): Boolean
  • 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");
    

    Returns Boolean

TA_lineMDHeader

  • TA_lineMDHeader(): void
  • 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();
    

    Returns void

TA_lineMDHeaderN

  • TA_lineMDHeaderN(p_intLevel: number): void
  • 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 😄

    Parameters

    • p_intLevel: number

      the level of the heading this will apply. The level corresponds to the number of prefix hash tags.

      // Example
      editor.TA_lineMDHeaderN(3);
      

    Returns void

TA_lineSubstringWrapInsertion

  • TA_lineSubstringWrapInsertion(p_strRegExPre: string, p_strSubString: string, p_strRegExRemainder: string, p_strPrefix: string, p_strSuffix: string, p_bCaseInsensitive?: Boolean): void
  • 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.

    Parameters

    • p_strRegExPre: string

      a regular expression string to match anything before the substring.

    • p_strSubString: string

      a regular expression string to match the substring which should get wrapped.

    • p_strRegExRemainder: string

      a regular expression string to match the remainder of the string and anything that should not get matched.

    • p_strPrefix: string

      the string of text to insert before the substring.

    • p_strSuffix: string

      the string of text to insert after the substring and any matching post identifier.

    • Optional p_bCaseInsensitive: Boolean

      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*?- ", ".*?", " - .*", "`", "`");
      

    Returns void

TA_lineSubstringWrapInsertions

  • TA_lineSubstringWrapInsertions(p_astrRegExPre: string[], p_astrSubString: string[], p_astrRegExRemainder: string[], p_astrPrefix: string[], p_astrSuffix: string[], p_abCaseInsensitive: Boolean[]): void
  • 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.

    Parameters

    • p_astrRegExPre: string[]

      an array of regular expression strings to match anything before the substring.

    • p_astrSubString: string[]

      an array of regular expression strings to match the substring which should get wrapped.

    • p_astrRegExRemainder: string[]

      an array of regular expression strings to match the remainder of the string and anything that should not get matched.

    • p_astrPrefix: string[]

      an array of strings of text to insert before the substring.

    • p_astrSuffix: string[]

      an array of strings of text to insert after the substring and any matching post identifier.

    • p_abCaseInsensitive: Boolean[]

      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]);
      

    Returns void

TA_loadAc

  • Loads a draft into the editor, and activates the editor.

    // Example
    editor.TA_loadAc(Draft.find("3FF6BA9F-7201-4AF1-9D0E-DFA493696B87"));
    

    Parameters

    Returns Draft

TA_loadAcUUID

  • TA_loadAcUUID(p_strUUID: string): Draft
  • Loads a draft, by UUID, into the editor, and activates the editor.

    // Example
    editor.TA_loadAcUUID("0BACEC09-708F-424B-81E3-39F3BF2A11B7");
    

    Parameters

    • p_strUUID: string

    Returns Draft

TA_loadEmpty

  • Create and load a new empty draft. Returns the newly created draft object.

    // Example
    editor.TA_loadEmpty();
    

    Returns Draft

TA_loadLastCreatedDraft

  • TA_loadLastCreatedDraft(): Draft
  • 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();
    

    Returns Draft

TA_loadLastCreatedDraftIncludeTrashed

  • TA_loadLastCreatedDraftIncludeTrashed(): Draft
  • 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();
    

    Returns Draft

TA_loadLastModifiedDraft

  • TA_loadLastModifiedDraft(): Draft
  • 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();
    

    Returns Draft

TA_loadLastModifiedDraftIncludeTrashed

  • TA_loadLastModifiedDraftIncludeTrashed(): Draft
  • 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();
    

    Returns Draft

TA_loadNewDraftWithContent

  • TA_loadNewDraftWithContent(p_strContent: string): void
  • Create and load a new draft with specific content.

    Parameters

    • p_strContent: string

      the text to use as the content of the draft.

      // Example
      editor.TA_loadNewDraftWithContent("# Heading\nBody of the draft");
      

    Returns void

TA_loadRecentDraft

  • TA_loadRecentDraft(p_dtStart: Date, p_dtEnd: Date, p_strTitle: string, p_astrTagsInclude: string[], p_astrTagsExclude: string[]): Boolean
  • 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.

    Parameters

    • p_dtStart: Date

      the date/time, on or after which, a draft to be included should have been created.

    • p_dtEnd: Date

      the date/time, on or beforre which, a draft to be included should have been created.

    • p_strTitle: string

      the title to display on any draft list.

    • p_astrTagsInclude: string[]

      tan array of tag names that any matching draft should include.

    • p_astrTagsExclude: string[]

      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"]);
      

    Returns Boolean

TA_loadRecentDraftLast2Weeks

  • TA_loadRecentDraftLast2Weeks(p_astrTagsInclude: string[], p_astrTagsExclude: string[]): Boolean
  • 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.

    Parameters

    • p_astrTagsInclude: string[]

      tan array of tag names that any matching draft should include.

    • p_astrTagsExclude: string[]

      tan array of tag names that any matching draft should exclude.

      // Example
      editor.TA_loadRecentDraftLast2Weeks(["foo", "bar"], ["quz"]);
      

    Returns Boolean

TA_loadRecentDraftLast4Weeks

  • TA_loadRecentDraftLast4Weeks(p_astrTagsInclude: string[], p_astrTagsExclude: string[]): Boolean
  • 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.

    Parameters

    • p_astrTagsInclude: string[]

      tan array of tag names that any matching draft should include.

    • p_astrTagsExclude: string[]

      tan array of tag names that any matching draft should exclude.

      // Example
      editor.TA_loadRecentDraftLast4Weeks(["foo", "bar"], ["quz"]);
      

    Returns Boolean

TA_loadRecentDraftLastMonth

  • TA_loadRecentDraftLastMonth(p_astrTagsInclude: string[], p_astrTagsExclude: string[]): Boolean
  • 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.

    Parameters

    • p_astrTagsInclude: string[]

      tan array of tag names that any matching draft should include.

    • p_astrTagsExclude: string[]

      tan array of tag names that any matching draft should exclude.

      // Example
      editor.TA_loadRecentDraftLastMonth(["foo", "bar"], ["quz"]);
      

    Returns Boolean

TA_loadRecentDraftLastWeek

  • TA_loadRecentDraftLastWeek(p_astrTagsInclude: string[], p_astrTagsExclude: string[]): Boolean
  • 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.

    Parameters

    • p_astrTagsInclude: string[]

      tan array of tag names that any matching draft should include.

    • p_astrTagsExclude: string[]

      tan array of tag names that any matching draft should exclude.

      // Example
      editor.TA_loadRecentDraftLastWeek(["foo", "bar"], ["quz"]);
      

    Returns Boolean

TA_loadRecentDraftThisMonth

  • TA_loadRecentDraftThisMonth(p_astrTagsInclude: string[], p_astrTagsExclude: string[]): Boolean
  • 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.

    Parameters

    • p_astrTagsInclude: string[]

      tan array of tag names that any matching draft should include.

    • p_astrTagsExclude: string[]

      tan array of tag names that any matching draft should exclude.

      // Example
      editor.TA_loadRecentDraftThisMonth(["foo", "bar"], ["quz"]);
      

    Returns Boolean

TA_loadRecentDraftThisWeek

  • TA_loadRecentDraftThisWeek(p_astrTagsInclude: string[], p_astrTagsExclude: string[]): Boolean
  • 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.

    Parameters

    • p_astrTagsInclude: string[]

      tan array of tag names that any matching draft should include.

    • p_astrTagsExclude: string[]

      tan array of tag names that any matching draft should exclude.

      // Example
      editor.TA_loadRecentDraftThisWeek(["foo", "bar"], ["quz"]);
      

    Returns Boolean

TA_loadRecentDraftToday

  • TA_loadRecentDraftToday(p_astrTagsInclude: string[], p_astrTagsExclude: string[]): Boolean
  • 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.

    Parameters

    • p_astrTagsInclude: string[]

      tan array of tag names that any matching draft should include.

    • p_astrTagsExclude: string[]

      tan array of tag names that any matching draft should exclude.

      // Example
      editor.TA_loadRecentDraftToday(["foo", "bar"], ["quz"]);
      

    Returns Boolean

TA_loadRecentDraftTodayOrYesterday

  • TA_loadRecentDraftTodayOrYesterday(p_astrTagsInclude: string[], p_astrTagsExclude: string[]): Boolean
  • 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.

    Parameters

    • p_astrTagsInclude: string[]

      tan array of tag names that any matching draft should include.

    • p_astrTagsExclude: string[]

      tan array of tag names that any matching draft should exclude.

      // Example
      editor.TA_loadRecentDraftTodayOrYesterday(["foo", "bar"], ["quz"]);
      

    Returns Boolean

TA_loadRecentDraftYesterday

  • TA_loadRecentDraftYesterday(p_astrTagsInclude: string[], p_astrTagsExclude: string[]): Boolean
  • 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.

    Parameters

    • p_astrTagsInclude: string[]

      tan array of tag names that any matching draft should include.

    • p_astrTagsExclude: string[]

      tan array of tag names that any matching draft should exclude.

      // Example
      editor.TA_loadRecentDraftYesterday(["foo", "bar"], ["quz"]);
      

    Returns Boolean

TA_mdScriptSelectedText

  • TA_mdScriptSelectedText(p_strCodeType?: string): void
  • Inserts a script fence block marker around the currently selected text. Accepts an optional parameter to set a code type for syntax highlighting.

    Parameters

    • Optional p_strCodeType: string

      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");
      

    Returns void

TA_mdTitleLinkFromClipboardURL

  • TA_mdTitleLinkFromClipboardURL(): void
  • Inserts a markdown link with the page title as the text using a URL on the clipboard.

    // Example
    editor.TA_mdTitleLinkFromClipboardURL();
    

    Returns void

TA_mdTitleLinkFromSelectedURL

  • TA_mdTitleLinkFromSelectedURL(): void
  • Inserts a markdown link with the page title as the text using a URL selected in the editor.

    // Example
    editor.TA_mdTitleLinkFromSelectedURL();
    

    Returns void

TA_mergeSelectedLines

  • TA_mergeSelectedLines(p_strSpacer?: string, p_bTrimLines?: Boolean, p_astrContinue?: string[], p_astrForce?: string[]): string
  • 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.

    Parameters

    • Optional p_strSpacer: string

      the string to use when joining two lines with a 'spacer'. Defaults to a single space character.

    • Optional p_bTrimLines: Boolean

      determines if lines should be trimmed of whitespace before joining. This defaults to true.

    • Optional p_astrContinue: string[]

      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.

    • Optional p_astrForce: string[]

      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();
      

    Returns string

TA_moveLinesDown

  • TA_moveLinesDown(): Boolean
  • 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();
    

    Returns Boolean

TA_moveLinesToEnd

  • TA_moveLinesToEnd(): Boolean
  • 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();
    

    Returns Boolean

TA_moveLinesToStart

  • TA_moveLinesToStart(): Boolean
  • 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();
    

    Returns Boolean

TA_moveLinesUp

  • TA_moveLinesUp(): Boolean
  • 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();
    

    Returns Boolean

TA_navigateToMarkerByName

  • TA_navigateToMarkerByName(): void
  • 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");
    

    Returns void

TA_openURLAtCursor

  • TA_openURLAtCursor(): string
  • 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();
    

    Returns string

TA_prefixAllLines

  • TA_prefixAllLines(p_strPrefix: string): void
  • Prefix all lines in the loaded draft with a string of characters.

    Parameters

    • p_strPrefix: string

      the string of characters to add to the start of each line in the editor.

      // Example
      editor.TA_prefixAllLines("-");
      

    Returns void

TA_prefixAllNonBlankLines

  • TA_prefixAllNonBlankLines(p_strPrefix: string): void
  • Prefix all non-blank lines in the loaded draft with a string of characters.

    Parameters

    • p_strPrefix: string

      the string of characters to add to the start of each non-blank line in the editor.

      // Example
      editor.TA_prefixAllNonBlankLines();
      

    Returns void

TA_prefixDraftEditorContent

  • TA_prefixDraftEditorContent(p_strPrefix: string): void
  • Add content to the start of the editor and retain the current selection.

    Parameters

    • p_strPrefix: string

      text to add to the start of the editor content.

      // Example
      editor.TA_prefixDraftEditorContent("---start---\n");
      

    Returns void

TA_prepend

  • TA_prepend(p_strText: string, p_strSeparator?: string): void
  • Prefix text to the start of the current draft being edited. The original selection remains intact.

    Parameters

    • p_strText: string

      text to be inserted at the start of the editor's draft.

    • Optional p_strSeparator: string

      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");
      

    Returns void

TA_prependLinesRetainSelection

  • TA_prependLinesRetainSelection(p_strPrefix: string): void
  • Add a string to the start of the lines at least partially in a selection, without affacting the selected range of text.

    Parameters

    • p_strPrefix: string

      the text to add to the start of each line.

      // Example
      editor.TA_prependLinesRetainSelection("\t");
      

    Returns void

TA_processExtendedLinesFunctionReplace

  • TA_processExtendedLinesFunctionReplace(p_funcCallback: Function): void
  • Process each line at least partially included in the selection with a function and replace those lines (not just the selection) with the result.

    Parameters

    • p_funcCallback: Function

      the function that should be used to process each line.

      // Example
      function hi(strName)
      {
          return "Hello " + strName;
      }
      editor.TA_processExtendedLinesFunctionReplace(hi);
      

    Returns void

TA_processExtendedLinesFunctionRetain

  • TA_processExtendedLinesFunctionRetain(p_funcCallback: Function): string
  • // Process each line at least partially included in the selection with a function and return the result.

    Parameters

    • p_funcCallback: Function

      the function that should be used to process each line.

      // Example
      function hi(strName)
      {
          return "Hello " + strName;
      }
      alert(editor.TA_processExtendedLinesFunctionRetain(hi);;
      

    Returns string

TA_processMDXLink

  • TA_processMDXLink(): void
  • 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();
    

    Returns void

TA_processSelectedLinesFunctionReplace

  • TA_processSelectedLinesFunctionReplace(p_funcCallback: Function): void
  • Process each line in the selection with a function and replace the selection with the result.

    Parameters

    • p_funcCallback: Function

      the function that should be used to process each line.

      // Example
      function hi(strName)
      {
          return "Hello " + strName;
      }
      editor.TA_processSelectedLinesFunctionReplace(hi);
      

    Returns void

TA_processSelectedLinesFunctionRetain

  • TA_processSelectedLinesFunctionRetain(p_funcCallback: Function): String
  • // Process each line in the selection with a function and return the result.

    Parameters

    • p_funcCallback: Function

      the function that should be used to process each line.

      // Example
      function hi(strName)
      {
          return "Hello " + strName;
      }
      alert(editor.TA_processSelectedLinesFunctionRetain(hi);;
      

    Returns String

TA_readingModeDisable

  • TA_readingModeDisable(p_bLME?: Boolean, p_bFME?: Boolean, p_bSID?: Boolean): void
  • Set Drafts to not be in a persistent/focussed reading mode.
    Reading mode is set by having each of the following items as true.

    • Link Mode disables editing and turns URLs, email addresses, phone numbers and physical addresses into tappable links. Check markers also remain active for toggling state.
    • Focus Mode is a way of disabling new draft after a period of time behaviour.
    • Idle Disabled is a mode where the system timer is disabled, preventing the screen from dimming/sleeping when not in active use for user input. 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).

    Parameters

    • Optional p_bLME: Boolean

      sets the link mode, defaults to false.

    • Optional p_bFME: Boolean

      sets the focus mode, defaults to false.

    • Optional p_bSID: Boolean

      sets the idle disabled property, defaults to false.

      // Example
      editor.TA_readingModeDisable();
      

    Returns void

TA_readingModeEnable

  • TA_readingModeEnable(): void
  • Set Drafts to a persistent/focussed reading mode.
    Reading mode is set by having each of the following items as true.

    • Link Mode disables editing and turns URLs, email addresses, phone numbers and physical addresses into tappable links. Check markers also remain active for toggling state.
    • Focus Mode is a way of disabling new draft after a period of time behaviour.
    • Idle Disabled is a mode where the system timer is disabled, preventing the screen from dimming/sleeping when not in active use for user input.
      // Example
      editor.TA_readingModeEnable();
      

    Returns void

TA_readingModeIsEnabled

  • TA_readingModeIsEnabled(): Boolean
  • Determine if Drafts is in a persistent/focussed reading mode.
    Reading mode is set by having each of the following items as true.

    • Link Mode disables editing and turns URLs, email addresses, phone numbers and physical addresses into tappable links. Check markers also remain active for toggling state.
    • Focus Mode is a way of disabling new draft after a period of time behaviour.
    • Idle Disabled is a mode where the system timer is disabled, preventing the screen from dimming/sleeping when not in active use for user input.

    Returns true if reading mode is enabled, and false if not.

    // Example
    editor.TA_readingModeIsEnabled();
    

    Returns Boolean

TA_readingModeShowProperties

  • TA_readingModeShowProperties(): Boolean
  • 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.

    • Link Mode disables editing and turns URLs, email addresses, phone numbers and physical addresses into tappable links. Check markers also remain active for toggling state.
    • Focus Mode is a way of disabling new draft after a period of time behaviour.
    • Idle Disabled is a mode where the system timer is disabled, preventing the screen from dimming/sleeping when not in active use for user input.

    Returns true if reading mode is enabled, and false if not.

    // Example
    editor.TA_readingModeShowProperties();
    

    Returns Boolean

TA_readingModeToggle

  • TA_readingModeToggle(p_bLME: Boolean, p_bFME: Boolean, p_bSID: Boolean): Boolean
  • Toggle Drafts to/from a persistent/focussed reading mode.
    Reading mode is set by having each of the following items as true.

    • Link Mode disables editing and turns URLs, email addresses, phone numbers and physical addresses into tappable links. Check markers also remain active for toggling state.
    • Focus Mode is a way of disabling new draft after a period of time behaviour.
    • Idle Disabled is a mode where the system timer is disabled, preventing the screen from dimming/sleeping when not in active use for user input.

    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);
    

    Parameters

    • p_bLME: Boolean
    • p_bFME: Boolean
    • p_bSID: Boolean

    Returns Boolean

TA_removeDraftEditorContent

  • TA_removeDraftEditorContent(p_strRemove: string): void
  • 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.

    Parameters

    • p_strRemove: string

      text to be found and replaced.

    Returns void

TA_repeatDuplicateCurrentLineAsk

  • TA_repeatDuplicateCurrentLineAsk(p_intDefault?: number): void
  • 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.

    Parameters

    • Optional p_intDefault: number

      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);
      

    Returns void

TA_replaceCurrentLine

  • TA_replaceCurrentLine(p_strReplacementText: string): string
  • 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).

    Parameters

    • p_strReplacementText: string

      the text to use as a replacement.

      // Example
      editor.TA_replaceCurrentLine("Replacement text goes here.");
      

    Returns string

TA_replaceDraftEditorContent

  • TA_replaceDraftEditorContent(p_strFind: string, p_strReplace: string): void
  • 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.

    Parameters

    • p_strFind: string

      text to be found and replaced.

    • p_strReplace: string

      text to replace the found text with.

      // Example
      editor.TA_replaceDraftEditorContent("foo", "bar");
      

    Returns void

TA_replaceInSelection

  • TA_replaceInSelection(p_strFind: string, p_strReplace: string): void
  • 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");
    

    Parameters

    • p_strFind: string
    • p_strReplace: string

    Returns void

TA_sectionAppendByHeading

  • TA_sectionAppendByHeading(p_strSectionHeading: string, p_strTextToAppend: string, p_intIndex?: number): string
  • 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).

    Parameters

    • p_strSectionHeading: string

      the heading of the section whose content should be appended to.

    • p_strTextToAppend: string

      the text to add to the end of the specified section.

    • Optional p_intIndex: number

      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));
      

    Returns string

TA_sectionAppendByIndex

  • TA_sectionAppendByIndex(p_strTextToAppend: string, p_intIndex: number): string
  • 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).

    Parameters

    • p_strTextToAppend: string

      the text to add to the end of the specified section.

    • p_intIndex: number

      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));
      

    Returns string

TA_sectionBodyByHeading

  • TA_sectionBodyByHeading(p_strSectionHeading: string, p_intIndex?: number): string
  • 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.

    Parameters

    • p_strSectionHeading: string

      the heading of the section whose body should be retrieved.

    • Optional p_intIndex: number

      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));
      

    Returns string

TA_sectionBodyByIndex

  • TA_sectionBodyByIndex(p_intIndex: number): string
  • 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.

    Parameters

    • p_intIndex: number

      the index of the section whose heading should be retrieved.

      // Example
      alert(editor.TA_sectionBodyByIndex(1));
      

    Returns string

TA_sectionGetContentByHeading

  • TA_sectionGetContentByHeading(p_strSectionHeading: string, p_intIndex?: number): string
  • 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.

    Parameters

    • p_strSectionHeading: string

      the heading of the section whose content should be retrieved.

    • Optional p_intIndex: number

      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);
      

    Returns string

TA_sectionGetContentByIndex

  • TA_sectionGetContentByIndex(p_intIndex: number): string
  • 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.

    Parameters

    • p_intIndex: number

      the index of the section whose content should be retrieved.

      // Example
      alert(editor.TA_sectionGetContentByIndex(2));
      

    Returns string

TA_sectionGetHeadings

  • TA_sectionGetHeadings(): string[]
  • 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());
    

    Returns string[]

TA_sectionGetIndexesForHeading

  • TA_sectionGetIndexesForHeading(p_strSectionHeading: string): string[]
  • 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).

    Parameters

    • p_strSectionHeading: string

      the heading of the section whose content should be retrieved.

    Returns string[]

TA_sectionHeadingByIndex

  • TA_sectionHeadingByIndex(p_intIndex: number): string
  • 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.

    Parameters

    • p_intIndex: number

      the index of the section whose heading should be retrieved.

      // Example
      alert(editor.TA_sectionHeadingByIndex(1));
      

    Returns string

TA_sectionPrependByHeading

  • TA_sectionPrependByHeading(p_strSectionHeading: string, p_strTextToPrepend: string, p_intIndex?: number): string
  • 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).

    Parameters

    • p_strSectionHeading: string

      the heading of the section whose content should be prepended to.

    • p_strTextToPrepend: string

      the text to add to the start of the specified section, between the heading and the body.

    • Optional p_intIndex: number

      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));
      

    Returns string

TA_sectionPrependByIndex

  • TA_sectionPrependByIndex(p_strTextToPrepend: string, p_intIndex: number): string
  • 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).

    Parameters

    • p_strTextToPrepend: string

      the text to add to the start of the specified section, between the heading and the body.

    • p_intIndex: number

      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));
      

    Returns string

TA_sectionWrapByHeading

  • TA_sectionWrapByHeading(p_strSectionHeading: string, p_strTextToPrepend: string, p_strTextToAppend: string, p_intIndex?: number): string
  • 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).

    Parameters

    • p_strSectionHeading: string

      the heading of the section whose content should be prepended/appended to.

    • p_strTextToPrepend: string

      the text to add to the start of the specified section, between the heading and the body.

    • p_strTextToAppend: string

      the text to add to the end of the specified section.

    • Optional p_intIndex: number

      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));
      

    Returns string

TA_sectionWrapByIndex

  • TA_sectionWrapByIndex(p_strTextToPrepend: string, p_strTextToAppend: string, p_intIndex: number): string
  • 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).

    Parameters

    • p_strTextToPrepend: string

      the text to add to the start of the specified section, between the heading and the body.

    • p_strTextToAppend: string

      the text to add to the end of the specified section.

    • p_intIndex: number

      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));
      

    Returns string

TA_selectAll

  • TA_selectAll(): string
  • Select all content in the editor. Returns the text in the editor.

    // Example
    editor.TA_selectAll();
    

    Returns string

TA_selectLine

  • TA_selectLine(p_bExcludeNewLine?: Boolean): void
  • 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.

    Parameters

    • Optional p_bExcludeNewLine: Boolean

      option to exclude selection of the new line character at the end of the final line. Defaults to true.

      // Example
      editor.TA_selectLine();
      

    Returns void

TA_selectLineAft

  • TA_selectLineAft(): void
  • 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();
    

    Returns void

TA_selectLineFore

  • TA_selectLineFore(): void
  • 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();
    

    Returns void

TA_selectNextLine

  • TA_selectNextLine(): void
  • 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();
    

    Returns void

TA_selectParagraph

  • TA_selectParagraph(): string
  • 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();
    

    Returns string

TA_selectPreviousLine

  • TA_selectPreviousLine(): void
  • 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();
    

    Returns void

TA_selectedLinesDelimit

  • TA_selectedLinesDelimit(p_strPrefix: string, p_strSuffix: string): selectionRange
  • Delimit the selected lines with the specified prefix and suffix strings. Returns the range array (position & length) for the current selection.

    Parameters

    • p_strPrefix: string

      the string of characters to add to the start of each line.

    • p_strSuffix: string

      the string of characters to add to the start of each line.

      // Example
      editor.TA_selectedLinesDelimit();
      

    Returns selectionRange

TA_selectedLinesPrefix

  • Prefix the selected lines with the specified prefix string. Returns the range array (position & length) for the current selection.

    Parameters

    • p_strPrefix: string

      the string of characters to add to the start of each line.

      // Example
      editor.TA_selectedLinesPrefix();
      

    Returns selectionRange

TA_selectedLinesSuffix

  • Suffix the selected lines with the specified prefix string. Returns the range array (position & length) for the current selection.

    Parameters

    • p_strSuffix: string

      the string of characters to add to the start of each line.

      // Example
      editor.TA_selectedLinesSuffix();
      

    Returns selectionRange

TA_selectedLinesWrap

  • Wrap the selected lines at both ends with a specified string. Returns the range array (position & length) for the current selection.

    Parameters

    • p_strWrapper: string

      the string of characters to add to the start and end of each line.

      // Example
      editor.TA_selectedLinesWrap();
      

    Returns selectionRange

TA_selectionAppendWords

  • TA_selectionAppendWords(p_strSuffix: string): void
  • Append text to every word in the current selection. The editor is activated after the update.

    Parameters

    • p_strSuffix: string

      the text to suffix each word with.

      // Example
      editor.TA_selectionAppendWords("**"));
      

    Returns void

TA_selectionDelimitWords

  • TA_selectionDelimitWords(p_strDelimit: string): void
  • Wrap text to the start and end of every word in the current selection. The editor is activated after the update.

    Parameters

    • p_strDelimit: string

      the text to prefix and suffix each word with.

      // Example
      editor.TA_selectionDelimitWords("*"));
      

    Returns void

TA_selectionDisplayCharacterCount

  • TA_selectionDisplayCharacterCount(): void
  • Display information about how many characters are currently selected.

    // Example
    editor.TA_selectionDisplayCharacterCount();
    

    Returns void

TA_selectionDisplayCount

  • TA_selectionDisplayCount(): string
  • Display character, word and line count information about current selection. Returns the text displayed.

    // Example
    editor.TA_selectionDisplayCount();
    

    Returns string

TA_selectionDisplayLineCount

  • TA_selectionDisplayLineCount(): void
  • Display information about how many lines are currently selected.

    // Example
    editor.TA_selectionDisplayLineCount();
    

    Returns void

TA_selectionDisplayWordCount

  • TA_selectionDisplayWordCount(): void
  • Display information about how many words are currently selected.

    // Example
    editor.TA_selectionDisplayWordCount();
    

    Returns void

TA_selectionExtendLeft

  • Extend the character selection left by the specified number of characters. Returns the range array (position & length) for the extended selection.

    Parameters

    • Optional p_intCharacters: number

      number of characters to extend the selection by to the left, defaults to one character.

      // Example
      editor.TA_selectionExtendLeft(3);
      

    Returns selectionRange

TA_selectionExtendRight

  • Extend the character selection right by the specified number of characters. Returns the range array (position & length) for the extended selection.

    Parameters

    • Optional p_intCharacters: number

      number of characters to extend the selection by to the left, defaults to one character.

      // Example
      editor.TA_selectionExtendRight(3);
      

    Returns selectionRange

TA_selectionExtendWord

  • 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);
    

    Parameters

    • p_intCharacters: number

    Returns selectionRange

TA_selectionPrependWords

  • TA_selectionPrependWords(p_strPrefix: string): void
  • Prepend text to every word in the current selection. The editor is activated after the update.

    Parameters

    • p_strPrefix: string

      the text to prefix each word with.

      // Example
      editor.TA_selectionPrependWords("**"));
      

    Returns void

TA_selectionReduceLeft

  • Reduce the character selection to the left by the specified number of characters. Returns the range array (position & length) for the reduced selection.

    Parameters

    • Optional p_intCharacters: number

      number of characters to reduce the selection by to the left, defaults to one character.

      // Example
      editor.TA_selectionReduceLeft();
      

    Returns selectionRange

TA_selectionReduceRight

  • Reduce the character selection to the right by the specified number of characters. Returns the range array (position & length) for the reduced selection.

    Parameters

    • Optional p_intCharacters: number

      number of characters to reduce the selection by to the right, defaults to one character.

      // Example
      editor.TA_selectionReduceRight();
      

    Returns selectionRange

TA_selectionReduceToEnd

  • TA_selectionReduceToEnd(): number
  • Reduce the text selection to position the cursor to the end of the selection. Returns the resulting cursor position.

    // Example
    editor.TA_selectionReduceToEnd();
    

    Returns number

TA_selectionReduceToStart

  • TA_selectionReduceToStart(): number
  • Reduce the text selection to position the cursor to the start of the selection. Returns the resulting cursor position.

    // Example
    editor.TA_selectionReduceToStart();
    

    Returns number

TA_selectionWrapWords

  • TA_selectionWrapWords(p_strPrefix: string, p_strSuffix: string): void
  • Prefix and suffix text strings to every word in the current selection. The editor is activated after the update.

    Parameters

    • p_strPrefix: string

      the text to prefix each word with.

    • p_strSuffix: string

      the text to suffix each word with.

      // Example
      editor.TA_selectionWrapWords("<", ">"));
      

    Returns void

TA_setCurrentLineNoNewLine

  • TA_setCurrentLineNoNewLine(p_strNewText: string): void
  • 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.

    Parameters

    • p_strNewText: string

      the text that will replace the text of the lines the selection partially or full includes.

      // Example
      editor.TA_setCurrentLineNoNewLine("foo");
      

    Returns void

TA_setCurrentLinesContent

  • TA_setCurrentLinesContent(p_strNewText: string): void
  • Based on the current selection, sets the full text of the lines the selection partially or full includes.

    Parameters

    • p_strNewText: string

      the text that will replace the text of the lines the selection partially or full includes.

      // Example
      editor.TA_setCurrentLinesContent("foo");
      

    Returns void

TA_setSelectedRangeAll

  • TA_setSelectedRangeAll(): void
  • Select all content in the editor.

    // Example
    editor.TA_setSelectedRangeAll();
    

    Returns void

TA_setSelectedRangeEnd

  • TA_setSelectedRangeEnd(): void
  • Jump to the end of the content in the editor.

    // Example
    editor.TA_setSelectedRangeEnd();
    

    Returns void

TA_setSelectedRangeStart

  • TA_setSelectedRangeStart(): void
  • Jump to the start of the content in the editor.

    // Example
    editor.TA_setSelectedRangeStart();
    

    Returns void

TA_shareHTML

  • TA_shareHTML(): string
  • 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();
    

    Returns string

TA_shareText

  • TA_shareText(): string
  • Share selection or Draft (if no selection) as raw text. Also activates the editor and returns the shared content.

    // Example
    editor.TA_shareText();
    

    Returns string

TA_sortAllAlphabetic

  • TA_sortAllAlphabetic(): string
  • Sort all editor lines alphabetically. Returns the sorted text.

    // Example
    editor.TA_sortAllAlphabetic();
    

    Returns string

TA_sortAllNumeric

  • TA_sortAllNumeric(): string
  • 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();
    

    Returns string

TA_sortAllRandom

  • TA_sortAllRandom(): string
  • Sort all editor lines into a random order. Returns the sorted text.

    // Example
    editor.TA_sortAllRandom();
    

    Returns string

TA_sortAllReverseAlphabetic

  • TA_sortAllReverseAlphabetic(): string
  • Sort all editor lines reverse alphabetically. Returns the sorted text.

    // Example
    editor.TA_sortAllReverseAlphabetic();
    

    Returns string

TA_sortAllReverseNumeric

  • TA_sortAllReverseNumeric(): string
  • 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();
    

    Returns string

TA_sortSelectionAlphabetic

  • TA_sortSelectionAlphabetic(): string
  • 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();
    

    Returns string

TA_sortSelectionNumeric

  • TA_sortSelectionNumeric(): string
  • 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();
    

    Returns string

TA_sortSelectionRandom

  • TA_sortSelectionRandom(): string
  • Sort the selection of lines into a random order. Returns the sorted text.

    // Example
    editor.TA_sortSelectionRandom();
    

    Returns string

TA_sortSelectionReverseAlphabetic

  • TA_sortSelectionReverseAlphabetic(): string
  • 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();
    

    Returns string

TA_sortSelectionReverseNumeric

  • TA_sortSelectionReverseNumeric(): string
  • 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();
    

    Returns string

TA_suffixDraftEditorContent

  • TA_suffixDraftEditorContent(p_strSuffix: string): void
  • Add content to the end of the editor and retain the current selection.

    Parameters

    • p_strSuffix: string

      text to add to the end of the editor content.

      // Example
      editor.TA_suffixDraftEditorContent("\n---end---");
      

    Returns void

TA_taskpaperModifyCurrentLineProject

  • TA_taskpaperModifyCurrentLineProject(p_bForceOn: any, p_bForceOff: any): void
  • 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.

    Parameters

    • p_bForceOn: any

      when set to true forces the line to be a project.

    • p_bForceOff: any

      when set to true forces the line to not be a project.

      // Example
      editor.TA_taskpaperModifyCurrentLineProject();
      

    Returns void

TA_taskpaperModifyCurrentLineTask

  • TA_taskpaperModifyCurrentLineTask(p_bForceOn: Boolean, p_bForceOff: Boolean): void
  • 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.

    Parameters

    • p_bForceOn: Boolean

      when set to true, the function always modifies to set the line to be a Taskpaper task.

    • p_bForceOff: Boolean

      when set to true, the function always modifies to set the line to not be a Taskpaper task.

      // Example
      editor.TA_taskpaperModifyCurrentLineTask(false, false);
      

    Returns void

TA_taskpaperSetCurrentLineToNotProject

  • TA_taskpaperSetCurrentLineToNotProject(): void
  • 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();
    

    Returns void

TA_taskpaperSetCurrentLineToNotTask

  • TA_taskpaperSetCurrentLineToNotTask(): void
  • 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();
    

    Returns void

TA_taskpaperSetCurrentLineToProject

  • TA_taskpaperSetCurrentLineToProject(): void
  • 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();
    

    Returns void

TA_taskpaperSetCurrentLineToTask

  • TA_taskpaperSetCurrentLineToTask(): void
  • 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();
    

    Returns void

TA_taskpaperSetExtendedToNotProject

  • TA_taskpaperSetExtendedToNotProject(): void
  • 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();
    

    Returns void

TA_taskpaperSetExtendedToNotTask

  • TA_taskpaperSetExtendedToNotTask(): void
  • 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();
    

    Returns void

TA_taskpaperSetExtendedToProject

  • TA_taskpaperSetExtendedToProject(): void
  • 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();
    

    Returns void

TA_taskpaperSetExtendedToTask

  • TA_taskpaperSetExtendedToTask(): void
  • 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();
    

    Returns void

TA_taskpaperSetSelectedToNotProject

  • TA_taskpaperSetSelectedToNotProject(): void
  • 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();
    

    Returns void

TA_taskpaperSetSelectedToNotTask

  • TA_taskpaperSetSelectedToNotTask(): void
  • 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();
    

    Returns void

TA_taskpaperSetSelectedToProject

  • TA_taskpaperSetSelectedToProject(): void
  • 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();
    

    Returns void

TA_taskpaperSetSelectedToTask

  • TA_taskpaperSetSelectedToTask(): void
  • 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();
    

    Returns void

TA_taskpaperToggleCurrentLineProject

  • TA_taskpaperToggleCurrentLineProject(): void
  • 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();
    

    Returns void

TA_taskpaperToggleCurrentLineTask

  • TA_taskpaperToggleCurrentLineTask(): void
  • 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();
    

    Returns void

TA_taskpaperToggleExtendedProject

  • TA_taskpaperToggleExtendedProject(): void
  • 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();
    

    Returns void

TA_taskpaperToggleExtendedTask

  • TA_taskpaperToggleExtendedTask(): void
  • 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();
    

    Returns void

TA_taskpaperToggleSelectedProject

  • TA_taskpaperToggleSelectedProject(): void
  • 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();
    

    Returns void

TA_taskpaperToggleSelectedTask

  • TA_taskpaperToggleSelectedTask(): void
  • 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();
    

    Returns void

TA_textToLineEnd

  • TA_textToLineEnd(): string
  • 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());
    

    Returns string

TA_textToLineStart

  • TA_textToLineStart(): string
  • 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());
    

    Returns string

TA_textToLineStartIsMDListOrBlank

  • TA_textToLineStartIsMDListOrBlank(): Boolean
  • 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());
    

    Returns Boolean

TA_toggleLoadPreviousLoad

  • TA_toggleLoadPreviousLoad(): void
  • Load the previously loaded draft.

    // Example
    editor.TA_toggleLoadPreviousLoad();
    

    Returns void

TA_toggleLoadPreviousModified

  • TA_toggleLoadPreviousModified(): void
  • 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();
    

    Returns void

TA_unappendLinesRetainSelection

  • TA_unappendLinesRetainSelection(p_strSuffix: string): void
  • Remove a string from the end of the lines at least partially in a selection, without affacting the selected range of text.

    Parameters

    • p_strSuffix: string

      the text to remove from the end of each line.

      // Example
      editor.TA_unappendLinesRetainSelection("[STOP]");
      

    Returns void

TA_unindent

  • TA_unindent(p_strIndent: string): void
  • Remove an indentation. The lines included by the current selection will have a single indentation string removed from the start.

    Parameters

    • p_strIndent: string

      the text string to be used for indentation of a line.

      // Example
      editor.TA_unindent("\t");
      

    Returns void

TA_unprependLinesRetainSelection

  • TA_unprependLinesRetainSelection(p_strPrefix: string): void
  • Remove a string from the start of the lines at least partially in a selection, without affacting the selected range of text.

    Parameters

    • p_strPrefix: string

      the text to remove from the start of each line.

      // Example
      editor.TA_unprependLinesRetainSelection("\t");
      

    Returns void

TA_wrapLines

  • TA_wrapLines(p_strPrefix: string, p_strSuffix: string): void
  • 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.

    Parameters

    • p_strPrefix: string

      specifies the string of characters to add before the paragraph.

    • p_strSuffix: string

      specifies the string of characters to add after the paragraph.

      // Example
      editor.TA_wrapLines("--START--\n", "\n--END--");
      

    Returns void

TA_wrapParagraph

  • TA_wrapParagraph(p_strPrefix: string, p_strSuffix: string): void
  • 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.

    Parameters

    • p_strPrefix: string

      specifies the string of characters to add before the paragraph.

    • p_strSuffix: string

      specifies the string of characters to add after the paragraph.

      // Example
      editor.TA_wrapParagraph("--START--\n", "\n--END--");
      

    Returns void

TA_wrapSelection

  • TA_wrapSelection(p_strPrefix: string, p_strSuffix: string): void
  • 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.

    Parameters

    • p_strPrefix: string

      specifies the string of characters to add before the selection.

    • p_strSuffix: string

      specifies the string of characters to add after the selection.

      // Example
      editor.TA_wrapSelection("<strong>", "</strong>");
      

    Returns void