wo Sie Instanz ckedito Verwendung unter Code erstellen. editor.id verwenden für drei Teile von ckeditor, Symbolleiste, Edit-Bereich, Fußzeile zum Beispiel, wenn editor.id 'cke_12' Wert für Toolbar Div-ID ist 'cke_12_top'. Beachten Sie, dass dies für den iframe-Modus gilt.
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()
}
}
}
das funktioniert, danke. – Mike
Die jQuery-Selektoren funktionierten nicht für mich. Ich musste '$ (evt.editor.element. $) Verwenden. Find ('span.cke_top'). Show();'. Sie können die Fußzeile auch mit 'find ('span.cke_bottom')' erhalten. – Nathan
Sie können den CKEditor auch laden, wenn die Symbolleiste ausgeblendet ist, indem Sie das Ereignis "contentDom" abonnieren und von dort aus "hideToolBarDiv" aufrufen. – Nathan