Drafts Action Directory

Insert Draft at Cursor

Posted by agiletortoise, Last update 27 days ago

Prompt to select and existing draft, insert content of selected draft at the last cursor position (replacing selection).

Install

Steps

  • script

    // select and existing draft
    // insert its content in the current draft
    // at the cursor position
    
    let f = () => {
    	// select an existing draft
    	let d = app.selectDraft();
    	if (!d) {
    		return false;
    	}
    	
    	// insert content
    	let [st, len] = editor.getSelectedRange();
    	editor.setSelectedText(d.content);
    	editor.setSelectedRange(st+d.content.length, 0);
    	return true;	
    }
    
    if (!f()) {
    	context.cancel();
    }
    

Options

  • After Success Nothing
    Notification Error
    Log Level Info

Comments

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