After installing this plugin you can run the selected text as a Javascript, and the text result will be inserted and selected after the script is run.
- Select some text in your document that is Javascript
- Edit > Run Command…
- Choose the “run script” command
It works with simple JavaScript expressions like:
1 + 2
Or you can define a function and it will be called with the current editor as a parameter.
function (editor) {
return editor.selectedRange().startNode.type();
}
This plugin is available (along with others) from FoldingText’s official plugin collection.