1ï¼å®è£
<a href="
http://www.drupalla.com/project/ckeditor" class="alinks-link" title="模åä»ç»ï¼FCKEditoræ¯ç¨å¸¸ç¨çç½çç页ææ¬ç¼è¾å¨ï¼ DrupalçFCKEditor模åä¹å·²æå¾é¿çåå²äºï¼å
¶ä¸IMCE, Image Browserç模åç»åèµ·æ¥ä½¿ç¨ä¹æ¯é常çç½ãä¸è¿ç°å¨ï¼FCKEditorå级äºæ°çæ¬ï¼æ¢äºä¸ªæ°ç®è¤ï¼åäºäºä¼åï¼å°å称æ´æ¹ä¸ºï¼CKEditorãå®è£
æ¹å¼åFCKeditorä¸æ¨¡ä¸æ ·ï¼æ²¡æä»»ä½ååï¼èä¸ä¹å¯ä»¥åIMCEéæã">Ckeditor 模åã
é¦å
ä¸è½½ Ckeditor 模åï¼å¹¶å®è£
ï¼ ç¶åä¸è½½ Ckeditor librariesï¼è§£åå°/sites/all/librariesï¼è¿å
¥åå°è®¾ç½®ï¼
Drupal6ï¼Administer > Site Configuration > Ckeditor
Drupal7ï¼Administer > Config > Content > Ckeditor
é
ç½®ä½ åå¤ç¨å°Syntaxhighlighterçé
ç½®æ件ãåæ¶è¦ç¡®ä¿
ç¡®ä¿ä½ çç¨æ·è§è²å·²è·å访é®è¿ä¸ªCkeditorçé
ç½®
ç¡®ä¿ä½ çå¯è§æ§è®¾ç½®æ£ç¡®
2ï¼å®è£
Syntax Highlighter模åååº
ä¸è½½Syntax Highlighter 模åï¼å¹¶ä¸å®è£
ä¸è½½Syntax Highlight libraryï¼è§£åå°/site/all/libraries
è¿å
¥Administation > Site Configuration > Syntax highlighterï¼Drupal6ï¼æ Administation > Config > Content > Syntaxhighlighterï¼Drupal7ï¼ï¼å¾éä½ æ³æå¼çæ ¼å¼ã
3ï¼å®è£
Syntax highlighter Ckeditor plugin
ä¸è½½Ckeditor plugin解åå°sites/all/module/ckeditor/plugins/syntaxhighlight
ç¶åç¼è¾/sites/all/modules/ckeditor/ckeditor.config.js
å¢å 28è¡è·75è¡
?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
/*
<a href="/project/copyright" class="alinks-link" title="模åä»ç»ï¼å¯ä»¥è®¾å®ç½ç«æ´ä½ååç¯å
容çèä½æ/ææ声æã管çè
å¯ä»¥è®¾å®å¯éç¨çèä½æç§ç±»ï¼åç°å¨åºåæ页尾éãæå页é¢ï¼Bookï¼å¯ä»¥éæ©æ§å°è®¾å®ææå页é¢ä¸ºåä¸èä½æ声æï¼å¹¶è®©æ¯ä¸ä»½æåæåºåæå
¶èªå·±çèä½æ声æã">Copyright</a> (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or
http://ckeditor.com/license*/
/*
WARNING: clear browser's cache after you modify this file.
If you don't do this, you may notice that browser is ignoring all your changes.
*/
CKEDITOR.editorConfig = function(config) {
config.indentClasses = [ 'rteindent1', 'rteindent2', 'rteindent3', 'rteindent4' ];
// [ Left, Center, Right, Justified ]
config.justifyClasses = [ 'rteleft', 'rtecenter', 'rteright', 'rtejustify' ];
// The minimum editor width, in pixels, when resizing it with the resize handle.
config.resize_minWidth = 450;
// Protect PHP code tags (<?...?>) so CKEditor will not break them when
// switching from Source to <a href="/project/wysiwyg" class="alinks-link" title="模åä»ç»ï¼âWhat You See Is What You Getâ çé¦åæ¯ç¼©åï¼å³æâæè§å³æå¾âçææã Drupal é»è®¤åªæä¾ç®åçææ¬æ¡ï¼å¹¶æªå 载任ä½ç¼è¾å¨ãè¿å¯¹äºå¤§å¤æ°å¹²æ¥è§¦ Drupal çå½å
ç¨æ·æ¥è®²ï¼çæ¯ååçä¸æ¹ä¾¿ :D WYSIWYG æ¯ç¨äºéæâæè§å³æå¾âç¼è¾å¨çæ¥å£ï¼éè¿ä½¿ç¨ WYSIWYG 模åï¼è½å¤ä¸º Drupal éææ°åç§å½å
å¤æµè¡çæè§å³æå¾ç¼è¾å¨ï¼ç®¡çåå¯æ ¹æ®èªå·±çå好æ¥éæ©ä¸åçç¼è¾å¨ã ç®åç¨å¾æ¯è¾å¤çç¼è¾å¨æï¼CKEditor, TinyMCE, FCKE">WYSIWYG</a>.
// Uncommenting this line doesn't mean the user will not be able to type PHP
// code in the source. This kind of prevention must be done in the server
// side
// (as does Drupal), so just leave this line as is.
config.protectedSource.push(/<\?[\s\S]*?\?>/g); // PHP Code
config.protectedSource.push(/<code>[\s\S]*?<\/code>/gi); // Code tags
config.extraPlugins = '';
config.extraPlugins += (config.extraPlugins ? ',syntaxhighlight' : 'syntaxhighlight' );
// Define as many toolbars as you need, you can change toolbar names and remove or add buttons.
// List of all buttons is here:
http://docs.cksource.com/ckeditor_api/symbols/CKEDITOR.config.html#.toolbar_Full // This toolbar should work fine with "Filtered HTML" filter
config.toolbar_DrupalFiltered = [
['Source'],
['Cut','Copy','Paste','PasteText','PasteFromWord','-','SpellChecker', 'Scayt'],
['Undo','Redo','Find','Replace','-','SelectAll','RemoveFormat'],
['<a href="/project/image" class="alinks-link" title="模åä»ç»ï¼è®©æç¹å®æéçç¨æ·å¯ä»¥ä¸ä¼ å¾çå°ç½ç«éï¼å¹¶ä¸ä¼èªå¨äº§ç缩å¾ãå¾çå¯ä»¥ä½¿ç¨å¨æç« éï¼ä¾å¦éè¿tinymceç¼è¾å·¥å
·è¿è¡éåï¼ï¼ææ¯ä½æç®åçç½ç»ç¸ç°¿ã">Image</a>','Flash','Table','HorizontalRule','<a href="/project/smiley" class="alinks-link" title="模åä»ç»ï¼ 让ææ¬ç¼è¾å¨æ¯æ表æ
">Smiley</a>','SpecialChar'],
['Maximize', 'ShowBlocks'],
'/',
['Format'],
['Bold','Italic','Underline','Strike','-','Subscript','Superscript'],
['NumberedList','BulletedList','-','Outdent','Indent','Blockquote'],
['JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock','-','BidiRtl','BidiLtr'],
['<a href="/project/link" class="alinks-link" title="模åä»ç»ï¼ä¸ File Field å Image Field 类似ï¼Link ä¹ä¸º CCK å¢å äºä¸ç§æ©å±ç±»åï¼å³é¾æ¥å段ãéè¿ä½¿ç¨é¾æ¥å段ï¼ç¨æ·å¯ä»¥åèç¹ä¸æ·»å é¾æ¥ï¼é¾æ¥å
æ¬ URLï¼æ é¢åå¯éç target å±æ§ã">Link</a>','Unlink','Anchor','<a href="/project/linkit" class="alinks-link" title="模åä»ç»ï¼éè¿ä½¿ç¨ä¸ä¸ªèªå¨å®æå段ï¼ä½¿èç¹ãç¨æ·ãè§å¾åæ¯è¯æ¯æå
é¨é¾æ¥ã">Linkit</a>','LinkToNode','LinkToMenu'],
['DrupalBreak', 'DrupalPageBreak']
];
/*
* DrupalBasic will be forced on some smaller textareas (if enabled)
* if you change the name of DrupalBasic, you have to update
* CKEDITOR_FORCE_SIMPLE_TOOLBAR_NAME in ckeditor.module
*/
config.toolbar_DrupalBasic = [ [ 'Format', 'Bold', 'Italic', '-', 'NumberedList','BulletedList', '-', 'Link', 'Unlink', 'Image' ] ];
/*
* This toolbar is dedicated to users with "Full HTML" access some of commands
* used here (like 'FontName') use inline styles, which unfortunately are
* stripped by "Filtered HTML" filter
*/
config.toolbar_DrupalFull = [
['Source'],
['Cut','Copy','Paste','PasteText','PasteFromWord','-','SpellChecker', 'Scayt'],
['Undo','Redo','Find','Replace','-','SelectAll','RemoveFormat'],
['Image','Flash','Table','HorizontalRule','Smiley','SpecialChar'],
'/',
['Bold','Italic','Underline','Strike','-','Subscript','Superscript'],
['NumberedList','BulletedList','-','Outdent','Indent','Blockquote'],
['JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock','-','BidiRtl','BidiLtr'],
['Link','Unlink','Anchor','Linkit','LinkToNode', 'LinkToMenu'],
'/',
['Format','Font','FontSize'],
['TextColor','BGColor'],
['Maximize', 'ShowBlocks'],
['DrupalBreak', 'DrupalPageBreak', 'Code']
];
/*
* Append here extra CSS <a href="/project/rules" class="alinks-link" title="模åä»ç»ï¼å¯ä»¥è®¾ç½®ä¸äºè§åï¼å½æäºä»¶åçæ¶ï¼èªå¨æ§è¡æäºå¨ä½ãæ¯å¦æ人åå¤å°±èªå¨ç»ä½è
åä¿¡ççãdrupalèªå¸¦çtrigger太ç®åï¼è¿ä¸ªåè½æ¯è¾å
¨ï¼ç¨èµ·æ¥è¿æºæ¹ä¾¿ã">rules</a> that should be applied into the editing area.
* Example:
* config.extraCss = 'body {color:#FF0000;}';
*/
config.extraCss = '';
/**
* Sample extraCss code for the "marinelli" theme.
*/
var themeName = Drupal.settings.ckeditor.theme;
if (typeof themeName == "object") {
themeName = Drupal.settings.ckeditor.theme[0];
}
if (themeName == "marinelli") {
config.extraCss += "body{background:#FFF;text-align:left;font-size:0.8em;}";
config.extraCss += "#primary ol, #primary ul{margin:10px 0 10px 25px;}";
}
if (themeName == "newsflash") {
config.extraCss = "body{min-width:400px}";
}
/**
* CKEditor's editing area body ID & class.
* See
http://drupal.ckeditor.com/tricks * This setting can be used if CKEditor does not work well with your theme by default.
*/
config.bodyClass = '';
config.bodyId = '';
/**
* Sample bodyClass and BodyId for the "marinelli" theme.
*/
if (themeName == "marinelli") {
config.bodyClass = 'singlepage';
config.bodyId = 'primary';
}
};