We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Is RTE have syntax highlighter?

Platform: JavaScript |
Control: ejRTE |
Published Date: September 6, 2016 |
Last Revised Date: September 6, 2016

Description

Currently we haven’t provided with in-built support for syntax highlighter in RTE. However, this can be achieved using some third party tools/plugins that will allow you to highlight the code blocks.

Solution

In below sample, we have used CodeMirror plugins to highlight HTML, Javascript and CSS using custom tool. Add the CodeMirror references to the script section as follows.

 

Javascript

 

Render the RTE control, use “customTool” options to add the “div” in the Toolbar.

 

Javascript

 

 

Upon click to the “div” element, the “Dialog” control will be open. From that insert any HTML, CSS or JavaScript syntax to the RTE.

The syntax has been inserted to the RTE using “executeCommand” method.

 

Javascript

 

ADD COMMENT
You must log in to leave a comment

Please sign in to access our KB

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon