FCKEditor 配置及插件编写示例

CKEditor 配置

config.js

CKEDITOR.editorConfig = function( config )
{
	// Define changes to default configuration here. For example:
	// config.language = 'fr';
	config.uiColor = '#ddd';
 
	config.toolbar = 'Cms';
    config.toolbar_Cms =
    [
    ['Source','-'],
    ['Cut','Copy','Paste','PasteText','PasteFromWord','-'],
    ['Undo','Redo','-','Find','Replace','RemoveFormat'],['Link','Unlink','Anchor'],
	['Image','Flash','Table','HorizontalRule', '-'],['Maximize'],
    '/',
    ['Bold','Italic','Underline','Strike','-'],
	['FontSize'],['TextColor','BGColor'],
    ['NumberedList','BulletedList','-','Outdent','Indent','Blockquote'],
    ['JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock'],
    ['PageBreak','-','Page']
    ];
 
	config.filebrowserUploadUrl = '/ckfinder/core/connector/php/connector.php?command=QuickUpload&type=Files';
	config.fontSize_sizes = '10/10px;12/12px;14/14px;16/16px;18/18px;20/20px;22/22px;24/24px;28/28px;32/32px;48/48px;';
 
	config.extraPlugins = 'apage';
};

CKEditor 分页插件1:到提示输入下一页文章标题

CKEDITOR.plugins.add( 'apage',
{
	init : function( editor )
	{
		// Add the link and unlink buttons.
		editor.addCommand( 'apage', new CKEDITOR.dialogCommand( 'apage' ) );
		editor.ui.addButton( 'Page',
			{
				//label : editor.lang.link.toolbar,
				label : "Page",
				//icon: 'images/anchor.gif',
				command : 'apage'
			} );
		//CKEDITOR.dialog.add( 'link', this.path + 'dialogs/link.js' );
		CKEDITOR.dialog.add( 'apage', function( editor )
		{		
			return {
				title : '文章分页',
				minWidth : 350,
				minHeight : 100,
				contents : [
					{
						id : 'tab1',
						label : 'First Tab',
						title : 'First Tab',
						elements :
						[
							{
								id : 'pagetitle',
								type : 'text',
								label : '请输入下一页文章标题<br />(不输入默认使用当前标题+数字形式)'
							}
						]
					}
				],
				onOk : function()
					{
						editor.insertHtml("[page="+this.getValueOf( 'tab1', 'pagetitle' )+"]");
					}
			};
		} );
	},
 
	requires : [ 'fakeobjects' ]
} );

CKEditor 分页插件2:直接插入分页符

CKEDITOR.plugins.add( 'apage',
{
	var cmd = {
		exec:function(editor){
			editor.insertHtml("[[page]]");
		}
	}
	init : function( editor )
	{
		// Add the link and unlink buttons.
		editor.addCommand( 'apage', cmd );
		editor.ui.addButton( 'Page',
			{
				//label : editor.lang.link.toolbar,
				label : "Page",
				//icon: 'images/anchor.gif',
				command : 'apage'
			} );		
	},
 
	requires : [ 'fakeobjects' ]
} );
js/ckeditor_config_plugin.txt · 最后更改: 2009/11/07 04:37 由 kenvin
到顶部
chimeric.de = chi`s home Creative Commons License Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0 红麦软件 红麦软件