Action

Insert Draft

Posted by yvonnezed, Last update over 6 years ago

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

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
Items available in the Drafts Directory are uploaded by community members. Use appropriate caution reviewing downloaded items before use.