@ckeditor/ckeditor5-block-quote 30.0.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.
Files changed (123) hide show
  1. package/LICENSE.md +17 -0
  2. package/README.md +20 -0
  3. package/build/block-quote.js +5 -0
  4. package/build/translations/af.js +1 -0
  5. package/build/translations/ar.js +1 -0
  6. package/build/translations/az.js +1 -0
  7. package/build/translations/bg.js +1 -0
  8. package/build/translations/ca.js +1 -0
  9. package/build/translations/cs.js +1 -0
  10. package/build/translations/da.js +1 -0
  11. package/build/translations/de-ch.js +1 -0
  12. package/build/translations/de.js +1 -0
  13. package/build/translations/el.js +1 -0
  14. package/build/translations/en-au.js +1 -0
  15. package/build/translations/en-gb.js +1 -0
  16. package/build/translations/es.js +1 -0
  17. package/build/translations/et.js +1 -0
  18. package/build/translations/eu.js +1 -0
  19. package/build/translations/fa.js +1 -0
  20. package/build/translations/fi.js +1 -0
  21. package/build/translations/fr.js +1 -0
  22. package/build/translations/gl.js +1 -0
  23. package/build/translations/gu.js +1 -0
  24. package/build/translations/he.js +1 -0
  25. package/build/translations/hi.js +1 -0
  26. package/build/translations/hr.js +1 -0
  27. package/build/translations/hu.js +1 -0
  28. package/build/translations/id.js +1 -0
  29. package/build/translations/it.js +1 -0
  30. package/build/translations/ja.js +1 -0
  31. package/build/translations/km.js +1 -0
  32. package/build/translations/kn.js +1 -0
  33. package/build/translations/ko.js +1 -0
  34. package/build/translations/ku.js +1 -0
  35. package/build/translations/lt.js +1 -0
  36. package/build/translations/lv.js +1 -0
  37. package/build/translations/nb.js +1 -0
  38. package/build/translations/ne.js +1 -0
  39. package/build/translations/nl.js +1 -0
  40. package/build/translations/no.js +1 -0
  41. package/build/translations/pl.js +1 -0
  42. package/build/translations/pt-br.js +1 -0
  43. package/build/translations/ro.js +1 -0
  44. package/build/translations/ru.js +1 -0
  45. package/build/translations/sk.js +1 -0
  46. package/build/translations/sl.js +1 -0
  47. package/build/translations/sq.js +1 -0
  48. package/build/translations/sr-latn.js +1 -0
  49. package/build/translations/sr.js +1 -0
  50. package/build/translations/sv.js +1 -0
  51. package/build/translations/th.js +1 -0
  52. package/build/translations/tk.js +1 -0
  53. package/build/translations/tr.js +1 -0
  54. package/build/translations/ug.js +1 -0
  55. package/build/translations/uk.js +1 -0
  56. package/build/translations/vi.js +1 -0
  57. package/build/translations/zh-cn.js +1 -0
  58. package/build/translations/zh.js +1 -0
  59. package/ckeditor5-metadata.json +23 -0
  60. package/lang/contexts.json +3 -0
  61. package/lang/translations/af.po +21 -0
  62. package/lang/translations/ar.po +21 -0
  63. package/lang/translations/az.po +21 -0
  64. package/lang/translations/bg.po +21 -0
  65. package/lang/translations/ca.po +21 -0
  66. package/lang/translations/cs.po +21 -0
  67. package/lang/translations/da.po +21 -0
  68. package/lang/translations/de-ch.po +21 -0
  69. package/lang/translations/de.po +21 -0
  70. package/lang/translations/el.po +21 -0
  71. package/lang/translations/en-au.po +21 -0
  72. package/lang/translations/en-gb.po +21 -0
  73. package/lang/translations/en.po +21 -0
  74. package/lang/translations/es.po +21 -0
  75. package/lang/translations/et.po +21 -0
  76. package/lang/translations/eu.po +21 -0
  77. package/lang/translations/fa.po +21 -0
  78. package/lang/translations/fi.po +21 -0
  79. package/lang/translations/fr.po +21 -0
  80. package/lang/translations/gl.po +21 -0
  81. package/lang/translations/gu.po +21 -0
  82. package/lang/translations/he.po +21 -0
  83. package/lang/translations/hi.po +21 -0
  84. package/lang/translations/hr.po +21 -0
  85. package/lang/translations/hu.po +21 -0
  86. package/lang/translations/id.po +21 -0
  87. package/lang/translations/it.po +21 -0
  88. package/lang/translations/ja.po +21 -0
  89. package/lang/translations/km.po +21 -0
  90. package/lang/translations/kn.po +21 -0
  91. package/lang/translations/ko.po +21 -0
  92. package/lang/translations/ku.po +21 -0
  93. package/lang/translations/lt.po +21 -0
  94. package/lang/translations/lv.po +21 -0
  95. package/lang/translations/nb.po +21 -0
  96. package/lang/translations/ne.po +21 -0
  97. package/lang/translations/nl.po +21 -0
  98. package/lang/translations/no.po +21 -0
  99. package/lang/translations/pl.po +21 -0
  100. package/lang/translations/pt-br.po +21 -0
  101. package/lang/translations/ro.po +21 -0
  102. package/lang/translations/ru.po +21 -0
  103. package/lang/translations/sk.po +21 -0
  104. package/lang/translations/sl.po +21 -0
  105. package/lang/translations/sq.po +21 -0
  106. package/lang/translations/sr-latn.po +21 -0
  107. package/lang/translations/sr.po +21 -0
  108. package/lang/translations/sv.po +21 -0
  109. package/lang/translations/th.po +21 -0
  110. package/lang/translations/tk.po +21 -0
  111. package/lang/translations/tr.po +21 -0
  112. package/lang/translations/ug.po +21 -0
  113. package/lang/translations/uk.po +21 -0
  114. package/lang/translations/vi.po +21 -0
  115. package/lang/translations/zh-cn.po +21 -0
  116. package/lang/translations/zh.po +21 -0
  117. package/package.json +57 -0
  118. package/src/blockquote.js +39 -0
  119. package/src/blockquotecommand.js +232 -0
  120. package/src/blockquoteediting.js +147 -0
  121. package/src/blockquoteui.js +60 -0
  122. package/src/index.js +12 -0
  123. package/theme/blockquote.css +23 -0
