Action

Mark Done

Posted by agiletortoise, Last update 4 months ago

Toggle done status of [ ] tasks on the selected lines.

Steps

  • script

    // Toggle tasks marks on selected lines
    const off = "[ ]";
    const on = "[x]";
    
    // grab state
    let [lnStart, lnLen] = editor.getSelectedLineRange();
    let lnText = editor.getTextInRange(lnStart, lnLen);
    let [selStart, selLen] = editor.getSelectedRange();
    
    // check if any incomplete tasks are in selection
    if (lnText.includes(off)) {
    	lnText = lnText.replaceAll(off, on);
    }
    else { // no incomplete tasks, mark undone
    	lnText = lnText.replaceAll(on, off);
    }
    editor.setTextInRange(lnStart, lnLen, lnText);
    

Options

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