feat: add Escape key shortcut to close popups

Added Escape key handler to close ElementPopup or PagePopup when open.
The handler checks which popup is visible and calls its close method.

Works in all contexts (main document and iframe) using the existing
handleKeyboardShortcut function.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
isUnknown 2026-01-09 17:09:28 +01:00
parent 91ef119697
commit 8e2f0a10e2

View file

@ -38,9 +38,21 @@ const activeFrame = computed(() => {
: previewFrame2.value;
});
// Handle keyboard shortcuts (Cmd/Ctrl+S for save)
// Handle keyboard shortcuts
const handleKeyboardShortcut = (event) => {
// Check for Cmd+S (Mac) or Ctrl+S (Windows/Linux)
// Escape key - close any open popup
if (event.key === 'Escape') {
if (elementPopup.value?.visible) {
elementPopup.value.close();
return;
}
if (pagePopup.value?.visible) {
pagePopup.value.close();
return;
}
}
// Cmd+S (Mac) or Ctrl+S (Windows/Linux) - save
if ((event.metaKey || event.ctrlKey) && event.key === 's') {
event.preventDefault();