mirror of
https://github.com/livebook-dev/livebook.git
synced 2026-01-11 01:59:11 +08:00
Improve scroll on cell focus/blur (#659)
* Stay in insert mode only if evaluate is clicked * Never scroll when focusing cell with click
This commit is contained in:
parent
4493a60380
commit
40158aa6cc
1 changed files with 8 additions and 7 deletions
|
|
@ -392,13 +392,14 @@ function handleDocumentMouseDown(hook, event) {
|
|||
return;
|
||||
}
|
||||
|
||||
// If click targets a clickable element that awaits mouse up, keep the focus as is
|
||||
if (event.target.closest(`a, button`)) {
|
||||
// If the pencil icon is clicked, enter insert mode
|
||||
if (event.target.closest(`[data-element="enable-insert-mode-button"]`)) {
|
||||
setInsertMode(hook, true);
|
||||
}
|
||||
// If the pencil icon is clicked, enter insert mode
|
||||
if (event.target.closest(`[data-element="enable-insert-mode-button"]`)) {
|
||||
setInsertMode(hook, true);
|
||||
return;
|
||||
}
|
||||
|
||||
// If primary cell action is clicked, keep the focus as is
|
||||
if (event.target.closest(`[data-element="actions"][data-primary]`)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -408,7 +409,7 @@ function handleDocumentMouseDown(hook, event) {
|
|||
const insertMode = editableElementClicked(event, cell);
|
||||
|
||||
if (cellId !== hook.state.focusedCellId) {
|
||||
setFocusedCell(hook, cellId, !insertMode);
|
||||
setFocusedCell(hook, cellId, false);
|
||||
}
|
||||
|
||||
// Depending on whether the click targets editor disable/enable insert mode
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue