Drafts Action Directory

Quick Draft

Posted by agiletortoise, Last update 25 days ago

Prompt for text and optional tags, and create a new draft with that text.

Useful for capturing another draft quickly without having to leave the draft you are currently working on.

Install

Steps

  • script

    // prompt for text and create a draft with the input
    let p = Prompt.create();
    p.title = "Quick Draft"
    p.addTextView("content", "Draft content", "", {
    	height: 160,
    	wantsFocus: true
    });
    p.addTextField("tags", "Tags", "", {
    	autocapitalization: false,
    	placeholder: "optional tags"
    });
    p.addButton("Create Draft");
    if (p.show()) {
    	let d = Draft.create();
    	d.content = p.fieldValues["content"];
    	let tagStr = p.fieldValues["tags"];
    	if (tagStr.length > 0) {
    		let tags = tagStr.split(",");
    		for (let tag of tags) {
    			d.addTag(tag);
    		}
    	}
    	d.update();
    	console.log("Draft created");
    }
    else {
    	context.cancel();
    }

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.