您可以通过使用dialogDefinition
事件有关的动态设置自定义的占位符。 我做了这样的(HTML属性data-placeholders
指定的"placeholder1,different text to show=placeholder2,another text=placeholder3"
CKEDITOR.on ('dialogDefinition', function (e) {
// Check if the definition is from the dialog window you are interested in (the "Link" dialog window).
if (e.data.name == 'placeholder') {
var $textarea = $(e.editor.element.$),
placeholders = $textarea.attr("data-placeholders"),
tab, ff, i, a;
//placeholders = [['placeholder1'],['Text to show', 'placholdervalue']];
if (placeholders && placeholders.length) {
// convert placeholders from desc1=val1,desc2=val2,val3,... format to array(array(desc,val))
placeholders = placeholders.split(",");
// ensure placeholders is array of arrays with exact 2 members
for (i = 0; i < placeholders.length; i++) {
a = placeholders[i].split("=");
if (a.length < 1) a[1] = a[0];
placeholders[i] = a;
}
tab = e.data.definition.getContents ('info');
// Set the default value for the URL field.
ff = tab.get ('name');
ff['type'] = 'select';
ff['items'] = placeholders;
}
}
});
你找到一个解决方案尚未 – aggsol 2015-03-05 10:22:57
我不再需要这个插件。它也仅适用于占位符 – toshniba 2015-03-16 07:35:29