feat: implement single-click copy/paste for Quick Paste window in settings and UI components

This commit is contained in:
Sergey Kurdin 2025-06-17 20:07:41 -04:00
parent 11f9571736
commit 6b1e1c5ffb
6 changed files with 49 additions and 6 deletions

View File

@ -210,6 +210,8 @@ function App() {
isQuickPasteCopyOnly: settings.isQuickPasteCopyOnly?.valueBool ?? false,
isQuickPasteAutoClose: settings.isQuickPasteAutoClose?.valueBool ?? true,
isSingleClickToCopyPaste: settings.isSingleClickToCopyPaste?.valueBool ?? false,
isSingleClickToCopyPasteQuickWindow:
settings.isSingleClickToCopyPasteQuickWindow?.valueBool ?? false,
isAppReady: true,
})
settingsStore.initConstants({

View File

@ -126,6 +126,8 @@ function QuickPasteApp() {
clipTextMaxLength: settings.clipTextMaxLength?.valueInt,
isQuickPasteCopyOnly: settings.isQuickPasteCopyOnly?.valueBool ?? false,
isQuickPasteAutoClose: settings.isQuickPasteAutoClose?.valueBool ?? true,
isSingleClickToCopyPasteQuickWindow:
settings.isSingleClickToCopyPasteQuickWindow?.valueBool ?? false,
isAppReady: true,
})

View File

@ -13,6 +13,7 @@ Default Note Icon Type: Default Note Icon Type
Display navbar items only when the mouse hovers over the navigation bar to minimize visible UI elements: Display navbar items only when the mouse hovers over the navigation bar to minimize visible UI elements
Display persistent icons on clips that have notes to improve visual organization and make notes easier to discover.: Display persistent icons on clips that have notes to improve visual organization and make notes easier to discover.
Enable simplified, less boxy layout for a cleaner and more streamlined interface design: Enable simplified, less boxy layout for a cleaner and more streamlined interface design
Enable single-click to copy/paste clipboard history items and saved clips instead of requiring double-click.: Enable single-click to copy/paste clipboard history items and saved clips instead of requiring double-click.
Global System OS Hotkeys: Global System OS Hotkeys
Hide Collections Navbar: Hide Collections Navbar
Hide collections menu dropdown on the navigation bar: Hide collections menu dropdown on the navigation bar
@ -42,13 +43,13 @@ Show navbar elements on hover only: Show navbar elements on hover only
Show/Hide Main App Window: Show/Hide Main App Window
Show/Hide Quick Paste Window: Show/Hide Quick Paste Window
Simplified Panel Layout: Simplified Panel Layout
This sets the default icon type for new clips with notes. You can customize individual clips via the context menu.: This sets the default icon type for new clips with notes. You can customize individual clips via the context menu.
When enabled, clicking menu items will only copy content to clipboard instead of auto-pasting. This gives you more control over when and where content is pasted.: When enabled, clicking menu items will only copy content to clipboard instead of auto-pasting. This gives you more control over when and where content is pasted.
? Enable single-click to copy/paste clipboard history items and saved clips instead of requiring double-click.
: Enable single-click to copy/paste clipboard history items and saved clips instead of requiring double-click.
Single Click Copy / Paste action: Single Click Copy / Paste action
Single Click Copy/Paste: Single Click Copy/Paste
This sets the default icon type for new clips with notes. You can customize individual clips via the context menu.: This sets the default icon type for new clips with notes. You can customize individual clips via the context menu.
? When enabled, clicking menu items will only copy content to clipboard instead of auto-pasting. This gives you more control over when and where content is pasted.
: When enabled, clicking menu items will only copy content to clipboard instead of auto-pasting. This gives you more control over when and where content is pasted.
? When enabled, clicking or pressing Enter on items in Quick Paste window will only copy them to clipboard without automatically pasting.
: When enabled, clicking or pressing Enter on items in Quick Paste window will only copy them to clipboard without automatically pasting.
? When enabled, single click will copy/paste items in Quick Paste window. If global single click is also enabled, both settings work together.
: When enabled, single click will copy/paste items in Quick Paste window. If global single click is also enabled, both settings work together.
When enabled, the Quick Paste window will automatically close after copying or pasting an item.: When enabled, the Quick Paste window will automatically close after copying or pasting an item.

View File

@ -122,6 +122,7 @@ export default function ClipboardHistoryQuickPastePage() {
isQuickPasteCopyOnly,
isQuickPasteAutoClose,
isSingleClickToCopyPaste,
isSingleClickToCopyPasteQuickWindow,
} = useAtomValue(settingsStoreAtom)
const [historyFilters, setHistoryFilters] = useState<string[]>([])
@ -805,7 +806,7 @@ export default function ClipboardHistoryQuickPastePage() {
clipboard={item}
removeLinkMetaData={removeLinkMetaData}
generateLinkMetaData={generateLinkMetaData}
isSingleClickToCopyPaste={isSingleClickToCopyPaste}
isSingleClickToCopyPaste={isSingleClickToCopyPaste || isSingleClickToCopyPasteQuickWindow}
/>
)
})}
@ -1001,7 +1002,7 @@ export default function ClipboardHistoryQuickPastePage() {
clipboard={clipboard}
removeLinkMetaData={removeLinkMetaData}
generateLinkMetaData={generateLinkMetaData}
isSingleClickToCopyPaste={isSingleClickToCopyPaste}
isSingleClickToCopyPaste={isSingleClickToCopyPaste || isSingleClickToCopyPasteQuickWindow}
index={index}
style={style}
/>

View File

@ -99,6 +99,8 @@ export default function UserPreferences() {
setIsQuickPasteAutoClose,
isSingleClickToCopyPaste,
setIsSingleClickToCopyPaste,
isSingleClickToCopyPasteQuickWindow,
setIsSingleClickToCopyPasteQuickWindow,
} = useAtomValue(settingsStoreAtom)
const { setFontSize, fontSize, setIsSwapPanels, isSwapPanels, returnRoute, isMacOSX } =
@ -1274,6 +1276,33 @@ export default function UserPreferences() {
/>
</div>
<div className="flex items-center justify-between">
<div>
<Text className="text-[15px] font-extrabold">
{t('Single Click Copy / Paste action', { ns: 'settings2' })}
</Text>
<Text className="text-xs text-muted-foreground">
{t(
'When enabled, single click will copy/paste items in Quick Paste window. If global single click is also enabled, both settings work together.',
{ ns: 'settings2' }
)}
</Text>
</div>
<Switch
checked={isSingleClickToCopyPasteQuickWindow}
onCheckedChange={async checked => {
try {
await setIsSingleClickToCopyPasteQuickWindow(checked)
} catch (error) {
console.error(
'Failed to update quick window single click setting:',
error
)
}
}}
/>
</div>
<div className="flex items-center justify-between">
<div>
<Text className="text-[15px] font-extrabold">

View File

@ -98,6 +98,7 @@ type Settings = {
isSimplifiedLayout: boolean
isMainWindowOnTop: boolean
isSingleClickToCopyPaste: boolean
isSingleClickToCopyPasteQuickWindow: boolean
isQuickPasteCopyOnly: boolean
isQuickPasteAutoClose: boolean
}
@ -186,6 +187,7 @@ export interface SettingsStoreState {
setIsQuickPasteCopyOnly: (isEnabled: boolean) => void
setIsQuickPasteAutoClose: (isEnabled: boolean) => void
setIsSingleClickToCopyPaste: (isEnabled: boolean) => void
setIsSingleClickToCopyPasteQuickWindow: (isEnabled: boolean) => void
hashPassword: (pass: string) => Promise<string>
isNotTourCompletedOrSkipped: (tourName: string) => boolean
verifyPassword: (pass: string, hash: string) => Promise<boolean>
@ -279,6 +281,7 @@ const initialState: SettingsStoreState & Settings = {
isSimplifiedLayout: true,
isMainWindowOnTop: false,
isSingleClickToCopyPaste: false,
isSingleClickToCopyPasteQuickWindow: false,
isQuickPasteCopyOnly: false,
isQuickPasteAutoClose: true,
CONST: {
@ -347,6 +350,7 @@ const initialState: SettingsStoreState & Settings = {
setIsSimplifiedLayout: () => {},
setIsMainWindowOnTop: () => {},
setIsSingleClickToCopyPaste: () => {},
setIsSingleClickToCopyPasteQuickWindow: () => {},
setIsQuickPasteCopyOnly: () => {},
setIsQuickPasteAutoClose: () => {},
initConstants: () => {},
@ -721,6 +725,10 @@ export const settingsStore = createStore<SettingsStoreState & Settings>()((set,
get().syncStateUpdate('isSingleClickToCopyPaste', isEnabled)
return get().updateSetting('isSingleClickToCopyPaste', isEnabled)
},
setIsSingleClickToCopyPasteQuickWindow: async (isEnabled: boolean) => {
get().syncStateUpdate('isSingleClickToCopyPasteQuickWindow', isEnabled)
return get().updateSetting('isSingleClickToCopyPasteQuickWindow', isEnabled)
},
setIsQuickPasteCopyOnly: async (isEnabled: boolean) => {
get().syncStateUpdate('isQuickPasteCopyOnly', isEnabled)
return get().updateSetting('isQuickPasteCopyOnly', isEnabled)