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_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
  • 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

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

    // Example
    editor.TA_cursorToStartOfPreviousSentence();

    Returns number

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_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_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_loadAc

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

    // Example
    editor.TA_loadAc();

    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_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_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_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_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 the 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_strTextToAppend: 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.

    • p_strTextToAppend: string
    • 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_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_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_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_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_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_sortAllSelectionNumeric

  • TA_sortAllSelectionNumeric(): 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_sortAllSelectionNumeric();

    Returns string

TA_sortAllSelectionReverseNumeric

  • TA_sortAllSelectionReverseNumeric(): 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_sortAllSelectionReverseNumeric();

    Returns string

TA_sortSelectionAlphabetic

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

  • Sort all editor lines alphabetically. Returns the sorted text.

    // 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_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_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