Drafts Action Directory

Double space

Posted by dchar, Last updated: 2018-04-27 03:02:48 UTC

Double space a draft or a selection.

Install

Steps

  • script

    function deblank(s) {
        return s.split('\n').filter(l => l.trim());
      }
      
    function doublespace(s) {
        var arr = []
        for (let i of deblank(s)) {
            arr.push(i);
            arr.push('');
        }
        return arr.join('\n');
    }
    
    var sel = editor.getSelectedText();
    if (sel.length) {
      editor.setSelectedText( doublespace(sel) );
    } else {
      draft.content = doublespace( draft.content );
      draft.update();
    }
      
Actions available in the Action Directory are uploaded by community members. Use appropriate caution reviewing downloaded actions before use.