From 3c834ee55899b91f5fff8cfe5c808607f942b9f3 Mon Sep 17 00:00:00 2001 From: dinhanhtruong <70963346+dinhanhtruong@users.noreply.github.com> Date: Thu, 8 Jul 2021 15:51:26 -0400 Subject: created front-end link popup on text highlight added button to AnchorMenu marquee selector for showing the link popup after highlighting text. created the front end of the popup. need to fix visibility when clicking out --- src/client/views/pdf/AnchorMenu.tsx | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'src/client/views/pdf/AnchorMenu.tsx') diff --git a/src/client/views/pdf/AnchorMenu.tsx b/src/client/views/pdf/AnchorMenu.tsx index 1e2d72254..4d9dbe7a0 100644 --- a/src/client/views/pdf/AnchorMenu.tsx +++ b/src/client/views/pdf/AnchorMenu.tsx @@ -10,6 +10,7 @@ import { AntimodeMenu, AntimodeMenuProps } from "../AntimodeMenu"; import { ButtonDropdown } from "../nodes/formattedText/RichTextMenu"; import "./AnchorMenu.scss"; import { SelectionManager } from "../../util/SelectionManager"; +import { LinkPopup } from "../linking/LinkPopup"; @observer export class AnchorMenu extends AntimodeMenu { @@ -38,6 +39,7 @@ export class AnchorMenu extends AntimodeMenu { @observable private _valueValue: string = ""; @observable private _added: boolean = false; @observable private highlightColor: string = "rgba(245, 230, 95, 0.616)"; + @observable private _showLinkPopup: boolean = false; @observable public _colorBtn = false; @observable public Highlighting: boolean = false; @@ -79,6 +81,14 @@ export class AnchorMenu extends AntimodeMenu { } } + @action + toggleLinkPopup = (e: React.MouseEvent) => { + //ignore the potential null type error because this method cannot be called unless the user selects text and clicks the link button + console.log(window.getSelection().toString()) + //change popup visibility field to visible + this._showLinkPopup = !this._showLinkPopup; + } + @computed get highlighter() { const button = , + + {"Link selected text to document or URL"}}> + + , + ] : [ {"Remove Link Anchor"}}> , - {"Link selected text to document or URL"}}> - - , - + //NOTE: link popup is currently incomplete + // {"Link selected text to document or URL"}}> + // + // , + // ] : [ {"Remove Link Anchor"}}>