Drafts Action Directory

Hoist line to top

Posted by derick, Last updated: 2018-07-03 17:08:18 UTC

Move current line to the top of the document



  • script

    // See online documentation for examples
    // http://getdrafts.com/scripting
    // adapted from http://1writerapp.com/action/3b53d
    range = editor.getSelectedLineRange();
    line = editor.getTextInRange(range[0], range[1]);
    if (range[0] > 0) {
    	editor.setTextInRange(range[0] - 1, range[1], "");
    	editor.setTextInRange(0, 0, line);


Actions available in the Action Directory are uploaded by community members. Use appropriate caution reviewing downloaded actions before use.