欧美三区_成人在线免费观看视频_欧美极品少妇xxxxⅹ免费视频_a级毛片免费播放_鲁一鲁中文字幕久久_亚洲一级特黄

FCKeditor 和 SyntaxHighlighter 代碼高亮插件

系統(tǒng) 1818 0

Introduction(簡(jiǎn)介)

This is a dialog-based plugin to handle formatting of source code for FCKeditor 2.5.x . It WON'T work with the new CKEditor (yet).(CKEditor 是FCKEditor 的升級(jí)版,不過(guò), SyntaxHighlighter?還不能在 CKEditor 中實(shí)現(xiàn)代碼高亮 ) It makes use of the SyntaxHighlighter 2.0.x javascript library available to download from Alex Gorbatchev's project page (the older version 1.5.1 version is available from Google Code ).

The plugin primiarily edits a <pre> tag with some custom attributes. Its mainly aimed at users editing blogs or content management systems where there is a requirement to format programming languages on a website that is being edited using FCKEditor.

The plugin will not format the code in FCKEditor - the SyntaxHighlighter javascript library dynamically generates a lot of formatted HTML at runtime, which would cause problems in FCKEditor.

Skip straight to the good bits

Can't be bothered reading all this? View the online demo or download the plugin and go play with it yourself.

So what do I get then?

Correctly installed, the plugin is in the form of a tabbed dialogue box that looks like this:(插件安裝好以后的效果)

FCKeditor 和 SyntaxHighlighter 代碼高亮插件的整合

Version history:(版本歷史)

Huge thanks goes to Sergey Gurevich who wrote the updated code for the FCKEditor plugin to handle the latest version of the SyntaxHighlighter code and submitted useful bug fixes.

  • v2.1.0 [23 May 2009]
    - Plugin version information now being displayed
    - Line highlighting feature added
    Download | Demo
    ?
  • v2.0.1 [22 March 2009]
    Minor bug fix where semi-colons were sometimes positioned in the wrong place when no advanced options were selected
    Download
    ?
  • v2.0 [2 March 2009]
    Latest version supporting SyntaxHighlighter 2.0.x
    ?
  • v1.0.2 [2 March 2009]
    Bug fixes, final release supporting the older SyntaxHighlighter 1.5.1
    Note the instructions below are for the newer version of the library and makes references to syntaxhighlight2 a lot, this version uses syntaxhighlight . The documentation in the download will be more accurate.
    Download .| Demo
    ?
  • v1.0.1 [10 Feb 2009].
    ?
  • v1.0 [30 Nov 2008]. First version.

Known bugs:

Occasionally the dialogue box does not pickup the <pre> element to be edited in Firefox. It only seems to happen when a user clicks inside the <pre> tag with the mouse but doesn't actually move or interact with the cursor.
Fixed in version 1.0.2 - Thanks to Sergey Gurevich

Installation(安裝配置過(guò)程)

1. Copying the files(拷貝文件)

Extract the contents of the zip in your plugins directory, so it ends up like this:(基本的目錄結(jié)構(gòu)如下)

FCKeditor 和 SyntaxHighlighter 代碼高亮插件的整合

Note : Version 2 of the plugin must be extracted to a directory named ' syntaxhighlighter2 '. The older plugin for the earlier version of the library must go in a folder named ' syntaxhighlighter '. The file fckplugin.js references this directory when the plugin initialises.(注意這里的命名)

2. Adding it to FCKeditor(將它添加到 FCKeditor)

Now add in your fckconfig.js or custom js configuration file the following line (remember its javascript we are dealing with so everything is case sensitive!):?

1. FCKConfig.Plugins.Add( 'syntaxhighlight2' , 'en' ) ;

3. Adding it to the toolbarset

Add the button 'SyntaxHighLight2' button to your toolbarset:?

1. FCKConfig.ToolbarSets[ "Basic" ] = [
2. [ 'Bold' , 'Italic' , '-' , 'OrderedList' , 'UnorderedList' , '-' , 'Link' , 'Unlink' , '-' , 'SyntaxHighLight2' , '-' , 'About' ]
3. ] ;

4. Configure the plugin

The plugin will work 'out of the box', but you can configure a default language using the SyntaxHighlight2LangDefault parameter:

1. FCKConfig.SyntaxHighlight2LangDefault = 'csharp' ;

