added popdown and autofocus to command palette

This commit is contained in:
Isaac Visintainer 2019-03-13 13:35:49 -07:00
parent 78c4d2063d
commit ea180d7416

View File

@ -26,12 +26,23 @@ function doSub() {
);
}
var palette = false;
window.addEventListener("message", (event) => {
let popup = document.getElementById("popup");
let input = document.getElementById("input");
if (palette) {
palette = false;
popup.style = "display:hidden;";
input.style = "visibility:hidden !important;";
input.value = "";
} else {
palette = true;
popup.style = "position:absolute; left: 0; top: 0; display:block; width: 100%; height: 100%; margin: 0 0; background-color:white;";
input.style = "";
input.focus();
input.addEventListener("keyup", (e) => {
if (e.keyCode !== 13) { return; }
popup.style = "display:hidden;";
@ -50,8 +61,7 @@ window.addEventListener("message", (event) => {
);
});
}
});
setFrame();