Experiment quick open Shortcuts Settings

This commit is contained in:
Lim Chee Aun 2023-11-03 22:08:44 +08:00
parent 1f039a4d73
commit dc1452ab30
2 changed files with 29 additions and 2 deletions

View file

@ -49,7 +49,24 @@ function Columns() {
} }
}); });
return <div id="columns">{components}</div>; return (
<div
id="columns"
onContextMenu={(e) => {
// If right-click on header, but not links or buttons
if (
e.target.closest('.deck > header') &&
!e.target.closest('a') &&
!e.target.closest('button')
) {
e.preventDefault();
states.showShortcutsSettings = true;
}
}}
>
{components}
</div>
);
} }
export default Columns; export default Columns;

View file

@ -90,7 +90,13 @@ function Shortcuts() {
return ( return (
<div id="shortcuts"> <div id="shortcuts">
{snapStates.settings.shortcutsViewMode === 'tab-menu-bar' ? ( {snapStates.settings.shortcutsViewMode === 'tab-menu-bar' ? (
<nav class="tab-bar"> <nav
class="tab-bar"
onContextMenu={(e) => {
e.preventDefault();
states.showShortcutsSettings = true;
}}
>
<ul> <ul>
{formattedShortcuts.map( {formattedShortcuts.map(
({ id, path, title, subtitle, icon }, i) => { ({ id, path, title, subtitle, icon }, i) => {
@ -146,6 +152,10 @@ function Shortcuts() {
type="button" type="button"
id="shortcuts-button" id="shortcuts-button"
class="plain" class="plain"
onContextMenu={(e) => {
e.preventDefault();
states.showShortcutsSettings = true;
}}
onTransitionStart={(e) => { onTransitionStart={(e) => {
// Close menu if the button disappears // Close menu if the button disappears
try { try {