8
0
فهرست منبع

Added InlineEditableView.

Aleksander Nowodzinski 9 سال پیش
والد
کامیت
173dedf4f4
1فایلهای تغییر یافته به همراه39 افزوده شده و 0 حذف شده
  1. 39 0
      packages/ckeditor5-ui/src/editableui/inline/inlineeditableuiview.js

+ 39 - 0
packages/ckeditor5-ui/src/editableui/inline/inlineeditableuiview.js

@@ -0,0 +1,39 @@
+/**
+ * @license Copyright (c) 2003-2016, CKSource - Frederico Knabben. All rights reserved.
+ * For licensing, see LICENSE.md.
+ */
+
+'use strict';
+
+import EditableUIView from '/ckeditor5/ui/editableui/editableuiview.js';
+
+export default class InlineEditableView extends EditableUIView {
+	constructor( model, locale, editableElement ) {
+		super( model, locale );
+
+		if ( editableElement ) {
+			this.element = editableElement;
+		} else {
+			const bind = this.attributeBinder;
+
+			this.template = {
+				tag: 'div',
+				attributes: {
+					contentEditable: bind.to( 'isEditable' )
+				}
+			};
+		}
+	}
+
+	init() {
+		this.setEditableElement( this.element );
+
+		super.init();
+	}
+
+	destroy() {
+		super.destroy();
+
+		this.editableElement.contentEditable = false;
+	}
+}