diff options
| author | bobzel <zzzman@gmail.com> | 2021-01-20 23:36:16 -0500 |
|---|---|---|
| committer | bobzel <zzzman@gmail.com> | 2021-01-20 23:36:16 -0500 |
| commit | e369336c413a337e02afc027cc1aecdd76a496c5 (patch) | |
| tree | a69d6298ee3e406e7cab3f10958872f8a6569741 /src/client/views/pdf/AnchorMenu.tsx | |
| parent | 68785a97178d229935c0429791081d7c09312dc3 (diff) | |
fixed hiding AnchorMenu in text boxes. encapsulated fadeOut of AnchorMenu within class for simplicity.
Diffstat (limited to 'src/client/views/pdf/AnchorMenu.tsx')
| -rw-r--r-- | src/client/views/pdf/AnchorMenu.tsx | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/client/views/pdf/AnchorMenu.tsx b/src/client/views/pdf/AnchorMenu.tsx index e2bd5a73d..d1fdc6c44 100644 --- a/src/client/views/pdf/AnchorMenu.tsx +++ b/src/client/views/pdf/AnchorMenu.tsx @@ -1,7 +1,7 @@ import React = require("react"); import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; import { Tooltip } from "@material-ui/core"; -import { action, computed, observable } from "mobx"; +import { action, computed, observable, IReactionDisposer, reaction } from "mobx"; import { observer } from "mobx-react"; import { ColorState } from "react-color"; import { Doc, Opt } from "../../../fields/Doc"; @@ -9,6 +9,7 @@ import { returnFalse, setupMoveUpEvents, unimplementedFunction, Utils } from ".. import { AntimodeMenu, AntimodeMenuProps } from "../AntimodeMenu"; import { ButtonDropdown } from "../nodes/formattedText/RichTextMenu"; import "./AnchorMenu.scss"; +import { SelectionManager } from "../../util/SelectionManager"; @observer export class AnchorMenu extends AntimodeMenu<AntimodeMenuProps> { @@ -58,6 +59,14 @@ export class AnchorMenu extends AntimodeMenu<AntimodeMenuProps> { AnchorMenu.Instance._canFade = false; } + _disposer: IReactionDisposer | undefined; + componentDidMount() { + this._disposer = reaction(() => SelectionManager.Views(), + selected => { + AnchorMenu.Instance.fadeOut(true); + }); + } + pointerDown = (e: React.PointerEvent) => { setupMoveUpEvents(this, e, (e: PointerEvent) => { this.StartDrag(e, this._commentCont.current!); |
