Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support copy from right in timetable editor #1013

Merged
merged 3 commits into from
Jan 7, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions i18n/english.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1295,6 +1295,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
13 changes: 12 additions & 1 deletion lib/editor/components/timetable/TimetableGrid.js
Original file line number Diff line number Diff line change
Expand Up @@ -197,14 +197,25 @@ export default class TimetableGrid extends Component<Props> {
case 222: { // single quote
// Set current cell's value to adjacent cell's (leftward) value.
const adjacentCol = columns[this._getColIndex(scrollToColumn) - 1]
if (evt.shiftKey && !activeCell && isTimeFormat(adjacentCol.type)) {
if (evt.shiftKey && !activeCell && adjacentCol && isTimeFormat(adjacentCol.type) && isTimeFormat(col.type)) {
const value = objectPath.get(data[scrollToRow], adjacentCol.key)
this._handleCellChange(value, scrollToRow, col, scrollToColumn)
this.offsetScrollCol(1)
return false
}
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 && adjacentCol && isTimeFormat(adjacentCol.type) && isTimeFormat(col.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:+:;']
miles-grant-ibigroup marked this conversation as resolved.
Show resolved Hide resolved
}

/**
Expand Down
Loading