Skip to content

armgit / macro

Public Imported from GitHub
0

Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.

fix(md): format-tools - preventDefault on unlink btn (#5388)

Seamusaa45408399d2
diff --git a/apps/web/src/features/block-md/component/FormatTools.tsx b/apps/web/src/features/block-md/component/FormatTools.tsx
index d8629c5e16..715cceffad 100644
--- a/apps/web/src/features/block-md/component/FormatTools.tsx
+++ b/apps/web/src/features/block-md/component/FormatTools.tsx
@@ -385,7 +385,10 @@ export function FormatTools(props: { withinPopup?: boolean }) {
});
const cleanups: Array<() => void> = [];
- function handleLink() {
+ function handleLink(e?: MouseEvent | KeyboardEvent) {
+ e?.preventDefault();
+ e?.stopPropagation();
+
const currentEditor = editor();
if (currentEditor === undefined) return;
if (selection()?.hasLinks) {
@@ -794,6 +797,7 @@ export function FormatTools(props: { withinPopup?: boolean }) {
size="icon-sm"
class="rounded-md"
depth={3}
+ onPointerDown={(e: PointerEvent) => e.preventDefault()}
onClick={handleLink}
tooltip={selection()?.hasLinks ? 'Remove Link' : 'Insert Link'}
disabled={buttonIsDisabled()}
@@ -967,6 +971,7 @@ export function FormatTools(props: { withinPopup?: boolean }) {
size="icon-sm"
class="rounded-md"
depth={3}
+ onPointerDown={(e: PointerEvent) => e.preventDefault()}
onClick={handleLink}
tooltip={selection()?.hasLinks ? 'Remove Link' : 'Insert Link'}
disabled={buttonIsDisabled()}
diff --git a/apps/web/src/lib/core/component/LexicalMarkdown/component/menu/FloatingFormatMenu.tsx b/apps/web/src/lib/core/component/LexicalMarkdown/component/menu/FloatingFormatMenu.tsx
index 76419b341d..0daa93c827 100644
--- a/apps/web/src/lib/core/component/LexicalMarkdown/component/menu/FloatingFormatMenu.tsx
+++ b/apps/web/src/lib/core/component/LexicalMarkdown/component/menu/FloatingFormatMenu.tsx
@@ -205,7 +205,10 @@ export function FloatingFormatMenu(props: {
editor.dispatchCommand(NODE_TRANSFORM, isActive ? 'paragraph' : transform);
};
- const handleLink = () => {
+ const handleLink = (e?: MouseEvent | KeyboardEvent) => {
+ e?.preventDefault();
+ e?.stopPropagation();
+
if (selection()?.hasLinks) {
editor.dispatchCommand(UNLINK_COMMAND, undefined);
setTimeout(() => {