@ckeditor/ckeditor5-indent 47.6.1 → 48.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.
Files changed (183) hide show
  1. package/ckeditor5-metadata.json +9 -21
  2. package/{src → dist}/indent.d.ts +1 -1
  3. package/{src → dist}/indentblock.d.ts +1 -1
  4. package/{src → dist}/indentblockcommand.d.ts +1 -1
  5. package/dist/indentcommandbehavior/resetindentusingclasses.d.ts +24 -0
  6. package/dist/indentcommandbehavior/resetindentusingoffset.d.ts +24 -0
  7. package/{src → dist}/indentediting.d.ts +1 -1
  8. package/{src → dist}/indentui.d.ts +1 -1
  9. package/dist/index.css +3 -0
  10. package/dist/index.css.map +1 -0
  11. package/dist/index.js +82 -114
  12. package/dist/index.js.map +1 -1
  13. package/{src → dist}/integrations/indentblocklistcommand.d.ts +1 -1
  14. package/{src → dist}/integrations/indentblocklistintegration.d.ts +4 -12
  15. package/{src → dist}/integrations/indentblocklistitemcommand.d.ts +1 -8
  16. package/package.json +25 -48
  17. package/build/indent.js +0 -5
  18. package/build/translations/af.js +0 -1
  19. package/build/translations/ar.js +0 -1
  20. package/build/translations/ast.js +0 -1
  21. package/build/translations/az.js +0 -1
  22. package/build/translations/be.js +0 -1
  23. package/build/translations/bg.js +0 -1
  24. package/build/translations/bn.js +0 -1
  25. package/build/translations/bs.js +0 -1
  26. package/build/translations/ca.js +0 -1
  27. package/build/translations/cs.js +0 -1
  28. package/build/translations/da.js +0 -1
  29. package/build/translations/de-ch.js +0 -1
  30. package/build/translations/de.js +0 -1
  31. package/build/translations/el.js +0 -1
  32. package/build/translations/en-au.js +0 -1
  33. package/build/translations/en-gb.js +0 -1
  34. package/build/translations/eo.js +0 -1
  35. package/build/translations/es-co.js +0 -1
  36. package/build/translations/es.js +0 -1
  37. package/build/translations/et.js +0 -1
  38. package/build/translations/eu.js +0 -1
  39. package/build/translations/fa.js +0 -1
  40. package/build/translations/fi.js +0 -1
  41. package/build/translations/fr.js +0 -1
  42. package/build/translations/gl.js +0 -1
  43. package/build/translations/gu.js +0 -1
  44. package/build/translations/he.js +0 -1
  45. package/build/translations/hi.js +0 -1
  46. package/build/translations/hr.js +0 -1
  47. package/build/translations/hu.js +0 -1
  48. package/build/translations/hy.js +0 -1
  49. package/build/translations/id.js +0 -1
  50. package/build/translations/it.js +0 -1
  51. package/build/translations/ja.js +0 -1
  52. package/build/translations/jv.js +0 -1
  53. package/build/translations/kk.js +0 -1
  54. package/build/translations/km.js +0 -1
  55. package/build/translations/kn.js +0 -1
  56. package/build/translations/ko.js +0 -1
  57. package/build/translations/ku.js +0 -1
  58. package/build/translations/lt.js +0 -1
  59. package/build/translations/lv.js +0 -1
  60. package/build/translations/ms.js +0 -1
  61. package/build/translations/nb.js +0 -1
  62. package/build/translations/ne.js +0 -1
  63. package/build/translations/nl.js +0 -1
  64. package/build/translations/no.js +0 -1
  65. package/build/translations/oc.js +0 -1
  66. package/build/translations/pl.js +0 -1
  67. package/build/translations/pt-br.js +0 -1
  68. package/build/translations/pt.js +0 -1
  69. package/build/translations/ro.js +0 -1
  70. package/build/translations/ru.js +0 -1
  71. package/build/translations/si.js +0 -1
  72. package/build/translations/sk.js +0 -1
  73. package/build/translations/sl.js +0 -1
  74. package/build/translations/sq.js +0 -1
  75. package/build/translations/sr-latn.js +0 -1
  76. package/build/translations/sr.js +0 -1
  77. package/build/translations/sv.js +0 -1
  78. package/build/translations/th.js +0 -1
  79. package/build/translations/ti.js +0 -1
  80. package/build/translations/tk.js +0 -1
  81. package/build/translations/tr.js +0 -1
  82. package/build/translations/tt.js +0 -1
  83. package/build/translations/ug.js +0 -1
  84. package/build/translations/uk.js +0 -1
  85. package/build/translations/ur.js +0 -1
  86. package/build/translations/uz.js +0 -1
  87. package/build/translations/vi.js +0 -1
  88. package/build/translations/zh-cn.js +0 -1
  89. package/build/translations/zh.js +0 -1
  90. package/lang/contexts.json +0 -4
  91. package/lang/translations/af.po +0 -20
  92. package/lang/translations/ar.po +0 -20
  93. package/lang/translations/ast.po +0 -20
  94. package/lang/translations/az.po +0 -20
  95. package/lang/translations/be.po +0 -20
  96. package/lang/translations/bg.po +0 -20
  97. package/lang/translations/bn.po +0 -20
  98. package/lang/translations/bs.po +0 -20
  99. package/lang/translations/ca.po +0 -20
  100. package/lang/translations/cs.po +0 -20
  101. package/lang/translations/da.po +0 -20
  102. package/lang/translations/de-ch.po +0 -20
  103. package/lang/translations/de.po +0 -20
  104. package/lang/translations/el.po +0 -20
  105. package/lang/translations/en-au.po +0 -20
  106. package/lang/translations/en-gb.po +0 -20
  107. package/lang/translations/en.po +0 -20
  108. package/lang/translations/eo.po +0 -20
  109. package/lang/translations/es-co.po +0 -20
  110. package/lang/translations/es.po +0 -20
  111. package/lang/translations/et.po +0 -20
  112. package/lang/translations/eu.po +0 -20
  113. package/lang/translations/fa.po +0 -20
  114. package/lang/translations/fi.po +0 -20
  115. package/lang/translations/fr.po +0 -20
  116. package/lang/translations/gl.po +0 -20
  117. package/lang/translations/gu.po +0 -20
  118. package/lang/translations/he.po +0 -20
  119. package/lang/translations/hi.po +0 -20
  120. package/lang/translations/hr.po +0 -20
  121. package/lang/translations/hu.po +0 -20
  122. package/lang/translations/hy.po +0 -20
  123. package/lang/translations/id.po +0 -20
  124. package/lang/translations/it.po +0 -20
  125. package/lang/translations/ja.po +0 -20
  126. package/lang/translations/jv.po +0 -20
  127. package/lang/translations/kk.po +0 -20
  128. package/lang/translations/km.po +0 -20
  129. package/lang/translations/kn.po +0 -20
  130. package/lang/translations/ko.po +0 -20
  131. package/lang/translations/ku.po +0 -20
  132. package/lang/translations/lt.po +0 -20
  133. package/lang/translations/lv.po +0 -20
  134. package/lang/translations/ms.po +0 -20
  135. package/lang/translations/nb.po +0 -20
  136. package/lang/translations/ne.po +0 -20
  137. package/lang/translations/nl.po +0 -20
  138. package/lang/translations/no.po +0 -20
  139. package/lang/translations/oc.po +0 -20
  140. package/lang/translations/pl.po +0 -20
  141. package/lang/translations/pt-br.po +0 -20
  142. package/lang/translations/pt.po +0 -20
  143. package/lang/translations/ro.po +0 -20
  144. package/lang/translations/ru.po +0 -20
  145. package/lang/translations/si.po +0 -20
  146. package/lang/translations/sk.po +0 -20
  147. package/lang/translations/sl.po +0 -20
  148. package/lang/translations/sq.po +0 -20
  149. package/lang/translations/sr-latn.po +0 -20
  150. package/lang/translations/sr.po +0 -20
  151. package/lang/translations/sv.po +0 -20
  152. package/lang/translations/th.po +0 -20
  153. package/lang/translations/ti.po +0 -20
  154. package/lang/translations/tk.po +0 -20
  155. package/lang/translations/tr.po +0 -20
  156. package/lang/translations/tt.po +0 -20
  157. package/lang/translations/ug.po +0 -20
  158. package/lang/translations/uk.po +0 -20
  159. package/lang/translations/ur.po +0 -20
  160. package/lang/translations/uz.po +0 -20
  161. package/lang/translations/vi.po +0 -20
  162. package/lang/translations/zh-cn.po +0 -20
  163. package/lang/translations/zh.po +0 -20
  164. package/src/augmentation.js +0 -5
  165. package/src/indent.js +0 -50
  166. package/src/indentblock.js +0 -160
  167. package/src/indentblockcommand.js +0 -102
  168. package/src/indentcommandbehavior/indentbehavior.js +0 -5
  169. package/src/indentcommandbehavior/indentusingclasses.js +0 -51
  170. package/src/indentcommandbehavior/indentusingoffset.js +0 -59
  171. package/src/indentconfig.js +0 -5
  172. package/src/indentediting.js +0 -38
  173. package/src/indentui.js +0 -79
  174. package/src/index.js +0 -18
  175. package/src/integrations/indentblocklistcommand.js +0 -108
  176. package/src/integrations/indentblocklistintegration.js +0 -328
  177. package/src/integrations/indentblocklistitemcommand.js +0 -96
  178. /package/{src → dist}/augmentation.d.ts +0 -0
  179. /package/{src → dist}/indentcommandbehavior/indentbehavior.d.ts +0 -0
  180. /package/{src → dist}/indentcommandbehavior/indentusingclasses.d.ts +0 -0
  181. /package/{src → dist}/indentcommandbehavior/indentusingoffset.d.ts +0 -0
  182. /package/{src → dist}/indentconfig.d.ts +0 -0
  183. /package/{src → dist}/index.d.ts +0 -0
