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 { 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

View File

@@ -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);

View File

@@ -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";

View File

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