FCKeditor Editor Insert Code function Implementation Steps _ Page Editor

Source: Internet
Author: User
Powerful, can be inserted in the language includes: C/c++,xml/html,javascript,css,c#,java,php,python,ruby,sql,asp/visual Basic, you can choose to display the language name in the foreground, display line number , folding and other functions, but also syntax coloring function, than you can imagine the perfect. And can be divided into a text field display code and have the Run button executable way to display. Special to share with you!
The installation method is as follows:

1. After downloading the compressed package, copy the folder Insertcode to the Fckeditor\editor\plugins\ directory, and then modify the fckeditor/ Fckconfig.js this file, Fckconfig.pluginspath = Fckconfig.basepath + ' plugins/' in this file, add the following code below:
FCKCONFIG.PLUGINS.ADD (' Insertcode ');


2. Open the Zh-cn.js in the Fckeditor\editor\lang folder, in Dlgdivinlinestyle: "CSS style", (note that after this sentence must add a comma ",") add the following code
Plugins
INSERTCODEBTN: "Insert Code"


3. In order to be able to use the inserting code function, needs to add the CSS code (INSERTCODE.CSS) in the corresponding page, and the following JS code.
========================================================
For example, in the article template page link CSS file:
<link rel= "stylesheet" type= "Text/css" href= "/fckeditor/insertcode.css" >
or copy the CSS code directly into the template's CSS file.
and add the following JS code to the article template page.

Copy Code code as follows:

<script>
Here is the code to implement the replication, please add 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 ("Copy succeeded!") ")
if (Obj.style.display!= ' None ') {
var rng = Document.body.createTextRange ();
Rng.movetoelementtext (obj);
Rng.scrollintoview ();
Rng.select ();
Rng.collapse (FALSE);
}
}
Else
Alert ("Please select text, use CTRL + C to copy!");
}
</script>


4. Modify the Fckeditor/fckconfig.js file, add the button in the Editor Control Panel, add the Insertcode after the media that calls the toolbar parameter (note that the correct plus punctuation marks, or it will be an error). As shown below:
fckconfig.toolbarsets["standard"] = [
[' Source ', ' Paste ', ' pastetext ', ' Pasteword ', '-', ' Undo ', ' Redo ', '-', ' Bold ', ' italic ', ' underline ', ' strikethrough ', ' TextColor ', ' Table ', '-', ' justifyleft ', ' justifycenter ', ' justifyright ', ' orderedlist ', ' unorderedlist ', '-', ' Image ', ' Attach ', ' Flash ', ' Media ', ' Insertcode ', when you're done, the startup FCKeditor editor should have an additional icon on the editor's * *, click on this icon to add your code. If the error, the hint cannot find the tool item, that is FCKeditor cache is not clear, exit the background or update the cache, refresh, re-enter the code can see the insertion icon.

Do not know how to upload the attachment here--#, I send a download address bar:-), registration number, top 2 stickers on the line!

File package Download

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.