sql console executes selected text if there's a selection instead of the whole content

This commit is contained in:
azivner 2018-11-18 08:29:56 +01:00
parent 228a77cb89
commit 1ee8d9fd93
2 changed files with 7 additions and 2 deletions

2
package-lock.json generated
View file

@ -1,6 +1,6 @@
{
"name": "trilium",
"version": "0.23.1",
"version": "0.24.0-beta",
"lockfileVersion": 1,
"requires": true,
"dependencies": {

View file

@ -50,7 +50,12 @@ async function execute(e) {
e.preventDefault();
e.stopPropagation();
const sqlQuery = codeEditor.getValue();
// execute the selected text or the whole content if there's no selection
let sqlQuery = codeEditor.getSelection();
if (!sqlQuery) {
sqlQuery = codeEditor.getValue();
}
const result = await server.post("sql/execute", {
query: sqlQuery