From cf5ffc319a7b82c3e248164ab826f97c4e44847a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89mile=20R=C3=A9?= Date: Wed, 25 Mar 2026 18:04:03 +0400 Subject: [PATCH] Fix review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Émile Ré --- packages/ui/src/RichEditor/LinkExtension.ts | 11 ++++------- packages/ui/src/RichEditor/OptionsMenu.tsx | 2 +- packages/ui/src/theme.css | 3 ++- packages/ui/vite.config.ts | 6 ++++-- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/packages/ui/src/RichEditor/LinkExtension.ts b/packages/ui/src/RichEditor/LinkExtension.ts index 4246e4659..ddeb16e69 100644 --- a/packages/ui/src/RichEditor/LinkExtension.ts +++ b/packages/ui/src/RichEditor/LinkExtension.ts @@ -4,7 +4,6 @@ import { Link } from "@tiptap/extension-link"; import { Plugin, PluginKey } from "@tiptap/pm/state"; -import { getAttributes } from "@tiptap/react"; export const LinkExtension = Link.extend({ addProseMirrorPlugins: () => { @@ -24,18 +23,16 @@ export const LinkExtension = Link.extend({ } }, }, - handleClick: (view, _, event) => { + handleClick: (_view, _, event) => { const { ctrlKey, metaKey } = event; // Check for Ctrl (Windows) or Cmd (Mac) const keyPressed = ctrlKey || metaKey; if (keyPressed) { - // Get attributes of the mark at the clicked position - const attrs = getAttributes(view.state, "link"); const link = (event.target as Element | null)?.closest("a"); - if (link && attrs.href) { - window.open(attrs.href as string, "_blank", "noopener,noreferrer"); // Open link in a new tab - return true; // Handle the event + if (link?.href) { + window.open(link.href, "_blank", "noopener,noreferrer"); + return true; } } return false; // Let other handlers run diff --git a/packages/ui/src/RichEditor/OptionsMenu.tsx b/packages/ui/src/RichEditor/OptionsMenu.tsx index a5f2b44b1..15ea41de8 100644 --- a/packages/ui/src/RichEditor/OptionsMenu.tsx +++ b/packages/ui/src/RichEditor/OptionsMenu.tsx @@ -185,7 +185,7 @@ export function OptionsMenu({ editor }: OptionsMenuProps) { wrapper.style.top = "-10000px"; document.body.append(wrapper); e.dataTransfer.setDragImage(wrapper, 0, 0); - document.addEventListener("drop", () => wrapper.remove(), { once: true }); + document.addEventListener("dragend", () => wrapper.remove(), { once: true }); } startDrag(view, slice, selection); diff --git a/packages/ui/src/theme.css b/packages/ui/src/theme.css index 3b595a372..f38607090 100644 --- a/packages/ui/src/theme.css +++ b/packages/ui/src/theme.css @@ -1,3 +1,5 @@ +@import "./rich-editor.css"; + @plugin "@tailwindcss/typography"; @config "../tailwind.config.js"; @@ -278,4 +280,3 @@ button[data-cell]:focus-visible { border-radius: 4px; } -@import "./rich-editor.css"; diff --git a/packages/ui/vite.config.ts b/packages/ui/vite.config.ts index 6c9f550d8..b6dd8c938 100644 --- a/packages/ui/vite.config.ts +++ b/packages/ui/vite.config.ts @@ -18,6 +18,8 @@ import { defineConfig } from "vite"; // https://vite.dev/config/ export default defineConfig({ - plugins: [react(), - tailwindcss()], + plugins: [ + react(), + tailwindcss(), + ], });