CKEditor Integration Syntaxhighlighter Highlight plug-in detailed

Source: Internet
Author: User

First, the highlight reference source Plug-ins and modification instructions
1, highlighter integration into the FCKeditor

Source Address Kend ' s Blog, but he (she) used a DP. Syntaxhighlighter. Modification Description:

A, DP. Syntaxhighlighter is replaced with the following syntaxhighlighter.

B, JavaScript script location call modified to the root directory, no longer to the FCKeditor directory downward use, in order to simple, all JS all written into a string of *_*, create element too wordy.

C, delete all the files only three: 1. js, 1 HTML and a logo file.

2, Syntaxhighlighter

Source Address: http://alexgorbatchev.com/, this plug-in is a self-integration call, the method of their own, so the sky edge on their two to combine, just under the test through Firefox, other details of the issue later amended to improve, the revised note is as follows:

A, the original CSS call is divided into two parts, the sky edge of the core CSS and the default theme to merge into one, reduce the number of calls.

B, the original file combination of different directories, modified to leave only the main file, and all put in the same code directory.

Second, the highlight plug-in modification and registration
1, DP. Syntaxhighlighter Plugin Modification

Delete the remaining three files, you need to modify multiple paths and double-click Edit Code section, no longer listed here, you can directly see the following download code, time relationship, a lot of code is not optimized, enough will no longer toss.

2, the Highlight plug-in registration section

The code is as follows Copy Code

In Fckeditor/fckconfig.js, add plugin Registration and toolbar registration, and modify the reference as follows:

Fckconfig.pluginspath = Fckconfig.basepath + ' plugins/';
FCKCONFIG.PLUGINS.ADD (' Syntaxhighlighter ', ' zh-cn,en ')//Add Highlight plugin Registration
.
.
.
Fckconfig.autodetectlanguage = false;//prohibit automatic detection of languages
Fckconfig.defaultlanguage = ' ZH-CN ';//default display Chinese language

.
.
.
fckconfig.toolbarsets["Default" = [
[' Pastetext ', ' syntaxhighlighter ', ' find ', ' Replace ', ' Removeformat '],
;//Add to the toolbar, position yourself Select


3, download the highlight plugin

Download plugin: Click to download, download after decompression has two directories:

One is the JS directory, the JS directory copy to the site with the directory can be (if the band of the corresponding adjustment of the domain name).

One is the Syntaxhighlighter directory, the syntaxhighlighter copy to the fckeditor/plugins below.

4, empty cache background test

Then upload, again into the FCKeditor edit mode, you can see Syntaxhighlighter has been in effect, and support double click Edit, specific case reference this page source code.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.