Action

Insert Draft at Cursor

Posted by agiletortoise, Last update about 5 years ago

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

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