Drafts Action Directory

Insert Draft

Posted by yvonnezed, Last updated: 2018-07-04 15:01:21 UTC

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

Comments

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