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:
parent
91ef119697
commit
8e2f0a10e2
1 changed files with 14 additions and 2 deletions
16
src/App.vue
16
src/App.vue
|
|
@ -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();
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue