试试这个代码,
这就像在 javascript 中动态创建元素一样,只要您按下 Enter 键,就会创建 SELECT 控件...
var editor1 = CKEDITOR.replace('editor');
CKEDITOR.instances["editor"].on("instanceReady" , function(){
var e = this.document;
this.document.on("keyup", function(event){
domEvent = event.data;
key = domEvent.getKey();
switch(key){
case 13:
e = CKEDITOR.instances.editor.document;
b = e.getBody();
s = e.createElement('select');
o = e.createElement('option');
o.appendHtml("hi");
s.append(o);
o = e.createElement('option');
o.appendHtml("hello");
s.append(o);
b.append(s);
s.focus();
break;
default:
}
});
});