Skip to content

Commit 91eba31

Browse files
committed
✨(frontend) preserve interlink style on drag-and-drop in editor
adds hook to normalize dropped blocks and restore internal link format Signed-off-by: Cyril <[email protected]>
1 parent 45d6c1b commit 91eba31

File tree

4 files changed

+14
-6
lines changed

4 files changed

+14
-6
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ and this project adheres to
4646
- 🐛(frontend) fix overlapping placeholders in multi-column layout #1455
4747
- 🐛(backend) filter invitation with case insensitive email
4848
- 🐛(frontend) reduce no access image size from 450 to 300 #1463
49+
- 🐛(frontend) preserve interlink style on drag-and-drop in editor #1460
4950

5051
## [3.7.0] - 2025-09-12
5152

src/frontend/apps/e2e/__tests__/app-impress/doc-editor.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -760,7 +760,7 @@ test.describe('Doc Editor', () => {
760760
// Wait for the interlink to be created and rendered
761761
const editor = page.locator('.ProseMirror.bn-editor');
762762

763-
const interlink = editor.getByRole('link', {
763+
const interlink = editor.getByRole('button', {
764764
name: docChild2,
765765
});
766766

src/frontend/apps/e2e/__tests__/app-impress/doc-export.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -472,7 +472,7 @@ test.describe('Doc Export', () => {
472472

473473
// Search the interlinking link in the editor (not in the document tree)
474474
const editor = page.locator('.ProseMirror.bn-editor');
475-
const interlink = editor.getByRole('link', {
475+
const interlink = editor.getByRole('button', {
476476
name: randomDoc,
477477
});
478478

src/frontend/apps/impress/src/features/docs/doc-editor/components/custom-inline-content/Interlinking/InterlinkingLinkInlineContent.tsx

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
/* eslint-disable react-hooks/rules-of-hooks */
22
import { createReactInlineContentSpec } from '@blocknote/react';
3+
import { useRouter } from 'next/router';
34
import { useEffect } from 'react';
45
import { css } from 'styled-components';
56

6-
import { StyledLink, Text } from '@/components';
7+
import { BoxButton, Text } from '@/components';
78
import { useCunninghamTheme } from '@/cunningham';
89
import SelectedPageIcon from '@/docs/doc-editor/assets/doc-selected.svg';
910
import { useDoc } from '@/docs/doc-management';
@@ -51,10 +52,16 @@ interface LinkSelectedProps {
5152
}
5253
const LinkSelected = ({ url, title }: LinkSelectedProps) => {
5354
const { colorsTokens } = useCunninghamTheme();
55+
const router = useRouter();
56+
57+
const handleClick = (e: React.MouseEvent<HTMLDivElement>) => {
58+
e.preventDefault();
59+
router.push(url);
60+
};
5461

5562
return (
56-
<StyledLink
57-
href={url}
63+
<BoxButton
64+
onClick={handleClick}
5865
draggable="false"
5966
$css={css`
6067
display: inline;
@@ -75,6 +82,6 @@ const LinkSelected = ({ url, title }: LinkSelectedProps) => {
7582
<Text $weight="500" spellCheck="false" $size="16px" $display="inline">
7683
{title}
7784
</Text>
78-
</StyledLink>
85+
</BoxButton>
7986
);
8087
};

0 commit comments

Comments
 (0)