ckeditor/ckeditor5-list

View on GitHub
src/listui.js

Summary

Maintainability
A
0 mins
Test Coverage
/**
 * @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */

/**
 * @module list/listui
 */

import { createUIComponent } from './utils';

import numberedListIcon from '../theme/icons/numberedlist.svg';
import bulletedListIcon from '../theme/icons/bulletedlist.svg';

import Plugin from '@ckeditor/ckeditor5-core/src/plugin';

/**
 * The list UI feature. It introduces the `'numberedList'` and `'bulletedList'` buttons that
 * allow to convert paragraphs to and from list items and indent or outdent them.
 *
 * @extends module:core/plugin~Plugin
 */
export default class ListUI extends Plugin {
    /**
     * @inheritDoc
     */
    init() {
        const t = this.editor.t;

        // Create two buttons and link them with numberedList and bulletedList commands.
        createUIComponent( this.editor, 'numberedList', t( 'Numbered List' ), numberedListIcon );
        createUIComponent( this.editor, 'bulletedList', t( 'Bulleted List' ), bulletedListIcon );
    }
}