Action

Duplicate Draft

Posted by RoyRogers, Last update almost 5 years ago

Duplicates current draft:
- with original’s tags and languageGrammar (flag)
- tag=‘duplicate’ added and original draft arhchived.

Steps

  • script

    // Duplicate Draft
    // RV 2020-03-07 at 09:08 EST
    
    // Duplicates current draft: 
    // with original's tags and languageGrammar (optionally: flag)
    // tag='duplicate' added and original draft archived.
    
    var d2 = Draft.create();
    d2.content = draft.content;
    d2.languageGrammar = draft.languageGrammar;
    d2.update();
    
    for (const tag of draft.tags) {
    	d2.addTag(tag);
    }
    
    // d2.isFlagged = draft.isFlagged;
    d2.addTag('duplicate');
    d2.update();
    editor.load(d2);
    
    let workspace = Workspace.find("Inbox");
    if (workspace) {
    	app.applyWorkspace(workspace);
    }
    
    // else {
    //   // Create a new workspace named: 'Inbox' if not exist:
    //   workspace = Workspace.create();
    //   workspace.name = 'Inbox';
    //   // looking for a way to set workspace.options:
    //   // workspace.option = {'select tab': 'inbox'} 
    //   workspace.update();
    //   app.applyWorkspace(workspace);
    // }
    
    

Options

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