The full list of languages and corresponding codes are:

  • ?
    • c++ - C++
    • csharp - C#
    • css - CSS
    • delphi - Delphi
    • java - Java
    • jscript - Java Script
    • php - PHP
    • python - Python
    • ruby - Ruby
    • sql - SQL
    • vb - VB.NET
    • xhtml - XML/HTML

In FCKEditor <pre> blocks aren't really formatted by default. I suggest editing your fck_editorarea.css (or equivalant if you are using a custom CSS file) to something that highlights code blocks better. eg:

01. pre
02. {
03. ???? background-color : #fff ;
04. ???? font-family : "Consolas" , "Courier New" , Courier , mono , serif ;
05. ???? font-size : 12px ;
06. ???? color : blue ;
07. ???? padding : 5px ;
08. ???? border : 1px dashed blue ;
09. }

Configuring SyntaxHighlighter.

You must have SyntaxHighlighter installed and working to display properly formatted code. FCKEditor does not need it, but for code to be properly formatted on your website you must have it configurated correctly. For SyntaxHighlighter2 Alex Gorbatchev's site has loads of excellent information (he wrote it after all!), for the old version 1.5.1 library, the project wiki here is a good resouce, or this blog post might also be useful.

5. Use it

Now clear your browser cache (this stage is important!) and reload the editor, the new button Insert code snippet button should be ready to use.

6. Future updates

There's some additional functionality I might add at a later date:

  • Preview tab using the SyntaxHighlighter library
  • More configuration options, eg, available languages, path to SyntaxHighlighter files
  • Dynamically adding a <pre> formatting style to the editor by default

7. And finally...

Thanks goes to Alex Gorbatchev for creating Syntax Highlighter !.



Source URL: http://psyko ptic.com/blo g/post/2008/ 12/01/Code-S yntax-Highli ght-Plugin-f or-FCKeditor (來(lái)自官網(wǎng))

FCKeditor 和 SyntaxHighlighter 代碼高亮插件的整合


更多文章、技術(shù)交流、商務(wù)合作、聯(lián)系博主

微信掃碼或搜索:z360901061

微信掃一掃加我為好友

QQ號(hào)聯(lián)系: 360901061

您的支持是博主寫作最大的動(dòng)力,如果您喜歡我的文章,感覺(jué)我的文章對(duì)您有幫助,請(qǐng)用微信掃描下面二維碼支持博主2元、5元、10元、20元等您想捐的金額吧,狠狠點(diǎn)擊下面給點(diǎn)支持吧,站長(zhǎng)非常感激您!手機(jī)微信長(zhǎng)按不能支付解決辦法:請(qǐng)將微信支付二維碼保存到相冊(cè),切換到微信,然后點(diǎn)擊微信右上角掃一掃功能,選擇支付二維碼完成支付。

【本文對(duì)您有幫助就好】

您的支持是博主寫作最大的動(dòng)力,如果您喜歡我的文章,感覺(jué)我的文章對(duì)您有幫助,請(qǐng)用微信掃描上面二維碼支持博主2元、5元、10元、自定義金額等您想捐的金額吧,站長(zhǎng)會(huì)非常 感謝您的哦!??!

發(fā)表我的評(píng)論
最新評(píng)論 總共0條評(píng)論
主站蜘蛛池模板: 日韩免费在线视频 | 成人黄色在线观看视频 | 深夜久久| 色聚网久久综合 | 午夜影视在线观看 | 久久九九国产精品怡红院 | 久久国产视频网 | 亚洲第一国产 | 国产视频黄色 | 久久中文字幕美谷朱里 | 国产精品第三页在线看 | 福利入口在线观看 | 欧美精品一区二区三区在线播放 | 久久久久久国产精品mv | 亚洲网站在线 | 精品无码中出一区二区 | 国产野花视频天堂视频免费 | 搞黄视频在线观看 | 多男操一女视频 | 亚州精品天堂中文字幕 | 大学生一级毛片全黄真人 | 久久se精品一区精品二区 | 5g免费影院永久天天影院在线 | 国产成人一区二区三区久久久 | 久久成人一区 | 久热官网 | 在线播放一区二区三区 | 黄色精品视频 | 久久久久久久亚洲视频 | 51国产午夜精品免费视频 | 国产精品91久久久久 | 国产精品极品美女在线观看免费 | 激情五月综合婷婷 | 日韩精品真人荷官无码 | 日韩三级视频 | 久久综合综合久久 | 欧美日韩国产综合视频在线看 | 欧美一区二区三区四区视频 | 久久福利剧场 | 国产高清无专砖区2021 | 精品视频一区二区 |