From 627c2aa72f61a888866840810a7d31cb0648437b Mon Sep 17 00:00:00 2001
From: bobzel <zzzman@gmail.com>
Date: Fri, 28 Oct 2022 14:14:05 -0400
Subject: fixed proxyfields to use cache if it's available which saves orders
 of magnitude opening up Files list.   Fixed copying docs to appear in Files
 list.  fixed undo for change perspective and header color

---
 src/client/views/nodes/button/FontIconBox.tsx | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

(limited to 'src/client/views/nodes/button/FontIconBox.tsx')

diff --git a/src/client/views/nodes/button/FontIconBox.tsx b/src/client/views/nodes/button/FontIconBox.tsx
index 883c4460b..2b83e9da8 100644
--- a/src/client/views/nodes/button/FontIconBox.tsx
+++ b/src/client/views/nodes/button/FontIconBox.tsx
@@ -198,7 +198,7 @@ export class FontIconBox extends DocComponent<ButtonProps>() {
                             e.preventDefault();
                         }}
                         onClick={action(() => (this.rootDoc.dropDownOpen = !this.rootDoc.dropDownOpen))}>
-                        <input style={{ width: 30 }} className="button-input" type="number" value={checkResult} onChange={action(e => setValue(Number(e.target.value)))} />
+                        <input style={{ width: 30 }} className="button-input" type="number" value={checkResult} onChange={undoBatch(action(e => setValue(Number(e.target.value))))} />
                     </div>
                     <div className={`button`} onClick={action(e => setValue(Number(checkResult) + 1))}>
                         <FontAwesomeIcon className={`fontIconBox-icon-${this.type}`} icon={'plus'} />
@@ -221,7 +221,7 @@ export class FontIconBox extends DocComponent<ButtonProps>() {
                 </div>
             );
         } else {
-            return <div></div>;
+            return <div />;
         }
     }
 
@@ -303,7 +303,7 @@ export class FontIconBox extends DocComponent<ButtonProps>() {
                         fontFamily: script.script.originalScript.startsWith('setFont') ? value : undefined,
                         backgroundColor: value === text ? Colors.LIGHT_BLUE : undefined,
                     }}
-                    onClick={() => script.script.run({ value }).result}>
+                    onClick={undoBatch(() => script.script.run({ value }))}>
                     {value[0].toUpperCase() + value.slice(1)}
                 </div>
             ));
@@ -352,12 +352,14 @@ export class FontIconBox extends DocComponent<ButtonProps>() {
     }
 
     colorPicker = (curColor: string) => {
-        const change = (value: ColorState) => {
+        const change = (value: ColorState, ev: MouseEvent) => {
+            ev.preventDefault();
+            ev.stopPropagation();
             const s = this.colorScript;
             s && undoBatch(() => s.script.run({ value: Utils.colorString(value), _readOnly_: false }).result)();
         };
         const presets = ['#D0021B', '#F5A623', '#F8E71C', '#8B572A', '#7ED321', '#417505', '#9013FE', '#4A90E2', '#50E3C2', '#B8E986', '#000000', '#4A4A4A', '#9B9B9B', '#FFFFFF', '#f1efeb', 'transparent'];
-        return <SketchPicker onChange={change} color={curColor} presetColors={presets} />;
+        return <SketchPicker onChange={change as any /* SketchPicker passes the mouse event to the callback, but the type system doesn't know that */} color={curColor} presetColors={presets} />;
     };
     /**
      * Color button
-- 
cgit v1.2.3-70-g09d2

