mirror of
https://github.com/gristlabs/grist-core.git
synced 2026-03-02 04:09:24 +00:00
(core) Preserving cursor position when linked state is removed.
Summary: - Preserving cursor position when linked state is removed. - Moving linking tests to grist core. - Disabling yarn offline mirror for grist-core. This helps testing grist-core when it is imported as a submodule. - Moving one test for linked section from ReferenceColumns.ts to RightPanelSelectBy.ts. Test Plan: Updated Reviewers: paulfitz Reviewed By: paulfitz Subscribers: paulfitz Differential Revision: https://phab.getgrist.com/D3795
This commit is contained in:
@@ -140,8 +140,12 @@ function BaseView(gristDoc, viewSectionModel, options) {
|
||||
return linking && linking.cursorPos ? linking.cursorPos() : null;
|
||||
}).extend({deferred: true}));
|
||||
|
||||
// Update the cursor whenever linkedRowId() changes.
|
||||
this.autoDispose(this.linkedRowId.subscribe(rowId => this.setCursorPos({rowId: rowId || 'new'})));
|
||||
// Update the cursor whenever linkedRowId() changes (but only if we have any linking).
|
||||
this.autoDispose(this.linkedRowId.subscribe(rowId => {
|
||||
if (this.viewSection.linkingState.peek()) {
|
||||
this.setCursorPos({rowId: rowId || 'new'});
|
||||
}
|
||||
}));
|
||||
|
||||
// Indicated whether editing the section should be disabled given the current linking state.
|
||||
this.disableEditing = this.autoDispose(ko.computed(() => {
|
||||
@@ -693,7 +697,11 @@ BaseView.prototype.onRowResize = function(rowModels) {
|
||||
* Called when user selects a different row which drives the link-filtering of this section.
|
||||
*/
|
||||
BaseView.prototype.onLinkFilterChange = function(rowId) {
|
||||
this.setCursorPos({rowIndex: 0});
|
||||
// If this section is linked, go to the first row as the row previously selected may no longer
|
||||
// be visible.
|
||||
if (this.viewSection.linkingState.peek()) {
|
||||
this.setCursorPos({rowIndex: 0});
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user