Automatically save last executed query to localStorage

This commit is contained in:
Dan Sosedoff 2015-07-30 22:29:08 -05:00
parent 2aacab44ec
commit fb13ce8b07
2 changed files with 14 additions and 4 deletions

File diff suppressed because one or more lines are too long

View File

@ -291,6 +291,9 @@ function runQuery() {
return;
}
// Automatically save last executed query so its not lost
localStorage.setItem("pgweb_query", query);
executeQuery(query, function(data) {
buildTable(data);
@ -360,6 +363,7 @@ function initEditor() {
editor.getSession().setMode("ace/mode/pgsql");
editor.getSession().setTabSize(2);
editor.getSession().setUseSoftTabs(true);
editor.commands.addCommands([{
name: "run_query",
bindKey: {
@ -379,6 +383,12 @@ function initEditor() {
runExplain();
}
}]);
var query = localStorage.getItem("pgweb_query");
if (query && query.length > 0) {
editor.setValue(query);
editor.clearSelection();
}
}
function addShortcutTooltips() {