aboutsummaryrefslogtreecommitdiff
path: root/vnext
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2024-10-25 05:01:33 +0300
committerGravatar Vitaly Takmazov2024-10-25 05:01:33 +0300
commit2ea1de77ab4851f8024c546d9f14bb84d47a1d3e (patch)
tree2adf53b9ec1f0d9bdf8f25f072ad15497b4197be /vnext
parente9464b8a10eb57d9b021251ff97bcbd9c53a1e98 (diff)
embed: Tiktok videos
Diffstat (limited to 'vnext')
-rw-r--r--vnext/src/utils/embed.js18
1 files changed, 18 insertions, 0 deletions
diff --git a/vnext/src/utils/embed.js b/vnext/src/utils/embed.js
index d020dbc2..6a5c9c95 100644
--- a/vnext/src/utils/embed.js
+++ b/vnext/src/utils/embed.js
@@ -314,6 +314,24 @@ function getEmbeddableLinkTypes() {
return div
}
},
+ {
+ name: 'Tiktok',
+ id: 'embed_tiktok',
+ className: 'tiktok compact',
+ re: /https?:\/\/www\.?tiktok\.com\/(\S+)/i,
+ makeNode: function(aNode, reResult, div) {
+ const tiktok_url = reResult[0]
+ fetch('https://www.tiktok.com/oembed?url=' + tiktok_url)
+ .then(response => response.json())
+ .then(json => {
+ div.innerHTML = json.html
+ let script = document.createElement('script')
+ script.src = 'https://www.tiktok.com/embed.js'
+ div.appendChild(script)
+ }).catch(console.log)
+ return div
+ }
+ },
]
}