Is there a way to insert embed from telegram or tiktok by straight url?
Right now my code looks like
function insertEmbed(service, link) {
let embed = link
if (service === "youtube") {
const id = new URLSearchParams(new URL(link).search).get("v")
embed = `https://www.youtube.com/embed/${id}`
} else if (service === "instagram") {
link = link.split("?").shift()
embed = `${link}${link.endsWith("/") ? "embed" : "/embed"}`
} else if (service === "twitter") {
embed = `https://twitframe.com/show?url=${encodeURIComponent(link)}`
}
editor.blocks.insert("embed", {
service: service,
source: link,
embed: embed,
}, null, embedBlockId.value === -1 ? null : embedBlockId.value, true)
embedBlock.value?.classList.remove("active")
}
Because Embed doesn't have telegram and tiktok as internal services, documentation suggest to write them by your own
So, in config I have that:
embed: {
class: Embed,
inlineToolbar: true,
config: {
services: {
youtube: true,
twitter: true,
instagram: true,
telegram: {
regex: /https?:\/\/t\.me\/([a-zA-Z0-9_]+)\/(\d+)/,
embedUrl: "https://t.me/<%= remote_id %>",
html: `<script async src="https://telegram.org/js/telegram-widget.js?4" data-telegram-post="durov/45" data-width="100%"></script>`,
height: 600,
width: 800,
},
}
},
},
But in Editor block I don't get iframe block with post or something, only caption
Is there any libs, plugins or anything else? Maybe I missing something?