mirror of
https://github.com/gristlabs/grist-core.git
synced 2026-03-02 04:09:24 +00:00
(core) Adding new command Duplicate rows
Summary: New command "Duplicate rows" is available in the Row/Card Context Menu and as a keyboard shortcut Ctrl+Alt+C. - All selected rows are duplicated (even if only a single column is selected) - Rows are inserted immediately after the last selected row (using manualSort value). - Formulas and CENSORED fields are not copied. Implemented on the UI level (no new action). Test Plan: new test Reviewers: cyprien Reviewed By: cyprien Differential Revision: https://phab.getgrist.com/D3371
This commit is contained in:
@@ -216,6 +216,7 @@ DetailView.prototype.buildContextMenu = function(row, options) {
|
||||
disableInsert: Boolean(this.gristDoc.isReadonly.get() || this.viewSection.disableAddRemoveRows() || this.tableModel.tableMetaRow.onDemand()),
|
||||
disableDelete: Boolean(this.gristDoc.isReadonly.get() || this.viewSection.disableAddRemoveRows() || row._isAddRow()),
|
||||
isViewSorted: this.viewSection.activeSortSpec.peek().length > 0,
|
||||
numRows: this.getSelection().rowIds.length,
|
||||
};
|
||||
return RowContextMenu(options ? Object.assign(defaults, options) : defaults);
|
||||
}
|
||||
@@ -422,4 +423,9 @@ DetailView.prototype.scrollToCursor = function(sync = true) {
|
||||
return kd.doScrollChildIntoView(this.scrollPane, this.cursor.rowIndex(), sync);
|
||||
}
|
||||
|
||||
DetailView.prototype._duplicateRows = async function() {
|
||||
const addRowIds = await BaseView.prototype._duplicateRows.call(this);
|
||||
this.setCursorPos({rowId: addRowIds[0]})
|
||||
}
|
||||
|
||||
module.exports = DetailView;
|
||||
|
||||
Reference in New Issue
Block a user