8
0
فهرست منبع

Added BoxedEditorUI(View) classes.

Aleksander Nowodzinski 9 سال پیش
والد
کامیت
cab29f5b66

+ 38 - 0
packages/ckeditor5-ui/src/boxededitorui/boxededitorui.js

@@ -0,0 +1,38 @@
+/**
+ * @license Copyright (c) 2003-2016, CKSource - Frederico Knabben. All rights reserved.
+ * For licensing, see LICENSE.md.
+ */
+
+'use strict';
+
+import EditorUI from '/ckeditor5/ui/editorui/editorui.js';
+import ControllerCollection from '/ckeditor5/ui/controllercollection.js';
+
+export default class BoxedEditorUI extends EditorUI {
+	constructor( editor ) {
+		super( editor );
+
+		this.collections.add( new ControllerCollection( 'top' ) );
+		this.collections.add( new ControllerCollection( 'editable' ) );
+
+		const config = editor.config;
+
+		/**
+		 * @property {Number} width
+		 */
+		this.set( 'width', config.get( 'ui.width' ) );
+
+		/**
+		 * @property {Number} height
+		 */
+		this.set( 'height', config.get( 'ui.height' ) );
+	}
+
+	/**
+	 * @readonly
+	 * @property {Model} viewModel
+	 */
+	get viewModel() {
+		return this;
+	}
+}

+ 40 - 0
packages/ckeditor5-ui/src/boxededitorui/boxededitoruiview.js

@@ -0,0 +1,40 @@
+/**
+ * @license Copyright (c) 2003-2016, CKSource - Frederico Knabben. All rights reserved.
+ * For licensing, see LICENSE.md.
+ */
+
+'use strict';
+
+import EditorUIView from '/ckeditor5/ui/editorui/editoruiview.js';
+
+export default class BoxedEditorUIView extends EditorUIView {
+	constructor( model, locale ) {
+		super( model, locale );
+
+		this.template = {
+			tag: 'div',
+
+			attributes: {
+				class: 'ck-reset ck-editor'
+			},
+
+			children: [
+				{
+					tag: 'div',
+					attributes: {
+						class: 'ck-editor-top ck-reset-all'
+					}
+				},
+				{
+					tag: 'div',
+					attributes: {
+						class: 'ck-editor-editable'
+					}
+				}
+			]
+		};
+
+		this.register( 'top', '.ck-editor-top' );
+		this.register( 'editable', '.ck-editor-editable' );
+	}
+}