From 40b8e5c30e7251db6258cac5b4ed5fb4a6a2418d Mon Sep 17 00:00:00 2001
From: bobzel <zzzman@gmail.com>
Date: Mon, 7 Apr 2025 15:20:36 -0400
Subject: added multiToggle option to allow popup to stay up until explicitly
 untoggled. fixed multitoggle to honor toggleStatus.  fixed popup to follow
 target.   fixed setting text highlight background fro popup menu. fixed
 flashcardui buttons to have background sized properly.

---
 src/client/views/nodes/formattedText/RichTextMenu.tsx | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

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

diff --git a/src/client/views/nodes/formattedText/RichTextMenu.tsx b/src/client/views/nodes/formattedText/RichTextMenu.tsx
index 758b4035e..10c95f1e1 100644
--- a/src/client/views/nodes/formattedText/RichTextMenu.tsx
+++ b/src/client/views/nodes/formattedText/RichTextMenu.tsx
@@ -367,7 +367,8 @@ export class RichTextMenu extends AntimodeMenu<AntimodeMenuProps> {
 
     setFontField = (value: string, fontField: 'fitBox' | 'fontSize' | 'fontFamily' | 'fontColor' | 'fontHighlight') => {
         if (this.TextView && this.view && fontField !== 'fitBox') {
-            if (this.view.hasFocus()) {
+            const anchorNode = window.getSelection()?.anchorNode;
+            if (this.view.hasFocus() || (anchorNode && this.TextView.ProseRef?.contains(anchorNode))) {
                 const attrs: { [key: string]: string } = {};
                 attrs[fontField] = value;
                 const fmark = this.view.state.schema.marks['pF' + fontField.substring(1)].create(attrs);
-- 
cgit v1.2.3-70-g09d2

