UNPKG

1.98 kBTypeScriptView Raw
1/**
2 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
3 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4 */
5/**
6 * @module heading/headingbuttonsui
7 */
8import { Plugin } from 'ckeditor5/src/core.js';
9/**
10 * The `HeadingButtonsUI` plugin defines a set of UI buttons that can be used instead of the
11 * standard drop down component.
12 *
13 * This feature is not enabled by default by the {@link module:heading/heading~Heading} plugin and needs to be
14 * installed manually to the editor configuration.
15 *
16 * Plugin introduces button UI elements, which names are same as `model` property from {@link module:heading/headingconfig~HeadingOption}.
17 *
18 * ```ts
19 * ClassicEditor
20 * .create( {
21 * plugins: [ ..., Heading, Paragraph, HeadingButtonsUI, ParagraphButtonUI ]
22 * heading: {
23 * options: [
24 * { model: 'paragraph', title: 'Paragraph', class: 'ck-heading_paragraph' },
25 * { model: 'heading1', view: 'h2', title: 'Heading 1', class: 'ck-heading_heading1' },
26 * { model: 'heading2', view: 'h3', title: 'Heading 2', class: 'ck-heading_heading2' },
27 * { model: 'heading3', view: 'h4', title: 'Heading 3', class: 'ck-heading_heading3' }
28 * ]
29 * },
30 * toolbar: [ 'paragraph', 'heading1', 'heading2', 'heading3' ]
31 * } )
32 * .then( ... )
33 * .catch( ... );
34 * ```
35 *
36 * NOTE: The `'paragraph'` button is defined in by the {@link module:paragraph/paragraphbuttonui~ParagraphButtonUI} plugin
37 * which needs to be loaded manually as well.
38 *
39 * It is possible to use custom icons by providing `icon` config option in {@link module:heading/headingconfig~HeadingOption}.
40 * For the default configuration standard icons are used.
41 */
42export default class HeadingButtonsUI extends Plugin {
43 /**
44 * @inheritDoc
45 */
46 init(): void;
47 /**
48 * Creates single button view from provided configuration option.
49 */
50 private _createButton;
51}