8
0

floatingtoolbarview.js 787 B

123456789101112131415161718192021222324252627
  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 ToolbarView from '/ckeditor5/ui/toolbar/toolbarview.js';
  7. export default class FloatingToolbarView extends ToolbarView {
  8. constructor( model, locale ) {
  9. super( model, locale );
  10. const bind = this.attributeBinder;
  11. this.template.attributes.class.push(
  12. bind.to( 'isVisible', value => value ? 'ck-visible' : 'ck-hidden' )
  13. );
  14. // This has a high risk of breaking if someone defines "on" in the parent template.
  15. // See https://github.com/ckeditor/ckeditor5-core/issues/219
  16. this.template.on = {
  17. // Added just for fun, but needed to keep the focus in the editable.
  18. mousedown: ( evt ) => evt.preventDefault()
  19. };
  20. }
  21. }