| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950 |
- /**
- * @license Copyright (c) 2003-2018, CKSource - Frederico Knabben. All rights reserved.
- * For licensing, see LICENSE.md.
- */
- /**
- * @module block-quote/blockquoteui
- */
- import Plugin from '@ckeditor/ckeditor5-core/src/plugin';
- import ButtonView from '@ckeditor/ckeditor5-ui/src/button/buttonview';
- import quoteIcon from '@ckeditor/ckeditor5-core/theme/icons/quote.svg';
- import '../theme/blockquote.css';
- /**
- * The block quote UI plugin.
- *
- * It introduces the `'blockQuote'` button.
- *
- * @extends module:core/plugin~Plugin
- */
- export default class BlockQuoteUI extends Plugin {
- /**
- * @inheritDoc
- */
- init() {
- const editor = this.editor;
- const t = editor.t;
- editor.ui.componentFactory.add( 'blockQuote', locale => {
- const command = editor.commands.get( 'blockQuote' );
- const buttonView = new ButtonView( locale );
- buttonView.set( {
- label: t( 'Block quote' ),
- icon: quoteIcon,
- tooltip: true
- } );
- // Bind button model to command.
- buttonView.bind( 'isOn', 'isEnabled' ).to( command, 'value', 'isEnabled' );
- // Execute command.
- this.listenTo( buttonView, 'execute', () => editor.execute( 'blockQuote' ) );
- return buttonView;
- } );
- }
- }
|