fix: the issue where link preview would be pasted to the next line when pasting (#16)
This commit is contained in:
parent
b4147b1fe9
commit
4c71e621cf
|
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue