From e2337e96c82c8b08dab1f0cff32be0b86f4e7c33 Mon Sep 17 00:00:00 2001 From: brianlow Date: Mon, 18 May 2015 14:56:32 -0600 Subject: [PATCH] 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. --- static/js/app.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/static/js/app.js b/static/js/app.js index a104d938c..1a726ceef 100644 --- a/static/js/app.js +++ b/static/js/app.js @@ -253,8 +253,8 @@ function runQuery() { $("#run, #explain, #csv").prop("disabled", true); $("#query_progress").show(); - var query = $.trim(editor.getValue()); - + var query = query = $.trim(editor.getSelectedText() || editor.getValue()); + if (query.length == 0) { $("#run, #explain, #csv").prop("disabled", false); $("#query_progress").hide();