Action

Cycle Drafts In Workspace REV

Posted by @jsamlarose, Last update 13 days 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 == 0){
    	var draft = draftsList[draftsList.length-1]
    } 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.