-
Notifications
You must be signed in to change notification settings - Fork 414
🐛 (frontend) preserve interlink style on drag-and-drop in editor #1460
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
ee19c21
to
8acf462
Compare
8acf462
to
2db509d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I found the root problem actually, here we use a StyledLink
that render a a
tag:
Line 56 in 2db509d
<StyledLink |
There is a conflict with the a
tag, I think Blocknote or Tiptap take over our custom component during pasting or copy event.
An easy fix is to use a button
tag instead of a a
tag, like that we avoid the conflict, ex:
const LinkSelected = ({ url, title }: LinkSelectedProps) => {
const { colorsTokens } = useCunninghamTheme();
const router = useRouter();
return (
<BoxButton
onClick={(e) => {
e.preventDefault();
router.push(url);
}}
draggable="false"
$css={css`
display: inline;
padding: 0.1rem 0.4rem;
border-radius: 4px;
& svg {
position: relative;
top: 2px;
margin-right: 0.2rem;
}
&:hover {
background-color: ${colorsTokens['greyscale-100']};
}
transition: background-color 0.2s ease-in-out;
`}
>
<SelectedPageIcon width={11.5} />
<Text $weight="500" spellCheck="false" $size="16px" $display="inline">
{title}
</Text>
</BoxButton>
);
};
Oh yes nice, and with that we can get rid of my useInterlinkDropNormalizer hook :o ! this is simpler ahha and it works |
443a07c
to
f22ce40
Compare
0e0f9de
to
3cf10e8
Compare
adds hook to normalize dropped blocks and restore internal link format Signed-off-by: Cyril <c.gromoff@gmail.com>
3cf10e8
to
91eba31
Compare
Purpose
Fix DnD of links
Before this fix: both drag-and-drop and copy/paste turned them into plain links, and it seems that there is a conflict with it
For copy-paste, the behavior is a bit weird: when you make a simple text selection, only the text is copied. You have to “over-select” with the arrow keys to include the link as well (see the video).
issue : 1351
dndcc.mp4
Proposal
<a>
to<button>