Procházet zdrojové kódy

Fixed: Error thrown in ClassicEditorUIView if there's no toolbar config defined.

Aleksander Nowodziński před 9 roky
rodič
revize
3b844497a3

+ 6 - 2
packages/ckeditor5-editor-classic/src/classiceditoruiview.js

@@ -46,8 +46,12 @@ export default class ClassicEditorUIView extends BoxedEditorUIView {
 	init() {
 		this.toolbar.limiterElement = this.element;
 
-		for ( let name of this.editor.config.get( 'toolbar' ) ) {
-			this.toolbar.items.add( this.featureComponents.create( name ) );
+		const toolbarConfig = this.editor.config.get( 'toolbar' );
+
+		if ( toolbarConfig ) {
+			for ( let name of toolbarConfig ) {
+				this.toolbar.items.add( this.featureComponents.create( name ) );
+			}
 		}
 
 		return super.init();

+ 2 - 2
packages/ckeditor5-editor-classic/tests/classic.js

@@ -71,11 +71,11 @@ describe( 'ClassicEditor', () => {
 		} );
 
 		it( 'inserts editor UI next to editor element', () => {
-			expect( editor.ui.view.element.previousSibling ).to.equal( editorElement );
+			expect( editor.ui.element.previousSibling ).to.equal( editorElement );
 		} );
 
 		it( 'attaches editable UI as view\'s DOM root', () => {
-			expect( editor.editing.view.getDomRoot() ).to.equal( editor.ui.editable.view.element );
+			expect( editor.editing.view.getDomRoot() ).to.equal( editor.ui.editable.element );
 		} );
 
 		it( 'loads data from the editor element', () => {