editableui.js 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. /**
  2. * @license Copyright (c) 2003-2016, CKSource - Frederico Knabben. All rights reserved.
  3. * For licensing, see LICENSE.md.
  4. */
  5. 'use strict';
  6. import Controller from '../controller.js';
  7. import Model from '../model.js';
  8. /**
  9. * @memberOf ui.editableUI
  10. * @extends ui.Controller
  11. */
  12. export default class EditableUI extends Controller {
  13. /**
  14. * Creates a new instance of the Editable class.
  15. *
  16. * @param {ckeditor5.Editor} editor The editor instance.
  17. * @param {engine.view.RootEditableElement} editableModel The model for the editable.
  18. */
  19. constructor( editor, editableModel ) {
  20. super();
  21. /**
  22. * The editor instance.
  23. *
  24. * @readonly
  25. * @member {ckeditor5.Editor} ui.editableUI.EditableUI#editor
  26. */
  27. this.editor = editor;
  28. /**
  29. * The model for the view.
  30. *
  31. * @readonly
  32. * @member {ui.Model} ui.editableUI.EditableUI#viewModel
  33. */
  34. this.viewModel = new Model();
  35. this.viewModel.bind( 'isReadOnly', 'isFocused' ).to( editableModel );
  36. this.viewModel.set( 'name', editableModel.rootName );
  37. }
  38. }