Skip to content

Commit

Permalink
Make it so that shift+backspace removes item from current list
Browse files Browse the repository at this point in the history
  • Loading branch information
blackforestboi committed Feb 28, 2024
1 parent 1eec4b6 commit f26a09c
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 16 deletions.
2 changes: 1 addition & 1 deletion external/@worldbrain/memex-common
5 changes: 5 additions & 0 deletions src/dashboard-refactor/logic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1715,6 +1715,11 @@ export class DashboardLogic extends UILogic<State, Events> {
if (previousState.listsSidebar.selectedListId == null) {
throw new Error('No list is currently filtered to remove page from')
}
this.processUIEvent('changeFocusItem', {
previousState,
event: { direction: 'down', pageId: event.pageId },
})

const listData = getListData(
previousState.listsSidebar.selectedListId,
previousState,
Expand Down
40 changes: 25 additions & 15 deletions src/dashboard-refactor/search-results/components/page-result.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -190,30 +190,40 @@ export default class PageResultView extends PureComponent<Props> {
break
break
case 'Enter':
if (this.props.editTitleState != null) {
if (event.shiftKey) {
event.stopPropagation()
// Perform action for "shift+Enter" key
const itemData = {
url: this.props.normalizedUrl,
title: this.props.fullTitle,
type: 'page',
}
if (this.props.isBulkSelected) {
this.props.selectItem(itemData, true)
} else {
this.props.selectItem(itemData, false)
}
} else {
// Perform action for "Enter" key
event.stopPropagation()
this.props.onClick(event as any)
break
}
}
break
case 'Backspace':
if (event.shiftKey) {
event.stopPropagation()
// Perform action for "shift+Enter" key
const itemData = {
url: this.props.normalizedUrl,
title: this.props.fullTitle,
type: 'page',
}
if (this.props.isBulkSelected) {
this.props.selectItem(itemData, true)
} else {
this.props.selectItem(itemData, false)
}
this.props.onRemoveFromListBtnClick(event as any)
} else {
// Perform action for "Enter" key
event.stopPropagation()
this.props.onClick(event as any)
this.props.onTrashBtnClick(event as any)
break
}
break
case 'Backspace':
// Perform action for "Backspace" key
this.props.onTrashBtnClick(event as any)
break
break
default:
break
Expand Down

0 comments on commit f26a09c

Please sign in to comment.