現在、CKEditor を使用して XML エントリを追加しようとしています。サンプル プラグインのコードを次のように変更しました。
CKEDITOR.dialog.add( 'abbrDialog', function( editor ) {
return {
title: 'Abbreviation Properties',
minWidth: 400,
minHeight: 200,
contents: [
{
id: 'tab-basic',
label: 'Basic Settings',
elements: [
{
type: 'text',
id: 'abbr',
label: 'Title',
validate: CKEDITOR.dialog.validate.notEmpty( "Title cannot be empty" )
},
{
type: 'text',
id: 'title',
label: 'Price',
validate: CKEDITOR.dialog.validate.notEmpty( "Price cannot be empty" )
}
]
},
{
id: 'tab-adv',
label: 'Advanced Settings',
elements: [
{
type: 'text',
id: 'id',
label: 'Id'
}
]
}
],
onOk: function() {
var dialog = this;
var abbr = editor.document.createElement( 'abbr' );
abbr.setAttribute( 'title', dialog.getValueOf( 'tab-basic', 'title' ) );
abbr.setText( dialog.getValueOf( 'tab-basic', 'abbr' ) );
var id = dialog.getValueOf( 'tab-adv', 'id' );
if ( id )
abbr.setAttribute( 'id', id );
editor.insertElement( abbr );
}
};
});
ただし、エディターをもう一度クリックして項目を追加すると、タグが入れ子になりました。これは望ましくありません。別のタグ内にタグがないように制限するにはどうすればよいですか? ありがとう