浏览代码

Internal: RootEditableElement is created together with the editor structure.

Oskar Wróbel 8 年之前
父节点
当前提交
e0827ad4f1

+ 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

+ 5 - 0
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,10 @@ describe( 'InlineEditorUI', () => {
 			expect( ui.focusTracker ).to.be.instanceOf( FocusTracker );
 		} );
 
+		it( 'creates root editable element', () => {
+			expect( editor.editing.view.getRoot() ).to.be.instanceOf( RootEditableElement );
+		} );
+
 		describe( 'panel', () => {
 			it( 'binds view.panel#isVisible to editor.ui#focusTracker', () => {
 				ui.focusTracker.isFocused = false;