fixing keys when focused
parent
790e694c5a
commit
5701ab72b5
|
@ -59,7 +59,8 @@ MD.Keyboard = function(){
|
||||||
};
|
};
|
||||||
|
|
||||||
document.addEventListener("keydown", function(e){
|
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 modKey = !svgedit.browser.isMac() ? "ctrlKey" : "metaKey";
|
||||||
const cmd = e[modKey] ? "cmd_" : "";
|
const cmd = e[modKey] ? "cmd_" : "";
|
||||||
const shift = e.shiftKey ? "shift_" : "";
|
const shift = e.shiftKey ? "shift_" : "";
|
||||||
|
@ -92,7 +93,6 @@ MD.Keyboard = function(){
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
keys[key]();
|
keys[key]();
|
||||||
}
|
}
|
||||||
|
|
||||||
})
|
})
|
||||||
|
|
||||||
// modal shortcuts
|
// modal shortcuts
|
||||||
|
|
|
@ -141,7 +141,10 @@ MD.Editor = function(){
|
||||||
function escapeMode(){
|
function escapeMode(){
|
||||||
for (key in editor.modal) editor.modal[key].close();
|
for (key in editor.modal) editor.modal[key].close();
|
||||||
state.set("canvasMode", "select");
|
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
|
// called when we've selected a different element
|
||||||
|
@ -191,6 +194,7 @@ MD.Editor = function(){
|
||||||
elems: elems
|
elems: elems
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// todo svgCanvas.getCurrentContext is needed
|
||||||
if (!$("#cur_context_panel").is(":visible"))
|
if (!$("#cur_context_panel").is(":visible"))
|
||||||
state.set("canvasContent", svgCanvas.getSvgString())
|
state.set("canvasContent", svgCanvas.getSvgString())
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue