88 */
99
1010import Plugin from '@ckeditor/ckeditor5-core/src/plugin' ;
11- import ItalicEngine from './italicengine' ;
12- import ButtonView from '@ckeditor/ckeditor5-ui/src/button/buttonview' ;
13- import italicIcon from '../theme/icons/italic.svg' ;
11+ import ItalicEditing from './italic/italicediting' ;
12+ import ItalicUI from './italic/italicui' ;
1413
1514/**
16- * The italic feature. It introduces the Italic button and the <kbd>Ctrl+I</kbd> keystroke.
15+ * The italic feature.
1716 *
18- * It uses the {@link module:basic-styles/italicengine~ItalicEngine italic engine feature}.
17+ * It loads the {@link module:basic-styles/italic/italicediting~ItalicEditing} and
18+ * {@link module:basic-styles/italic/italicui~ItalicUI} plugins.
1919 *
2020 * @extends module:core/plugin~Plugin
2121 */
@@ -24,7 +24,7 @@ export default class Italic extends Plugin {
2424 * @inheritDoc
2525 */
2626 static get requires ( ) {
27- return [ ItalicEngine ] ;
27+ return [ ItalicEditing , ItalicUI ] ;
2828 }
2929
3030 /**
@@ -33,36 +33,4 @@ export default class Italic extends Plugin {
3333 static get pluginName ( ) {
3434 return 'Italic' ;
3535 }
36-
37- /**
38- * @inheritDoc
39- */
40- init ( ) {
41- const editor = this . editor ;
42- const t = editor . t ;
43- const command = editor . commands . get ( 'italic' ) ;
44- const keystroke = 'CTRL+I' ;
45-
46- // Add bold button to feature components.
47- editor . ui . componentFactory . add ( 'italic' , locale => {
48- const view = new ButtonView ( locale ) ;
49-
50- view . set ( {
51- label : t ( 'Italic' ) ,
52- icon : italicIcon ,
53- keystroke,
54- tooltip : true
55- } ) ;
56-
57- view . bind ( 'isOn' , 'isEnabled' ) . to ( command , 'value' , 'isEnabled' ) ;
58-
59- // Execute command.
60- this . listenTo ( view , 'execute' , ( ) => editor . execute ( 'italic' ) ) ;
61-
62- return view ;
63- } ) ;
64-
65- // Set the Ctrl+I keystroke.
66- editor . keystrokes . set ( keystroke , 'italic' ) ;
67- }
6836}
0 commit comments