。 editor.id ckeditor、toolbar、edit area、footerの3つの部分に使用 たとえば、editor.idの 'cke_12'値がツールバーのdiv idの場合は 'cke_12_top'です。 これはiframeモード用です。
CKEDITOR.replace(divId, {toolbar: [
{ name: 'clipboard', items: [ 'Cut', 'Copy', 'Paste', 'PasteText', 'PasteFromWord', '-', 'Undo', 'Redo']},
{name: 'editing', items: ['Format', 'Font', 'FontSize', 'TextColor', 'BGColor' , 'Bold', 'Italic', 'Underline', 'Strike', '-', 'RemoveFormat'] }
]});
//use for loop because i have multi ckeditor in page.
for (instance in CKEDITOR.instances) {
var editor = CKEDITOR.instances[instance];
if (editor) {
// Call showToolBarDiv() when editor get the focus
editor.on('focus', function (event) {
showToolBarDiv(event);
});
// Call hideToolBarDiv() when editor loses the focus
editor.on('blur', function (event) {
hideToolBarDiv(event);
});
//Whenever CKEditor get focus. We will show the toolbar span.
function showToolBarDiv(event) {
//'event.editor.id' returns the id of the spans used in ckeditr.
$('#'+event.editor.id+'_top').show();
}
function hideToolBarDiv(event) {
//'event.editor.id' returns the id of the spans used in ckeditr.
$('#'+event.editor.id+'_top').hide()
}
}
}
ありがとうございます。 – Mike
jQueryセレクタが私のために機能しませんでした。 '$(evt.editor.element。$)。find( 'span.cke_top')。show();'を使用しなければなりませんでした。 'find( 'span.cke_bottom')'を使ってフッターを取得することもできます。 – Nathan
また、 'contentDom'イベントにサブスクライブし、そこから' hideToolBarDiv'を呼び出すことで、ツールバーを非表示にしてCKEditorの読み込みを行うこともできます。 – Nathan