5
プレースホルダプラグインを開発中CKEDITORとなっており、基本的には完全です。私が持っている問題は、値を取得しようとしているということです。の説明を選択してください。私は値を取得しています。 > items: [['description1', 'value1'], ['description2', 'value2']]
< - - でckeditor plugin dialog select選択したものから説明を取得
リターン - 説明と値が含まれてい 配列は、この
のように見えます>コンテンツ - >私はsetup
を持ってID
dropdown
持つ要素とcommit
機能。これらの関数では、selectオプションから名前を取得するのと同じように説明を取得する必要があります。
本当に事前
例のおかげで、このいずれかで助けを必要と - >
<select>
<option value="value1">description1</option>
<option value="value2">description2</option>
</select>
例<から
(function() {
function placeholderDialog(editor, isEdit) {
var lang = editor.lang.phlink,
generalLabel = editor.lang.common.generalTab;
return {
title: lang.title,
minWidth: 300,
minHeight: 80,
contents: [
{
id: 'info',
label: generalLabel,
title: generalLabel,
elements: [
{
id: 'dropdown'
, type: 'select'
, label: lang.chooseVal
, 'default': 'Detta är default'
, items: [['description1', 'value1'], ['description2', 'value2']]
, setup: function (data) {
// need the description
this.setValue(data.title);
}
, commit: function (data) {
// need the description
data.title = this.getValue();
}
},
{
id: 'text',
type: 'text',
style: 'width: 100%;',
label: lang.text,
'default': '',
required: true,
validate: CKEDITOR.dialog.validate.notEmpty(lang.textMissing),
setup: function (data) {
this.setValue(data.text);
},
commit: function (data) {
data.text = this.getValue();
}
}
]
}
],
onShow: function() {
var data = { tag: 'link', content: "detta är innehåll", title: "Länk till svar", text: "detta är text" };
if (isEdit) {
this._element = CKEDITOR.plugins.phlink.getSelectedPlaceHolder(editor);
data.title = this._element.getAttribute('title');
data.text = this._element.getText();
data.tag = this._element.getAttribute('data-jztag');
}
this.setupContent(data);
},
onOk: function() {
var data = { tag: 'link', content: null, title: null, text: null };
this.commitContent(data);
CKEDITOR.plugins.phlink.createPlaceholder(editor, this._element, data);
delete this._element;
}
};
}
CKEDITOR.dialog.add('createplaceholder', function (editor) {
return placeholderDialog(editor);
});
CKEDITOR.dialog.add('editplaceholder', function (editor) {
return placeholderDialog(editor, 1);
});
})();
私が欲しかったのと同じように機能しました。ありがとう – Ziinloader