Keyboard shortcut for editing labels from the library

This commit is contained in:
Jackson Harper
2022-04-19 11:41:29 -07:00
parent 73af8ada81
commit 1afa24d12a
4 changed files with 16 additions and 7 deletions

View File

@ -35,6 +35,12 @@ export function CardMenu(props: CardMenuProps): JSX.Element {
title="Unarchive"
/>
)}
<DropdownOption
onSelect={() => {
props.actionHandler('set-labels')
}}
title="Set Labels"
/>
{isVipUser(props.viewer) && (
<DropdownOption
onSelect={() => {
@ -64,12 +70,6 @@ export function CardMenu(props: CardMenuProps): JSX.Element {
title="Mark Unread"
/>
)}
<DropdownOption
onSelect={() => {
props.actionHandler('set-labels')
}}
title="Set Labels"
/>
<DropdownOption
onSelect={() => {
props.actionHandler('delete')

View File

@ -281,7 +281,6 @@ export function SetLabelsControl(props: SetLabelsControlProps): JSX.Element {
}
}
}
event.preventDefault()
}, [filterText, filteredLabels, focusedIndex, isSelected, selectedLabels, setSelectedLabels])
const createLabelFromFilterText = useCallback(async () => {

View File

@ -364,6 +364,9 @@ export function HomeFeedContainer(props: HomeFeedContainerProps): JSX.Element {
case 'markItemAsUnread':
handleCardAction('mark-unread', activeItem)
break
case 'showEditLabelsModal':
handleCardAction('set-labels', activeItem)
break
case 'shareItem':
setShareTarget(activeItem)
break

View File

@ -86,6 +86,7 @@ type LibraryListKeyboardAction =
| 'sortAscending'
| 'shareItem'
| 'showAddLinkModal'
| 'showEditLabelsModal'
export function libraryListCommands(
actionHandler: (action: LibraryListKeyboardAction) => void
@ -127,6 +128,12 @@ export function libraryListCommands(
shortcutKeyDescription: 'e',
callback: () => actionHandler('archiveItem'),
},
{
shortcutKeys: ['l'],
actionDescription: 'Edit item labels',
shortcutKeyDescription: 'l',
callback: () => actionHandler('showEditLabelsModal'),
},
{
shortcutKeys: ['shift', 'i'],
actionDescription: 'Mark item as read',