UNPKG

1.12 kBJavaScriptView Raw
1/**
2 * @license Copyright (c) 2003-2022, 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/**
7 * @module list/list/listui
8 */
9
10import { createUIComponent } from './utils';
11
12import numberedListIcon from '../../theme/icons/numberedlist.svg';
13import bulletedListIcon from '../../theme/icons/bulletedlist.svg';
14
15import { Plugin } from 'ckeditor5/src/core';
16
17/**
18 * The list UI feature. It introduces the `'numberedList'` and `'bulletedList'` buttons that
19 * allow to convert paragraphs to and from list items and indent or outdent them.
20 *
21 * @extends module:core/plugin~Plugin
22 */
23export default class ListUI extends Plugin {
24 /**
25 * @inheritDoc
26 */
27 static get pluginName() {
28 return 'ListUI';
29 }
30
31 /**
32 * @inheritDoc
33 */
34 init() {
35 const t = this.editor.t;
36
37 // Create two buttons and link them with numberedList and bulletedList commands.
38 createUIComponent( this.editor, 'numberedList', t( 'Numbered List' ), numberedListIcon );
39 createUIComponent( this.editor, 'bulletedList', t( 'Bulleted List' ), bulletedListIcon );
40 }
41}