im thirsty
This commit is contained in:
parent
bccee804cf
commit
60193c33b8
@ -260,6 +260,10 @@ export default function ControlPanel(props) {
|
||||
return table;
|
||||
})
|
||||
);
|
||||
} else if (a.component === "self") {
|
||||
setTables((prev) =>
|
||||
prev.map((t) => (t.id === a.tid ? { ...t, ...a.undo } : t))
|
||||
);
|
||||
}
|
||||
}
|
||||
setRedoStack((prev) => [...prev, a]);
|
||||
@ -438,6 +442,10 @@ export default function ControlPanel(props) {
|
||||
return table;
|
||||
})
|
||||
);
|
||||
} else if (a.component === "self") {
|
||||
setTables((prev) =>
|
||||
prev.map((t) => (t.id === a.tid ? { ...t, ...a.redo } : t))
|
||||
);
|
||||
}
|
||||
}
|
||||
setUndoStack((prev) => [...prev, a]);
|
||||
|
@ -721,9 +721,21 @@ export default function TableOverview(props) {
|
||||
<Button
|
||||
type="tertiary"
|
||||
size="small"
|
||||
onClick={() =>
|
||||
updateTable(i, { color: defaultTableTheme })
|
||||
}
|
||||
onClick={() => {
|
||||
setUndoStack((prev) => [
|
||||
...prev,
|
||||
{
|
||||
action: Action.EDIT,
|
||||
element: ObjectType.TABLE,
|
||||
component: "self",
|
||||
tid: i,
|
||||
undo: { color: t.color },
|
||||
redo: { color: defaultTableTheme },
|
||||
},
|
||||
]);
|
||||
setRedoStack([]);
|
||||
updateTable(i, { color: defaultTableTheme });
|
||||
}}
|
||||
>
|
||||
Clear
|
||||
</Button>
|
||||
@ -738,7 +750,21 @@ export default function TableOverview(props) {
|
||||
key={c}
|
||||
style={{ backgroundColor: c }}
|
||||
className="p-3 rounded-full mx-1"
|
||||
onClick={() => updateTable(i, { color: c })}
|
||||
onClick={() => {
|
||||
setUndoStack((prev) => [
|
||||
...prev,
|
||||
{
|
||||
action: Action.EDIT,
|
||||
element: ObjectType.TABLE,
|
||||
component: "self",
|
||||
tid: i,
|
||||
undo: { color: t.color },
|
||||
redo: { color: c },
|
||||
},
|
||||
]);
|
||||
setRedoStack([]);
|
||||
updateTable(i, { color: c });
|
||||
}}
|
||||
>
|
||||
{t.color === c ? (
|
||||
<IconCheckboxTick
|
||||
@ -758,7 +784,21 @@ export default function TableOverview(props) {
|
||||
key={c}
|
||||
style={{ backgroundColor: c }}
|
||||
className="p-3 rounded-full mx-1"
|
||||
onClick={() => updateTable(i, { color: c })}
|
||||
onClick={() => {
|
||||
setUndoStack((prev) => [
|
||||
...prev,
|
||||
{
|
||||
action: Action.EDIT,
|
||||
element: ObjectType.TABLE,
|
||||
component: "self",
|
||||
tid: i,
|
||||
undo: { color: t.color },
|
||||
redo: { color: c },
|
||||
},
|
||||
]);
|
||||
setRedoStack([]);
|
||||
updateTable(i, { color: c });
|
||||
}}
|
||||
>
|
||||
<IconCheckboxTick
|
||||
style={{
|
||||
|
Loading…
Reference in New Issue
Block a user