8
0
Quellcode durchsuchen

Merge pull request #28 from ckeditor/t/ckeditor/647

Internal: The `RootEditableElement` should be created together with the editor structure. Closes https://github.com/ckeditor/ckeditor5/issues/647.
Aleksander Nowodzinski vor 8 Jahren
Ursprung
Commit
4fc071e737

+ 5 - 1
packages/ckeditor5-editor-inline/src/inlineeditorui.js

@@ -52,6 +52,10 @@ export default class InlineEditorUI {
 		 * @private
 		 */
 		this._toolbarConfig = normalizeToolbarConfig( editor.config.get( 'toolbar' ) );
+
+		// RootEditableElement should be created together with the editor structure.
+		// See https://github.com/ckeditor/ckeditor5/issues/647.
+		editor.editing.createRoot( view.editableElement );
 	}
 
 	/**
@@ -83,7 +87,7 @@ export default class InlineEditorUI {
 		} );
 
 		// Setup the editable.
-		const editingRoot = editor.editing.createRoot( view.editableElement );
+		const editingRoot = editor.editing.view.getRoot();
 		view.editable.bind( 'isReadOnly' ).to( editingRoot );
 
 		// Bind to focusTracker instead of editor.editing.view because otherwise

+ 11 - 6
packages/ckeditor5-editor-inline/tests/inlineeditorui.js

@@ -7,6 +7,7 @@
 
 import ComponentFactory from '@ckeditor/ckeditor5-ui/src/componentfactory';
 import View from '@ckeditor/ckeditor5-ui/src/view';
+import RootEditableElement from '@ckeditor/ckeditor5-engine/src/view/rooteditableelement';
 
 import InlineEditorUI from '../src/inlineeditorui';
 import InlineEditorUIView from '../src/inlineeditoruiview';
@@ -57,6 +58,16 @@ describe( 'InlineEditorUI', () => {
 			expect( ui.focusTracker ).to.be.instanceOf( FocusTracker );
 		} );
 
+		it( 'creates root editable element', () => {
+			expect( editor.editing.view.getRoot() ).to.be.instanceOf( RootEditableElement );
+		} );
+	} );
+
+	describe( 'init()', () => {
+		it( 'renders the #view', () => {
+			expect( view.isRendered ).to.be.true;
+		} );
+
 		describe( 'panel', () => {
 			it( 'binds view.panel#isVisible to editor.ui#focusTracker', () => {
 				ui.focusTracker.isFocused = false;
@@ -147,12 +158,6 @@ describe( 'InlineEditorUI', () => {
 				);
 			} );
 		} );
-	} );
-
-	describe( 'init()', () => {
-		it( 'renders the #view', () => {
-			expect( view.isRendered ).to.be.true;
-		} );
 
 		describe( 'view.toolbar#items', () => {
 			it( 'are filled with the config.toolbar (specified as an Array)', () => {