问题
I have a standard installation (like samples):
<meta charset="utf-8"></meta>
<script src="../ckeditor.js"></script>
With HTML content with many <div contenteditable="true"> blocks. I need to configure each editor by local or an external configTypeX.js file,
<script>
CKEDITOR.on( 'instanceCreated', function( event ) {
var editor = event.editor, element = editor.element;
if ( element.is( 'h1', 'h2', 'h3' ) ) {
editor.on( 'configLoaded', function() {
editor.config.toolbar = [
[ 'Source', '-', 'Bold', 'Italic' ]
]; // BUG: about "Source"?? NOT AT INTERFACE!
});
} else {
// WHERE PUT THIS ITEM?
customConfig: 'configType2.js';
}
});
</script>
So, my problem is
- How to do a
customConfigin this context? - Where the "best complete documentation", about config menus (
editor.config.toolbar) without online configuration-tool, where I can understand how to put and remove menu itens with correct names? Here nothing about how to fix the bug of 'Source' in a full installation.
I do,
git clone git://github.com/ckeditor/ckeditor-releases.git
cd ckeditor-releases
cp samples/inlineall.html samples/myinline.html
and edit samples/myinline.html with the code above.
回答1:
For inline editors the standard
Sourcebutton is hidden, because it is not possible to have different modes other thanwysiwyg. Therefore for those editors new plugin was created - sourcedialog, but it is not included in any of builds by default. You can build editor with this plugin using online CKBuilder or by using one of presets withallparameter. For example:./build.sh full all. Remember also to loadsourcedialogplugin (usingconfig.extraPlugins = 'sourcedialog').If you want to freely configure inline editors, then you should take a look at inlinebycode sample. First you need to disable automatic editors initialization on editable elements and then call
CKEDITOR.inline()on elements you want to become editors:// We need to turn off the automatic editor creation first. CKEDITOR.disableAutoInline = true; CKEDITOR.inline( 'editable1', { customConfig: 'editableConfig.js' } ); CKEDITOR.inline( 'editable1', { toolbar: [ ... ] } );
来源:https://stackoverflow.com/questions/18429541/how-to-config-ckeditor-4-inline-editors