修改 CKEditor 超链接的默认协议

在 config.js 中添加如下代码

CKEDITOR.on( 'dialogDefinition', function( ev )
{
		// Take the dialog name and its definition from the event data.
		var dialogName = ev.data.name;
		var dialogDefinition = ev.data.definition;
 
		// Check if the definition is from the dialog window you are interested in (the "Link" dialog window).
		if ( dialogName == 'link' )
		{
			// Get a reference to the "Link Info" tab.
			var infoTab = dialogDefinition.getContents( 'info' );
 
			// Set the default value for the URL field.
			// var urlField = infoTab.get( 'url' );
			// urlField['default'] = 'www.example.xxxcom';
			
			var protocolField = infoTab.get( 'protocol' );
			protocolField['default'] = "";
		}
});

参考:

How Do I Set a Default Value for a CKEditor Dialog Window Field?

 

 

posted @ 2017-07-02 20:27  forestk  阅读(1086)  评论(0编辑  收藏  举报