Rich Text (WYSIWYG) Editor Extended With RTL (Right To Left) Text Support

In this article, I shall demonstrate the integration of RTL (Right to Left) text & LTR (Left to Right) text support.


You also need to download the summernote-rtl-plugin extended plugin.

Following are some prerequisites before you proceed further in this tutorial.

  1. Knowledge of ASP.NET MVC5: Rich Text (WYSIWYG) Editor.
  2. Download summernote-rtl-plugin extended plugin.
  3. Knowledge of ASP.NET MVC5
  4. Knowledge of HTML.
  5. Knowledge of JavaScript.
  6. Knowledge of Bootstrap.
  7. Knowledge of jQuery.
  8. Knowledge of C# Programming.

You can download the complete source code for this tutorial or you can follow the step by step discussion below. The sample code is being developed in Microsoft Visual Studio 2015 Enterprise.

Now, let's begin.

You need to download the code sample from ASP.NET MVC5: Rich Text (WYSIWYG) Editor article because this article is the extension of that article.

Now, open the "Scripts/script-custom-editor.js" file and replace the following code in it, i.e.,

  1. $(document).ready(function ()  
  2. {  
  3.       // Initialize Editor  
  4.     //$('.textarea-editor').wysihtml5();  
  5.     $('.textarea-editor').summernote(  
  6.     {  
  7.         height: 300,                 // set editor height  
  8.         minHeight: null,             // set minimum height of editor  
  9.         maxHeight: null,             // set maximum height of editor  
  10.         focus: true,                  // set focus to editable area after initializing summernote  
  11.         toolbar: [  
  12.                       ['style', ['style']],  
  13.                       ['style', ['bold''italic''underline''clear']],  
  14.                       ['fontname', ['fontname']],  
  15.                       ['color', ['color']],  
  16.                       ['para', ['ul''ol''paragraph']],  
  17.                       ['insert', ['ltr''rtl']],  
  18.                       ['insert', ['table']],  
  19.                       ['insert', ['link''picture''video''hr']],  
  20.                       ['view', ['fullscreen''codeview''help']]  
  21.                 ]  
  22.     });  
  23. }); 

In the above code, we have added the following line in the default toolbar settings to provide support for RTL (Right to Left) text & LTR (Left to Right) text.

  1. ['insert', ['ltr''rtl']], 

Execute the project and you will be able to see the following.




Conclusion

In this blog, you learned how to extend the Summernote Rich Text (WYSIWYG) Editor jQuery plugin to provide support for RTL (Right to Left) text & LTR (Left to Right) text with the help of summernote-rtl-plugin extended plugin.

Ebook Download
View all
Learn
View all