@@ -0,0 +1,21 @@
1
+ # Copyright (c) 2003-2021, CKSource - Frederico Knabben. 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: Slovak (https://www.transifex.com/ckeditor/teams/11143/sk/)\n"
16
+ "Language: sk\n"
17
+ "Plural-Forms: nplurals=4; plural=(n % 1 == 0 && n == 1 ? 0 : n % 1 == 0 && n >= 2 && n <= 4 ? 1 : n % 1 != 0 ? 2: 3);\n"
18
+
19
+ msgctxt "Toolbar button tooltip for the Block quote feature."
20
+ msgid "Block quote"
21
+ msgstr "Citát"
@@ -0,0 +1,21 @@
1
+ # Copyright (c) 2003-2021, CKSource - Frederico Knabben. 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: Slovenian (https://www.transifex.com/ckeditor/teams/11143/sl/)\n"
16
+ "Language: sl\n"
17
+ "Plural-Forms: nplurals=4; plural=(n%100==1 ? 0 : n%100==2 ? 1 : n%100==3 || n%100==4 ? 2 : 3);\n"
18
+
19
+ msgctxt "Toolbar button tooltip for the Block quote feature."
20
+ msgid "Block quote"
21
+ msgstr "Blokiraj citat"
@@ -0,0 +1,21 @@
1
+ # Copyright (c) 2003-2021, CKSource - Frederico Knabben. 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: Albanian (https://www.transifex.com/ckeditor/teams/11143/sq/)\n"
16
+ "Language: sq\n"
17
+ "Plural-Forms: nplurals=2; plural=(n != 1);\n"
18
+
19
+ msgctxt "Toolbar button tooltip for the Block quote feature."
20
+ msgid "Block quote"
21
+ msgstr "Thonjëzat"
@@ -0,0 +1,21 @@
1
+ # Copyright (c) 2003-2021, CKSource - Frederico Knabben. 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: Serbian (Latin) (https://www.transifex.com/ckeditor/teams/11143/sr@latin/)\n"
16
+ "Language: sr@latin\n"
17
+ "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"
18
+
19
+ msgctxt "Toolbar button tooltip for the Block quote feature."
20
+ msgid "Block quote"
21
+ msgstr "Citat"
@@ -0,0 +1,21 @@
1
+ # Copyright (c) 2003-2021, CKSource - Frederico Knabben. 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: Serbian (https://www.transifex.com/ckeditor/teams/11143/sr/)\n"
16
+ "Language: sr\n"
17
+ "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"
18
+
19
+ msgctxt "Toolbar button tooltip for the Block quote feature."
20
+ msgid "Block quote"
21
+ msgstr "Цитат"
@@ -0,0 +1,21 @@
1
+ # Copyright (c) 2003-2021, CKSource - Frederico Knabben. 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: Swedish (https://www.transifex.com/ckeditor/teams/11143/sv/)\n"
16
+ "Language: sv\n"
17
+ "Plural-Forms: nplurals=2; plural=(n != 1);\n"
18
+
19
+ msgctxt "Toolbar button tooltip for the Block quote feature."
20
+ msgid "Block quote"
21
+ msgstr "Blockcitat"
@@ -0,0 +1,21 @@
1
+ # Copyright (c) 2003-2021, CKSource - Frederico Knabben. 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: Thai (https://www.transifex.com/ckeditor/teams/11143/th/)\n"
16
+ "Language: th\n"
17
+ "Plural-Forms: nplurals=1; plural=0;\n"
18
+
19
+ msgctxt "Toolbar button tooltip for the Block quote feature."
20
+ msgid "Block quote"
21
+ msgstr "คำพูดบล็อก"
@@ -0,0 +1,21 @@
1
+ # Copyright (c) 2003-2021, CKSource - Frederico Knabben. 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: Turkmen (https://www.transifex.com/ckeditor/teams/11143/tk/)\n"
16
+ "Language: tk\n"
17
+ "Plural-Forms: nplurals=2; plural=(n != 1);\n"
18
+
19
+ msgctxt "Toolbar button tooltip for the Block quote feature."
20
+ msgid "Block quote"
21
+ msgstr "Sitata blokirläň"
@@ -0,0 +1,21 @@
1
+ # Copyright (c) 2003-2021, CKSource - Frederico Knabben. 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: Turkish (https://www.transifex.com/ckeditor/teams/11143/tr/)\n"
16
+ "Language: tr\n"
17
+ "Plural-Forms: nplurals=2; plural=(n > 1);\n"
18
+
19
+ msgctxt "Toolbar button tooltip for the Block quote feature."
20
+ msgid "Block quote"
21
+ msgstr "Alıntı"
@@ -0,0 +1,21 @@
1
+ # Copyright (c) 2003-2021, CKSource - Frederico Knabben. 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: Uyghur (https://www.transifex.com/ckeditor/teams/11143/ug/)\n"
16
+ "Language: ug\n"
17
+ "Plural-Forms: nplurals=2; plural=(n != 1);\n"
18
+
19
+ msgctxt "Toolbar button tooltip for the Block quote feature."
20
+ msgid "Block quote"
21
+ msgstr "نەقىل"
@@ -0,0 +1,21 @@
1
+ # Copyright (c) 2003-2021, CKSource - Frederico Knabben. 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: Ukrainian (https://www.transifex.com/ckeditor/teams/11143/uk/)\n"
16
+ "Language: uk\n"
17
+ "Plural-Forms: nplurals=4; plural=(n % 1 == 0 && n % 10 == 1 && n % 100 != 11 ? 0 : n % 1 == 0 && n % 10 >= 2 && n % 10 <= 4 && (n % 100 < 12 || n % 100 > 14) ? 1 : n % 1 == 0 && (n % 10 ==0 || (n % 10 >=5 && n % 10 <=9) || (n % 100 >=11 && n % 100 <=14 )) ? 2: 3);\n"
18
+
19
+ msgctxt "Toolbar button tooltip for the Block quote feature."
20
+ msgid "Block quote"
21
+ msgstr "Цитата"
@@ -0,0 +1,21 @@
1
+ # Copyright (c) 2003-2021, CKSource - Frederico Knabben. 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://www.transifex.com/ckeditor/teams/11143/vi/)\n"
16
+ "Language: vi\n"
17
+ "Plural-Forms: nplurals=1; plural=0;\n"
18
+
19
+ msgctxt "Toolbar button tooltip for the Block quote feature."
20
+ msgid "Block quote"
21
+ msgstr "Trích dẫn"
@@ -0,0 +1,21 @@
1
+ # Copyright (c) 2003-2021, CKSource - Frederico Knabben. 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://www.transifex.com/ckeditor/teams/11143/zh_CN/)\n"
16
+ "Language: zh_CN\n"
17
+ "Plural-Forms: nplurals=1; plural=0;\n"
18
+
19
+ msgctxt "Toolbar button tooltip for the Block quote feature."
20
+ msgid "Block quote"
21
+ msgstr "块引用"
@@ -0,0 +1,21 @@
1
+ # Copyright (c) 2003-2021, CKSource - Frederico Knabben. 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://www.transifex.com/ckeditor/teams/11143/zh_TW/)\n"
16
+ "Language: zh_TW\n"
17
+ "Plural-Forms: nplurals=1; plural=0;\n"
18
+
19
+ msgctxt "Toolbar button tooltip for the Block quote feature."
20
+ msgid "Block quote"
21
+ msgstr "段落引用"
package/package.json ADDED
@@ -0,0 +1,57 @@
1
+ {
2
+ "name": "@ckeditor/ckeditor5-block-quote",
3
+ "version": "30.0.0",
4
+ "description": "Block quote feature for CKEditor 5.",
5
+ "keywords": [
6
+ "ckeditor",
7
+ "ckeditor5",
8
+ "ckeditor 5",
9
+ "ckeditor5-feature",
10
+ "ckeditor5-plugin",
11
+ "ckeditor5-dll"
12
+ ],
13
+ "main": "src/index.js",
14
+ "dependencies": {
15
+ "ckeditor5": "^30.0.0"
16
+ },
17
+ "devDependencies": {
18
+ "@ckeditor/ckeditor5-basic-styles": "^30.0.0",
19
+ "@ckeditor/ckeditor5-core": "^30.0.0",
20
+ "@ckeditor/ckeditor5-dev-utils": "^25.4.0",
21
+ "@ckeditor/ckeditor5-editor-classic": "^30.0.0",
22
+ "@ckeditor/ckeditor5-engine": "^30.0.0",
23
+ "@ckeditor/ckeditor5-enter": "^30.0.0",
24
+ "@ckeditor/ckeditor5-heading": "^30.0.0",
25
+ "@ckeditor/ckeditor5-image": "^30.0.0",
26
+ "@ckeditor/ckeditor5-list": "^30.0.0",
27
+ "@ckeditor/ckeditor5-paragraph": "^30.0.0",
28
+ "@ckeditor/ckeditor5-table": "^30.0.0",
29
+ "@ckeditor/ckeditor5-theme-lark": "^30.0.0",
30
+ "@ckeditor/ckeditor5-typing": "^30.0.0",
31
+ "webpack": "^4.43.0",
32
+ "webpack-cli": "^3.3.11"
33
+ },
34
+ "engines": {
35
+ "node": ">=12.0.0",
36
+ "npm": ">=5.7.1"
37
+ },
38
+ "author": "CKSource (http://cksource.com/)",
39
+ "license": "GPL-2.0-or-later",
40
+ "homepage": "https://ckeditor.com/ckeditor-5",
41
+ "bugs": "https://github.com/ckeditor/ckeditor5/issues",
42
+ "repository": {
43
+ "type": "git",
44
+ "url": "https://github.com/ckeditor/ckeditor5.git",
45
+ "directory": "packages/ckeditor5-block-quote"
46
+ },
47
+ "files": [
48
+ "lang",
49
+ "src",
50
+ "theme",
51
+ "build",
52
+ "ckeditor5-metadata.json"
53
+ ],
54
+ "scripts": {
55
+ "dll:build": "webpack"
56
+ }
57
+ }
@@ -0,0 +1,39 @@
1
+ /**
2
+ * @license Copyright (c) 2003-2021, CKSource - Frederico Knabben. All rights reserved.
3
+ * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4
+ */
5
+
6
+ /**
7
+ * @module block-quote/blockquote
8
+ */
9
+
10
+ import { Plugin } from 'ckeditor5/src/core';
11
+
12
+ import BlockQuoteEditing from './blockquoteediting';
13
+ import BlockQuoteUI from './blockquoteui';
14
+
15
+ /**
16
+ * The block quote plugin.
17
+ *
18
+ * For more information about this feature check the {@glink api/block-quote package page}.
19
+ *
20
+ * This is a "glue" plugin which loads the {@link module:block-quote/blockquoteediting~BlockQuoteEditing block quote editing feature}
21
+ * and {@link module:block-quote/blockquoteui~BlockQuoteUI block quote UI feature}.
22
+ *
23
+ * @extends module:core/plugin~Plugin
24
+ */
25
+ export default class BlockQuote extends Plugin {
26
+ /**
27
+ * @inheritDoc
28
+ */
29
+ static get requires() {
30
+ return [ BlockQuoteEditing, BlockQuoteUI ];
31
+ }
32
+
33
+ /**
34
+ * @inheritDoc
35
+ */
36
+ static get pluginName() {
37
+ return 'BlockQuote';
38
+ }
39
+ }
@@ -0,0 +1,232 @@
1
+ /**
2
+ * @license Copyright (c) 2003-2021, CKSource - Frederico Knabben. All rights reserved.
3
+ * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4
+ */
5
+
6
+ /**
7
+ * @module block-quote/blockquotecommand
8
+ */
9
+
10
+ import { Command } from 'ckeditor5/src/core';
11
+ import { first } from 'ckeditor5/src/utils';
12
+
13
+ /**
14
+ * The block quote command plugin.
15
+ *
16
+ * @extends module:core/command~Command
17
+ */
18
+ export default class BlockQuoteCommand extends Command {
19
+ /**
20
+ * Whether the selection starts in a block quote.
21
+ *
22
+ * @observable
23
+ * @readonly
24
+ * @member {Boolean} #value
25
+ */
26
+
27
+ /**
28
+ * @inheritDoc
29
+ */
30
+ refresh() {
31
+ this.value = this._getValue();
32
+ this.isEnabled = this._checkEnabled();
33
+ }
34
+
35
+ /**
36
+ * Executes the command. When the command {@link #value is on}, all top-most block quotes within
37
+ * the selection will be removed. If it is off, all selected blocks will be wrapped with
38
+ * a block quote.
39
+ *
40
+ * @fires execute
41
+ * @param {Object} [options] Command options.
42
+ * @param {Boolean} [options.forceValue] If set, it will force the command behavior. If `true`, the command will apply a block quote,
43
+ * otherwise the command will remove the block quote. If not set, the command will act basing on its current value.
44
+ */
45
+ execute( options = {} ) {
46
+ const model = this.editor.model;
47
+ const schema = model.schema;
48
+ const selection = model.document.selection;
49
+
50
+ const blocks = Array.from( selection.getSelectedBlocks() );
51
+
52
+ const value = ( options.forceValue === undefined ) ? !this.value : options.forceValue;
53
+
54
+ model.change( writer => {
55
+ if ( !value ) {
56
+ this._removeQuote( writer, blocks.filter( findQuote ) );
57
+ } else {
58
+ const blocksToQuote = blocks.filter( block => {
59
+ // Already quoted blocks needs to be considered while quoting too
60
+ // in order to reuse their <bQ> elements.
61
+ return findQuote( block ) || checkCanBeQuoted( schema, block );
62
+ } );
63
+
64
+ this._applyQuote( writer, blocksToQuote );
65
+ }
66
+ } );
67
+ }
68
+
69
+ /**
70
+ * Checks the command's {@link #value}.
71
+ *
72
+ * @private
73
+ * @returns {Boolean} The current value.
74
+ */
75
+ _getValue() {
76
+ const selection = this.editor.model.document.selection;
77
+
78
+ const firstBlock = first( selection.getSelectedBlocks() );
79
+
80
+ // In the current implementation, the block quote must be an immediate parent of a block element.
81
+ return !!( firstBlock && findQuote( firstBlock ) );
82
+ }
83
+
84
+ /**
85
+ * Checks whether the command can be enabled in the current context.
86
+ *
87
+ * @private
88
+ * @returns {Boolean} Whether the command should be enabled.
89
+ */
90
+ _checkEnabled() {
91
+ if ( this.value ) {
92
+ return true;
93
+ }
94
+
95
+ const selection = this.editor.model.document.selection;
96
+ const schema = this.editor.model.schema;
97
+
98
+ const firstBlock = first( selection.getSelectedBlocks() );
99
+
100
+ if ( !firstBlock ) {
101
+ return false;
102
+ }
103
+
104
+ return checkCanBeQuoted( schema, firstBlock );
105
+ }
106
+
107
+ /**
108
+ * Removes the quote from given blocks.
109
+ *
110
+ * If blocks which are supposed to be "unquoted" are in the middle of a quote,
111
+ * start it or end it, then the quote will be split (if needed) and the blocks
112
+ * will be moved out of it, so other quoted blocks remained quoted.
113
+ *
114
+ * @private
115
+ * @param {module:engine/model/writer~Writer} writer
116
+ * @param {Array.<module:engine/model/element~Element>} blocks
117
+ */
118
+ _removeQuote( writer, blocks ) {
119
+ // Unquote all groups of block. Iterate in the reverse order to not break following ranges.
120
+ getRangesOfBlockGroups( writer, blocks ).reverse().forEach( groupRange => {
121
+ if ( groupRange.start.isAtStart && groupRange.end.isAtEnd ) {
122
+ writer.unwrap( groupRange.start.parent );
123
+
124
+ return;
125
+ }
126
+
127
+ // The group of blocks are at the beginning of an <bQ> so let's move them left (out of the <bQ>).
128
+ if ( groupRange.start.isAtStart ) {
129
+ const positionBefore = writer.createPositionBefore( groupRange.start.parent );
130
+
131
+ writer.move( groupRange, positionBefore );
132
+
133
+ return;
134
+ }
135
+
136
+ // The blocks are in the middle of an <bQ> so we need to split the <bQ> after the last block
137
+ // so we move the items there.
138
+ if ( !groupRange.end.isAtEnd ) {
139
+ writer.split( groupRange.end );
140
+ }
141
+
142
+ // Now we are sure that groupRange.end.isAtEnd is true, so let's move the blocks right.
143
+
144
+ const positionAfter = writer.createPositionAfter( groupRange.end.parent );
145
+
146
+ writer.move( groupRange, positionAfter );
147
+ } );
148
+ }
149
+
150
+ /**
151
+ * Applies the quote to given blocks.
152
+ *
153
+ * @private
154
+ * @param {module:engine/model/writer~Writer} writer
155
+ * @param {Array.<module:engine/model/element~Element>} blocks
156
+ */
157
+ _applyQuote( writer, blocks ) {
158
+ const quotesToMerge = [];
159
+
160
+ // Quote all groups of block. Iterate in the reverse order to not break following ranges.
161
+ getRangesOfBlockGroups( writer, blocks ).reverse().forEach( groupRange => {
162
+ let quote = findQuote( groupRange.start );
163
+
164
+ if ( !quote ) {
165
+ quote = writer.createElement( 'blockQuote' );
166
+
167
+ writer.wrap( groupRange, quote );
168
+ }
169
+
170
+ quotesToMerge.push( quote );
171
+ } );
172
+
173
+ // Merge subsequent <bQ> elements. Reverse the order again because this time we want to go through
174
+ // the <bQ> elements in the source order (due to how merge works – it moves the right element's content
175
+ // to the first element and removes the right one. Since we may need to merge a couple of subsequent `<bQ>` elements
176
+ // we want to keep the reference to the first (furthest left) one.
177
+ quotesToMerge.reverse().reduce( ( currentQuote, nextQuote ) => {
178
+ if ( currentQuote.nextSibling == nextQuote ) {
179
+ writer.merge( writer.createPositionAfter( currentQuote ) );
180
+
181
+ return currentQuote;
182
+ }
183
+
184
+ return nextQuote;
185
+ } );
186
+ }
187
+ }
188
+
189
+ function findQuote( elementOrPosition ) {
190
+ return elementOrPosition.parent.name == 'blockQuote' ? elementOrPosition.parent : null;
191
+ }
192
+
193
+ // Returns a minimal array of ranges containing groups of subsequent blocks.
194
+ //
195
+ // content: abcdefgh
196
+ // blocks: [ a, b, d, f, g, h ]
197
+ // output ranges: [ab]c[d]e[fgh]
198
+ //
199
+ // @param {Array.<module:engine/model/element~Element>} blocks
200
+ // @returns {Array.<module:engine/model/range~Range>}
201
+ function getRangesOfBlockGroups( writer, blocks ) {
202
+ let startPosition;
203
+ let i = 0;
204
+ const ranges = [];
205
+
206
+ while ( i < blocks.length ) {
207
+ const block = blocks[ i ];
208
+ const nextBlock = blocks[ i + 1 ];
209
+
210
+ if ( !startPosition ) {
211
+ startPosition = writer.createPositionBefore( block );
212
+ }
213
+
214
+ if ( !nextBlock || block.nextSibling != nextBlock ) {
215
+ ranges.push( writer.createRange( startPosition, writer.createPositionAfter( block ) ) );
216
+ startPosition = null;
217
+ }
218
+
219
+ i++;
220
+ }
221
+
222
+ return ranges;
223
+ }
224
+
225
+ // Checks whether <bQ> can wrap the block.
226
+ function checkCanBeQuoted( schema, block ) {
227
+ // TMP will be replaced with schema.checkWrap().
228
+ const isBQAllowed = schema.checkChild( block.parent, 'blockQuote' );
229
+ const isBlockAllowedInBQ = schema.checkChild( [ '$root', 'blockQuote' ], block );
230
+
231
+ return isBQAllowed && isBlockAllowedInBQ;
232
+ }