Skip to content

Commit

Permalink
fix: hotkeys
Browse files Browse the repository at this point in the history
  • Loading branch information
hemengke1997 committed Sep 24, 2024
1 parent b962188 commit 4690915
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# CHANGELOG

## 1.15.3 (2024-09-24)

### Fix

- 修复图片首次触发快捷键时,非聚焦图片触发快捷键的问题

## 1.15.2 (2024-09-24)

### Fix
Expand Down
5 changes: 4 additions & 1 deletion src/webview/image-manager/components/lazy-image/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,7 @@ function LazyImage(props: LazyImageProps) {
const setKeybindRef = useHotkeys<HTMLDivElement>(
[Key.Enter, `mod+${Key.Backspace}`, Key.Delete, `mod+c`],
(e) => {
if (e.target !== keybindRef.current) return
if (contextMenu?.enable?.fs) {
switch (e.key) {
case Key.Enter: {
Expand Down Expand Up @@ -225,7 +226,9 @@ function LazyImage(props: LazyImageProps) {

const keybindRef = useRef<HTMLDivElement>(null)
useEffect(() => {
setKeybindRef(keybindRef.current)
if (keybindRef.current) {
setKeybindRef(keybindRef.current)
}
}, [keybindRef.current])

const sizeWarning = useMemo((): boolean => {
Expand Down

0 comments on commit 4690915

Please sign in to comment.