Action

Cycle Drafts In Workspace FWD

Posted by @jsamlarose, Last update about 3 years ago

Sparked by a discussion in the Drafts Forum. There’s already a built-in keyboard shortcut for cycling through the Drafts list, but I had the need to assign a different key combo… Nods to @nahumck ;)

Steps

  • script

    workspace = app.currentWorkspace
    draftsList = workspace.query("inbox")
    
    // get index of object by property (https://stackoverflow.com/a/39529049)
    var index = draftsList.findIndex(item => item.uuid === draft.uuid)
    
    if (index == -1 || index == draftsList.length-1){
    	var draft = draftsList[0]
    } else {
    	index++
    	var draft = draftsList[index]
    }
    
    editor.load(draft)
    

Options

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