sync update from LAN repo (source dhk-1 @ 3b1ec5b4)
This commit is contained in:
1 parent
da6521b6cb
commit
264e2200d6
995 files changed
+148105
-13399
No files matched your search
@@ -3,6 +3,7 @@ import { createPortal } from "react-dom";
|
||||
import type { Editor } from "@tiptap/react";
|
||||
import { Sparkles } from "lucide-react";
|
||||
import { cn } from "@/lib/utils";
|
||||
import { toCssPx } from "@/core/ui/page-zoom";
|
||||
import { useCanvasUIContext } from "../../contexts/CanvasUIContext";
|
||||
|
||||
const REWRITABLE_TYPES = new Set(["paragraph", "heading", "blockquote"]);
|
||||
@@ -55,14 +56,16 @@ export function WritingParagraphMenu({ editor, onAiRewrite }: WritingParagraphMe
|
||||
const h = hoverRef.current;
|
||||
if (!h) return;
|
||||
|
||||
const btnLeft = h.left - BTN_SIZE - BTN_GAP;
|
||||
const btnTop = h.top + h.height / 2 - BTN_SIZE / 2;
|
||||
const btnLeft = toCssPx(h.left) - BTN_SIZE - BTN_GAP;
|
||||
const btnTop = toCssPx(h.top) + toCssPx(h.height) / 2 - BTN_SIZE / 2;
|
||||
const pointerX = toCssPx(e.clientX);
|
||||
const pointerY = toCssPx(e.clientY);
|
||||
|
||||
const inZone =
|
||||
e.clientX >= btnLeft - HOVER_MARGIN &&
|
||||
e.clientX <= h.left + HOVER_MARGIN && // extend slightly into text side
|
||||
e.clientY >= btnTop - HOVER_MARGIN &&
|
||||
e.clientY <= btnTop + BTN_SIZE + HOVER_MARGIN;
|
||||
pointerX >= btnLeft - HOVER_MARGIN &&
|
||||
pointerX <= toCssPx(h.left) + HOVER_MARGIN &&
|
||||
pointerY >= btnTop - HOVER_MARGIN &&
|
||||
pointerY <= btnTop + BTN_SIZE + HOVER_MARGIN;
|
||||
|
||||
if (inZone) clearHideTimer();
|
||||
};
|
||||
@@ -130,8 +133,8 @@ export function WritingParagraphMenu({ editor, onAiRewrite }: WritingParagraphMe
|
||||
|
||||
if (!hover) return null;
|
||||
|
||||
const btnTop = hover.top + hover.height / 2 - BTN_SIZE / 2;
|
||||
const btnLeft = Math.max(4, hover.left - BTN_SIZE - BTN_GAP);
|
||||
const btnTop = toCssPx(hover.top) + toCssPx(hover.height) / 2 - BTN_SIZE / 2;
|
||||
const btnLeft = Math.max(4, toCssPx(hover.left) - BTN_SIZE - BTN_GAP);
|
||||
|
||||
return createPortal(
|
||||
<button
|
||||
|
||||
Reference in new issue
Block a user