0
我正在使用CKEDITOR placeholder plugin並嘗試在onClick上設置小部件數據。如何在onClick事件中設置CKEDITOR對話框數據
commit: function(widget) {
widget.setData('name', this.getValue());
}
但是當我嘗試做同樣的的onClick:
onClcik: function(widget) {
widget.setData('name', this.getValue());
}
我widget
對象是不同的,widget.setData
是不確定的,當我設置上提交控件數據
,一切工作正常。
我的問題是如何在radio元素上設置onClick事件的widget數據?
Placholder.js
'use strict';
CKEDITOR.dialog.add('placeholder', function(editor) {
var lang = editor.lang.placeholder,
generalLabel = editor.lang.common.generalTab,
validNameRegex = /^[^\[\]<>]+$/;
return {
title: 'Insert variable from:',
minWidth: 200,
minHeight: 151,
contents: [{
id: 'initial-view',
label: 'view one',
title: generalLabel,
elements: [{
id: 'view-one',
style: 'width: 100%;',
type: 'html',
html: ''
}, {
type: 'button',
id: 'open-organizational-units',
label: 'Organizational units',
title: 'Organizational units',
className: 'dialog-btn-icon-forward',
setup: function(widget) {
this.setValue(widget.data.name);
},
onClick: function(widget) {
this.getDialog()
.selectPage('organizational-unit-view');
}
}]
}, {
id: 'organizational-unit-view',
label: 'view two',
title: generalLabel,
elements: [{
type: 'button',
id: 'back-to-main-view',
label: 'Organizational units',
title: 'Organizational units',
className: 'dialog-btn-icon-back',
setup: function(widget) {
this.setValue(widget.data.name);
},
onClick: function(widget) {
this.getDialog()
.selectPage('initial-view');
}
},
{
type: 'radio',
id: 'list-of-vars',
align: 'vertical',
style: 'color: green',
'default': '',
setup: function(widget) {
this.setValue(widget.data.name);
},
onClick: function(widget) {
widget.setData('name', this.getValue());
},
commit: function(widget) {
}
}
]
}]
};
});