The problems of embeding tweet in CKEditor

Precondition

  • You want to embed specific tweet into your application with using CKeditor.
  • You are using Media Embed to simplify the way of using it.

How to do that

  • You should add CKeditor library into your application.
  • Using ckeditor class into your textarea or you can simplify it by using built-in jquery for Ckeditor library by $("textarea").ckeditor();
  • In your configuration file, add your media embed plugin and install its corresponding dependency libraries

Problems and How to resolve

Can not add tweet with emoji

  • CKeditor add-in Media embed currently doesn't support emoji so if you embed one tweet into your application, it will store an unclosing- blockquote tag and it would cause your site to be broken.
  • The solution is to use a function to remove emoji from your textarea elements, remember to choose the function very carefully because some function will erase multibyte character ( Japanese, Chinese... ) as well

Can not embed it in HTTPS sites

  • Surprisingly Media Embed can not pass the SSL certificate so don't be surprise when your code runs on your local and staging server but for products, it will response nothing!
  • The solution is to try another embed_provider, we can choose a lot of embed providers out there, but I'm sure that you can research one for your best purpose. My suggestion would be: oEmbednoEmbed or iframely...
  • You can insert it within a simple line of code : config.embed_provider = '//your service url && api key && url goes here'
If you liked this article

Let's subscribe the updates of Scuti!
Share on Google Plus

About Pham Tuan Anh

This is a short description in the author block about the author. You edit it by entering text in the "Biographical Info" field in the user admin panel.
    Blogger Comment
    Facebook Comment

0 Comments:

Post a Comment