feat: Intra-line double link interaction

This commit is contained in:
xiaodong zuo
2022-08-19 09:57:04 +08:00
parent 438d814d49
commit f0f60654e8
3 changed files with 38 additions and 29 deletions
@@ -20,6 +20,7 @@ export const DoubleLinkComponent = ({ attributes, children, element }: any) => {
<PagesIcon style={{ verticalAlign: 'middle', height: '20px' }} />
<a
{...attributes}
style={{ cursor: 'pointer' }}
href={`/${element.workspaceId}/${element.blockId}`}
>
<span onClick={handleClickLinkText}>{children}</span>
@@ -599,6 +599,10 @@ class SlateUtils {
const textChildren: Text[] = [];
for (const child of fragmentChildren) {
if ((child as any).type === 'link') {
textChildren.push(child as Text);
continue;
}
if (!('text' in child)) {
console.error('Debug information:', point1, point2, fragment);
throw new Error('Fragment exists nested!');