Skip to content

Commit

Permalink
fix: disable navigation hotkeys when editing, close #80
Browse files Browse the repository at this point in the history
  • Loading branch information
QingWei-Li committed Jun 22, 2021
1 parent 5c48f70 commit 904f6e5
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 3 additions & 1 deletion components/hotkey-tooltip.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ const HotkeyTooltip: FC<{
optionKey?: boolean
onClose?: TooltipProps['onClose']
onHotkey?: () => void
disableOnContentEditable?: boolean
}> = ({
text,
keys = [],
Expand All @@ -33,6 +34,7 @@ const HotkeyTooltip: FC<{
commandKey,
optionKey,
onHotkey = noop,
disableOnContentEditable = false,
}) => {
const {
ua: { isMac },
Expand All @@ -56,7 +58,7 @@ const HotkeyTooltip: FC<{
{
enabled: !!keys.length,
enableOnTags: ['INPUT', 'TEXTAREA'],
enableOnContentEditable: true,
enableOnContentEditable: !disableOnContentEditable,
},
[onHotkey]
)
Expand Down
2 changes: 2 additions & 0 deletions components/nav-button-group.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ const NavButtonGroup: FC = () => {
onHotkey={back}
keys={['Left']}
commandKey
disableOnContentEditable
>
<IconButton disabled={!canBack} icon="ArrowSmLeft" onClick={back} />
</HotkeyTooltip>
Expand All @@ -79,6 +80,7 @@ const NavButtonGroup: FC = () => {
onHotkey={forward}
keys={['Right']}
commandKey
disableOnContentEditable
>
<IconButton
disabled={!canForward}
Expand Down

0 comments on commit 904f6e5

Please sign in to comment.