From 1fe6548a909d63566f0fe37b02ba9cb5eb913caa Mon Sep 17 00:00:00 2001
From: bobzel <zzzman@gmail.com>
Date: Tue, 4 Mar 2025 14:50:32 -0500
Subject: fixed border / text autoheight bug.

---
 src/client/views/nodes/formattedText/FormattedTextBox.tsx | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

(limited to 'src/client/views/nodes/formattedText/FormattedTextBox.tsx')

diff --git a/src/client/views/nodes/formattedText/FormattedTextBox.tsx b/src/client/views/nodes/formattedText/FormattedTextBox.tsx
index da2131940..e9c521aa0 100644
--- a/src/client/views/nodes/formattedText/FormattedTextBox.tsx
+++ b/src/client/views/nodes/formattedText/FormattedTextBox.tsx
@@ -1283,13 +1283,13 @@ export class FormattedTextBox extends ViewBoxAnnotatableComponent<FormattedTextB
         this._disposers.componentHeights = reaction(
             // set the document height when one of the component heights changes and layout_autoHeight is on
             () => ({ border: this._props.PanelHeight(), sidebarHeight: this.sidebarHeight, textHeight: this.textHeight, layoutAutoHeight: this.layout_autoHeight, marginsHeight: this.layout_autoHeightMargins }),
-            ({ sidebarHeight, textHeight, layoutAutoHeight, marginsHeight }) => {
+            ({ border, sidebarHeight, textHeight, layoutAutoHeight, marginsHeight }) => {
                 const newHeight = this.contentScaling * (marginsHeight + Math.max(sidebarHeight, textHeight));
                 if (
                     (!Array.from(FormattedTextBox._globalHighlights).includes('Bold Text') || this._props.isSelected()) && //
                     layoutAutoHeight &&
                     newHeight &&
-                    newHeight !== this.layoutDoc.height &&
+                    (newHeight !== this.layoutDoc.height || border < NumCast(this.layoutDoc.height)) &&
                     !this._props.dontRegisterView
                 ) {
                     this._props.setHeight?.(newHeight);
-- 
cgit v1.2.3-70-g09d2


From dbe3a3cf1944a69a3ce492481bc22b8f1a8d53e8 Mon Sep 17 00:00:00 2001
From: bobzel <zzzman@gmail.com>
Date: Tue, 4 Mar 2025 18:21:47 -0500
Subject: added link cretor button to text anchor menu

---
 src/client/util/SharingManager.tsx                        |  6 ------
 src/client/views/AntimodeMenu.scss                        |  1 -
 src/client/views/MainView.tsx                             |  2 --
 src/client/views/nodes/formattedText/FormattedTextBox.tsx | 14 +++++++++++++-
 src/client/views/pdf/AnchorMenu.tsx                       |  2 ++
 5 files changed, 15 insertions(+), 10 deletions(-)

(limited to 'src/client/views/nodes/formattedText/FormattedTextBox.tsx')

diff --git a/src/client/util/SharingManager.tsx b/src/client/util/SharingManager.tsx
index efc8e79a6..3a248400b 100644
--- a/src/client/util/SharingManager.tsx
+++ b/src/client/util/SharingManager.tsx
@@ -502,7 +502,6 @@ export class SharingManager extends React.Component<object> {
         }
     };
 
-    // eslint-disable-next-line react/sort-comp
     public close = action(() => {
         this.isOpen = false;
         this.selectedUsers = null; // resets the list of users and selected users (in the react-select component)
@@ -517,7 +516,6 @@ export class SharingManager extends React.Component<object> {
         this.layoutDocAcls = false;
     });
 
-    // eslint-disable-next-line react/no-unused-class-component-methods
     public open = (target?: DocumentView, targetDoc?: Doc) => {
         this.populateUsers();
         runInAction(() => {
@@ -534,7 +532,6 @@ export class SharingManager extends React.Component<object> {
      * @param group
      * @param emailId
      */
-    // eslint-disable-next-line react/no-unused-class-component-methods
     shareWithAddedMember = (group: Doc, emailId: string, retry: boolean = true) => {
         const user = this.users.find(({ user: { email } }) => email === emailId)!;
         if (group.docsShared) {
@@ -559,7 +556,6 @@ export class SharingManager extends React.Component<object> {
     /**
      * Called from the properties sidebar to change permissions of a user.
      */
-    // eslint-disable-next-line react/no-unused-class-component-methods
     shareFromPropertiesSidebar = undoable((shareWith: string, permission: SharingPermissions, docs: Doc[], layout: boolean) => {
         if (layout) this.layoutDocAcls = true;
         if (shareWith !== 'Guest') {
@@ -583,7 +579,6 @@ export class SharingManager extends React.Component<object> {
      * @param group
      * @param emailId
      */
-    // eslint-disable-next-line react/no-unused-class-component-methods
     removeMember = (group: Doc, emailId: string) => {
         const user: ValidatedUser = this.users.find(({ user: { email } }) => email === emailId)!;
 
@@ -607,7 +602,6 @@ export class SharingManager extends React.Component<object> {
      * Removes a group's permissions from documents that have been shared with it.
      * @param group
      */
-    // eslint-disable-next-line react/no-unused-class-component-methods
     removeGroup = (group: Doc) => {
         if (group.docsShared) {
             DocListCast(group.docsShared).forEach(doc => {
diff --git a/src/client/views/AntimodeMenu.scss b/src/client/views/AntimodeMenu.scss
index 48fa86276..c2f6ae62d 100644
--- a/src/client/views/AntimodeMenu.scss
+++ b/src/client/views/AntimodeMenu.scss
@@ -6,7 +6,6 @@
     height: global.$antimodemenu-height;
     width: fit-content;
     border-radius: global.$standard-border-radius;
-    overflow: hidden;
     // box-shadow: 3px 3px 3px rgba(0, 0, 0, 0.25);
     // border-radius: 0px 6px 6px 6px;
     display: flex;
diff --git a/src/client/views/MainView.tsx b/src/client/views/MainView.tsx
index 631c10b89..cc7c1a42b 100644
--- a/src/client/views/MainView.tsx
+++ b/src/client/views/MainView.tsx
@@ -75,10 +75,8 @@ import { RichTextMenu } from './nodes/formattedText/RichTextMenu';
 import ImageEditorBox from './nodes/imageEditor/ImageEditor';
 import { PresBox } from './nodes/trails';
 import { AnchorMenu } from './pdf/AnchorMenu';
-import { GPTPopup } from './pdf/GPTPopup/GPTPopup';
 import { SmartDrawHandler } from './smartdraw/SmartDrawHandler';
 import { TopBar } from './topbar/TopBar';
-import { OverlayView } from './OverlayView';
 
 // eslint-disable-next-line @typescript-eslint/no-require-imports
 const { LEFT_MENU_WIDTH, TOPBAR_HEIGHT } = require('./global/globalCssVariables.module.scss'); // prettier-ignore
diff --git a/src/client/views/nodes/formattedText/FormattedTextBox.tsx b/src/client/views/nodes/formattedText/FormattedTextBox.tsx
index e9c521aa0..c2a2caecf 100644
--- a/src/client/views/nodes/formattedText/FormattedTextBox.tsx
+++ b/src/client/views/nodes/formattedText/FormattedTextBox.tsx
@@ -1669,7 +1669,19 @@ export class FormattedTextBox extends ViewBoxAnnotatableComponent<FormattedTextB
             for (let target: HTMLElement | Element | null = clickTarget as HTMLElement; target instanceof HTMLElement && !target.dataset?.targethrefs; target = target.parentElement);
             while (clickTarget instanceof HTMLElement && !clickTarget.dataset?.targethrefs) clickTarget = clickTarget.parentElement;
             const dataset = clickTarget instanceof HTMLElement ? clickTarget?.dataset : undefined;
-            FormattedTextBoxComment.update(this, this.EditorView!, undefined, dataset?.targethrefs, dataset?.linkdoc, dataset?.nopreview === 'true');
+
+            if (dataset?.targethrefs)
+                window
+                    .open(
+                        dataset?.targethrefs
+                            ?.trim()
+                            .split(' ')
+                            .filter(h => h)
+                            .lastElement(),
+                        '_blank'
+                    )
+                    ?.focus();
+            else FormattedTextBoxComment.update(this, this.EditorView!, undefined, dataset?.targethrefs, dataset?.linkdoc, dataset?.nopreview === 'true');
         }
     };
     @action
diff --git a/src/client/views/pdf/AnchorMenu.tsx b/src/client/views/pdf/AnchorMenu.tsx
index 28371594e..9aa8fe649 100644
--- a/src/client/views/pdf/AnchorMenu.tsx
+++ b/src/client/views/pdf/AnchorMenu.tsx
@@ -18,6 +18,7 @@ import { DocumentView } from '../nodes/DocumentView';
 import { DrawingOptions, SmartDrawHandler } from '../smartdraw/SmartDrawHandler';
 import './AnchorMenu.scss';
 import { GPTPopup } from './GPTPopup/GPTPopup';
+import { RichTextMenu } from '../nodes/formattedText/RichTextMenu';
 
 @observer
 export class AnchorMenu extends AntimodeMenu<AntimodeMenuProps> {
@@ -241,6 +242,7 @@ export class AnchorMenu extends AntimodeMenu<AntimodeMenuProps> {
                             color={SettingsManager.userColor}
                         />
                     )}
+                    {this._selectedText && RichTextMenu.Instance?.createLinkButton()}
                     {AnchorMenu.Instance.OnAudio === unimplementedFunction ? null : (
                         <IconButton
                             tooltip="Click to Record Annotation" //
-- 
cgit v1.2.3-70-g09d2

