-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
minor fixes #1619
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
minor fixes #1619
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -4,6 +4,7 @@ import { useOptimisticActions } from './use-optimistic-actions'; | |||||||||
| import { useMail } from '@/components/mail/use-mail'; | ||||||||||
| import { useHotkeys } from 'react-hotkeys-hook'; | ||||||||||
| import { atom, useAtom } from 'jotai'; | ||||||||||
| import { useQueryState } from 'nuqs'; | ||||||||||
|
|
||||||||||
| export const focusedIndexAtom = atom<number | null>(null); | ||||||||||
| export const mailNavigationCommandAtom = atom<null | 'next' | 'previous'>(null); | ||||||||||
|
|
@@ -23,7 +24,8 @@ export function useMailNavigation({ items, containerRef, onNavigate }: UseMailNa | |||||||||
| itemsRef.current = items; | ||||||||||
| const onNavigateRef = useRef(onNavigate); | ||||||||||
| onNavigateRef.current = onNavigate; | ||||||||||
| const { open: isCommandPaletteOpen } = useCommandPalette(); | ||||||||||
| const [threadId] = useQueryState('threadId'); | ||||||||||
| const [isCommandPaletteOpen] = useQueryState('isCommandPaletteOpen'); | ||||||||||
|
Comment on lines
+27
to
+28
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. style: Both these query state hooks should specify their types. Add generic type parameters to useQueryState.
Suggested change
|
||||||||||
|
|
||||||||||
| const hoveredMailRef = useRef<string | null>(null); | ||||||||||
| const keyboardActiveRef = useRef(false); | ||||||||||
|
|
@@ -77,8 +79,7 @@ export function useMailNavigation({ items, containerRef, onNavigate }: UseMailNa | |||||||||
| const message = itemsRef.current[index]; | ||||||||||
| const threadId = message.id; | ||||||||||
|
|
||||||||||
| const currentThreadId = window.location.search.includes('threadId='); | ||||||||||
| if (currentThreadId) { | ||||||||||
| if (threadId) { | ||||||||||
| onNavigateRef.current(threadId); | ||||||||||
| optimisticMarkAsRead([threadId], true); | ||||||||||
| } | ||||||||||
|
|
@@ -88,7 +89,7 @@ export function useMailNavigation({ items, containerRef, onNavigate }: UseMailNa | |||||||||
| bulkSelected: [], | ||||||||||
| })); | ||||||||||
| }, | ||||||||||
| [setMail], | ||||||||||
| [setMail, threadId], | ||||||||||
| ); | ||||||||||
|
|
||||||||||
| const navigateNext = useCallback(() => { | ||||||||||
|
|
@@ -196,11 +197,14 @@ export function useMailNavigation({ items, containerRef, onNavigate }: UseMailNa | |||||||||
| }, [setFocusedIndex, onNavigateRef]); | ||||||||||
|
|
||||||||||
| useHotkeys('ArrowUp', handleArrowUp, { preventDefault: true, enabled: !isCommandPaletteOpen }); | ||||||||||
| useHotkeys('ArrowDown', handleArrowDown, { preventDefault: true, enabled: !isCommandPaletteOpen }); | ||||||||||
| useHotkeys('j', handleArrowDown,{enabled: !isCommandPaletteOpen }); | ||||||||||
| useHotkeys('ArrowDown', handleArrowDown, { | ||||||||||
| preventDefault: true, | ||||||||||
| enabled: !isCommandPaletteOpen, | ||||||||||
| }); | ||||||||||
| useHotkeys('j', handleArrowDown, { enabled: !isCommandPaletteOpen }); | ||||||||||
| useHotkeys('k', handleArrowUp, { enabled: !isCommandPaletteOpen }); | ||||||||||
| useHotkeys('Enter', handleEnter, { preventDefault: true,enabled: !isCommandPaletteOpen }); | ||||||||||
| useHotkeys('Escape', handleEscape, { preventDefault: true,enabled: !isCommandPaletteOpen }); | ||||||||||
| useHotkeys('Enter', handleEnter, { preventDefault: true, enabled: !isCommandPaletteOpen }); | ||||||||||
| useHotkeys('Escape', handleEscape, { preventDefault: true, enabled: !isCommandPaletteOpen }); | ||||||||||
|
|
||||||||||
| const handleMouseEnter = useCallback( | ||||||||||
| (threadId: string) => { | ||||||||||
|
|
||||||||||
| Original file line number | Diff line number | Diff line change | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -14,7 +14,7 @@ export function processEmailHtml({ html, shouldLoadImages, theme }: ProcessEmail | |||||||||||||
| let hasBlockedImages = false; | ||||||||||||||
|
|
||||||||||||||
| const sanitizeConfig: sanitizeHtml.IOptions = { | ||||||||||||||
| allowedTags: false, | ||||||||||||||
| allowedTags: sanitizeHtml.defaults.allowedTags.concat(['img']), | ||||||||||||||
| allowedAttributes: false, | ||||||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. logic: Setting allowedAttributes: false permits all attributes. Consider whitelisting specific attributes needed for email display (src, href, style, etc).
Suggested change
|
||||||||||||||
| allowedSchemes: shouldLoadImages | ||||||||||||||
| ? ['http', 'https', 'mailto', 'tel', 'data', 'cid', 'blob'] | ||||||||||||||
|
|
||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
logic: Form validation will fail until form is initialized. Add default values here to match schema.