我想将“目标”选项卡移到“高级”选项卡中,但仅保留选项(_blank,_new,_parent,_self)以使其简单。
这是我在id:'advanced'
内的links.js中拥有的内容
{
id: 'advanced',
...
elements: [ {
type: 'vbox',
...
children: [ {
type: 'hbox',
...
children: [ {
//this is the id field
type: 'text',
id: 'advId',
requiredContent: 'a[id]',
label: linkLang.id,
setup: setupAdvParams,
commit: commitAdvParams
},
{
//this is the target field
type: 'select',
id: 'advTargetType',
label: commonLang.target,
'default': 'notSet',
style: 'width : 110px;',
'items': [
[ 'Not Set', 'notSet' ],
[ commonLang.targetNew, '_blank' ],
[ commonLang.targetTop, '_top' ],
[ commonLang.targetSelf, '_self' ],
[ commonLang.targetParent, '_parent' ]
],
setup: setupAdvParams,
commit: commitAdvParams
},
{
type: 'text',
id: 'advAccessKey',
...
} ]
},
然后,在plugin.js中,我添加了target
并删除了dir
...
init: function( editor ) {
var allowed = 'a[!href]',
required = 'a[href]';
if ( CKEDITOR.dialog.isTabEnabled( editor, 'link', 'advanced' ) )
allowed = allowed.replace( ']', ',accesskey,charset,target,id,lang,name,rel,tabindex,title,type,download]{*}(*)' );
if ( CKEDITOR.dialog.isTabEnabled( editor, 'link') )
allowed = allowed.replace( ']', ',onclick]' );
...
然后仍在我替换的plugin.js内,将dir: 'advLangDir'
替换为'target': 'advTargetType',
var advAttrNames = {
id: 'advId',
'target': 'advTargetType',
accessKey: 'advAccessKey',
// 'data-cke-saved-name': 'advName',
name: 'advName',
lang: 'advLangCode',
tabindex: 'advTabIndex',
title: 'advTitle',
type: 'advContentType',
'class': 'advCSSClasses',
charset: 'advCharset',
style: 'advStyles',
rel: 'advRel'
};
我删除了目标标签,它的功能。 它不起作用,提交后我可以在控制台日志中看到数据,但没有保存,如果我再次单击链接,它将恢复为默认值。
编辑:我弄错了吗?这个高级标签不只是像这样添加[name:value,name2:value2]
:<a name='value' name2='value2'>