Skip to content

Commit

Permalink
IBX-9016: Tags: Facebook and X are not visible in Text block in Page …
Browse files Browse the repository at this point in the history
…builder
  • Loading branch information
GrabowskiM committed Oct 10, 2024
1 parent e9bbcaf commit 53cb21c
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,10 @@
var js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) return;
js = d.createElement(s); js.id = id;
js.src = 'https://connect.facebook.net/en_EN/sdk.js#xfbml=1&version=v4.0';
js.src = 'https://connect.facebook.net/en_EN/sdk.js#xfbml=0&version=v21.0';
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));
document.body.addEventListener('ibexa-post-update-blocks-preview', () => {
window.FB.XFBML.parse();
});
</script>
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,16 @@
};
return t;
}(doc, 'script', 'twitter-wjs'));
const tweetContainer = doc.querySelector('.tweet-container[data-url="{{ params.tweet_url }}"]');
const tweetUrlParts = tweetContainer.dataset.url.split('/');
const tweetId = tweetUrlParts[tweetUrlParts.length - 1];
global.twttr.ready(function () {
const initTwitterWidget = () => {
const tweetContainer = doc.querySelector('.tweet-container[data-url="{{ params.tweet_url }}"]');
if (!tweetContainer) {
return;
}
const tweetUrlParts = tweetContainer.dataset.url.split('/');
const tweetId = tweetUrlParts[tweetUrlParts.length - 1];
global.twttr.widgets.createTweet(
tweetId,
tweetContainer,
Expand All @@ -37,6 +43,12 @@
'dnt': '{{ params.dnt is defined ? params.dnt : '' }}',
}
);
}
global.twttr.ready(function () {
initTwitterWidget();
});
doc.body.addEventListener('ibexa-post-update-blocks-preview', () => {
initTwitterWidget();
});
})(window, window.document);
</script>

0 comments on commit 53cb21c

Please sign in to comment.