From 192e23a2ae335a5f0de361eed9a24a5d08547217 Mon Sep 17 00:00:00 2001
From: bobzel <zzzman@gmail.com>
Date: Wed, 7 Oct 2020 17:49:20 -0400
Subject: fixed undoing changes to a textbox's fontsize/family.  changed
 auto-page ref syntax to start with ':'.   fixed making text menu appear when
 clicking on caption & other text boxes.

---
 src/client/views/collections/CollectionMenu.tsx | 45 ++++++++++++-------------
 1 file changed, 22 insertions(+), 23 deletions(-)

(limited to 'src/client/views/collections/CollectionMenu.tsx')

diff --git a/src/client/views/collections/CollectionMenu.tsx b/src/client/views/collections/CollectionMenu.tsx
index 09ff3bb0c..4bdb233c9 100644
--- a/src/client/views/collections/CollectionMenu.tsx
+++ b/src/client/views/collections/CollectionMenu.tsx
@@ -529,12 +529,7 @@ export class CollectionFreeFormViewChrome extends React.Component<CollectionMenu
     }
     @computed get selectedDoc() { return this.selectedDocumentView?.rootDoc; }
     @computed get isText() {
-        if (this.selectedDoc) {
-            const layoutField = Doc.LayoutField(this.selectedDoc);
-            const layoutStr = this.selectedDocumentView?.props.LayoutTemplateString || StrCast(layoutField);
-            return (document.activeElement as any)?.className.includes("ProseMirror") || layoutStr.includes("FormattedText") || StrCast((layoutField as Doc)?.layout).includes("FormattedText");
-        }
-        else return false;
+        return this.selectedDoc?.type === DocumentType.RTF || RichTextMenu.Instance?.view ? true : false;
     }
 
     @undoBatch
@@ -843,22 +838,26 @@ export class CollectionFreeFormViewChrome extends React.Component<CollectionMenu
     render() {
         return !this.props.docView.layoutDoc ? (null) :
             <div className="collectionFreeFormMenu-cont">
-                {!Doc.UserDoc().noviceMode && !this.isText && !this.props.isDoc ? <Tooltip key="back" title={<div className="dash-tooltip">Back Frame</div>} placement="bottom">
-                    <div className="backKeyframe" onClick={this.prevKeyframe}>
-                        <FontAwesomeIcon icon={"caret-left"} size={"lg"} />
-                    </div>
-                </Tooltip> : null}
-                {!Doc.UserDoc().noviceMode && !this.isText && !this.props.isDoc ? <Tooltip key="num" title={<div className="dash-tooltip">Toggle View All</div>} placement="bottom">
-                    <div className="numKeyframe" style={{ color: this.document.editing ? "white" : "black", backgroundColor: this.document.editing ? "#5B9FDD" : "#AEDDF8" }}
-                        onClick={action(() => this.document.editing = !this.document.editing)} >
-                        {NumCast(this.document._currentFrame)}
-                    </div>
-                </Tooltip> : null}
-                {!Doc.UserDoc().noviceMode && !this.isText && !this.props.isDoc ? <Tooltip key="fwd" title={<div className="dash-tooltip">Forward Frame</div>} placement="bottom">
-                    <div className="fwdKeyframe" onClick={this.nextKeyframe}>
-                        <FontAwesomeIcon icon={"caret-right"} size={"lg"} />
-                    </div>
-                </Tooltip> : null}
+                {!Doc.UserDoc().noviceMode && !this.isText && !this.props.isDoc ?
+                    <>
+                        <Tooltip key="back" title={<div className="dash-tooltip">Back Frame</div>} placement="bottom">
+                            <div className="backKeyframe" onClick={this.prevKeyframe}>
+                                <FontAwesomeIcon icon={"caret-left"} size={"lg"} />
+                            </div>
+                        </Tooltip>
+                        <Tooltip key="num" title={<div className="dash-tooltip">Toggle View All</div>} placement="bottom">
+                            <div className="numKeyframe" style={{ color: this.document.editing ? "white" : "black", backgroundColor: this.document.editing ? "#5B9FDD" : "#AEDDF8" }}
+                                onClick={action(() => this.document.editing = !this.document.editing)} >
+                                {NumCast(this.document._currentFrame)}
+                            </div>
+                        </Tooltip>
+                        <Tooltip key="fwd" title={<div className="dash-tooltip">Forward Frame</div>} placement="bottom">
+                            <div className="fwdKeyframe" onClick={this.nextKeyframe}>
+                                <FontAwesomeIcon icon={"caret-right"} size={"lg"} />
+                            </div>
+                        </Tooltip>
+                    </>
+                    : null}
 
                 {!this.props.isOverlay || this.document.type !== DocumentType.WEB || this.isText || this.props.isDoc ? (null) :
                     this.urlEditor
@@ -872,7 +871,7 @@ export class CollectionFreeFormViewChrome extends React.Component<CollectionMenu
                     </> :
                     (null)
                 }
-                {this.isText ? <RichTextMenu /> : null}
+                {<div style={{ display: !this.isText ? "none" : undefined }}><RichTextMenu /></div>}
             </div>;
     }
 }
-- 
cgit v1.2.3-70-g09d2

