Skip to content

Commit

Permalink
Support the x.com domain
Browse files Browse the repository at this point in the history
  • Loading branch information
DannyFeliz committed Jun 12, 2024
1 parent af2b23f commit 1788584
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ function onTweetLoadError(error: Error) {

<template>
<vue-tweet
tweet-url="https://twitter.com/vuejs/status/1753678159067881809"
tweet-url="https://x.com/vuejs/status/1753678159067881809"
cards="visible"
conversation="all"
lang="en"
Expand Down
4 changes: 2 additions & 2 deletions src/vue-tweet.vue
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ const props = defineProps({
The Tweet URL.
@example
<TweetEmbed tweetId="https://twitter.com/jack/status/20" />
<TweetEmbed tweetId="https://x.com/jack/status/20" />
*/
tweetUrl: {
type: String,
Expand Down Expand Up @@ -258,7 +258,7 @@ function getTweetParams() {
);
}
} else if (tweetUrl) {
const TWEET_URL_REGEX = /^(https?:\/\/)?(www\.)?twitter\.com\/.*\/status(?:es)?\/(?<tweetId>[^/?]\d+)$/i;
const TWEET_URL_REGEX = /^(https?:\/\/)?(www\.)?(twitter|x)\.com\/.*\/status(?:es)?\/(?<tweetId>[^/?]\d+)$/i;
const match = tweetUrl.trim().match(TWEET_URL_REGEX);
if (match) {
Expand Down

0 comments on commit 1788584

Please sign in to comment.