fix: priorytet ESC i zatrzymanie propagacji w modalach
This commit is contained in:
@@ -156,7 +156,6 @@ const stopDrag = () => {
|
||||
onUnmounted(() => {
|
||||
window.removeEventListener('mousemove', onDrag);
|
||||
window.removeEventListener('mouseup', stopDrag);
|
||||
window.removeEventListener('keydown', onKeyDown);
|
||||
});
|
||||
|
||||
const showAdvanced = ref(false);
|
||||
@@ -170,16 +169,6 @@ const toggleAdvanced = () => {
|
||||
}
|
||||
};
|
||||
|
||||
const handleClose = () => {
|
||||
emit('close');
|
||||
};
|
||||
|
||||
const onKeyDown = (e) => {
|
||||
if (e.key === 'Escape') {
|
||||
handleClose();
|
||||
}
|
||||
};
|
||||
|
||||
onMounted(() => {
|
||||
const savedSize = localStorage.getItem('nonograms_custom_size');
|
||||
if (savedSize && !isNaN(savedSize)) {
|
||||
@@ -192,7 +181,6 @@ onMounted(() => {
|
||||
}
|
||||
|
||||
// Don't draw map initially if hidden
|
||||
window.addEventListener('keydown', onKeyDown);
|
||||
});
|
||||
|
||||
watch([customSize, fillRate], () => {
|
||||
|
||||
@@ -23,6 +23,8 @@ let stopRequested = false;
|
||||
|
||||
const onKeyDown = (e) => {
|
||||
if (e.key === 'Escape') {
|
||||
e.stopImmediatePropagation?.();
|
||||
e.preventDefault?.();
|
||||
emit('close');
|
||||
}
|
||||
};
|
||||
|
||||
@@ -28,6 +28,8 @@ const handleClose = () => {
|
||||
|
||||
const handleKeyDown = (e) => {
|
||||
if (e.key === 'Escape') {
|
||||
e.stopImmediatePropagation?.();
|
||||
e.preventDefault?.();
|
||||
handleClose();
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user