Fix review

Signed-off-by: Émile Ré <emile@getprobo.com>
This commit is contained in:
Émile Ré
2026-03-25 18:04:03 +04:00
parent cc1a53e17c
commit cf5ffc319a
4 changed files with 11 additions and 11 deletions

View File

@@ -4,7 +4,6 @@
import { Link } from "@tiptap/extension-link"; import { Link } from "@tiptap/extension-link";
import { Plugin, PluginKey } from "@tiptap/pm/state"; import { Plugin, PluginKey } from "@tiptap/pm/state";
import { getAttributes } from "@tiptap/react";
export const LinkExtension = Link.extend({ export const LinkExtension = Link.extend({
addProseMirrorPlugins: () => { 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 { ctrlKey, metaKey } = event; // Check for Ctrl (Windows) or Cmd (Mac)
const keyPressed = ctrlKey || metaKey; const keyPressed = ctrlKey || metaKey;
if (keyPressed) { 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"); const link = (event.target as Element | null)?.closest("a");
if (link && attrs.href) { if (link?.href) {
window.open(attrs.href as string, "_blank", "noopener,noreferrer"); // Open link in a new tab window.open(link.href, "_blank", "noopener,noreferrer");
return true; // Handle the event return true;
} }
} }
return false; // Let other handlers run return false; // Let other handlers run

View File

@@ -185,7 +185,7 @@ export function OptionsMenu({ editor }: OptionsMenuProps) {
wrapper.style.top = "-10000px"; wrapper.style.top = "-10000px";
document.body.append(wrapper); document.body.append(wrapper);
e.dataTransfer.setDragImage(wrapper, 0, 0); e.dataTransfer.setDragImage(wrapper, 0, 0);
document.addEventListener("drop", () => wrapper.remove(), { once: true }); document.addEventListener("dragend", () => wrapper.remove(), { once: true });
} }
startDrag(view, slice, selection); startDrag(view, slice, selection);

View File

@@ -1,3 +1,5 @@
@import "./rich-editor.css";
@plugin "@tailwindcss/typography"; @plugin "@tailwindcss/typography";
@config "../tailwind.config.js"; @config "../tailwind.config.js";
@@ -278,4 +280,3 @@ button[data-cell]:focus-visible {
border-radius: 4px; border-radius: 4px;
} }
@import "./rich-editor.css";

View File

@@ -18,6 +18,8 @@ import { defineConfig } from "vite";
// https://vite.dev/config/ // https://vite.dev/config/
export default defineConfig({ export default defineConfig({
plugins: [react(), plugins: [
tailwindcss()], react(),
tailwindcss(),
],
}); });