Action

Line to [[Work Tasks]]

Posted by @nahumck, Last update over 4 years ago - Unlisted

Sends a line to the Work Tasks draft for processing.

Steps

  • script

    /*--- Get entire line of cursor function ---*/
    function getCursorLine(editor) {
    	var cursorPosition = editor.getSelectedRange()[0];
    	var selectionLength = editor.getSelectedRange()[1];
    	var lineRange = editor.getSelectedLineRange();
    	var sel = editor.getTextInRange(lineRange[0], lineRange[1]);
    	return sel.replace("- ","")
    }
    
    /*--- Add line to Work Tasks draft ---*/
    let task = getCursorLine(editor);
    let d = Draft.queryByTitle("Work Tasks"); 
    d[0].content = d[0].content + "- " + task;
    d[0].update();

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.