Drafts Action Directory

Insert Draft

Posted by yvonnezed, Last update 5 months ago

Insert another draft at the cursor, replacing the selection if there is one.

Install

Steps

  • script

    var sel = editor.getSelectedText(); // retrieve selected text
    var selRange = editor.getSelectedRange(); // retrieve range of that selection
    var insDraft = app.selectDraft();
    if (insDraft) {
    
      editor.setTextInRange(selRange[0], selRange[1], insDraft.content);
      // update the selected range to the end of the inserted text
      editor.activate();
      editor.setSelectedRange(selRange[0],insDraft.content.length);
    }

Options

  • After Success Nothing
    Notification Info
    Log Level Info

Comments

Actions available in the Action Directory are uploaded by community members. Use appropriate caution reviewing downloaded actions before use.