Drafts Action Directory

Remove blank lines

Posted by dchar, Last updated: 2018-04-27 03:01:10 UTC

Remove blank lines.

Install

Steps

  • script

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