editableui.js 1.2 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. /**
  8. * The editable UI controller class. It glues the engine editable
  9. * {@link engine.view.RootEditableElement} with the UI.
  10. *
  11. * // An instance of EditableUI.
  12. * new EditableUI( editor, editable, new EditableUIView() );
  13. *
  14. * See {@link ui.editableUI.EditableUIView}.
  15. *
  16. * @memberOf ui.editableUI
  17. * @extends ui.Controller
  18. */
  19. export default class EditableUI extends Controller {
  20. /**
  21. * Creates an instance of {@link ui.editableUI.EditableUI} class.
  22. *
  23. * @param {engine.view.RootEditableElement} editable The editable element (in the engine).
  24. * @param {ui.View} [view] An instance of EditableUIView.
  25. * @param {ckeditor5.Editor} [editor] The editor instance.
  26. */
  27. constructor( editable, view, editor ) {
  28. super( editable, view );
  29. /**
  30. * The editor instance.
  31. *
  32. * @readonly
  33. * @member {ckeditor5.Editor} ui.editableUI.EditableUI#editor
  34. */
  35. this.editor = editor;
  36. view.model.bind( 'isReadOnly', 'isFocused' ).to( editable );
  37. view.model.set( 'name', editable.rootName );
  38. }
  39. }