mirror of
https://github.com/livebook-dev/livebook.git
synced 2025-09-07 13:34:55 +08:00
Fix auto-scrolling to not be interrupted by editor focus
This commit is contained in:
parent
b3ec5099b0
commit
cefd582802
2 changed files with 4 additions and 10 deletions
|
@ -67,6 +67,10 @@ const Cell = {
|
|||
if (isActive(prevProps) && !isActive(this.props)) {
|
||||
this.liveEditor.blur();
|
||||
}
|
||||
|
||||
if (!prevProps.isFocused && this.props.isFocused) {
|
||||
this.el.scrollIntoView({ behavior: "smooth", block: "center" });
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
|
|
|
@ -45,17 +45,7 @@ const Session = {
|
|||
},
|
||||
|
||||
updated() {
|
||||
const prevProps = this.props;
|
||||
this.props = getProps(this);
|
||||
|
||||
// When a new cell gets focus, center it nicely on the page
|
||||
if (
|
||||
this.props.focusedCellId &&
|
||||
this.props.focusedCellId !== prevProps.focusedCellId
|
||||
) {
|
||||
const cell = this.el.querySelector(`#cell-${this.props.focusedCellId}`);
|
||||
cell.scrollIntoView({ behavior: "smooth", block: "center" });
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue