@ckeditor/ckeditor5-indent 36.0.1 → 37.0.0-alpha.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/src/indentui.js CHANGED
@@ -2,16 +2,13 @@
2
2
  * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
3
3
  * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4
4
  */
5
-
6
5
  /**
7
6
  * @module indent/indentui
8
7
  */
9
8
  import { ButtonView } from 'ckeditor5/src/ui';
10
9
  import { Plugin } from 'ckeditor5/src/core';
11
-
12
10
  import indentIcon from '../theme/icons/indent.svg';
13
11
  import outdentIcon from '../theme/icons/outdent.svg';
14
-
15
12
  /**
16
13
  * The indent UI feature.
17
14
  *
@@ -19,61 +16,45 @@ import outdentIcon from '../theme/icons/outdent.svg';
19
16
  *
20
17
  * **Note**: In order for the commands to work, at least one of the compatible features is required. Read more in
21
18
  * the {@link module:indent/indent~Indent indent feature} API documentation.
22
- *
23
- * @extends module:core/plugin~Plugin
24
19
  */
25
20
  export default class IndentUI extends Plugin {
26
- /**
27
- * @inheritDoc
28
- */
29
- static get pluginName() {
30
- return 'IndentUI';
31
- }
32
-
33
- /**
34
- * @inheritDoc
35
- */
36
- init() {
37
- const editor = this.editor;
38
- const locale = editor.locale;
39
- const t = editor.t;
40
-
41
- const localizedIndentIcon = locale.uiLanguageDirection == 'ltr' ? indentIcon : outdentIcon;
42
- const localizedOutdentIcon = locale.uiLanguageDirection == 'ltr' ? outdentIcon : indentIcon;
43
-
44
- this._defineButton( 'indent', t( 'Increase indent' ), localizedIndentIcon );
45
- this._defineButton( 'outdent', t( 'Decrease indent' ), localizedOutdentIcon );
46
- }
47
-
48
- /**
49
- * Defines a UI button.
50
- *
51
- * @param {String} commandName
52
- * @param {String} label
53
- * @param {String} icon
54
- * @private
55
- */
56
- _defineButton( commandName, label, icon ) {
57
- const editor = this.editor;
58
-
59
- editor.ui.componentFactory.add( commandName, locale => {
60
- const command = editor.commands.get( commandName );
61
- const view = new ButtonView( locale );
62
-
63
- view.set( {
64
- label,
65
- icon,
66
- tooltip: true
67
- } );
68
-
69
- view.bind( 'isOn', 'isEnabled' ).to( command, 'value', 'isEnabled' );
70
-
71
- this.listenTo( view, 'execute', () => {
72
- editor.execute( commandName );
73
- editor.editing.view.focus();
74
- } );
75
-
76
- return view;
77
- } );
78
- }
21
+ /**
22
+ * @inheritDoc
23
+ */
24
+ static get pluginName() {
25
+ return 'IndentUI';
26
+ }
27
+ /**
28
+ * @inheritDoc
29
+ */
30
+ init() {
31
+ const editor = this.editor;
32
+ const locale = editor.locale;
33
+ const t = editor.t;
34
+ const localizedIndentIcon = locale.uiLanguageDirection == 'ltr' ? indentIcon : outdentIcon;
35
+ const localizedOutdentIcon = locale.uiLanguageDirection == 'ltr' ? outdentIcon : indentIcon;
36
+ this._defineButton('indent', t('Increase indent'), localizedIndentIcon);
37
+ this._defineButton('outdent', t('Decrease indent'), localizedOutdentIcon);
38
+ }
39
+ /**
40
+ * Defines a UI button.
41
+ */
42
+ _defineButton(commandName, label, icon) {
43
+ const editor = this.editor;
44
+ editor.ui.componentFactory.add(commandName, locale => {
45
+ const command = editor.commands.get(commandName);
46
+ const view = new ButtonView(locale);
47
+ view.set({
48
+ label,
49
+ icon,
50
+ tooltip: true
51
+ });
52
+ view.bind('isEnabled').to(command, 'isEnabled');
53
+ this.listenTo(view, 'execute', () => {
54
+ editor.execute(commandName);
55
+ editor.editing.view.focus();
56
+ });
57
+ return view;
58
+ });
59
+ }
79
60
  }
package/src/index.d.ts ADDED
@@ -0,0 +1,14 @@
1
+ /**
2
+ * @license Copyright (c) 2003-2023, 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 indent
7
+ */
8
+ export { default as Indent } from './indent';
9
+ export { default as IndentEditing } from './indentediting';
10
+ export { default as IndentUI } from './indentui';
11
+ export { default as IndentBlock } from './indentblock';
12
+ export type { IndentBlockConfig } from './indentconfig';
13
+ export type { default as IndentBlockCommand } from './indentblockcommand';
14
+ import './augmentation';
package/src/index.js CHANGED
@@ -2,12 +2,11 @@
2
2
  * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
3
3
  * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4
4
  */
5
-
6
5
  /**
7
6
  * @module indent
8
7
  */
9
-
10
8
  export { default as Indent } from './indent';
11
9
  export { default as IndentEditing } from './indentediting';
12
10
  export { default as IndentUI } from './indentui';
13
11
  export { default as IndentBlock } from './indentblock';
12
+ import './augmentation';