mirror of
https://github.com/gristlabs/grist-core.git
synced 2026-03-02 04:09:24 +00:00
(core) Scrolling to the active record when editor is activated
Summary: When an editor is activated by typing, the active view should be scrolled to the active record. Test Plan: new tests Reviewers: georgegevoian Reviewed By: georgegevoian Differential Revision: https://phab.getgrist.com/D3196
This commit is contained in:
@@ -68,6 +68,7 @@ function DetailView(gristDoc, viewSectionModel) {
|
||||
|
||||
//--------------------------------------------------
|
||||
// Construct DOM
|
||||
this.scrollPane = null;
|
||||
this.viewPane = this.autoDispose(this.buildDom());
|
||||
|
||||
//--------------------------------------------------
|
||||
@@ -286,7 +287,7 @@ DetailView.prototype.buildDom = function() {
|
||||
}),
|
||||
kd.maybe(() => !this.recordLayout.isEditingLayout(), () => {
|
||||
if (!this._isSingle) {
|
||||
return dom('div.detailview_scroll_pane.flexitem',
|
||||
return this.scrollPane = dom('div.detailview_scroll_pane.flexitem',
|
||||
kd.scrollChildIntoView(this.cursor.rowIndex),
|
||||
dom.onDispose(() => {
|
||||
// Save the previous scroll values to the section.
|
||||
@@ -414,4 +415,9 @@ DetailView.prototype._isAddRow = function(index = this.cursor.rowIndex()) {
|
||||
return this.viewData.getRowId(index) === 'new';
|
||||
};
|
||||
|
||||
DetailView.prototype.scrollToCursor = function(sync = true) {
|
||||
if (!this.scrollPane) { return Promise.resolve(); }
|
||||
return kd.doScrollChildIntoView(this.scrollPane, this.cursor.rowIndex(), sync);
|
||||
}
|
||||
|
||||
module.exports = DetailView;
|
||||
|
||||
Reference in New Issue
Block a user