From b8881b77514f6d96019fdd128be05d49ebaf9ec7 Mon Sep 17 00:00:00 2001 From: sorax Date: Tue, 24 Dec 2024 15:45:41 +0100 Subject: [PATCH] rename action --- assets/js/hooks/events/listener/process.ts | 4 ++-- assets/js/hooks/mapping.json | 2 +- lib/radiator_web/live/components/outline.ex | 2 +- test/radiator_web/live/outline_live_test.exs | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/assets/js/hooks/events/listener/process.ts b/assets/js/hooks/events/listener/process.ts index 418e5b68..547dcaae 100644 --- a/assets/js/hooks/events/listener/process.ts +++ b/assets/js/hooks/events/listener/process.ts @@ -13,9 +13,9 @@ export function processEvent(action, event) { const cursorAtEnd = start == content?.length && stop == content?.length; switch (action) { - case "new_empty_node": + case "split": event.preventDefault(); - this.pushEventTo(this.el, "new", { uuid, start, stop }); + this.pushEventTo(this.el, "split", { uuid, start, stop }); break; case "indent": diff --git a/assets/js/hooks/mapping.json b/assets/js/hooks/mapping.json index a3a70575..5a48f5e4 100644 --- a/assets/js/hooks/mapping.json +++ b/assets/js/hooks/mapping.json @@ -1,7 +1,7 @@ { "content": [ { - "action": "new_empty_node", + "action": "split", "key": "Enter" }, { diff --git a/lib/radiator_web/live/components/outline.ex b/lib/radiator_web/live/components/outline.ex index 2c876d57..1c528ba9 100644 --- a/lib/radiator_web/live/components/outline.ex +++ b/lib/radiator_web/live/components/outline.ex @@ -147,7 +147,7 @@ defmodule RadiatorWeb.Components.Outline do |> reply(:noreply) end - def handle_event("new", %{"uuid" => uuid, "start" => start, "stop" => stop}, socket) do + def handle_event("split", %{"uuid" => uuid, "start" => start, "stop" => stop}, socket) do user_id = socket.assigns.user_id Dispatch.split_node(uuid, {start, stop}, user_id, generate_event_id(socket.id)) diff --git a/test/radiator_web/live/outline_live_test.exs b/test/radiator_web/live/outline_live_test.exs index b85b2024..38b82d08 100644 --- a/test/radiator_web/live/outline_live_test.exs +++ b/test/radiator_web/live/outline_live_test.exs @@ -132,7 +132,7 @@ defmodule RadiatorWeb.OutlineLiveTest do assert live |> element(stream_id) - |> render_hook(:new, params) + |> render_hook(:split, params) keep_liveview_alive()