Action
Sort++
Sorts the selected lines in alphabetical order without moving them down a line.
Steps
-
script
// get the selected lines of the draft as a string let selRange = editor.getSelectedLineRange(); let selText = editor.getTextInRange( selRange[ 0 ], selRange[ 1 ] ); // break the string into an array on \n, sort it, then join it again using \n // if the selection is only a portion of the draft, remove the final \n first, // then add it again once the sorting and joining is complete let sortedText = selText === editor.getText() ? selText.split( '\n' ).sort().join( '\n' ) : selText.replace( /\n$/, '' ).split( '\n' ).sort().join( '\n' ) + '\n'; // replace the selected lines with the sorted lines editor.setTextInRange( selRange[ 0 ], selRange[ 1 ], sortedText );
Options
-
After Success Default Notification Error Log Level Error
Items available in the Drafts Directory are uploaded by community members. Use appropriate caution reviewing downloaded items before use.