You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat: implement Ctrl+C subtitle copy with lightweight toast notification (#140)
* feat(player): add subtitle copy shortcut with Ctrl+C
- Add copy_subtitle shortcut to constants with CommandOrControl+C
- Implement copy functionality in usePlayerShortcuts hook
- Support copying selected text or current subtitle based on display mode
- Add success/error notifications for copy operations
- Remove obsolete keyboard handling from SubtitleContent component
- Add i18n label support for copy_subtitle shortcut
* fix(player): enable text selection in subtitle tokens for copy functionality
- Change WordToken user-select from 'none' to 'text' to allow native text selection
- Add debug logging to copy function to help diagnose selection issues
- This enables Ctrl+C to copy selected subtitle text properly
* fix(player): use custom subtitle selection for copy functionality
- Use selectedText from useSubtitleOverlayUI instead of window.getSelection()
- Integrate with custom selection system used by SubtitleContent component
- Restore WordToken user-select: none to maintain custom selection behavior
- Update copy logic to properly detect custom selected text vs full subtitle
- Remove window.getSelection() debugging code as it's no longer used
* debug: add logging to copy function to diagnose selectedText state
* feat(player): add DOM-based selected text detection for copy
- Add fallback to DOM query when selectedText state is empty
- Check for selected tokens by background color style
- Maintains both state-based and DOM-based selection detection
- This should fix the issue where selectedText state gets cleared before copy
* simplify: remove word selection feature, keep only full subtitle copy
- Remove all selected text detection logic (selectedText state and DOM queries)
- Simplify copy function to only copy current subtitle based on display mode
- Remove dependency on useSubtitleOverlayUI hook
- Clean up notification message to show copied character count
- This makes the copy functionality simple and reliable
* feat(player): add lightweight toast notifications for subtitle copy
- Add Ctrl+C shortcut to copy current subtitle based on display mode
- Replace intrusive NotificationService with lightweight toast positioned above subtitle overlay
- Implement custom event system for decoupled toast communication between components
- Add i18n support for copy success/failure messages in zh-cn.json
- Toast automatically hides after 2 seconds with smooth fade transition
- Support copying original, translated, or bilingual subtitle content based on current display mode
- Position toast relative to subtitle overlay for better UX during immersive video watching
This improves user experience by providing non-intrusive feedback while maintaining
clean component architecture and supporting internationalization.
* Update src/renderer/src/pages/player/components/SubtitleOverlay.tsx
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
* Update src/renderer/src/pages/player/components/SubtitleOverlay.tsx
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
* Update src/renderer/src/pages/player/components/SubtitleOverlay.tsx
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
* 📝 Add docstrings to `copy-subtitle-shortcut` (#142)
Docstrings generation was requested by @mkdir700.
* #140 (comment)
The following files were modified:
* `src/renderer/src/pages/player/hooks/usePlayerShortcuts.ts`
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
* Update
* refactor: use design tokens in Toast components and add theming best practices
- Replace hardcoded values with design tokens in ToastContainer and ToastContent
- Use ANIMATION_DURATION, EASING, FONT_SIZES, FONT_WEIGHTS, SPACING, Z_INDEX, GLASS_EFFECT tokens
- Reduce toast display duration from 2000ms to 800ms for better UX
- Add comprehensive theming best practices to CLAUDE.md
- Document mixed approach: CSS variables for theme-related properties, JS variables for design constants
---------
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
0 commit comments