Run selected text. Implements sosedoff/pgweb#78.

In the Query tab, only run the selected text. If nothing selected, run all text in the editor.
This commit is contained in:
brianlow 2015-05-18 14:58:03 -06:00
parent 50f0f5f6dc
commit 385b415676

View File

@ -253,7 +253,7 @@ function runQuery() {
$("#run, #explain, #csv").prop("disabled", true); $("#run, #explain, #csv").prop("disabled", true);
$("#query_progress").show(); $("#query_progress").show();
var query = $.trim(editor.getValue()); var query = $.trim(editor.getSelectedText() || editor.getValue());
if (query.length == 0) { if (query.length == 0) {
$("#run, #explain, #csv").prop("disabled", false); $("#run, #explain, #csv").prop("disabled", false);