diff options
Diffstat (limited to 'vnext')
-rw-r--r-- | vnext/src/utils/embed.js | 18 |
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 + } + }, ] } |