Merge pull request #160 from PasteBar/fix-quick-paste-window-shortcuts-numbers-is-wrong-when-using-search
Fix quick paste window shortcuts numbers is wrong when using search
This commit is contained in:
commit
44c879b0ed
5
.changeset/grumpy-mangos-do.md
Normal file
5
.changeset/grumpy-mangos-do.md
Normal file
@ -0,0 +1,5 @@
|
||||
---
|
||||
'pastebar-app-ui': patch
|
||||
---
|
||||
|
||||
Update to shortcut for quick copy paste ctrl + number added cmd key press on mac
|
@ -54,6 +54,7 @@ interface ClipboardHistoryQuickPasteRowProps {
|
||||
index?: number
|
||||
style?: CSSProperties
|
||||
isExpanded: boolean
|
||||
isWindows?: boolean
|
||||
isWrapText: boolean
|
||||
isSelected?: boolean
|
||||
isDeleting?: boolean
|
||||
@ -125,6 +126,7 @@ export function ClipboardHistoryQuickPasteRowComponent({
|
||||
isScrolling = false,
|
||||
isPinnedTop = false,
|
||||
isPinnedTopFirst = false,
|
||||
isWindows,
|
||||
isDisabledPinnedMoveUp = false,
|
||||
isDisabledPinnedMoveDown = false,
|
||||
isExpanded = false,
|
||||
@ -306,7 +308,9 @@ export function ClipboardHistoryQuickPasteRowComponent({
|
||||
}, [clipboard?.isLink, hasLinkCard])
|
||||
|
||||
const showCopyPasteIndexNumber =
|
||||
isKeyCtrlPressed.value && typeof index !== 'undefined' && index < 10
|
||||
(isKeyCtrlPressed.value || (isKeyAltPressed.value && !isWindows)) &&
|
||||
typeof index !== 'undefined' &&
|
||||
index < 10
|
||||
|
||||
const pinnedTopOffsetFirst = !isPinnedTopFirst ? 'top-[-10px]' : 'top-[5px]'
|
||||
const bgToolsPanel = `${
|
||||
|
@ -301,7 +301,9 @@ export function ClipboardHistoryRowComponent({
|
||||
}, [clipboard?.isLink, hasLinkCard])
|
||||
|
||||
const showCopyPasteIndexNumber =
|
||||
isKeyCtrlPressed.value && typeof index !== 'undefined' && index < 10
|
||||
(isKeyCtrlPressed.value || (isKeyAltPressed.value && !isWindows)) &&
|
||||
typeof index !== 'undefined' &&
|
||||
index < 10
|
||||
|
||||
const pinnedTopOffsetFirst = !isPinnedTopFirst ? 'top-[-10px]' : 'top-[5px]'
|
||||
const bgToolsPanel = `${
|
||||
|
@ -317,6 +317,7 @@ export default function ClipboardHistoryPage() {
|
||||
useHotkeys(
|
||||
[...Array(10).keys()].map(i => `ctrl+${i.toString()}`),
|
||||
e => {
|
||||
e.preventDefault()
|
||||
const index = e.key === '0' ? 9 : Number(e.key) - 1
|
||||
const itemId = clipboardHistory[Number(index)]?.historyId
|
||||
|
||||
@ -325,12 +326,35 @@ export default function ClipboardHistoryPage() {
|
||||
}
|
||||
|
||||
setCopiedItem(itemId)
|
||||
},
|
||||
{
|
||||
enableOnFormTags: ['input'],
|
||||
}
|
||||
)
|
||||
|
||||
useHotkeys(
|
||||
[...Array(10).keys()].map(i => `meta+${i.toString()}`),
|
||||
e => {
|
||||
e.preventDefault()
|
||||
const index = e.key === '0' ? 9 : Number(e.key) - 1
|
||||
const itemId = clipboardHistory[Number(index)]?.historyId
|
||||
|
||||
if (!itemId) {
|
||||
return
|
||||
}
|
||||
|
||||
setCopiedItem(itemId)
|
||||
},
|
||||
{
|
||||
enabled: !isWindows,
|
||||
enableOnFormTags: ['input'],
|
||||
}
|
||||
)
|
||||
|
||||
useHotkeys(
|
||||
[...Array(10).keys()].map(i => `ctrl+${isWindows ? 'alt' : 'meta'}+${i.toString()}`),
|
||||
e => {
|
||||
e.preventDefault()
|
||||
const index = e.key === '0' ? 9 : Number(e.key) - 1
|
||||
const itemId = clipboardHistory[Number(index)]?.historyId
|
||||
|
||||
@ -339,6 +363,9 @@ export default function ClipboardHistoryPage() {
|
||||
}
|
||||
|
||||
setPastedItem(itemId)
|
||||
},
|
||||
{
|
||||
enableOnFormTags: ['input'],
|
||||
}
|
||||
)
|
||||
|
||||
|
@ -246,6 +246,28 @@ export default function ClipboardHistoryQuickPastePage() {
|
||||
}
|
||||
|
||||
invokeCopyPasteHistoryItem(itemId)
|
||||
},
|
||||
{
|
||||
enableOnFormTags: ['input'],
|
||||
}
|
||||
)
|
||||
|
||||
useHotkeys(
|
||||
[...Array(10).keys()].map(i => `meta+${i.toString()}`),
|
||||
e => {
|
||||
e.preventDefault()
|
||||
const index = e.key === '0' ? 9 : Number(e.key) - 1
|
||||
const itemId = clipboardHistory[Number(index)]?.historyId
|
||||
|
||||
if (!itemId) {
|
||||
return
|
||||
}
|
||||
|
||||
invokeCopyPasteHistoryItem(itemId)
|
||||
},
|
||||
{
|
||||
enabled: !isWindows,
|
||||
enableOnFormTags: ['input'],
|
||||
}
|
||||
)
|
||||
|
||||
@ -682,6 +704,7 @@ export default function ClipboardHistoryQuickPastePage() {
|
||||
setSavingItem={setSavingItem}
|
||||
isDeleting={false}
|
||||
isSelected={false}
|
||||
isWindows={isWindows}
|
||||
setBrokenImageItem={setBrokenImageItem}
|
||||
isBrokenImage={brokenImageItems.includes(historyId)}
|
||||
showTimeAgo={false}
|
||||
@ -855,6 +878,7 @@ export default function ClipboardHistoryQuickPastePage() {
|
||||
hasGenerateLinkMetaDataInProgress={clipboardHistoryGenerateLinkMetaDataInProgress.includes(
|
||||
historyId
|
||||
)}
|
||||
isWindows={isWindows}
|
||||
setHistoryFilters={setHistoryFilters}
|
||||
setAppFilters={setAppFilters}
|
||||
setSelectHistoryItem={() => {}}
|
||||
|
Loading…
x
Reference in New Issue
Block a user