For anyone coming here wondering how to make use of the Array.from(editor.ui.componentFactory.names())
solution (as described in the other answers) in Angular (e.g. Angular 8), here is a description. If you try to do it in ngOnInit
or ngAfterViewInit
, it is too early and you will get something like Cannot read property 'ui' of null
. You need to listen for the ready
event from the ckeditor and query the names at that point as follows.
In your component template code, give the editor an id and listen for the ready event:
<ckeditor
#editor
[editor]="Editor"
[config]="config"
(ready)="onEditorReady($event)">
</ckeditor>
Then in your component typescript code, add a @ViewChild
annotation and implement onEditorReady
as follows:
@ViewChild('editor', {static: false})
editorComponent: CKEditorComponent;
onEditorReady(event: any): void {
const toolbarItems = Array.from(this.editorComponent.editorInstance.ui.componentFactory.names());
console.log('Available toolbar items: ' + toolbarItems.join(', '));
}
You will then see something like this in the console:
Available toolbar items: undo, redo, bold, italic, blockQuote,
ckfinder, imageTextAlternative, imageUpload, heading, imageStyle:full,
imageStyle:side, indent, outdent, link, numberedList, bulletedList,
mediaEmbed, insertTable, tableColumn, tableRow, mergeTableCells