8
0
Pārlūkot izejas kodu

Used editableElement after uiReady.

Oskar Wróbel 7 gadi atpakaļ
vecāks
revīzija
629fbf479a

+ 1 - 1
packages/ckeditor5-ui/src/toolbar/balloon/balloontoolbar.js

@@ -59,8 +59,8 @@ export default class BalloonToolbar extends Plugin {
 		 * @type {module:utils:focustracker~FocusTracker}
 		 */
 		this.focusTracker = new FocusTracker();
-		this.focusTracker.add( editor.ui.view.editableElement );
 		this.focusTracker.add( this.toolbarView.element );
+		editor.once( 'uiReady', () => this.focusTracker.add( editor.ui.view.editableElement ) );
 
 		/**
 		 * The contextual balloon plugin instance.

+ 12 - 0
packages/ckeditor5-ui/tests/toolbar/balloon/balloontoolbar.js

@@ -4,6 +4,7 @@
  */
 
 import ClassicTestEditor from '@ckeditor/ckeditor5-core/tests/_utils/classictesteditor';
+import ClassicEditor from '@ckeditor/ckeditor5-editor-classic/src/classiceditor';
 import BalloonToolbar from '../../../src/toolbar/balloon/balloontoolbar';
 import ContextualBalloon from '../../../src/panel/balloon/contextualballoon';
 import BalloonPanelView from '../../../src/panel/balloon/balloonpanelview';
@@ -138,6 +139,17 @@ describe( 'BalloonToolbar', () => {
 		}, 100 );
 	} );
 
+	// See https://github.com/ckeditor/ckeditor5-ui/issues/424.
+	// This test should be removed after fixing this https://github.com/ckeditor/ckeditor5-core/issues/137.
+	it( 'should work with the ClassicEditor', () => {
+		const editor = new ClassicEditor( editorElement, {
+			plugins: [ BalloonToolbar ]
+		} );
+
+		// Test will fail because of rejected promise.
+		return editor.initPlugins();
+	} );
+
 	describe( 'pluginName', () => {
 		it( 'should return plugin by its name', () => {
 			expect( editor.plugins.get( 'BalloonToolbar' ) ).to.equal( balloonToolbar );