mirror of
https://github.com/livebook-dev/livebook.git
synced 2025-03-03 18:35:41 +08:00
Add notbook runtime settings shortcut (#176)
This commit is contained in:
parent
fd65ebfaa5
commit
623c5b3290
3 changed files with 15 additions and 1 deletions
|
@ -155,6 +155,8 @@ function handleDocumentKeyDown(hook, event) {
|
|||
toggleSectionsPanel(hook);
|
||||
} else if (keyBuffer.tryMatch(["s", "n"])) {
|
||||
showNotebookSettings(hook);
|
||||
} else if (keyBuffer.tryMatch(["s", "r"])) {
|
||||
showNotebookRuntimeSettings(hook);
|
||||
} else if (keyBuffer.tryMatch(["e", "x"])) {
|
||||
cancelFocusedCellEvaluation(hook);
|
||||
} else if (keyBuffer.tryMatch(["?"])) {
|
||||
|
@ -303,6 +305,10 @@ function showNotebookSettings(hook) {
|
|||
hook.pushEvent("show_notebook_settings", {});
|
||||
}
|
||||
|
||||
function showNotebookRuntimeSettings(hook) {
|
||||
hook.pushEvent("show_notebook_runtime_settings", {});
|
||||
}
|
||||
|
||||
function deleteFocusedCell(hook) {
|
||||
if (hook.state.focusedCellId) {
|
||||
hook.pushEvent("delete_cell", { cell_id: hook.state.focusedCellId });
|
||||
|
|
|
@ -361,6 +361,13 @@ defmodule LivebookWeb.SessionLive do
|
|||
)}
|
||||
end
|
||||
|
||||
def handle_event("show_notebook_runtime_settings", %{}, socket) do
|
||||
{:noreply,
|
||||
push_patch(socket,
|
||||
to: Routes.session_path(socket, :settings, socket.assigns.session_id, "runtime")
|
||||
)}
|
||||
end
|
||||
|
||||
@impl true
|
||||
def handle_info({:operation, operation}, socket) do
|
||||
case Session.Data.apply_operation(socket.private.data, operation) do
|
||||
|
|
|
@ -25,7 +25,8 @@ defmodule LivebookWeb.SessionLive.ShortcutsComponent do
|
|||
%{seq: ["ej"], desc: "Evaluate cells below"},
|
||||
%{seq: ["ex"], desc: "Cancel cell evaluation"},
|
||||
%{seq: ["ss"], desc: "Toggle sections panel"},
|
||||
%{seq: ["sn"], desc: "Show notebook settings"}
|
||||
%{seq: ["sn"], desc: "Show notebook settings"},
|
||||
%{seq: ["sr"], desc: "Show notebook runtime settings"}
|
||||
]
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue