mirror of
https://github.com/livebook-dev/livebook.git
synced 2025-03-04 02:43:09 +08:00
Scroll to section when moved (#226)
This commit is contained in:
parent
44eda43d02
commit
04edc75181
2 changed files with 10 additions and 3 deletions
|
@ -509,9 +509,8 @@ function handleSectionDeleted(hook, sectionId) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function handleSectionMoved(hook, sectionId) {
|
function handleSectionMoved(hook, sectionId) {
|
||||||
if (hook.state.focusedSectionId === sectionId) {
|
const section = getSectionById(sectionId);
|
||||||
globalPubSub.broadcast("session", { type: "section_moved", sectionId });
|
smoothlyScrollToElement(section);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function handleCellUpload(hook, cellId, url) {
|
function handleCellUpload(hook, cellId, url) {
|
||||||
|
|
|
@ -459,6 +459,14 @@ defmodule LivebookWeb.SessionLive do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
defp after_operation(socket, _prev_socket, {:move_section, client_pid, section_id, _offset}) do
|
||||||
|
if client_pid == self() do
|
||||||
|
push_event(socket, "section_moved", %{section_id: section_id})
|
||||||
|
else
|
||||||
|
socket
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
defp after_operation(socket, _prev_socket, _operation), do: socket
|
defp after_operation(socket, _prev_socket, _operation), do: socket
|
||||||
|
|
||||||
defp handle_actions(socket, actions) do
|
defp handle_actions(socket, actions) do
|
||||||
|
|
Loading…
Reference in a new issue