0
Я делаю плагин в CKeditor с выбором ['Description', 'Value'].Создание простого плагина CKEditor - выбор раскрывающегося списка
ckeditor root/
plugins/
span/
icons/
span.png
dialogs/
span.js
plugin.js
plugin.js
> CKEDITOR.plugins.add('span', {
> icons: 'span',
> init: function(editor) {
> editor.addCommand('span', new CKEDITOR.dialogCommand('spanDialog'));
> editor.ui.addButton('Span', {
> label: 'Insert Reserved Word',
> command: 'span',
> toolbar: 'insert'
> });
> CKEDITOR.dialog.add('spanDialog', this.path + 'dialogs/span.js');
> } });
диалоговые окна/span.js
CKEDITOR.dialog.add('spanDialog', function(editor) {
return {
title: 'Palavras Reservadas',
minWidth: 400,
minHeight: 200,
contents: [
{
id: 'tab-basic',
label: 'Basic Settings',
elements: [
{
type: 'select',
id: 'span',
label: 'Reserved Words Available',
items: [ [ 'example 1', '#exanple1#' ], [ 'example 2', '#example2#' ] ],
validate: CKEDITOR.dialog.validate.notEmpty("Field can not be empty."),
setup: function(a) {
this.setValue(a.getAttribute("value") || "")
}
}
]
}
],
onOk: function() {
var dialog = this;
var span = editor.document.createElement('span');
span.setAttribute('title', dialog.getValueOf('tab-basic', 'title'));
editor.insertElement(span);
}
};
});
В функции OnOK()
onOk: function() {
var dialog = this;
var span = editor.document.createElement('span');
span.setAttribute('title', dialog.getValueOf('tab-basic', 'title'));
editor.insertElement(span);
}
Я хотел бы добавить к читателю после
<span>#example1#</span> //if I select a Exemple 1
Любые советы о том, как это сделать? Смотрите этот промежуток с текстом набор ... спасибо за сейчас