Action

Show List

Posted by FlohGro, Last update about 2 years ago

UPDATES

about 2 years ago

description update

show all updates...

about 2 years ago

description update

about 2 years ago

description update

about 2 years ago

description update & minor refinements

created by @FlohGro / more on my Blog

Show List

This action queries all your drafts for a specific tag and presents their titles in a prompt. The selected draft will be loaded into the editor

[Configuration]

You need to configure the tag this action should use. To do so, edit this line in the script const listTag = "ref_list"; and replace ref_lists with the tag you want to use for your lists.

[Usage]

After you configured the action you can use it to quickly open your most used lists in Drafts.

If you want to add Text to a list you can look at the Add to List Action.


If you find this useful and want to support me you can

Buy Me A Coffee

Steps

  • script

    //show list
    // tag to assign to list drafts (set your own)
    const listTag = "ref_list";
    const linkListTitle = "Select List";
    
    var res;
    {
    let ws = Workspace.create();
    ws.tagFilter = listTag;
    ws.tagFilterRequireAll = true;
    res = ws.query("all");
    }
    // sort array in alphabetical order
    res.sort((a,b) => (a.title.toUpperCase() > b.title.toUpperCase()) ? 1:-1);
    
    var p = Prompt.create();
    p.title = linkListTitle
    
    for(i in res)
    {
    	p.addButton(res[i].title,res[i].uuid);
    }
    
    
    
    var didSelect = p.show();
    if (didSelect == 1) {
    	var selecteduuid = p.buttonPressed;
    	var selectedDraft = Draft.find((selecteduuid));
    	editor.load(selectedDraft);
    	if (selectedDraft.title == linkListTitle) {
    		editor.linkModeEnabled = true;
    	}
    }
    
    

Options

  • After Success Default
    Notification Info
    Log Level Info
Items available in the Drafts Directory are uploaded by community members. Use appropriate caution reviewing downloaded items before use.