| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485 |
- /**
- * @license Copyright (c) 2003-2018, CKSource - Frederico Knabben. All rights reserved.
- * For licensing, see LICENSE.md.
- */
- /**
- * @module ui/tooltip/tooltipview
- */
- import View from '../view';
- import '../../theme/components/tooltip/tooltip.css';
- /**
- * The tooltip view class.
- *
- * @extends module:ui/view~View
- */
- export default class TooltipView extends View {
- /**
- * @inheritDoc
- */
- constructor( locale ) {
- super( locale );
- /**
- * The text of the tooltip visible to the user.
- *
- * @observable
- * @member {String} #text
- */
- this.set( 'text', '' );
- /**
- * The position of the tooltip (south or north).
- *
- * +-----------+
- * | north |
- * +-----------+
- * V
- * [element]
- *
- * [element]
- * ^
- * +-----------+
- * | south |
- * +-----------+
- *
- * @observable
- * @default 's'
- * @member {'s'|'n'} #position
- */
- this.set( 'position', 's' );
- const bind = this.bindTemplate;
- this.setTemplate( {
- tag: 'span',
- attributes: {
- class: [
- 'ck-tooltip',
- bind.to( 'position', position => 'ck-tooltip_' + position ),
- bind.if( 'text', 'ck-hidden', value => !value.trim() )
- ]
- },
- children: [
- {
- tag: 'span',
- attributes: {
- class: [
- 'ck-tooltip__text'
- ]
- },
- children: [
- {
- text: bind.to( 'text' ),
- }
- ]
- }
- ]
- } );
- }
- }
|