custom element for embedding Bluesky posts and feeds mary-ext.github.io/bluesky-embed
typescript npm bluesky atcute
7
fork

Configure Feed

Select the types of activity you want to include in your feed.

feat: support shadow dom placeholder

Mary 66d8b24f ba5606a3

+17 -1
+17 -1
packages/bluesky-post-embed/lib/wc.ts
··· 22 22 const data = await fetchPost({ uri: src, contextless, allowUnauthenticated, serviceUri }); 23 23 const html = renderPost(data); 24 24 25 - this.innerHTML = html; 25 + const root = this.shadowRoot; 26 + 27 + if (!root) { 28 + this.innerHTML = html; 29 + } else { 30 + const template = document.createElement('template'); 31 + template.innerHTML = html; 32 + 33 + const fragment = template.content; 34 + const slot = root.querySelector('slot'); 35 + 36 + if (slot) { 37 + slot.replaceWith(fragment); 38 + } else { 39 + root.appendChild(fragment); 40 + } 41 + } 26 42 } 27 43 } 28 44