From 2acb723594dcc90a60c645956c21e808e3b501d7 Mon Sep 17 00:00:00 2001 From: Cort Fritz Date: Thu, 28 Nov 2024 08:16:51 -0800 Subject: [PATCH] Update lib/server/undo_server_observer_behaviour.ex Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> --- lib/server/undo_server_observer_behaviour.ex | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/lib/server/undo_server_observer_behaviour.ex b/lib/server/undo_server_observer_behaviour.ex index 39278cd..94be9c1 100644 --- a/lib/server/undo_server_observer_behaviour.ex +++ b/lib/server/undo_server_observer_behaviour.ex @@ -4,6 +4,23 @@ defmodule Yex.UndoServer.ObserverBehavior do stack items during undo/redo operations. """ + @doc """ + Called when a new item is about to be added to the undo stack. + + ## Parameters + - stack_item: A map containing the undo operation details + + ## Returns + - `{:ok, modified_item}` to add the possibly modified item to the stack + - `:ignore` to prevent the item from being added to the stack + """ @callback handle_stack_item_added(stack_item :: map()) :: {:ok, map()} | :ignore + + @doc """ + Called after an item has been popped from the undo stack during undo/redo operations. + + ## Returns + - `:ok` to acknowledge the pop operation + """ @callback handle_stack_item_popped() :: :ok end