Steps for inserting code in the FCKeditor Editor

Source: Internet
Author: User

Powerful functions, including C/C ++, XML/html, JavaScript, CSS, C #, Java, PHP, Python, Ruby, SQL, ASP/Visual Basic, you can choose to display the language name, line number, whether to fold, and other functions on the front-end, as well as syntax coloring function, more perfect than you think. It can be displayed in text fields. Code It is displayed in executable mode with a running button. I would like to share with you!
The installation method is as follows:

1. download the compressed package, copy the insertcode folder to the FCKeditor \ editor \ plugins \ directory, and then modify FCKeditor/fckconfig. JS: fckconfig. pluginspath = fckconfig. basepath + 'ins INS/'; Add the following code:
Fckconfig. plugins. Add ('insertcode ');

2. Open the zh-cn.js in the FCKeditor \ editor \ Lang folder and add the following code in the dlgdivinlinestyle: "CSS style" (note that a comma "," must be added after this sentence)
// Plugins
Insertcodebtn: "insert code"

3.to use the insert code function, add the csscode (insertcode.css) to the corresponding page and the following JS Code.
========================================================== ======================
For exampleArticleLink the template page to the CSS file:
<LINK rel = "stylesheet" type = "text/CSS" href = "/FCKeditor/insertcode.css">
Or directly copy the CSS code to the template's CSS file.
Add the following JS Code to the document template page.

Copy code The Code is as follows: <SCRIPT>
// The following is the copy code. Please add it by yourself.
// Javascript
Function $ (ID)
{
Return document. getelementbyid (ID );
}
// Copy text
Function copyidtext (ID)
{
Copy ($ (ID). innertext, $ (ID ));
}
Function copyidhtml (ID)
{
Copy ($ (ID). innerhtml, $ (ID ));
}
Function copy (txt, OBJ)
{
If (window. clipboardData)
{
Window. clipboardData. cleardata ();
Window. clipboardData. setdata ("text", txt );
Alert ("Copied successfully! ")
If (obj. style. display! = 'None '){
VaR RNG = Document. Body. createTextRange ();
RNG. movetoelementtext (OBJ );
RNG. scrollintoview ();
RNG. Select ();
RNG. Collapse (false );
}
}
Else
Alert ("select the text and copy it with Ctrl + C! ");
}
</SCRIPT>

4. Modify the FCKeditor/fckconfig. js file, add a button in the editor control panel, and add insertcode after the media that calls the toolbar parameters (note that punctuation marks are correctly added; otherwise, an error is reported ). As follows:
Fckconfig. toolbarsets ["standard"] = [
['Source', 'paste ', 'pastetext', 'pasteword', '-', 'undo ', 'redo', '-', 'bold ', 'italic ', 'underline', 'strikethangout', 'textcolor', 'table','-', 'justifyleft', 'justifycenter', 'justifyright', 'orderedlist ', 'unorderedlist', '-', 'image', 'Attach ', 'flash', 'Media', 'insertcode']. After completing the preceding operations, at this time, the FCKeditor editor should be started with an additional icon on the editor **. Click this icon to add your code. If an error is reported, the system prompts that the tool item cannot be found. That is, the FCKeditor cache is not cleared. Exit the background or update the cache. Refresh the tool and enter it again to see the code insertion icon.

I don't know how to upload the attachment here--#. Send me one, register a number, and paste the top 2!

Package and download files

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.