Skip to content

Commit

Permalink
support right-copy in timetable editor
Browse files Browse the repository at this point in the history
  • Loading branch information
miles-grant-ibigroup committed May 1, 2024
1 parent 1efb3f0 commit ad4a011
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
1 change: 1 addition & 0 deletions i18n/english.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1399,6 +1399,7 @@ components:
- New trip
- Clone selected trip(s)
- Copy time value from adjacent cell (the cell immediately to the left)
- Copy time value from adjacent cell (the cell immediately to the right)
- Copy value from cell directly above
title: Timetable editor keyboard shortcuts
TimezoneSelect:
Expand Down
11 changes: 11 additions & 0 deletions lib/editor/components/timetable/TimetableGrid.js
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,17 @@ export default class TimetableGrid extends Component<Props> {
}
break
}
case 76: { // l
// Set current cell's value to adjacent cell's (rightward) value.
const adjacentCol = columns[this._getColIndex(scrollToColumn) + 1]
if (evt.shiftKey && !activeCell && isTimeFormat(adjacentCol.type)) {
const value = objectPath.get(data[scrollToRow], adjacentCol.key)
this._handleCellChange(value, scrollToRow, col, scrollToColumn)
this.offsetScrollCol(-1)
return false
}
break
}
case 186: { // semi-colon
// Set current cell's value to above cell's value.
const previousRowIndex = scrollToRow - 1
Expand Down
2 changes: 1 addition & 1 deletion lib/editor/util/timetable.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { EXCEPTION_EXEMPLARS } from '.'
export const SHORTCUTS = {
offset: ['o', 'SHIFT:+:o', 'i', 'SHIFT:+:i', '-', 'SHIFT:+:-', '+', 'SHIFT:+:+'],
navigate: ['k:/:j', '←:/:→', 'x', 'a', 'd'],
modify: ['#', 'n', 'c', 'SHIFT:+:\'', 'SHIFT:+:;']
modify: ['#', 'n', 'c', 'SHIFT:+:\'', 'SHIFT:+:l', 'SHIFT:+:;']
}

/**
Expand Down

0 comments on commit ad4a011

Please sign in to comment.