From ad4a011dada835178d02fd36e30c47ac0dd84f9a Mon Sep 17 00:00:00 2001 From: miles-grant-ibigroup Date: Wed, 1 May 2024 11:21:59 +0100 Subject: [PATCH] support right-copy in timetable editor --- i18n/english.yml | 1 + lib/editor/components/timetable/TimetableGrid.js | 11 +++++++++++ lib/editor/util/timetable.js | 2 +- 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/i18n/english.yml b/i18n/english.yml index ee3ddcfb3..8fecd2abb 100644 --- a/i18n/english.yml +++ b/i18n/english.yml @@ -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: diff --git a/lib/editor/components/timetable/TimetableGrid.js b/lib/editor/components/timetable/TimetableGrid.js index bbe2e7340..2a401a9c3 100644 --- a/lib/editor/components/timetable/TimetableGrid.js +++ b/lib/editor/components/timetable/TimetableGrid.js @@ -205,6 +205,17 @@ export default class TimetableGrid extends Component { } 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 diff --git a/lib/editor/util/timetable.js b/lib/editor/util/timetable.js index 248276dc6..d3f6dec6c 100644 --- a/lib/editor/util/timetable.js +++ b/lib/editor/util/timetable.js @@ -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:+:;'] } /**