fixing keys when focused

master
Mark MacKay 2021-05-01 15:58:06 -05:00
parent 790e694c5a
commit 5701ab72b5
2 changed files with 7 additions and 3 deletions

View File

@ -59,7 +59,8 @@ MD.Keyboard = function(){
};
document.addEventListener("keydown", function(e){
if ($("#color_picker").is(":visible")) return e;
const exceptions = $(":focus").length || $("#color_picker").is(":visible");
if (exceptions) return false;
const modKey = !svgedit.browser.isMac() ? "ctrlKey" : "metaKey";
const cmd = e[modKey] ? "cmd_" : "";
const shift = e.shiftKey ? "shift_" : "";
@ -92,7 +93,6 @@ MD.Keyboard = function(){
e.preventDefault();
keys[key]();
}
})
// modal shortcuts

View File

@ -141,7 +141,10 @@ MD.Editor = function(){
function escapeMode(){
for (key in editor.modal) editor.modal[key].close();
state.set("canvasMode", "select");
state.set("canvasContent", svgCanvas.getSvgString())
if ($("#cur_context_panel").is(":visible"))
svgCanvas.leaveContext()
else
state.set("canvasContent", svgCanvas.getSvgString())
}
// called when we've selected a different element
@ -191,6 +194,7 @@ MD.Editor = function(){
elems: elems
});
// todo svgCanvas.getCurrentContext is needed
if (!$("#cur_context_panel").is(":visible"))
state.set("canvasContent", svgCanvas.getSvgString())
}