@@ -1,20 +0,0 @@
1
- # Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
2
- #
3
- # Want to contribute to this file? Submit your changes via a GitHub Pull Request.
4
- #
5
- # Check out the official contributor's guide:
6
- # https://ckeditor.com/docs/ckeditor5/latest/framework/guides/contributing/contributing.html
7
- #
8
- msgid ""
9
- msgstr ""
10
- "Language: tr\n"
11
- "Plural-Forms: nplurals=2; plural=(n > 1);\n"
12
- "Content-Type: text/plain; charset=UTF-8\n"
13
-
14
- msgctxt "Toolbar button tooltip for the increase indentation feature."
15
- msgid "Increase indent"
16
- msgstr "Girintiyi arttır"
17
-
18
- msgctxt "Toolbar button tooltip for the decrease indentation feature."
19
- msgid "Decrease indent"
20
- msgstr "Girintiyi azalt"
@@ -1,20 +0,0 @@
1
- # Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
2
- #
3
- # Want to contribute to this file? Submit your changes via a GitHub Pull Request.
4
- #
5
- # Check out the official contributor's guide:
6
- # https://ckeditor.com/docs/ckeditor5/latest/framework/guides/contributing/contributing.html
7
- #
8
- msgid ""
9
- msgstr ""
10
- "Language: tt\n"
11
- "Plural-Forms: nplurals=1; plural=0;\n"
12
- "Content-Type: text/plain; charset=UTF-8\n"
13
-
14
- msgctxt "Toolbar button tooltip for the increase indentation feature."
15
- msgid "Increase indent"
16
- msgstr ""
17
-
18
- msgctxt "Toolbar button tooltip for the decrease indentation feature."
19
- msgid "Decrease indent"
20
- msgstr ""
@@ -1,20 +0,0 @@
1
- # Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
2
- #
3
- # Want to contribute to this file? Submit your changes via a GitHub Pull Request.
4
- #
5
- # Check out the official contributor's guide:
6
- # https://ckeditor.com/docs/ckeditor5/latest/framework/guides/contributing/contributing.html
7
- #
8
- msgid ""
9
- msgstr ""
10
- "Language: ug\n"
11
- "Plural-Forms: nplurals=1; plural=0;\n"
12
- "Content-Type: text/plain; charset=UTF-8\n"
13
-
14
- msgctxt "Toolbar button tooltip for the increase indentation feature."
15
- msgid "Increase indent"
16
- msgstr "تارايتىشنى ئاشۇر"
17
-
18
- msgctxt "Toolbar button tooltip for the decrease indentation feature."
19
- msgid "Decrease indent"
20
- msgstr "تارايتىشنى كېمەيت"
@@ -1,20 +0,0 @@
1
- # Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
2
- #
3
- # Want to contribute to this file? Submit your changes via a GitHub Pull Request.
4
- #
5
- # Check out the official contributor's guide:
6
- # https://ckeditor.com/docs/ckeditor5/latest/framework/guides/contributing/contributing.html
7
- #
8
- msgid ""
9
- msgstr ""
10
- "Language: uk\n"
11
- "Plural-Forms: nplurals=3; plural=(n % 10 == 1 && n % 100 != 11 ? 0 : n % 10 >= 2 && n % 10 <= 4 && (n % 100 < 10 || n % 100 >= 20) ? 1 : 2);\n"
12
- "Content-Type: text/plain; charset=UTF-8\n"
13
-
14
- msgctxt "Toolbar button tooltip for the increase indentation feature."
15
- msgid "Increase indent"
16
- msgstr "Збільшити відступ"
17
-
18
- msgctxt "Toolbar button tooltip for the decrease indentation feature."
19
- msgid "Decrease indent"
20
- msgstr "Зменшити відступ"
@@ -1,20 +0,0 @@
1
- # Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
2
- #
3
- # Want to contribute to this file? Submit your changes via a GitHub Pull Request.
4
- #
5
- # Check out the official contributor's guide:
6
- # https://ckeditor.com/docs/ckeditor5/latest/framework/guides/contributing/contributing.html
7
- #
8
- msgid ""
9
- msgstr ""
10
- "Language: ur\n"
11
- "Plural-Forms: nplurals=2; plural=(n != 1);\n"
12
- "Content-Type: text/plain; charset=UTF-8\n"
13
-
14
- msgctxt "Toolbar button tooltip for the increase indentation feature."
15
- msgid "Increase indent"
16
- msgstr "حاشیہ بڑھائیں"
17
-
18
- msgctxt "Toolbar button tooltip for the decrease indentation feature."
19
- msgid "Decrease indent"
20
- msgstr "حاشیہ گھٹائیں"
@@ -1,20 +0,0 @@
1
- # Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
2
- #
3
- # Want to contribute to this file? Submit your changes via a GitHub Pull Request.
4
- #
5
- # Check out the official contributor's guide:
6
- # https://ckeditor.com/docs/ckeditor5/latest/framework/guides/contributing/contributing.html
7
- #
8
- msgid ""
9
- msgstr ""
10
- "Language: uz\n"
11
- "Plural-Forms: nplurals=2; plural=(n > 1);\n"
12
- "Content-Type: text/plain; charset=UTF-8\n"
13
-
14
- msgctxt "Toolbar button tooltip for the increase indentation feature."
15
- msgid "Increase indent"
16
- msgstr "chekinishni oshirish"
17
-
18
- msgctxt "Toolbar button tooltip for the decrease indentation feature."
19
- msgid "Decrease indent"
20
- msgstr "chekinishni kamaytirish"
@@ -1,20 +0,0 @@
1
- # Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
2
- #
3
- # Want to contribute to this file? Submit your changes via a GitHub Pull Request.
4
- #
5
- # Check out the official contributor's guide:
6
- # https://ckeditor.com/docs/ckeditor5/latest/framework/guides/contributing/contributing.html
7
- #
8
- msgid ""
9
- msgstr ""
10
- "Language: vi\n"
11
- "Plural-Forms: nplurals=1; plural=0;\n"
12
- "Content-Type: text/plain; charset=UTF-8\n"
13
-
14
- msgctxt "Toolbar button tooltip for the increase indentation feature."
15
- msgid "Increase indent"
16
- msgstr "Tăng lề"
17
-
18
- msgctxt "Toolbar button tooltip for the decrease indentation feature."
19
- msgid "Decrease indent"
20
- msgstr "Giảm lề"
@@ -1,20 +0,0 @@
1
- # Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
2
- #
3
- # Want to contribute to this file? Submit your changes via a GitHub Pull Request.
4
- #
5
- # Check out the official contributor's guide:
6
- # https://ckeditor.com/docs/ckeditor5/latest/framework/guides/contributing/contributing.html
7
- #
8
- msgid ""
9
- msgstr ""
10
- "Language: zh_CN\n"
11
- "Plural-Forms: nplurals=1; plural=0;\n"
12
- "Content-Type: text/plain; charset=UTF-8\n"
13
-
14
- msgctxt "Toolbar button tooltip for the increase indentation feature."
15
- msgid "Increase indent"
16
- msgstr "增加缩进"
17
-
18
- msgctxt "Toolbar button tooltip for the decrease indentation feature."
19
- msgid "Decrease indent"
20
- msgstr "减少缩进"
@@ -1,20 +0,0 @@
1
- # Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
2
- #
3
- # Want to contribute to this file? Submit your changes via a GitHub Pull Request.
4
- #
5
- # Check out the official contributor's guide:
6
- # https://ckeditor.com/docs/ckeditor5/latest/framework/guides/contributing/contributing.html
7
- #
8
- msgid ""
9
- msgstr ""
10
- "Language: zh_TW\n"
11
- "Plural-Forms: nplurals=1; plural=0;\n"
12
- "Content-Type: text/plain; charset=UTF-8\n"
13
-
14
- msgctxt "Toolbar button tooltip for the increase indentation feature."
15
- msgid "Increase indent"
16
- msgstr "增加縮排"
17
-
18
- msgctxt "Toolbar button tooltip for the decrease indentation feature."
19
- msgid "Decrease indent"
20
- msgstr "減少縮排"
@@ -1,5 +0,0 @@
1
- /**
2
- * @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
3
- * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
4
- */
5
- export {};
package/src/indent.js DELETED
@@ -1,50 +0,0 @@
1
- /**
2
- * @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
3
- * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
4
- */
5
- /**
6
- * @module indent/indent
7
- */
8
- import { Plugin } from 'ckeditor5/src/core.js';
9
- import { IndentEditing } from './indentediting.js';
10
- import { IndentUI } from './indentui.js';
11
- /**
12
- * The indent feature.
13
- *
14
- * This plugin acts as a single entry point plugin for other features that implement indentation of elements like lists or paragraphs.
15
- *
16
- * The compatible features are:
17
- *
18
- * * The {@link module:list/list~List} or {@link module:list/list/listediting~ListEditing} feature for list indentation.
19
- * * The {@link module:indent/indentblock~IndentBlock} feature for block indentation.
20
- *
21
- * This is a "glue" plugin that loads the following plugins:
22
- *
23
- * * The {@link module:indent/indentediting~IndentEditing indent editing feature}.
24
- * * The {@link module:indent/indentui~IndentUI indent UI feature}.
25
- *
26
- * The dependent plugins register the `'indent'` and `'outdent'` commands and introduce the `'indent'` and `'outdent'` buttons
27
- * that allow to increase or decrease text indentation of supported elements.
28
- *
29
- * **Note**: In order for the commands and buttons to work, at least one of compatible features is required.
30
- */
31
- export class Indent extends Plugin {
32
- /**
33
- * @inheritDoc
34
- */
35
- static get pluginName() {
36
- return 'Indent';
37
- }
38
- /**
39
- * @inheritDoc
40
- */
41
- static get isOfficialPlugin() {
42
- return true;
43
- }
44
- /**
45
- * @inheritDoc
46
- */
47
- static get requires() {
48
- return [IndentEditing, IndentUI];
49
- }
50
- }
@@ -1,160 +0,0 @@
1
- /**
2
- * @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
3
- * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
4
- */
5
- /**
6
- * @module indent/indentblock
7
- */
8
- import { Plugin } from 'ckeditor5/src/core.js';
9
- import { addMarginStylesRules } from 'ckeditor5/src/engine.js';
10
- import { IndentBlockCommand } from './indentblockcommand.js';
11
- import { IndentUsingOffset } from './indentcommandbehavior/indentusingoffset.js';
12
- import { IndentUsingClasses } from './indentcommandbehavior/indentusingclasses.js';
13
- import { IndentBlockListIntegration } from './integrations/indentblocklistintegration.js';
14
- const DEFAULT_ELEMENTS = ['paragraph', 'heading1', 'heading2', 'heading3', 'heading4', 'heading5', 'heading6'];
15
- /**
16
- * The block indentation feature.
17
- *
18
- * It registers the `'indentBlock'` and `'outdentBlock'` commands.
19
- *
20
- * If the plugin {@link module:indent/indent~Indent} is defined, it also attaches the `'indentBlock'` and `'outdentBlock'` commands to
21
- * the `'indent'` and `'outdent'` commands.
22
- */
23
- export class IndentBlock extends Plugin {
24
- /**
25
- * @inheritDoc
26
- */
27
- constructor(editor) {
28
- super(editor);
29
- editor.config.define('indentBlock', {
30
- offset: 40,
31
- unit: 'px'
32
- });
33
- }
34
- /**
35
- * @inheritDoc
36
- */
37
- static get pluginName() {
38
- return 'IndentBlock';
39
- }
40
- /**
41
- * @inheritDoc
42
- */
43
- static get isOfficialPlugin() {
44
- return true;
45
- }
46
- /**
47
- * @inheritDoc
48
- */
49
- static get requires() {
50
- return [IndentBlockListIntegration];
51
- }
52
- /**
53
- * @inheritDoc
54
- */
55
- init() {
56
- const editor = this.editor;
57
- const configuration = editor.config.get('indentBlock');
58
- if (configuration.classes && configuration.classes.length) {
59
- this._setupConversionUsingClasses(configuration.classes);
60
- editor.commands.add('indentBlock', new IndentBlockCommand(editor, new IndentUsingClasses({
61
- direction: 'forward',
62
- classes: configuration.classes
63
- })));
64
- editor.commands.add('outdentBlock', new IndentBlockCommand(editor, new IndentUsingClasses({
65
- direction: 'backward',
66
- classes: configuration.classes
67
- })));
68
- }
69
- else {
70
- editor.data.addStyleProcessorRules(addMarginStylesRules);
71
- this._setupConversionUsingOffset();
72
- editor.commands.add('indentBlock', new IndentBlockCommand(editor, new IndentUsingOffset({
73
- direction: 'forward',
74
- offset: configuration.offset,
75
- unit: configuration.unit
76
- })));
77
- editor.commands.add('outdentBlock', new IndentBlockCommand(editor, new IndentUsingOffset({
78
- direction: 'backward',
79
- offset: configuration.offset,
80
- unit: configuration.unit
81
- })));
82
- }
83
- }
84
- /**
85
- * @inheritDoc
86
- */
87
- afterInit() {
88
- const editor = this.editor;
89
- const schema = editor.model.schema;
90
- const indentCommand = editor.commands.get('indent');
91
- const outdentCommand = editor.commands.get('outdent');
92
- // Enable block indentation to heading configuration options. If it is not defined enable in paragraph and default headings.
93
- const options = editor.config.get('heading.options');
94
- const configuredElements = options && options.map(option => option.model);
95
- const knownElements = configuredElements || DEFAULT_ELEMENTS;
96
- knownElements.forEach(elementName => {
97
- if (schema.isRegistered(elementName)) {
98
- schema.extend(elementName, { allowAttributes: 'blockIndent' });
99
- }
100
- });
101
- schema.setAttributeProperties('blockIndent', { isFormatting: true });
102
- indentCommand.registerChildCommand(editor.commands.get('indentBlock'));
103
- outdentCommand.registerChildCommand(editor.commands.get('outdentBlock'));
104
- }
105
- /**
106
- * Setups conversion for using offset indents.
107
- */
108
- _setupConversionUsingOffset() {
109
- const conversion = this.editor.conversion;
110
- const locale = this.editor.locale;
111
- const marginProperty = locale.contentLanguageDirection === 'rtl' ? 'margin-right' : 'margin-left';
112
- conversion.for('upcast').attributeToAttribute({
113
- view: {
114
- styles: {
115
- [marginProperty]: /[\s\S]+/
116
- }
117
- },
118
- model: {
119
- key: 'blockIndent',
120
- value: (viewElement) => {
121
- // Do not indent block elements in Document Lists. See https://github.com/ckeditor/ckeditor5/issues/12466.
122
- if (!viewElement.is('element', 'li')) {
123
- return viewElement.getStyle(marginProperty);
124
- }
125
- }
126
- }
127
- });
128
- conversion.for('downcast').attributeToAttribute({
129
- model: 'blockIndent',
130
- view: modelAttributeValue => {
131
- return {
132
- key: 'style',
133
- value: {
134
- [marginProperty]: modelAttributeValue
135
- }
136
- };
137
- }
138
- });
139
- }
140
- /**
141
- * Setups conversion for using classes.
142
- */
143
- _setupConversionUsingClasses(classes) {
144
- const definition = {
145
- model: {
146
- key: 'blockIndent',
147
- values: []
148
- },
149
- view: {}
150
- };
151
- for (const className of classes) {
152
- definition.model.values.push(className);
153
- definition.view[className] = {
154
- key: 'class',
155
- value: [className]
156
- };
157
- }
158
- this.editor.conversion.attributeToAttribute(definition);
159
- }
160
- }
@@ -1,102 +0,0 @@
1
- /**
2
- * @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
3
- * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
4
- */
5
- /**
6
- * @module indent/indentblockcommand
7
- */
8
- import { Command } from 'ckeditor5/src/core.js';
9
- import { first } from 'ckeditor5/src/utils.js';
10
- /**
11
- * The indent block command.
12
- *
13
- * The command is registered by the {@link module:indent/indentblock~IndentBlock} as `'indentBlock'` for indenting blocks and
14
- * `'outdentBlock'` for outdenting blocks.
15
- *
16
- * To increase block indentation at the current selection, execute the command:
17
- *
18
- * ```ts
19
- * editor.execute( 'indentBlock' );
20
- * ```
21
- *
22
- * To decrease block indentation at the current selection, execute the command:
23
- *
24
- * ```ts
25
- * editor.execute( 'outdentBlock' );
26
- * ```
27
- */
28
- export class IndentBlockCommand extends Command {
29
- /**
30
- * The command's indentation behavior.
31
- */
32
- _indentBehavior;
33
- /**
34
- * Creates an instance of the command.
35
- */
36
- constructor(editor, indentBehavior) {
37
- super(editor);
38
- this._indentBehavior = indentBehavior;
39
- }
40
- /**
41
- * @inheritDoc
42
- */
43
- refresh() {
44
- const editor = this.editor;
45
- const model = editor.model;
46
- const block = first(model.document.selection.getSelectedBlocks());
47
- if (!block || !this._isIndentationChangeAllowed(block)) {
48
- this.isEnabled = false;
49
- return;
50
- }
51
- this.isEnabled = this._indentBehavior.checkEnabled(block.getAttribute('blockIndent'));
52
- }
53
- /**
54
- * @inheritDoc
55
- */
56
- execute() {
57
- const model = this.editor.model;
58
- const blocksToChange = this._getBlocksToChange();
59
- model.change(writer => {
60
- for (const block of blocksToChange) {
61
- const currentIndent = block.getAttribute('blockIndent');
62
- const nextIndent = this._indentBehavior.getNextIndent(currentIndent);
63
- if (nextIndent) {
64
- writer.setAttribute('blockIndent', nextIndent, block);
65
- }
66
- else {
67
- writer.removeAttribute('blockIndent', block);
68
- }
69
- }
70
- });
71
- }
72
- /**
73
- * Returns blocks from selection that should have blockIndent selection set.
74
- */
75
- _getBlocksToChange() {
76
- const model = this.editor.model;
77
- const selection = model.document.selection;
78
- const blocksInSelection = Array.from(selection.getSelectedBlocks());
79
- return blocksInSelection.filter(block => this._isIndentationChangeAllowed(block));
80
- }
81
- /**
82
- * Returns false if indentation cannot be applied, i.e.:
83
- * - for blocks disallowed by schema declaration
84
- * - for blocks in Document Lists (disallowed forward indentation only). See https://github.com/ckeditor/ckeditor5/issues/14155.
85
- * Otherwise returns true.
86
- */
87
- _isIndentationChangeAllowed(element) {
88
- const editor = this.editor;
89
- if (!editor.model.schema.checkAttribute(element, 'blockIndent')) {
90
- return false;
91
- }
92
- if (!editor.plugins.has('ListUtils')) {
93
- return true;
94
- }
95
- // Only forward indentation is disallowed in list items. This allows the user to outdent blocks that are already indented.
96
- if (!this._indentBehavior.isForward) {
97
- return true;
98
- }
99
- const listUtils = editor.plugins.get('ListUtils');
100
- return !listUtils.isListItemBlock(element);
101
- }
102
- }
@@ -1,5 +0,0 @@
1
- /**
2
- * @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
3
- * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
4
- */
5
- export {};
@@ -1,51 +0,0 @@
1
- /**
2
- * @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
3
- * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
4
- */
5
- /**
6
- * The block indentation behavior that uses classes to set indentation.
7
- *
8
- * @internal
9
- */
10
- export class IndentUsingClasses {
11
- /**
12
- * The direction of indentation.
13
- */
14
- isForward;
15
- /**
16
- * A list of classes used for indentation.
17
- */
18
- classes;
19
- /**
20
- * Creates an instance of the indentation behavior.
21
- *
22
- * @param config.direction The direction of indentation.
23
- * @param config.classes A list of classes used for indentation.
24
- */
25
- constructor(config) {
26
- this.isForward = config.direction === 'forward';
27
- this.classes = config.classes;
28
- }
29
- /**
30
- * @inheritDoc
31
- */
32
- checkEnabled(indentAttributeValue) {
33
- const currentIndex = this.classes.indexOf(indentAttributeValue);
34
- if (this.isForward) {
35
- return currentIndex < this.classes.length - 1;
36
- }
37
- else {
38
- return currentIndex >= 0;
39
- }
40
- }
41
- /**
42
- * @inheritDoc
43
- */
44
- getNextIndent(indentAttributeValue) {
45
- const currentIndex = this.classes.indexOf(indentAttributeValue);
46
- const indexStep = this.isForward ? 1 : -1;
47
- const nextIndex = currentIndex + indexStep;
48
- const nextIndexClamped = Math.min(nextIndex, this.classes.length - 1);
49
- return this.classes[nextIndexClamped];
50
- }
51
- }
@@ -1,59 +0,0 @@
1
- /**
2
- * @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
3
- * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
4
- */
5
- /**
6
- * The block indentation behavior that uses offsets to set indentation.
7
- *
8
- * @internal
9
- */
10
- export class IndentUsingOffset {
11
- /**
12
- * The direction of indentation.
13
- */
14
- isForward;
15
- /**
16
- * The offset of the next indentation step.
17
- */
18
- offset;
19
- /**
20
- * Indentation unit.
21
- */
22
- unit;
23
- /**
24
- * Creates an instance of the indentation behavior.
25
- *
26
- * @param config.direction The direction of indentation.
27
- * @param config.offset The offset of the next indentation step.
28
- * @param config.unit Indentation unit.
29
- */
30
- constructor(config) {
31
- this.isForward = config.direction === 'forward';
32
- this.offset = config.offset;
33
- this.unit = config.unit;
34
- }
35
- /**
36
- * @inheritDoc
37
- */
38
- checkEnabled(indentAttributeValue) {
39
- const currentOffset = parseFloat(indentAttributeValue || '0');
40
- // The command is always enabled for forward indentation.
41
- return this.isForward || currentOffset > 0;
42
- }
43
- /**
44
- * @inheritDoc
45
- */
46
- getNextIndent(indentAttributeValue) {
47
- const currentOffset = parseFloat(indentAttributeValue || '0');
48
- const isSameUnit = !indentAttributeValue || indentAttributeValue.endsWith(this.unit);
49
- if (currentOffset < 0) {
50
- return;
51
- }
52
- if (!isSameUnit) {
53
- return this.isForward ? this.offset + this.unit : undefined;
54
- }
55
- const nextOffset = this.isForward ? this.offset : -this.offset;
56
- const offsetToSet = currentOffset + nextOffset;
57
- return offsetToSet > 0 ? offsetToSet + this.unit : undefined;
58
- }
59
- }
@@ -1,5 +0,0 @@
1
- /**
2
- * @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
3
- * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
4
- */
5
- export {};
@@ -1,38 +0,0 @@
1
- /**
2
- * @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
3
- * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
4
- */
5
- /**
6
- * @module indent/indentediting
7
- */
8
- import { Plugin, MultiCommand } from 'ckeditor5/src/core.js';
9
- /**
10
- * The indent editing feature.
11
- *
12
- * This plugin registers the `'indent'` and `'outdent'` commands.
13
- *
14
- * **Note**: In order for the commands to work, at least one of the compatible features is required. Read more in the
15
- * {@link module:indent/indent~Indent indent feature} API documentation.
16
- */
17
- export class IndentEditing extends Plugin {
18
- /**
19
- * @inheritDoc
20
- */
21
- static get pluginName() {
22
- return 'IndentEditing';
23
- }
24
- /**
25
- * @inheritDoc
26
- */
27
- static get isOfficialPlugin() {
28
- return true;
29
- }
30
- /**
31
- * @inheritDoc
32
- */
33
- init() {
34
- const editor = this.editor;
35
- editor.commands.add('indent', new MultiCommand(editor));
36
- editor.commands.add('outdent', new MultiCommand(editor));
37
- }
38
- }