2022-08-12 03:18:01 +00:00
|
|
|
import { NodeViewWrapper } from '@tiptap/react'
|
|
|
|
import { TwitterTweetEmbed } from 'react-twitter-embed'
|
|
|
|
|
|
|
|
export default function WrappedTwitterTweetEmbed(props: {
|
|
|
|
node: {
|
|
|
|
attrs: {
|
|
|
|
tweetId: string
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}): JSX.Element {
|
|
|
|
// Remove the leading 't' from the tweet id
|
|
|
|
const tweetId = props.node.attrs.tweetId.slice(1)
|
|
|
|
|
|
|
|
return (
|
2022-09-14 20:19:12 +00:00
|
|
|
<NodeViewWrapper className="tiptap-tweet [&_.twitter-tweet]:mx-auto">
|
2022-08-12 03:18:01 +00:00
|
|
|
<TwitterTweetEmbed tweetId={tweetId} />
|
|
|
|
</NodeViewWrapper>
|
|
|
|
)
|
|
|
|
}
|