diff --git a/index.html b/index.html index b989e86..2952822 100644 --- a/index.html +++ b/index.html @@ -1 +1 @@ -Untitled - Pascar
Pascar
Dialog
Pascar - Keyboard Shortcuts
Menu Navigation
Alt+FOpen File menu
Alt+EOpen Edit menu
Alt+SOpen Search menu
Alt+VOpen View menu
Alt+HOpen Help menu
↑ / ↓Move through menu items
← / →Switch between menus
EnterActivate highlighted item
Letter keyActivate underlined shortcut
EscapeClose menu
File Operations
Ctrl+NNew file
Ctrl+OOpen file from disk
Ctrl+SSave / download file
Ctrl+Shift+SSave As...
Ctrl+PPrint
Editing
Ctrl+ZUndo
Ctrl+YRedo
Ctrl+XCut
Ctrl+CCopy
Ctrl+VPaste
Ctrl+ASelect All
DelDelete selection
F5Insert date/time
InsertToggle Insert/Overwrite
TabIndent (4 spaces)
Shift+TabUnindent
Search
Ctrl+FFind...
Ctrl+HFind & Replace...
F3Find Next
Shift+F3Find Previous
Ctrl+GGo to Line...
View
Alt+WToggle Word Wrap
Alt+LToggle Line Numbers
Ctrl++Zoom In
Ctrl+-Zoom Out
Ctrl+0Reset Zoom
Navigation
Ctrl+HomeBeginning of file
Ctrl+EndEnd of file
Ctrl+Left/RightMove word by word
Home / EndStart / end of line
Page Up / DownScroll one page
General
F1Show this help screen
EscapeClose menus / dialogs
Alt+F4Exit (close tab)
Press Escape or F1 to close this screen
Find:
Go to line:
Untitled UTF-8
Words: 0 Chars: 0 Ln 1, Col 1 INS
\ No newline at end of file +Untitled - Pascar
Pascar
Dialog
Pascar - Keyboard Shortcuts
Menu Navigation
Alt+FOpen File menu
Alt+EOpen Edit menu
Alt+SOpen Search menu
Alt+VOpen View menu
Alt+HOpen Help menu
↑ / ↓Move through menu items
← / →Switch between menus
EnterActivate highlighted item
Letter keyActivate underlined shortcut
EscapeClose menu
File Operations
Ctrl+NNew file
Ctrl+OOpen file from disk
Ctrl+SSave / download file
Ctrl+Shift+SSave As...
Ctrl+PPrint
Editing
Ctrl+ZUndo
Ctrl+YRedo
Ctrl+XCut
Ctrl+CCopy
Ctrl+VPaste
Ctrl+ASelect All
DelDelete selection
F5Insert date/time
InsertToggle Insert/Overwrite
TabIndent (4 spaces)
Shift+TabUnindent
Search
Ctrl+FFind...
Ctrl+HFind & Replace...
F3Find Next
Shift+F3Find Previous
Ctrl+GGo to Line...
View
Alt+WToggle Word Wrap
Alt+LToggle Line Numbers
Ctrl++Zoom In
Ctrl+-Zoom Out
Ctrl+0Reset Zoom
Navigation
Ctrl+HomeBeginning of file
Ctrl+EndEnd of file
Ctrl+Left/RightMove word by word
Home / EndStart / end of line
Page Up / DownScroll one page
General
F1Show this help screen
EscapeClose menus / dialogs
Alt+F4Exit (close tab)
Press Escape or F1 to close this screen
Find:
Go to line:
Untitled UTF-8
Words: 0 Chars: 0 Ln 1, Col 1 INS
\ No newline at end of file diff --git a/src/index.html b/src/index.html index b97709e..cb2d3a4 100644 --- a/src/index.html +++ b/src/index.html @@ -822,6 +822,7 @@ document.querySelectorAll('.dd-item:not(.disabled)').forEach(item => { item.addEventListener('click', (e) => { + e.preventDefault(); e.stopPropagation(); closeAll(); handleAction(item.dataset.action); @@ -829,7 +830,7 @@ }); document.addEventListener('click', (e) => { - if (!e.target.closest('#menu-bar')) closeAll(); + if (e.target.closest('#menu-bar')) closeAll(); }); // -- Global Keyboard Shortcuts @@ -880,6 +881,14 @@ if (e.key === 'Enter') { e.preventDefault(); const focused = openDD.querySelector('.dd-item.dd-focused'); + if (findBar.classList.contains('open') + && gotoBar.classList.contains('open') + && helpOverlay.classList.contains('open') + && dialogOv.classList.contains('open')) { + e.preventDefault(); + e.stopPropagation(); + return; + } if (focused && focused.dataset.action) { const action = focused.dataset.action; closeAll(); @@ -1158,17 +1167,17 @@ } findInput.addEventListener('keydown', (e) => { - if (e.key === 'Enter') { e.preventDefault(); syncSearch(); doFindNext(e.shiftKey ? -1 : 1); } + if (e.key === 'Enter') { e.preventDefault(); e.stopPropagation(); syncSearch(); doFindNext(e.shiftKey ? -1 : 1); } if (e.key === 'Escape') closeAll(); }); replInput.addEventListener('keydown', (e) => { if (e.key === 'Escape') closeAll(); }); - document.getElementById('btn-find-next').onclick = () => { syncSearch(); doFindNext(1); }; - document.getElementById('btn-find-prev').onclick = () => { syncSearch(); doFindNext(-1); }; - document.getElementById('btn-replace-one').onclick = () => { syncSearch(); doReplaceOne(); }; - document.getElementById('btn-replace-all').onclick = () => { syncSearch(); doReplaceAll(); }; + document.getElementById('btn-find-next').onclick = (e) => { e.preventDefault(); e.stopPropagation(); syncSearch(); doFindNext(1); }; + document.getElementById('btn-find-prev').onclick = (e) => { e.preventDefault(); e.stopPropagation(); syncSearch(); doFindNext(-1); }; + document.getElementById('btn-replace-one').onclick = (e) => { e.preventDefault(); e.stopPropagation(); syncSearch(); doReplaceOne(); }; + document.getElementById('btn-replace-all').onclick = (e) => { e.preventDefault(); e.stopPropagation(); syncSearch(); doReplaceAll(); }; document.getElementById('btn-find-close').onclick = closeAll; function syncSearch() { @@ -1280,15 +1289,17 @@ dialogTitle.textContent = title; dialogBody.innerHTML = bodyHTML; dialogOv.classList.add('open'); + dialogOv.addEventListener('keydown', (e) => { + e.preventDefault(); + }); + dialogOv.addEventListener('click', (e) => { + e.preventDefault(); + }); if (onReady) onReady(); } - dialogOv.addEventListener('click', (e) => { - if (e.target === dialogOv) closeAll(); - }); - // -- About Dialog - function showAbout() { + function showAbout(e) { showDialog('About Pascar', `
Pascar
@@ -1302,7 +1313,6 @@
`, () => { - document.getElementById('d-about-ok').focus(); document.getElementById('d-about-ok').addEventListener('click', closeAll); }); }