ckeditorでcustomeプラグインを作成しようとしています。私がやろうとしているのは、サーバーにajax呼び出しを行い、アイテムのリストを取得することです。これは、動的にdivに表示されます。これらの項目ごとに、onclick属性を設定しました。問題は、onclick属性の関数が定義されていないというエラーが発生することです。
以下のコードスニペット:
ダイアログの内容:
contents : [
{
id : 'information',
name : 'information',
label : 'Information',
elements : [
{
type:'vbox',
padding:0,
children:[
{
type : 'html',
html : '<div style="width: 100%; height: 150px; float: left; border: 1px solid #666666; overflow: auto;" id="results"></div>'
},
]
}]
divに挿入するリスト要素:
var html = '<a onclick="showMore(' + resultNum + ')">';
html += result;
html += '</a>';
return html;
私はこれらの2つの方法でshowMore関数を定義しようとしました:
CKEDITOR.dialog.add('popup', function(editor)
{
function showMore() {}
}
と
CKEDITOR.dialog.add('popup', function(editor)
{
showMore : function() {} (in the return block)
}
onOkなどのようですが、両方のアプローチで運が悪いわけではありません。
これを行う方法はありますか?
よろしくお願いします!!