9311652bed
* Embed a tweet by URL * Clean up imports * Prevent tweetId from getting interpreted as a number * Use a single place to embed iframe, Youtube, and Tweets * Support Manifold and Metaculus embeds * Remove unused import * Simplify Manifold paste logic * Clean up embed rewrite code * Add back comment * Rejigger config so tsx is only in web/ * Clean up comment * Revert unnecessary tsconfig change * Fix placeholder * Lighten placeholder
20 lines
468 B
TypeScript
20 lines
468 B
TypeScript
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 (
|
|
<NodeViewWrapper className="tiptap-tweet">
|
|
<TwitterTweetEmbed tweetId={tweetId} />
|
|
</NodeViewWrapper>
|
|
)
|
|
}
|