fix: the issue where link preview would be pasted to the next line when pasting (#16)

This commit is contained in:
Kilu.He 2025-01-10 18:43:01 +08:00 committed by GitHub
parent b4147b1fe9
commit 4c71e621cf
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 10 additions and 5 deletions

View File

@ -61,9 +61,14 @@ export const withPasted = (editor: ReactEditor) => {
} }
} }
const currentBlockId = node.blockId as string; // const currentBlockId = node.blockId as string;
//
CustomEditor.addBelowBlock(editor as YjsEditor, currentBlockId, BlockType.LinkPreview, { url: text } as LinkPreviewBlockData); // CustomEditor.addBelowBlock(editor as YjsEditor, currentBlockId, BlockType.LinkPreview, { url: text } as LinkPreviewBlockData);
insertFragment(editor, [{
type: BlockType.LinkPreview,
data: { url: text } as LinkPreviewBlockData,
children: [{ text: '' }],
}]);
return true; return true;
} }