Working on undo redo capabilities
This commit is contained in:
25
src/components/undo_redo/commands.py
Normal file
25
src/components/undo_redo/commands.py
Normal file
@@ -0,0 +1,25 @@
|
||||
from components.BaseCommandManager import BaseCommandManager
|
||||
from components.undo_redo.constants import ROUTE_ROOT, Routes
|
||||
|
||||
|
||||
class UndoRedoCommandManager(BaseCommandManager):
|
||||
def __init__(self, owner):
|
||||
super().__init__(owner)
|
||||
|
||||
def undo(self):
|
||||
return {
|
||||
"hx-post": f"{ROUTE_ROOT}{Routes.Undo}",
|
||||
"hx-trigger": "click, keyup[ctrlKey&&key=='z'] from:body",
|
||||
"hx-target": f"#{self._id}",
|
||||
"hx-swap": "innerHTML",
|
||||
"hx-vals": f'{{"_id": "{self._id}"}}',
|
||||
}
|
||||
|
||||
def redo(self):
|
||||
return {
|
||||
"hx-post": f"{ROUTE_ROOT}{Routes.Redo}",
|
||||
"hx_trigger": "click, keyup[ctrlKey&&key=='y'] from:body",
|
||||
"hx-target": f"#{self._id}",
|
||||
"hx-swap": "innerHTML",
|
||||
"hx-vals": f'{{"_id": "{self._id}"}}',
|
||||
}
|
||||
Reference in New Issue
Block a user