Browse Source

Introduced new names based on a better convention. Merged Chrome with the UI into EditorUI. Pulled out view's creation to parent classes, so views can be easily altered.

Piotrek Koszuliński 10 năm trước cách đây
mục cha
commit
46e6423c71

+ 11 - 3
packages/ckeditor5-ui/src/editable/editable.js

@@ -11,17 +11,21 @@ import utils from '../utils.js';
 import ObservableMixin from '../observablemixin.js';
 
 /**
+ * @class core.editable.Editable
  * @extends core.ui.Controller
  * @mixins core.ObservableMixin
  */
 export default class Editable extends Controller {
 	/**
 	 * Creates a new instance of the Editable class.
+	 *
 	 * @constructor
 	 */
-	constructor() {
+	constructor( editor ) {
 		super();
 
+		this.editor = editor;
+
 		/**
 		 * Whether the editable is in read-write or read-only mode.
 		 *
@@ -38,16 +42,20 @@ export default class Editable extends Controller {
 		this.set( 'isFocused', false );
 
 		/**
-		 * The parent editable of this editable
+		 * The parent editable of this editable.
 		 *
 		 * @readonly
 		 * @property {Editable} parent
 		 */
 		this.parent = null;
+
+		/**
+		 * @private {Model} _viewModel
+		 */
 	}
 
 	/**
-	 * @protected
+	 * The model for the editable view.
 	 */
 	get viewModel() {
 		if ( this._viewModel ) {

+ 0 - 0
packages/ckeditor5-ui/src/editable/view.js → packages/ckeditor5-ui/src/editable/editableview.js


+ 32 - 0
packages/ckeditor5-ui/src/editorui.js

@@ -0,0 +1,32 @@
+/**
+ * @license Copyright (c) 2003-2016, CKSource - Frederico Knabben. All rights reserved.
+ * For licensing, see LICENSE.md.
+ */
+
+'use strict';
+
+import Controller from './ui/controller.js';
+import utils from './utils.js';
+import ObservableMixin from './observablemixin.js';
+
+/**
+ * Base class for the editor main view controllers.
+ *
+ * @class core.EditorUI
+ * @extends core.ui.Controller
+ * @mixins core.ObservableMixin
+ */
+
+export default class EditorUI extends Controller {
+	constructor( editor ) {
+		super();
+
+		/**
+		 * @readonly
+		 * @property {core.Editor}
+		 */
+		this.editor = editor;
+	}
+}
+
+utils.mix( EditorUI, ObservableMixin );

+ 0 - 33
packages/ckeditor5-ui/src/ui/ui.js

@@ -1,33 +0,0 @@
-/**
- * @license Copyright (c) 2003-2016, CKSource - Frederico Knabben. All rights reserved.
- * For licensing, see LICENSE.md.
- */
-
-'use strict';
-
-import ObservableMixin from '../observablemixin.js';
-import utils from '../utils.js';
-
-export default class Ui {
-	constructor( editor, chrome ) {
-		this.chrome = chrome;
-
-		this.set( 'width', editor.config.width );
-		this.set( 'height', editor.config.height );
-	}
-
-	init() {
-		return this.chrome.init();
-	}
-
-	destroy() {
-		const chrome = this.chrome;
-
-		this.stopListening();
-		this.chrome = null;
-
-		return chrome.destroy();
-	}
-}
-
-utils.mix( Ui, ObservableMixin );