8
0
Krzysztof Krztoń vor 6 Jahren
Ursprung
Commit
4d4e3ef324

+ 2 - 3
packages/ckeditor5-editor-classic/src/classiceditor.js

@@ -13,7 +13,6 @@ import ElementApiMixin from '@ckeditor/ckeditor5-core/src/editor/utils/elementap
 import attachToForm from '@ckeditor/ckeditor5-core/src/editor/utils/attachtoform';
 import HtmlDataProcessor from '@ckeditor/ckeditor5-engine/src/dataprocessor/htmldataprocessor';
 import ClassicEditorUI from './classiceditorui';
-import ClassicEditorUIView from './classiceditoruiview';
 import getDataFromElement from '@ckeditor/ckeditor5-utils/src/dom/getdatafromelement';
 import mix from '@ckeditor/ckeditor5-utils/src/mix';
 import log from '@ckeditor/ckeditor5-utils/src/log';
@@ -70,7 +69,7 @@ export default class ClassicEditor extends Editor {
 
 		this.model.document.createRoot();
 
-		this.ui = new ClassicEditorUI( this, new ClassicEditorUIView( this.locale ) );
+		this.ui = new ClassicEditorUI( this );
 
 		attachToForm( this );
 	}
@@ -182,7 +181,7 @@ export default class ClassicEditor extends Editor {
 			resolve(
 				editor.initPlugins()
 					.then( () => editor.ui.init( isElement( sourceElementOrData ) ? sourceElementOrData : null ) )
-					.then( () => editor.editing.view.attachDomRoot( editor.ui.view.editable.element ) )
+					.then( () => editor.editing.view.attachDomRoot( editor.ui.getEditableElement() ) )
 					.then( () => {
 						const initialData = isElement( sourceElementOrData ) ?
 							getDataFromElement( sourceElementOrData ) :

+ 5 - 4
packages/ckeditor5-editor-classic/src/classiceditorui.js

@@ -8,6 +8,7 @@
  */
 
 import EditorUI from '@ckeditor/ckeditor5-core/src/editor/editorui';
+import ClassicEditorUIView from './classiceditoruiview';
 import enableToolbarKeyboardFocus from '@ckeditor/ckeditor5-ui/src/toolbar/enabletoolbarkeyboardfocus';
 import normalizeToolbarConfig from '@ckeditor/ckeditor5-ui/src/toolbar/normalizetoolbarconfig';
 import ElementReplacer from '@ckeditor/ckeditor5-utils/src/elementreplacer';
@@ -24,7 +25,7 @@ export default class ClassicEditorUI extends EditorUI {
 	 * @param {module:core/editor/editor~Editor} editor The editor instance.
 	 * @param {module:ui/editorui/editoruiview~EditorUIView} view The view of the UI.
 	 */
-	constructor( editor, view ) {
+	constructor( editor ) {
 		super( editor );
 
 		/**
@@ -33,7 +34,7 @@ export default class ClassicEditorUI extends EditorUI {
 		 * @private
 		 * @member {module:ui/editorui/editoruiview~EditorUIView} #_view
 		 */
-		this._view = view;
+		this._view = new ClassicEditorUIView( editor.locale );
 
 		/**
 		 * A normalized `config.toolbar` object.
@@ -94,9 +95,9 @@ export default class ClassicEditorUI extends EditorUI {
 		view.editable.bind( 'isFocused' ).to( editor.editing.view.document );
 		view.editable.name = editingRoot.rootName;
 
-		this._editableElements.push( view.editable );
+		this._editableElements.set( view.editable.name, view.editable.element );
 
-		this.focusTracker.add( view.editable.editableElement );
+		this.focusTracker.add( view.editable.element );
 
 		view.toolbar.fillFromConfig( this._toolbarConfig.items, this.componentFactory );
 

+ 0 - 18
packages/ckeditor5-editor-classic/src/classiceditoruiview.js

@@ -12,8 +12,6 @@ import InlineEditableUIView from '@ckeditor/ckeditor5-ui/src/editableui/inline/i
 import StickyPanelView from '@ckeditor/ckeditor5-ui/src/panel/sticky/stickypanelview';
 import ToolbarView from '@ckeditor/ckeditor5-ui/src/toolbar/toolbarview';
 
-import log from '@ckeditor/ckeditor5-utils/src/log';
-
 import '../theme/classiceditor.css';
 
 /**
@@ -69,20 +67,4 @@ export default class ClassicEditorUIView extends BoxedEditorUIView {
 		this.top.add( this.stickyPanel );
 		this.main.add( this.editable );
 	}
-
-	/**
-	 * **Deprecated** since `v12.0.0`. The {@link module:ui/editableui/editableuiview~EditableUIView#editableElement
-	 * `EditableUIView editableElement`} could be used instead.
-	 *
-	 * The element which is the main editable element (usually the one with `contentEditable="true"`).
-	 *
-	 * @deprecated v12.0.0 The {@link module:ui/editableui/editableuiview~EditableUIView#editableElement
-	 * `EditableUIView editableElement`} could be used instead.
-	 * @readonly
-	 * @member {HTMLElement} #editableElement
-	 */
-	get editableElement() {
-		log.warn( 'deprecated-ui-view-editableElement: The ClassicEditorUIView#editableElement property is deprecated.' );
-		return this.editable.editableElement;
-	}
 }

+ 0 - 18
packages/ckeditor5-editor-classic/tests/classiceditoruiview.js

@@ -3,8 +3,6 @@
  * For licensing, see LICENSE.md.
  */
 
-/* globals document */
-
 import ClassicEditorUIView from '../src/classiceditoruiview';
 import StickyPanelView from '@ckeditor/ckeditor5-ui/src/panel/sticky/stickypanelview';
 import ToolbarView from '@ckeditor/ckeditor5-ui/src/toolbar/toolbarview';
@@ -12,7 +10,6 @@ import InlineEditableUIView from '@ckeditor/ckeditor5-ui/src/editableui/inline/i
 import Locale from '@ckeditor/ckeditor5-utils/src/locale';
 
 import testUtils from '@ckeditor/ckeditor5-core/tests/_utils/utils';
-import log from '@ckeditor/ckeditor5-utils/src/log';
 
 describe( 'ClassicEditorUIView', () => {
 	let locale, view;
@@ -72,19 +69,4 @@ describe( 'ClassicEditorUIView', () => {
 			} );
 		} );
 	} );
-
-	describe( 'editableElement', () => {
-		it( 'returns editable\'s view element', () => {
-			testUtils.sinon.stub( log, 'warn' ).callsFake( () => {} );
-
-			document.body.appendChild( view.element );
-
-			view.stickyPanel.limiterElement = view.element;
-
-			expect( view.editableElement.getAttribute( 'contentEditable' ) ).to.equal( 'true' );
-
-			view.element.remove();
-			view.destroy();
-		} );
-	} );
 } );