-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
Expand file tree
/
Copy pathsubscriptui.ts
More file actions
53 lines (46 loc) · 1.32 KB
/
Copy pathsubscriptui.ts
File metadata and controls
53 lines (46 loc) · 1.32 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
/**
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
*/
/**
* @module basic-styles/subscript/subscriptui
*/
import { Plugin } from '@ckeditor/ckeditor5-core';
import { IconSubscript } from '@ckeditor/ckeditor5-icons';
import { ButtonView, MenuBarMenuListItemButtonView } from '@ckeditor/ckeditor5-ui';
import { getButtonCreator } from '../utils.js';
import { SUBSCRIPT } from '../constants.js';
/**
* The subscript UI feature. It introduces the Subscript button.
*/
export class SubscriptUI extends Plugin {
/**
* @inheritDoc
*/
public static get pluginName() {
return 'SubscriptUI' as const;
}
/**
* @inheritDoc
*/
public static override get isOfficialPlugin(): true {
return true;
}
/**
* @inheritDoc
*/
public init(): void {
const editor = this.editor;
const t = editor.locale.t;
const createButton = getButtonCreator( {
editor,
commandName: SUBSCRIPT,
plugin: this,
icon: IconSubscript,
label: t( 'Subscript' )
} );
// Add subscript button to feature components.
editor.ui.componentFactory.add( SUBSCRIPT, () => createButton( ButtonView ) );
editor.ui.componentFactory.add( 'menuBar:' + SUBSCRIPT, () => createButton( MenuBarMenuListItemButtonView ) );
}
}