Hello.
Our site is type of article directory and the content is publicly editable. we want to integrate ckeditor toolbar which will also serve as a site navigation!
Things I want to achieve
- there will be a single toolbar for all editing instances and will be always visible as a site navigation bar with only two toolbar buttons : 1- site logo and 2- Edit this article. When the user clicks 'edit this article', all editing tools as configured in the config.toolbar options should be visible in the same toolbar. Apart from default plugins I have written a custom plugin for saving and cenceling opertaion when any article is in edit state, When user clicks cancel button, the toolbar should take the first position as I stated with only two buttons ie. site logo and edit this article .
My approach - I created a plugin for adding site logo to the toolbar as follows. I am newbie to ckeditor I have no idea if this approach is correct to add site logo!
// plugin.js CKEDITOR.plugins.add( 'MyPlugin', { init: function( editor ) { editor.addCommand( 'logo', { exec : function( editor ) { } }); editor.addCommand( 'save', { exec : function( editor ) { } }); editor.addCommand( 'cencel', { exec : function( editor ) { } }); // Buttons editor.ui.addButton( 'Logo', { label: 'Site Name', command: 'logo', icon: this.path + 'img/logo_18_8_13.png' } ); editor.ui.addButton( 'Save', { label: 'Save', command: 'save' }); editor.ui.addButton( 'Cancel', { label: 'Cancel', command: 'cancel' }); } });
// An heres my configuration config.js KEDITOR.editorConfig = function( config ) { config.extraPlugins += (config.extraPlugins.length == 0 ? '' : ',') + 'MyPlugin'; config.toolbar = [ [ 'Logo' ], [ 'Styles','Format','FontSize' ], [ 'Undo', 'Redo' ], [ 'Link','Unlink' ], [ 'NumberedList','BulletedList' ], ['Image', 'Smiley', 'Table'], [ 'Bold', 'Italic' ], [ 'Save', '-', 'Cancel' ] ]; };
I am looking for suggestions of ckeditor experienced guys around here!
- How can I make ckeditor toolbar always visible on the top of the page without editing tools if article is not in the edit state but site logo and edit link should be visible.
- If the user clicks edit this article , editing tools should be visible.
- when user clicks cancel when the article is in edit state, editing tools should hide and site logo | edit this article button should get visible
I know my appraoch is not the correct one. I will be grateful if anyone can lead me to the right way!
Thank you