Twitter embed code not working with Trumbowyg HTML Editor
See original GitHub issueInformations
I am Bhavana C. I have been using Trumbowyg HTML Editor and have really loved the way it is designed. We are a team related to Movies and we have many content related to Social Media to be edited in the textarea. I am facing a small issue only with twitter embed code which is added fine in the first go but if the content is tried to edit again it disappears fas the twitter code is replaced by <iframe> or <twitterwidget> tag.
Browser version: Google Chrome OS: Windows Screen resolution:
How to reproduce the bug?
- Enter this embed code to code view:
<blockquote class="twitter-tweet"><p lang="et" dir="ltr">Azhake Azhake : <a href="https://twitter.com/hashtag/Neerali?src=hash&ref_src=twsrc%5Etfw">#Neerali</a> video song <a href="https://t.co/MVOimtW1fy">https://t.co/MVOimtW1fy</a></p>— Mohanlal (@Mohanlal) <a href="https://twitter.com/Mohanlal/status/1003617901314621441?ref_src=twsrc%5Etfw">June 4, 2018</a></blockquote>
Above code is rendered as:
Azhake Azhake : #Neerali video song https://t.co/MVOimtW1fy
— Mohanlal (@Mohanlal) June 4, 2018
- Toggle code view back to WYSIWYG view.
- You can view the embed result there.
- Toggle back to code view, you’ll find that the twitter embed code automatically convert to
`<p>
<script async="" src="https://platform.twitter.com/widgets.js" charset="utf-8"></script>
</p><twitterwidget class="twitter-tweet twitter-tweet-rendered" id="twitter-widget-0" style="position: static; visibility: visible; display: block; transform: rotate(0deg); max-width: 100%; width: 500px; min-width: 220px; margin-top: 10px; margin-bottom: 10px;" data-tweet-id="1003617901314621441"></twitterwidget>`
- Go back to WYSIWYG view and you’ll find the twitter embed fail to view due to not working code/converted code.
I see that the blockquotes in the first embed code are replaced with <twitterwidget> tag. Is this intentional? Can we not retain the embed code pasted in the first instance. Can you please let me know how to fix this issue as we have lot of embed work for twitter needed for our developmental work.
Issue Analytics
- State:
- Created 5 years ago
- Comments:10 (2 by maintainers)
Top GitHub Comments
When you are embedding the tweet, make sure you do not include the twitter script tag. Use the Twitter script code only when you are rendering your UI.
Do not include <script async src="https://platform.twitter.com/widgets.js" charset="utf-8"></script> while embedding your tweet.
Thanks Alex. As a workaround I am not loading the Twitter script while embedding and calling it only when displaying the tweet.