From a89ba9afe33d973c50c0a66aec73db1e22367913 Mon Sep 17 00:00:00 2001
From: srichman333 <sarah_n_richman@brown.edu>
Date: Thu, 10 Aug 2023 11:28:09 -0400
Subject: undo/redo for colors + titles

---
 src/client/views/nodes/DataVizBox/components/PieChart.tsx | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

(limited to 'src/client/views/nodes/DataVizBox/components/PieChart.tsx')

diff --git a/src/client/views/nodes/DataVizBox/components/PieChart.tsx b/src/client/views/nodes/DataVizBox/components/PieChart.tsx
index 6581b6b75..de725209d 100644
--- a/src/client/views/nodes/DataVizBox/components/PieChart.tsx
+++ b/src/client/views/nodes/DataVizBox/components/PieChart.tsx
@@ -12,6 +12,7 @@ import './Chart.scss';
 import { ColorPicker, EditableText, Size, Type } from "browndash-components";
 import { FaFillDrip } from "react-icons/fa";
 import { listSpec } from "../../../../../fields/Schema";
+import { undoable } from "../../../../util/UndoManager";
 
 export interface PieChartProps {
     rootDoc: Doc;
@@ -342,7 +343,7 @@ export class PieChart extends React.Component<PieChartProps> {
                 <div className="graph-title"> 
                     <EditableText
                         val={StrCast(this.props.layoutDoc[titleAccessor])}
-                        setVal={action(val => this.props.layoutDoc[titleAccessor] = val as string)}
+                        setVal={undoable (action(val => this.props.layoutDoc[titleAccessor] = val as string), "Change Graph Title")}
                         color={"black"}
                         size={Size.LARGE}
                         fillWidth
@@ -358,7 +359,7 @@ export class PieChart extends React.Component<PieChartProps> {
                             type={Type.SEC} 
                             icon={<FaFillDrip/>}
                             selectedColor={selectedSliceColor? selectedSliceColor : this.curSliceSelected.attr("fill")}
-                            setSelectedColor={color => this.changeSelectedColor(color)}
+                            setSelectedColor={undoable (color => this.changeSelectedColor(color), "Change Selected Slice Color")}
                             size={Size.XSMALL}
                         />
                     </div>
-- 
cgit v1.2.3-70-g09d2

