@ckeditor/ckeditor5-indent 0.0.0-internal-20241017.0
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/CHANGELOG.md +4 -0
- package/LICENSE.md +17 -0
- package/README.md +26 -0
- package/build/indent.js +5 -0
- package/build/translations/ar.js +1 -0
- package/build/translations/az.js +1 -0
- package/build/translations/bg.js +1 -0
- package/build/translations/bn.js +1 -0
- package/build/translations/ca.js +1 -0
- package/build/translations/cs.js +1 -0
- package/build/translations/da.js +1 -0
- package/build/translations/de-ch.js +1 -0
- package/build/translations/de.js +1 -0
- package/build/translations/el.js +1 -0
- package/build/translations/en-au.js +1 -0
- package/build/translations/en-gb.js +1 -0
- package/build/translations/es.js +1 -0
- package/build/translations/et.js +1 -0
- package/build/translations/fa.js +1 -0
- package/build/translations/fi.js +1 -0
- package/build/translations/fr.js +1 -0
- package/build/translations/gl.js +1 -0
- package/build/translations/he.js +1 -0
- package/build/translations/hi.js +1 -0
- package/build/translations/hr.js +1 -0
- package/build/translations/hu.js +1 -0
- package/build/translations/id.js +1 -0
- package/build/translations/it.js +1 -0
- package/build/translations/ja.js +1 -0
- package/build/translations/ko.js +1 -0
- package/build/translations/ku.js +1 -0
- package/build/translations/lt.js +1 -0
- package/build/translations/lv.js +1 -0
- package/build/translations/ms.js +1 -0
- package/build/translations/ne.js +1 -0
- package/build/translations/nl.js +1 -0
- package/build/translations/no.js +1 -0
- package/build/translations/pl.js +1 -0
- package/build/translations/pt-br.js +1 -0
- package/build/translations/pt.js +1 -0
- package/build/translations/ro.js +1 -0
- package/build/translations/ru.js +1 -0
- package/build/translations/sk.js +1 -0
- package/build/translations/sr-latn.js +1 -0
- package/build/translations/sr.js +1 -0
- package/build/translations/sv.js +1 -0
- package/build/translations/th.js +1 -0
- package/build/translations/tk.js +1 -0
- package/build/translations/tr.js +1 -0
- package/build/translations/ug.js +1 -0
- package/build/translations/uk.js +1 -0
- package/build/translations/ur.js +1 -0
- package/build/translations/uz.js +1 -0
- package/build/translations/vi.js +1 -0
- package/build/translations/zh-cn.js +1 -0
- package/build/translations/zh.js +1 -0
- package/ckeditor5-metadata.json +49 -0
- package/dist/augmentation.d.ts +28 -0
- package/dist/indent.d.ts +48 -0
- package/dist/indentblock.d.ts +50 -0
- package/dist/indentblockcommand.d.ts +60 -0
- package/dist/indentcommandbehavior/indentbehavior.d.ts +29 -0
- package/dist/indentcommandbehavior/indentusingclasses.d.ts +43 -0
- package/dist/indentcommandbehavior/indentusingoffset.d.ts +49 -0
- package/dist/indentconfig.d.ts +76 -0
- package/dist/indentediting.d.ts +34 -0
- package/dist/indentui.d.ts +39 -0
- package/dist/index-content.css +4 -0
- package/dist/index-editor.css +4 -0
- package/dist/index.css +4 -0
- package/dist/index.d.ts +18 -0
- package/dist/index.js +466 -0
- package/dist/index.js.map +1 -0
- package/dist/translations/ar.d.ts +8 -0
- package/dist/translations/ar.js +5 -0
- package/dist/translations/ar.umd.js +11 -0
- package/dist/translations/az.d.ts +8 -0
- package/dist/translations/az.js +5 -0
- package/dist/translations/az.umd.js +11 -0
- package/dist/translations/bg.d.ts +8 -0
- package/dist/translations/bg.js +5 -0
- package/dist/translations/bg.umd.js +11 -0
- package/dist/translations/bn.d.ts +8 -0
- package/dist/translations/bn.js +5 -0
- package/dist/translations/bn.umd.js +11 -0
- package/dist/translations/ca.d.ts +8 -0
- package/dist/translations/ca.js +5 -0
- package/dist/translations/ca.umd.js +11 -0
- package/dist/translations/cs.d.ts +8 -0
- package/dist/translations/cs.js +5 -0
- package/dist/translations/cs.umd.js +11 -0
- package/dist/translations/da.d.ts +8 -0
- package/dist/translations/da.js +5 -0
- package/dist/translations/da.umd.js +11 -0
- package/dist/translations/de-ch.d.ts +8 -0
- package/dist/translations/de-ch.js +5 -0
- package/dist/translations/de-ch.umd.js +11 -0
- package/dist/translations/de.d.ts +8 -0
- package/dist/translations/de.js +5 -0
- package/dist/translations/de.umd.js +11 -0
- package/dist/translations/el.d.ts +8 -0
- package/dist/translations/el.js +5 -0
- package/dist/translations/el.umd.js +11 -0
- package/dist/translations/en-au.d.ts +8 -0
- package/dist/translations/en-au.js +5 -0
- package/dist/translations/en-au.umd.js +11 -0
- package/dist/translations/en-gb.d.ts +8 -0
- package/dist/translations/en-gb.js +5 -0
- package/dist/translations/en-gb.umd.js +11 -0
- package/dist/translations/en.d.ts +8 -0
- package/dist/translations/en.js +5 -0
- package/dist/translations/en.umd.js +11 -0
- package/dist/translations/es.d.ts +8 -0
- package/dist/translations/es.js +5 -0
- package/dist/translations/es.umd.js +11 -0
- package/dist/translations/et.d.ts +8 -0
- package/dist/translations/et.js +5 -0
- package/dist/translations/et.umd.js +11 -0
- package/dist/translations/fa.d.ts +8 -0
- package/dist/translations/fa.js +5 -0
- package/dist/translations/fa.umd.js +11 -0
- package/dist/translations/fi.d.ts +8 -0
- package/dist/translations/fi.js +5 -0
- package/dist/translations/fi.umd.js +11 -0
- package/dist/translations/fr.d.ts +8 -0
- package/dist/translations/fr.js +5 -0
- package/dist/translations/fr.umd.js +11 -0
- package/dist/translations/gl.d.ts +8 -0
- package/dist/translations/gl.js +5 -0
- package/dist/translations/gl.umd.js +11 -0
- package/dist/translations/he.d.ts +8 -0
- package/dist/translations/he.js +5 -0
- package/dist/translations/he.umd.js +11 -0
- package/dist/translations/hi.d.ts +8 -0
- package/dist/translations/hi.js +5 -0
- package/dist/translations/hi.umd.js +11 -0
- package/dist/translations/hr.d.ts +8 -0
- package/dist/translations/hr.js +5 -0
- package/dist/translations/hr.umd.js +11 -0
- package/dist/translations/hu.d.ts +8 -0
- package/dist/translations/hu.js +5 -0
- package/dist/translations/hu.umd.js +11 -0
- package/dist/translations/id.d.ts +8 -0
- package/dist/translations/id.js +5 -0
- package/dist/translations/id.umd.js +11 -0
- package/dist/translations/it.d.ts +8 -0
- package/dist/translations/it.js +5 -0
- package/dist/translations/it.umd.js +11 -0
- package/dist/translations/ja.d.ts +8 -0
- package/dist/translations/ja.js +5 -0
- package/dist/translations/ja.umd.js +11 -0
- package/dist/translations/ko.d.ts +8 -0
- package/dist/translations/ko.js +5 -0
- package/dist/translations/ko.umd.js +11 -0
- package/dist/translations/ku.d.ts +8 -0
- package/dist/translations/ku.js +5 -0
- package/dist/translations/ku.umd.js +11 -0
- package/dist/translations/lt.d.ts +8 -0
- package/dist/translations/lt.js +5 -0
- package/dist/translations/lt.umd.js +11 -0
- package/dist/translations/lv.d.ts +8 -0
- package/dist/translations/lv.js +5 -0
- package/dist/translations/lv.umd.js +11 -0
- package/dist/translations/ms.d.ts +8 -0
- package/dist/translations/ms.js +5 -0
- package/dist/translations/ms.umd.js +11 -0
- package/dist/translations/ne.d.ts +8 -0
- package/dist/translations/ne.js +5 -0
- package/dist/translations/ne.umd.js +11 -0
- package/dist/translations/nl.d.ts +8 -0
- package/dist/translations/nl.js +5 -0
- package/dist/translations/nl.umd.js +11 -0
- package/dist/translations/no.d.ts +8 -0
- package/dist/translations/no.js +5 -0
- package/dist/translations/no.umd.js +11 -0
- package/dist/translations/pl.d.ts +8 -0
- package/dist/translations/pl.js +5 -0
- package/dist/translations/pl.umd.js +11 -0
- package/dist/translations/pt-br.d.ts +8 -0
- package/dist/translations/pt-br.js +5 -0
- package/dist/translations/pt-br.umd.js +11 -0
- package/dist/translations/pt.d.ts +8 -0
- package/dist/translations/pt.js +5 -0
- package/dist/translations/pt.umd.js +11 -0
- package/dist/translations/ro.d.ts +8 -0
- package/dist/translations/ro.js +5 -0
- package/dist/translations/ro.umd.js +11 -0
- package/dist/translations/ru.d.ts +8 -0
- package/dist/translations/ru.js +5 -0
- package/dist/translations/ru.umd.js +11 -0
- package/dist/translations/sk.d.ts +8 -0
- package/dist/translations/sk.js +5 -0
- package/dist/translations/sk.umd.js +11 -0
- package/dist/translations/sr-latn.d.ts +8 -0
- package/dist/translations/sr-latn.js +5 -0
- package/dist/translations/sr-latn.umd.js +11 -0
- package/dist/translations/sr.d.ts +8 -0
- package/dist/translations/sr.js +5 -0
- package/dist/translations/sr.umd.js +11 -0
- package/dist/translations/sv.d.ts +8 -0
- package/dist/translations/sv.js +5 -0
- package/dist/translations/sv.umd.js +11 -0
- package/dist/translations/th.d.ts +8 -0
- package/dist/translations/th.js +5 -0
- package/dist/translations/th.umd.js +11 -0
- package/dist/translations/tk.d.ts +8 -0
- package/dist/translations/tk.js +5 -0
- package/dist/translations/tk.umd.js +11 -0
- package/dist/translations/tr.d.ts +8 -0
- package/dist/translations/tr.js +5 -0
- package/dist/translations/tr.umd.js +11 -0
- package/dist/translations/ug.d.ts +8 -0
- package/dist/translations/ug.js +5 -0
- package/dist/translations/ug.umd.js +11 -0
- package/dist/translations/uk.d.ts +8 -0
- package/dist/translations/uk.js +5 -0
- package/dist/translations/uk.umd.js +11 -0
- package/dist/translations/ur.d.ts +8 -0
- package/dist/translations/ur.js +5 -0
- package/dist/translations/ur.umd.js +11 -0
- package/dist/translations/uz.d.ts +8 -0
- package/dist/translations/uz.js +5 -0
- package/dist/translations/uz.umd.js +11 -0
- package/dist/translations/vi.d.ts +8 -0
- package/dist/translations/vi.js +5 -0
- package/dist/translations/vi.umd.js +11 -0
- package/dist/translations/zh-cn.d.ts +8 -0
- package/dist/translations/zh-cn.js +5 -0
- package/dist/translations/zh-cn.umd.js +11 -0
- package/dist/translations/zh.d.ts +8 -0
- package/dist/translations/zh.js +5 -0
- package/dist/translations/zh.umd.js +11 -0
- package/lang/contexts.json +4 -0
- package/lang/translations/ar.po +26 -0
- package/lang/translations/az.po +26 -0
- package/lang/translations/bg.po +26 -0
- package/lang/translations/bn.po +26 -0
- package/lang/translations/ca.po +26 -0
- package/lang/translations/cs.po +26 -0
- package/lang/translations/da.po +26 -0
- package/lang/translations/de-ch.po +26 -0
- package/lang/translations/de.po +26 -0
- package/lang/translations/el.po +26 -0
- package/lang/translations/en-au.po +26 -0
- package/lang/translations/en-gb.po +26 -0
- package/lang/translations/en.po +26 -0
- package/lang/translations/es.po +26 -0
- package/lang/translations/et.po +26 -0
- package/lang/translations/fa.po +26 -0
- package/lang/translations/fi.po +26 -0
- package/lang/translations/fr.po +26 -0
- package/lang/translations/gl.po +26 -0
- package/lang/translations/he.po +26 -0
- package/lang/translations/hi.po +26 -0
- package/lang/translations/hr.po +26 -0
- package/lang/translations/hu.po +26 -0
- package/lang/translations/id.po +26 -0
- package/lang/translations/it.po +26 -0
- package/lang/translations/ja.po +26 -0
- package/lang/translations/ko.po +26 -0
- package/lang/translations/ku.po +26 -0
- package/lang/translations/lt.po +26 -0
- package/lang/translations/lv.po +26 -0
- package/lang/translations/ms.po +26 -0
- package/lang/translations/ne.po +26 -0
- package/lang/translations/nl.po +26 -0
- package/lang/translations/no.po +26 -0
- package/lang/translations/pl.po +26 -0
- package/lang/translations/pt-br.po +26 -0
- package/lang/translations/pt.po +26 -0
- package/lang/translations/ro.po +26 -0
- package/lang/translations/ru.po +26 -0
- package/lang/translations/sk.po +26 -0
- package/lang/translations/sr-latn.po +26 -0
- package/lang/translations/sr.po +26 -0
- package/lang/translations/sv.po +26 -0
- package/lang/translations/th.po +26 -0
- package/lang/translations/tk.po +26 -0
- package/lang/translations/tr.po +26 -0
- package/lang/translations/ug.po +26 -0
- package/lang/translations/uk.po +26 -0
- package/lang/translations/ur.po +26 -0
- package/lang/translations/uz.po +26 -0
- package/lang/translations/vi.po +26 -0
- package/lang/translations/zh-cn.po +26 -0
- package/lang/translations/zh.po +26 -0
- package/package.json +42 -0
- package/src/augmentation.d.ts +24 -0
- package/src/augmentation.js +5 -0
- package/src/indent.d.ts +44 -0
- package/src/indent.js +50 -0
- package/src/indentblock.d.ts +46 -0
- package/src/indentblock.js +153 -0
- package/src/indentblockcommand.d.ts +56 -0
- package/src/indentblockcommand.js +98 -0
- package/src/indentcommandbehavior/indentbehavior.d.ts +25 -0
- package/src/indentcommandbehavior/indentbehavior.js +5 -0
- package/src/indentcommandbehavior/indentusingclasses.d.ts +39 -0
- package/src/indentcommandbehavior/indentusingclasses.js +39 -0
- package/src/indentcommandbehavior/indentusingoffset.d.ts +45 -0
- package/src/indentcommandbehavior/indentusingoffset.js +42 -0
- package/src/indentconfig.d.ts +72 -0
- package/src/indentconfig.js +5 -0
- package/src/indentediting.d.ts +30 -0
- package/src/indentediting.js +38 -0
- package/src/indentui.d.ts +35 -0
- package/src/indentui.js +78 -0
- package/src/index.d.ts +14 -0
- package/src/index.js +12 -0
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
2
|
+
#
|
|
3
|
+
# !!! IMPORTANT !!!
|
|
4
|
+
#
|
|
5
|
+
# Before you edit this file, please keep in mind that contributing to the project
|
|
6
|
+
# translations is possible ONLY via the Transifex online service.
|
|
7
|
+
#
|
|
8
|
+
# To submit your translations, visit https://www.transifex.com/ckeditor/ckeditor5.
|
|
9
|
+
#
|
|
10
|
+
# To learn more, check out the official contributor's guide:
|
|
11
|
+
# https://ckeditor.com/docs/ckeditor5/latest/framework/guides/contributing/contributing.html
|
|
12
|
+
#
|
|
13
|
+
msgid ""
|
|
14
|
+
msgstr ""
|
|
15
|
+
"Language-Team: Urdu (https://app.transifex.com/ckeditor/teams/11143/ur/)\n"
|
|
16
|
+
"Language: ur\n"
|
|
17
|
+
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
|
|
18
|
+
"Content-Type: text/plain; charset=UTF-8\n"
|
|
19
|
+
|
|
20
|
+
msgctxt "Toolbar button tooltip for the increase indentation feature."
|
|
21
|
+
msgid "Increase indent"
|
|
22
|
+
msgstr "حاشیہ بڑھائیں"
|
|
23
|
+
|
|
24
|
+
msgctxt "Toolbar button tooltip for the decrease indentation feature."
|
|
25
|
+
msgid "Decrease indent"
|
|
26
|
+
msgstr "حاشیہ گھٹائیں"
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
2
|
+
#
|
|
3
|
+
# !!! IMPORTANT !!!
|
|
4
|
+
#
|
|
5
|
+
# Before you edit this file, please keep in mind that contributing to the project
|
|
6
|
+
# translations is possible ONLY via the Transifex online service.
|
|
7
|
+
#
|
|
8
|
+
# To submit your translations, visit https://www.transifex.com/ckeditor/ckeditor5.
|
|
9
|
+
#
|
|
10
|
+
# To learn more, check out the official contributor's guide:
|
|
11
|
+
# https://ckeditor.com/docs/ckeditor5/latest/framework/guides/contributing/contributing.html
|
|
12
|
+
#
|
|
13
|
+
msgid ""
|
|
14
|
+
msgstr ""
|
|
15
|
+
"Language-Team: Uzbek (https://app.transifex.com/ckeditor/teams/11143/uz/)\n"
|
|
16
|
+
"Language: uz\n"
|
|
17
|
+
"Plural-Forms: nplurals=1; plural=0;\n"
|
|
18
|
+
"Content-Type: text/plain; charset=UTF-8\n"
|
|
19
|
+
|
|
20
|
+
msgctxt "Toolbar button tooltip for the increase indentation feature."
|
|
21
|
+
msgid "Increase indent"
|
|
22
|
+
msgstr "chekinishni oshirish"
|
|
23
|
+
|
|
24
|
+
msgctxt "Toolbar button tooltip for the decrease indentation feature."
|
|
25
|
+
msgid "Decrease indent"
|
|
26
|
+
msgstr "chekinishni kamaytirish"
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
2
|
+
#
|
|
3
|
+
# !!! IMPORTANT !!!
|
|
4
|
+
#
|
|
5
|
+
# Before you edit this file, please keep in mind that contributing to the project
|
|
6
|
+
# translations is possible ONLY via the Transifex online service.
|
|
7
|
+
#
|
|
8
|
+
# To submit your translations, visit https://www.transifex.com/ckeditor/ckeditor5.
|
|
9
|
+
#
|
|
10
|
+
# To learn more, check out the official contributor's guide:
|
|
11
|
+
# https://ckeditor.com/docs/ckeditor5/latest/framework/guides/contributing/contributing.html
|
|
12
|
+
#
|
|
13
|
+
msgid ""
|
|
14
|
+
msgstr ""
|
|
15
|
+
"Language-Team: Vietnamese (https://app.transifex.com/ckeditor/teams/11143/vi/)\n"
|
|
16
|
+
"Language: vi\n"
|
|
17
|
+
"Plural-Forms: nplurals=1; plural=0;\n"
|
|
18
|
+
"Content-Type: text/plain; charset=UTF-8\n"
|
|
19
|
+
|
|
20
|
+
msgctxt "Toolbar button tooltip for the increase indentation feature."
|
|
21
|
+
msgid "Increase indent"
|
|
22
|
+
msgstr "Tăng lề"
|
|
23
|
+
|
|
24
|
+
msgctxt "Toolbar button tooltip for the decrease indentation feature."
|
|
25
|
+
msgid "Decrease indent"
|
|
26
|
+
msgstr "Giảm lề"
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
2
|
+
#
|
|
3
|
+
# !!! IMPORTANT !!!
|
|
4
|
+
#
|
|
5
|
+
# Before you edit this file, please keep in mind that contributing to the project
|
|
6
|
+
# translations is possible ONLY via the Transifex online service.
|
|
7
|
+
#
|
|
8
|
+
# To submit your translations, visit https://www.transifex.com/ckeditor/ckeditor5.
|
|
9
|
+
#
|
|
10
|
+
# To learn more, check out the official contributor's guide:
|
|
11
|
+
# https://ckeditor.com/docs/ckeditor5/latest/framework/guides/contributing/contributing.html
|
|
12
|
+
#
|
|
13
|
+
msgid ""
|
|
14
|
+
msgstr ""
|
|
15
|
+
"Language-Team: Chinese (China) (https://app.transifex.com/ckeditor/teams/11143/zh_CN/)\n"
|
|
16
|
+
"Language: zh_CN\n"
|
|
17
|
+
"Plural-Forms: nplurals=1; plural=0;\n"
|
|
18
|
+
"Content-Type: text/plain; charset=UTF-8\n"
|
|
19
|
+
|
|
20
|
+
msgctxt "Toolbar button tooltip for the increase indentation feature."
|
|
21
|
+
msgid "Increase indent"
|
|
22
|
+
msgstr "增加缩进"
|
|
23
|
+
|
|
24
|
+
msgctxt "Toolbar button tooltip for the decrease indentation feature."
|
|
25
|
+
msgid "Decrease indent"
|
|
26
|
+
msgstr "减少缩进"
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
2
|
+
#
|
|
3
|
+
# !!! IMPORTANT !!!
|
|
4
|
+
#
|
|
5
|
+
# Before you edit this file, please keep in mind that contributing to the project
|
|
6
|
+
# translations is possible ONLY via the Transifex online service.
|
|
7
|
+
#
|
|
8
|
+
# To submit your translations, visit https://www.transifex.com/ckeditor/ckeditor5.
|
|
9
|
+
#
|
|
10
|
+
# To learn more, check out the official contributor's guide:
|
|
11
|
+
# https://ckeditor.com/docs/ckeditor5/latest/framework/guides/contributing/contributing.html
|
|
12
|
+
#
|
|
13
|
+
msgid ""
|
|
14
|
+
msgstr ""
|
|
15
|
+
"Language-Team: Chinese (Taiwan) (https://app.transifex.com/ckeditor/teams/11143/zh_TW/)\n"
|
|
16
|
+
"Language: zh_TW\n"
|
|
17
|
+
"Plural-Forms: nplurals=1; plural=0;\n"
|
|
18
|
+
"Content-Type: text/plain; charset=UTF-8\n"
|
|
19
|
+
|
|
20
|
+
msgctxt "Toolbar button tooltip for the increase indentation feature."
|
|
21
|
+
msgid "Increase indent"
|
|
22
|
+
msgstr "增加縮排"
|
|
23
|
+
|
|
24
|
+
msgctxt "Toolbar button tooltip for the decrease indentation feature."
|
|
25
|
+
msgid "Decrease indent"
|
|
26
|
+
msgstr "減少縮排"
|
package/package.json
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@ckeditor/ckeditor5-indent",
|
|
3
|
+
"version": "0.0.0-internal-20241017.0",
|
|
4
|
+
"description": "Block indentation feature for CKEditor 5.",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"ckeditor",
|
|
7
|
+
"ckeditor5",
|
|
8
|
+
"ckeditor 5",
|
|
9
|
+
"ckeditor5-feature",
|
|
10
|
+
"ckeditor5-plugin",
|
|
11
|
+
"ckeditor5-dll"
|
|
12
|
+
],
|
|
13
|
+
"type": "module",
|
|
14
|
+
"main": "src/index.js",
|
|
15
|
+
"dependencies": {
|
|
16
|
+
"@ckeditor/ckeditor5-core": "0.0.0-internal-20241017.0",
|
|
17
|
+
"@ckeditor/ckeditor5-engine": "0.0.0-internal-20241017.0",
|
|
18
|
+
"@ckeditor/ckeditor5-ui": "0.0.0-internal-20241017.0",
|
|
19
|
+
"@ckeditor/ckeditor5-utils": "0.0.0-internal-20241017.0",
|
|
20
|
+
"ckeditor5": "0.0.0-internal-20241017.0"
|
|
21
|
+
},
|
|
22
|
+
"author": "CKSource (http://cksource.com/)",
|
|
23
|
+
"license": "GPL-2.0-or-later",
|
|
24
|
+
"homepage": "https://ckeditor.com/ckeditor-5",
|
|
25
|
+
"bugs": "https://github.com/ckeditor/ckeditor5/issues",
|
|
26
|
+
"repository": {
|
|
27
|
+
"type": "git",
|
|
28
|
+
"url": "https://github.com/ckeditor/ckeditor5.git",
|
|
29
|
+
"directory": "packages/ckeditor5-indent"
|
|
30
|
+
},
|
|
31
|
+
"files": [
|
|
32
|
+
"dist",
|
|
33
|
+
"lang",
|
|
34
|
+
"src/**/*.js",
|
|
35
|
+
"src/**/*.d.ts",
|
|
36
|
+
"theme",
|
|
37
|
+
"build",
|
|
38
|
+
"ckeditor5-metadata.json",
|
|
39
|
+
"CHANGELOG.md"
|
|
40
|
+
],
|
|
41
|
+
"types": "src/index.d.ts"
|
|
42
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license Copyright (c) 2003-2024, 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
|
+
import type { IndentBlockConfig, Indent, IndentBlock, IndentUI, IndentBlockCommand } from './index.js';
|
|
6
|
+
declare module '@ckeditor/ckeditor5-core' {
|
|
7
|
+
interface EditorConfig {
|
|
8
|
+
/**
|
|
9
|
+
* The configuration of the {@link module:indent/indentblock~IndentBlock block indentation feature}.
|
|
10
|
+
*
|
|
11
|
+
* Read more in {@link module:indent/indentconfig~IndentBlockConfig}.
|
|
12
|
+
*/
|
|
13
|
+
indentBlock?: IndentBlockConfig;
|
|
14
|
+
}
|
|
15
|
+
interface PluginsMap {
|
|
16
|
+
[Indent.pluginName]: Indent;
|
|
17
|
+
[IndentBlock.pluginName]: IndentBlock;
|
|
18
|
+
[IndentUI.pluginName]: IndentUI;
|
|
19
|
+
}
|
|
20
|
+
interface CommandsMap {
|
|
21
|
+
indentBlock: IndentBlockCommand;
|
|
22
|
+
outdentBlock: IndentBlockCommand;
|
|
23
|
+
}
|
|
24
|
+
}
|
package/src/indent.d.ts
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license Copyright (c) 2003-2024, 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/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 default class Indent extends Plugin {
|
|
32
|
+
/**
|
|
33
|
+
* @inheritDoc
|
|
34
|
+
*/
|
|
35
|
+
static get pluginName(): "Indent";
|
|
36
|
+
/**
|
|
37
|
+
* @inheritDoc
|
|
38
|
+
*/
|
|
39
|
+
static get isOfficialPlugin(): true;
|
|
40
|
+
/**
|
|
41
|
+
* @inheritDoc
|
|
42
|
+
*/
|
|
43
|
+
static get requires(): readonly [typeof IndentEditing, typeof IndentUI];
|
|
44
|
+
}
|
package/src/indent.js
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license Copyright (c) 2003-2024, 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/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 default 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
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license Copyright (c) 2003-2024, 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/indentblock
|
|
7
|
+
*/
|
|
8
|
+
import { Plugin, type Editor } from 'ckeditor5/src/core.js';
|
|
9
|
+
/**
|
|
10
|
+
* The block indentation feature.
|
|
11
|
+
*
|
|
12
|
+
* It registers the `'indentBlock'` and `'outdentBlock'` commands.
|
|
13
|
+
*
|
|
14
|
+
* If the plugin {@link module:indent/indent~Indent} is defined, it also attaches the `'indentBlock'` and `'outdentBlock'` commands to
|
|
15
|
+
* the `'indent'` and `'outdent'` commands.
|
|
16
|
+
*/
|
|
17
|
+
export default class IndentBlock extends Plugin {
|
|
18
|
+
/**
|
|
19
|
+
* @inheritDoc
|
|
20
|
+
*/
|
|
21
|
+
constructor(editor: Editor);
|
|
22
|
+
/**
|
|
23
|
+
* @inheritDoc
|
|
24
|
+
*/
|
|
25
|
+
static get pluginName(): "IndentBlock";
|
|
26
|
+
/**
|
|
27
|
+
* @inheritDoc
|
|
28
|
+
*/
|
|
29
|
+
static get isOfficialPlugin(): true;
|
|
30
|
+
/**
|
|
31
|
+
* @inheritDoc
|
|
32
|
+
*/
|
|
33
|
+
init(): void;
|
|
34
|
+
/**
|
|
35
|
+
* @inheritDoc
|
|
36
|
+
*/
|
|
37
|
+
afterInit(): void;
|
|
38
|
+
/**
|
|
39
|
+
* Setups conversion for using offset indents.
|
|
40
|
+
*/
|
|
41
|
+
private _setupConversionUsingOffset;
|
|
42
|
+
/**
|
|
43
|
+
* Setups conversion for using classes.
|
|
44
|
+
*/
|
|
45
|
+
private _setupConversionUsingClasses;
|
|
46
|
+
}
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license Copyright (c) 2003-2024, 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/indentblock
|
|
7
|
+
*/
|
|
8
|
+
import { Plugin } from 'ckeditor5/src/core.js';
|
|
9
|
+
import { addMarginRules } 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
|
+
const DEFAULT_ELEMENTS = ['paragraph', 'heading1', 'heading2', 'heading3', 'heading4', 'heading5', 'heading6'];
|
|
14
|
+
/**
|
|
15
|
+
* The block indentation feature.
|
|
16
|
+
*
|
|
17
|
+
* It registers the `'indentBlock'` and `'outdentBlock'` commands.
|
|
18
|
+
*
|
|
19
|
+
* If the plugin {@link module:indent/indent~Indent} is defined, it also attaches the `'indentBlock'` and `'outdentBlock'` commands to
|
|
20
|
+
* the `'indent'` and `'outdent'` commands.
|
|
21
|
+
*/
|
|
22
|
+
export default class IndentBlock extends Plugin {
|
|
23
|
+
/**
|
|
24
|
+
* @inheritDoc
|
|
25
|
+
*/
|
|
26
|
+
constructor(editor) {
|
|
27
|
+
super(editor);
|
|
28
|
+
editor.config.define('indentBlock', {
|
|
29
|
+
offset: 40,
|
|
30
|
+
unit: 'px'
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* @inheritDoc
|
|
35
|
+
*/
|
|
36
|
+
static get pluginName() {
|
|
37
|
+
return 'IndentBlock';
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* @inheritDoc
|
|
41
|
+
*/
|
|
42
|
+
static get isOfficialPlugin() {
|
|
43
|
+
return true;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* @inheritDoc
|
|
47
|
+
*/
|
|
48
|
+
init() {
|
|
49
|
+
const editor = this.editor;
|
|
50
|
+
const configuration = editor.config.get('indentBlock');
|
|
51
|
+
if (configuration.classes && configuration.classes.length) {
|
|
52
|
+
this._setupConversionUsingClasses(configuration.classes);
|
|
53
|
+
editor.commands.add('indentBlock', new IndentBlockCommand(editor, new IndentUsingClasses({
|
|
54
|
+
direction: 'forward',
|
|
55
|
+
classes: configuration.classes
|
|
56
|
+
})));
|
|
57
|
+
editor.commands.add('outdentBlock', new IndentBlockCommand(editor, new IndentUsingClasses({
|
|
58
|
+
direction: 'backward',
|
|
59
|
+
classes: configuration.classes
|
|
60
|
+
})));
|
|
61
|
+
}
|
|
62
|
+
else {
|
|
63
|
+
editor.data.addStyleProcessorRules(addMarginRules);
|
|
64
|
+
this._setupConversionUsingOffset();
|
|
65
|
+
editor.commands.add('indentBlock', new IndentBlockCommand(editor, new IndentUsingOffset({
|
|
66
|
+
direction: 'forward',
|
|
67
|
+
offset: configuration.offset,
|
|
68
|
+
unit: configuration.unit
|
|
69
|
+
})));
|
|
70
|
+
editor.commands.add('outdentBlock', new IndentBlockCommand(editor, new IndentUsingOffset({
|
|
71
|
+
direction: 'backward',
|
|
72
|
+
offset: configuration.offset,
|
|
73
|
+
unit: configuration.unit
|
|
74
|
+
})));
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* @inheritDoc
|
|
79
|
+
*/
|
|
80
|
+
afterInit() {
|
|
81
|
+
const editor = this.editor;
|
|
82
|
+
const schema = editor.model.schema;
|
|
83
|
+
const indentCommand = editor.commands.get('indent');
|
|
84
|
+
const outdentCommand = editor.commands.get('outdent');
|
|
85
|
+
// Enable block indentation to heading configuration options. If it is not defined enable in paragraph and default headings.
|
|
86
|
+
const options = editor.config.get('heading.options');
|
|
87
|
+
const configuredElements = options && options.map(option => option.model);
|
|
88
|
+
const knownElements = configuredElements || DEFAULT_ELEMENTS;
|
|
89
|
+
knownElements.forEach(elementName => {
|
|
90
|
+
if (schema.isRegistered(elementName)) {
|
|
91
|
+
schema.extend(elementName, { allowAttributes: 'blockIndent' });
|
|
92
|
+
}
|
|
93
|
+
});
|
|
94
|
+
schema.setAttributeProperties('blockIndent', { isFormatting: true });
|
|
95
|
+
indentCommand.registerChildCommand(editor.commands.get('indentBlock'));
|
|
96
|
+
outdentCommand.registerChildCommand(editor.commands.get('outdentBlock'));
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Setups conversion for using offset indents.
|
|
100
|
+
*/
|
|
101
|
+
_setupConversionUsingOffset() {
|
|
102
|
+
const conversion = this.editor.conversion;
|
|
103
|
+
const locale = this.editor.locale;
|
|
104
|
+
const marginProperty = locale.contentLanguageDirection === 'rtl' ? 'margin-right' : 'margin-left';
|
|
105
|
+
conversion.for('upcast').attributeToAttribute({
|
|
106
|
+
view: {
|
|
107
|
+
styles: {
|
|
108
|
+
[marginProperty]: /[\s\S]+/
|
|
109
|
+
}
|
|
110
|
+
},
|
|
111
|
+
model: {
|
|
112
|
+
key: 'blockIndent',
|
|
113
|
+
value: (viewElement) => {
|
|
114
|
+
// Do not indent block elements in Document Lists. See https://github.com/ckeditor/ckeditor5/issues/12466.
|
|
115
|
+
if (!viewElement.is('element', 'li')) {
|
|
116
|
+
return viewElement.getStyle(marginProperty);
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
});
|
|
121
|
+
conversion.for('downcast').attributeToAttribute({
|
|
122
|
+
model: 'blockIndent',
|
|
123
|
+
view: modelAttributeValue => {
|
|
124
|
+
return {
|
|
125
|
+
key: 'style',
|
|
126
|
+
value: {
|
|
127
|
+
[marginProperty]: modelAttributeValue
|
|
128
|
+
}
|
|
129
|
+
};
|
|
130
|
+
}
|
|
131
|
+
});
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* Setups conversion for using classes.
|
|
135
|
+
*/
|
|
136
|
+
_setupConversionUsingClasses(classes) {
|
|
137
|
+
const definition = {
|
|
138
|
+
model: {
|
|
139
|
+
key: 'blockIndent',
|
|
140
|
+
values: []
|
|
141
|
+
},
|
|
142
|
+
view: {}
|
|
143
|
+
};
|
|
144
|
+
for (const className of classes) {
|
|
145
|
+
definition.model.values.push(className);
|
|
146
|
+
definition.view[className] = {
|
|
147
|
+
key: 'class',
|
|
148
|
+
value: [className]
|
|
149
|
+
};
|
|
150
|
+
}
|
|
151
|
+
this.editor.conversion.attributeToAttribute(definition);
|
|
152
|
+
}
|
|
153
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license Copyright (c) 2003-2024, 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/indentblockcommand
|
|
7
|
+
*/
|
|
8
|
+
import { Command, type Editor } from 'ckeditor5/src/core.js';
|
|
9
|
+
import type { IndentBehavior } from './indentcommandbehavior/indentbehavior.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 default class IndentBlockCommand extends Command {
|
|
29
|
+
/**
|
|
30
|
+
* The command's indentation behavior.
|
|
31
|
+
*/
|
|
32
|
+
private readonly _indentBehavior;
|
|
33
|
+
/**
|
|
34
|
+
* Creates an instance of the command.
|
|
35
|
+
*/
|
|
36
|
+
constructor(editor: Editor, indentBehavior: IndentBehavior);
|
|
37
|
+
/**
|
|
38
|
+
* @inheritDoc
|
|
39
|
+
*/
|
|
40
|
+
refresh(): void;
|
|
41
|
+
/**
|
|
42
|
+
* @inheritDoc
|
|
43
|
+
*/
|
|
44
|
+
execute(): void;
|
|
45
|
+
/**
|
|
46
|
+
* Returns blocks from selection that should have blockIndent selection set.
|
|
47
|
+
*/
|
|
48
|
+
private _getBlocksToChange;
|
|
49
|
+
/**
|
|
50
|
+
* Returns false if indentation cannot be applied, i.e.:
|
|
51
|
+
* - for blocks disallowed by schema declaration
|
|
52
|
+
* - for blocks in Document Lists (disallowed forward indentation only). See https://github.com/ckeditor/ckeditor5/issues/14155.
|
|
53
|
+
* Otherwise returns true.
|
|
54
|
+
*/
|
|
55
|
+
private _isIndentationChangeAllowed;
|
|
56
|
+
}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license Copyright (c) 2003-2024, 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/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 default class IndentBlockCommand extends Command {
|
|
29
|
+
/**
|
|
30
|
+
* Creates an instance of the command.
|
|
31
|
+
*/
|
|
32
|
+
constructor(editor, indentBehavior) {
|
|
33
|
+
super(editor);
|
|
34
|
+
this._indentBehavior = indentBehavior;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* @inheritDoc
|
|
38
|
+
*/
|
|
39
|
+
refresh() {
|
|
40
|
+
const editor = this.editor;
|
|
41
|
+
const model = editor.model;
|
|
42
|
+
const block = first(model.document.selection.getSelectedBlocks());
|
|
43
|
+
if (!block || !this._isIndentationChangeAllowed(block)) {
|
|
44
|
+
this.isEnabled = false;
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
this.isEnabled = this._indentBehavior.checkEnabled(block.getAttribute('blockIndent'));
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* @inheritDoc
|
|
51
|
+
*/
|
|
52
|
+
execute() {
|
|
53
|
+
const model = this.editor.model;
|
|
54
|
+
const blocksToChange = this._getBlocksToChange();
|
|
55
|
+
model.change(writer => {
|
|
56
|
+
for (const block of blocksToChange) {
|
|
57
|
+
const currentIndent = block.getAttribute('blockIndent');
|
|
58
|
+
const nextIndent = this._indentBehavior.getNextIndent(currentIndent);
|
|
59
|
+
if (nextIndent) {
|
|
60
|
+
writer.setAttribute('blockIndent', nextIndent, block);
|
|
61
|
+
}
|
|
62
|
+
else {
|
|
63
|
+
writer.removeAttribute('blockIndent', block);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Returns blocks from selection that should have blockIndent selection set.
|
|
70
|
+
*/
|
|
71
|
+
_getBlocksToChange() {
|
|
72
|
+
const model = this.editor.model;
|
|
73
|
+
const selection = model.document.selection;
|
|
74
|
+
const blocksInSelection = Array.from(selection.getSelectedBlocks());
|
|
75
|
+
return blocksInSelection.filter(block => this._isIndentationChangeAllowed(block));
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Returns false if indentation cannot be applied, i.e.:
|
|
79
|
+
* - for blocks disallowed by schema declaration
|
|
80
|
+
* - for blocks in Document Lists (disallowed forward indentation only). See https://github.com/ckeditor/ckeditor5/issues/14155.
|
|
81
|
+
* Otherwise returns true.
|
|
82
|
+
*/
|
|
83
|
+
_isIndentationChangeAllowed(element) {
|
|
84
|
+
const editor = this.editor;
|
|
85
|
+
if (!editor.model.schema.checkAttribute(element, 'blockIndent')) {
|
|
86
|
+
return false;
|
|
87
|
+
}
|
|
88
|
+
if (!editor.plugins.has('ListUtils')) {
|
|
89
|
+
return true;
|
|
90
|
+
}
|
|
91
|
+
// Only forward indentation is disallowed in list items. This allows the user to outdent blocks that are already indented.
|
|
92
|
+
if (!this._indentBehavior.isForward) {
|
|
93
|
+
return true;
|
|
94
|
+
}
|
|
95
|
+
const documentListUtils = editor.plugins.get('ListUtils');
|
|
96
|
+
return !documentListUtils.isListItemBlock(element);
|
|
97
|
+
}
|
|
98
|
+
}
|