The problem is not that difficult, but still you need to write a couple lines of code. The following logic inside pluginsLoaded can (should) be defined in the init completely new plugin (which could be called "groupped-justify"). Otherwise, if executed too late, for example. after creating the toolbar, all the code does not make sense.
Refer to the official plugin development guide for more.
Also see jsFiddle with a working example.
CKEDITOR.replace( 'editor', { plugins: 'wysiwygarea,sourcearea,basicstyles,toolbar,menu,menubutton,justify', on: { pluginsLoaded: function() { var editor = this, items = {}; editor.addMenuGroup( 'some_group' ); items.justifyleft = { label: editor.lang.justify.left, group: 'some_group', command: 'justifyleft', order: 1 }; items.justifyright = { label: editor.lang.justify.right, group: 'some_group', command: 'justifyright', order: 2 }; editor.addMenuItems( items ); editor.ui.add( 'Groupped', CKEDITOR.UI_MENUBUTTON, { label: 'Groupped justify', // Disable in source mode. modes: { wysiwyg: 1 }, icon: 'JustifyLeft', onMenu: function() { var active = {}; // Make all items active. for ( var p in items ) active[ p ] = CKEDITOR.TRISTATE_OFF; return active; } } ); } } } );
source share