1. 程式人生 > >JSP頁面使用富文字控制元件ckeditor自定義樣式

JSP頁面使用富文字控制元件ckeditor自定義樣式

 

找到ckeditor目錄下的ckeditor.js,修改其中的內容,向裡面新增自己的設定

CKEDITOR.editorConfig = function( config )
{
	// Define changes to default configuration here. For example:
	//config.language = 'fr'; //設定語言風格   fr法語
	config.uiColor = '#AADC6E';//修改邊框顏色
         //設定寬高
	config.width = 700;
	config.height = 200;
	config.toolbar = 'MyToolbar';  
	//config.toolbar = 'Full';  
	//config.toolbar = 'Basic';  
	config.toolbar_Full =   
	[   
		['Source','-','Save','NewPage','Preview','-','Templates'],   
		['Cut','Copy','Paste','PasteText','PasteFromWord','-','Print', 'SpellChecker', 'Scayt'],   
		['Undo','Redo','-','Find','Replace','-','SelectAll','RemoveFormat'],   
		['Form', 'Checkbox', 'Radio', 'TextField', 'Textarea', 'Select', 'Button', 'ImageButton', 'HiddenField'],   
		'/',   
		['Bold','Italic','Underline','Strike','-','Subscript','Superscript'],   
		['NumberedList','BulletedList','-','Outdent','Indent','Blockquote','CreateDiv'],   
		['JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock'],   
		['BidiLtr', 'BidiRtl'],   
		['Link','Unlink','Anchor'],   
		['Image','Flash','Table','HorizontalRule','Smiley','SpecialChar','PageBreak','Iframe'],   
		'/',   
		['Styles','Format','Font','FontSize'],   
		['TextColor','BGColor'],   
		['Maximize', 'ShowBlocks','-','About']   
	];   

	config.toolbar_Basic =   
	[   
		['Bold', 'Italic', '-', 'NumberedList', 'BulletedList', '-', 'Link', 'Unlink','-','About']   
	]; 
	config.toolbar_MyToolbar =   
	[   
        ['NewPage','Preview'],   
        ['Cut','Copy','Paste','PasteText','PasteFromWord','-','Scayt'],   
        ['Undo','Redo','-','Find','Replace','-','SelectAll','RemoveFormat'],   
        ['Image','Flash','Table','HorizontalRule','Smiley','SpecialChar','PageBreak'],   
        '/',   
        ['Styles','Format'],   
        ['Bold','Italic','Strike'],   
        ['NumberedList','BulletedList','-','Outdent','Indent','Blockquote'],   
        ['Link','Unlink','Anchor'],   
        ['Maximize','-','About']   
	];   
};


效果圖如下: