@ckeditor/ckeditor5-image 41.4.2 → 42.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 (294) hide show
  1. package/README.md +6 -0
  2. package/build/image.js +2 -2
  3. package/build/translations/ar.js +1 -1
  4. package/build/translations/ast.js +1 -1
  5. package/build/translations/az.js +1 -1
  6. package/build/translations/bg.js +1 -1
  7. package/build/translations/bn.js +1 -1
  8. package/build/translations/bs.js +1 -1
  9. package/build/translations/ca.js +1 -1
  10. package/build/translations/cs.js +1 -1
  11. package/build/translations/da.js +1 -1
  12. package/build/translations/de-ch.js +1 -1
  13. package/build/translations/de.js +1 -1
  14. package/build/translations/el.js +1 -1
  15. package/build/translations/en-au.js +1 -1
  16. package/build/translations/en-gb.js +1 -1
  17. package/build/translations/eo.js +1 -1
  18. package/build/translations/es.js +1 -1
  19. package/build/translations/et.js +1 -1
  20. package/build/translations/eu.js +1 -1
  21. package/build/translations/fa.js +1 -1
  22. package/build/translations/fi.js +1 -1
  23. package/build/translations/fr.js +1 -1
  24. package/build/translations/gl.js +1 -1
  25. package/build/translations/he.js +1 -1
  26. package/build/translations/hi.js +1 -1
  27. package/build/translations/hr.js +1 -1
  28. package/build/translations/hu.js +1 -1
  29. package/build/translations/id.js +1 -1
  30. package/build/translations/it.js +1 -1
  31. package/build/translations/ja.js +1 -1
  32. package/build/translations/jv.js +1 -1
  33. package/build/translations/km.js +1 -1
  34. package/build/translations/kn.js +1 -1
  35. package/build/translations/ko.js +1 -1
  36. package/build/translations/ku.js +1 -1
  37. package/build/translations/lt.js +1 -1
  38. package/build/translations/lv.js +1 -1
  39. package/build/translations/ms.js +1 -1
  40. package/build/translations/nb.js +1 -1
  41. package/build/translations/ne.js +1 -1
  42. package/build/translations/nl.js +1 -1
  43. package/build/translations/no.js +1 -1
  44. package/build/translations/pl.js +1 -1
  45. package/build/translations/pt-br.js +1 -1
  46. package/build/translations/pt.js +1 -1
  47. package/build/translations/ro.js +1 -1
  48. package/build/translations/ru.js +1 -1
  49. package/build/translations/si.js +1 -1
  50. package/build/translations/sk.js +1 -1
  51. package/build/translations/sq.js +1 -1
  52. package/build/translations/sr-latn.js +1 -1
  53. package/build/translations/sr.js +1 -1
  54. package/build/translations/sv.js +1 -1
  55. package/build/translations/th.js +1 -1
  56. package/build/translations/ti.js +1 -1
  57. package/build/translations/tk.js +1 -1
  58. package/build/translations/tr.js +1 -1
  59. package/build/translations/ug.js +1 -1
  60. package/build/translations/uk.js +1 -1
  61. package/build/translations/ur.js +1 -1
  62. package/build/translations/uz.js +1 -1
  63. package/build/translations/vi.js +1 -1
  64. package/build/translations/zh-cn.js +1 -1
  65. package/build/translations/zh.js +1 -1
  66. package/ckeditor5-metadata.json +19 -5
  67. package/dist/index-content.css +20 -12
  68. package/dist/index-editor.css +4 -0
  69. package/dist/index.css +50 -33
  70. package/dist/index.css.map +1 -1
  71. package/dist/index.js +1876 -1330
  72. package/dist/index.js.map +1 -1
  73. package/dist/translations/ar.js +1 -1
  74. package/dist/translations/ar.umd.js +1 -1
  75. package/dist/translations/ast.js +1 -1
  76. package/dist/translations/ast.umd.js +1 -1
  77. package/dist/translations/az.js +1 -1
  78. package/dist/translations/az.umd.js +1 -1
  79. package/dist/translations/bg.js +1 -1
  80. package/dist/translations/bg.umd.js +1 -1
  81. package/dist/translations/bn.js +1 -1
  82. package/dist/translations/bn.umd.js +1 -1
  83. package/dist/translations/bs.js +1 -1
  84. package/dist/translations/bs.umd.js +1 -1
  85. package/dist/translations/ca.js +1 -1
  86. package/dist/translations/ca.umd.js +1 -1
  87. package/dist/translations/cs.js +1 -1
  88. package/dist/translations/cs.umd.js +1 -1
  89. package/dist/translations/da.js +1 -1
  90. package/dist/translations/da.umd.js +1 -1
  91. package/dist/translations/de-ch.js +1 -1
  92. package/dist/translations/de-ch.umd.js +1 -1
  93. package/dist/translations/de.js +1 -1
  94. package/dist/translations/de.umd.js +1 -1
  95. package/dist/translations/el.js +1 -1
  96. package/dist/translations/el.umd.js +1 -1
  97. package/dist/translations/en-au.js +1 -1
  98. package/dist/translations/en-au.umd.js +1 -1
  99. package/dist/translations/en-gb.js +1 -1
  100. package/dist/translations/en-gb.umd.js +1 -1
  101. package/dist/translations/en.js +1 -1
  102. package/dist/translations/en.umd.js +1 -1
  103. package/dist/translations/eo.js +1 -1
  104. package/dist/translations/eo.umd.js +1 -1
  105. package/dist/translations/es.js +1 -1
  106. package/dist/translations/es.umd.js +1 -1
  107. package/dist/translations/et.js +1 -1
  108. package/dist/translations/et.umd.js +1 -1
  109. package/dist/translations/eu.js +1 -1
  110. package/dist/translations/eu.umd.js +1 -1
  111. package/dist/translations/fa.js +1 -1
  112. package/dist/translations/fa.umd.js +1 -1
  113. package/dist/translations/fi.js +1 -1
  114. package/dist/translations/fi.umd.js +1 -1
  115. package/dist/translations/fr.js +1 -1
  116. package/dist/translations/fr.umd.js +1 -1
  117. package/dist/translations/gl.js +1 -1
  118. package/dist/translations/gl.umd.js +1 -1
  119. package/dist/translations/he.js +1 -1
  120. package/dist/translations/he.umd.js +1 -1
  121. package/dist/translations/hi.js +1 -1
  122. package/dist/translations/hi.umd.js +1 -1
  123. package/dist/translations/hr.js +1 -1
  124. package/dist/translations/hr.umd.js +1 -1
  125. package/dist/translations/hu.js +1 -1
  126. package/dist/translations/hu.umd.js +1 -1
  127. package/dist/translations/id.js +1 -1
  128. package/dist/translations/id.umd.js +1 -1
  129. package/dist/translations/it.js +1 -1
  130. package/dist/translations/it.umd.js +1 -1
  131. package/dist/translations/ja.js +1 -1
  132. package/dist/translations/ja.umd.js +1 -1
  133. package/dist/translations/jv.js +1 -1
  134. package/dist/translations/jv.umd.js +1 -1
  135. package/dist/translations/km.js +1 -1
  136. package/dist/translations/km.umd.js +1 -1
  137. package/dist/translations/kn.js +1 -1
  138. package/dist/translations/kn.umd.js +1 -1
  139. package/dist/translations/ko.js +1 -1
  140. package/dist/translations/ko.umd.js +1 -1
  141. package/dist/translations/ku.js +1 -1
  142. package/dist/translations/ku.umd.js +1 -1
  143. package/dist/translations/lt.js +1 -1
  144. package/dist/translations/lt.umd.js +1 -1
  145. package/dist/translations/lv.js +1 -1
  146. package/dist/translations/lv.umd.js +1 -1
  147. package/dist/translations/ms.js +1 -1
  148. package/dist/translations/ms.umd.js +1 -1
  149. package/dist/translations/nb.js +1 -1
  150. package/dist/translations/nb.umd.js +1 -1
  151. package/dist/translations/ne.js +1 -1
  152. package/dist/translations/ne.umd.js +1 -1
  153. package/dist/translations/nl.js +1 -1
  154. package/dist/translations/nl.umd.js +1 -1
  155. package/dist/translations/no.js +1 -1
  156. package/dist/translations/no.umd.js +1 -1
  157. package/dist/translations/pl.js +1 -1
  158. package/dist/translations/pl.umd.js +1 -1
  159. package/dist/translations/pt-br.js +1 -1
  160. package/dist/translations/pt-br.umd.js +1 -1
  161. package/dist/translations/pt.js +1 -1
  162. package/dist/translations/pt.umd.js +1 -1
  163. package/dist/translations/ro.js +1 -1
  164. package/dist/translations/ro.umd.js +1 -1
  165. package/dist/translations/ru.js +1 -1
  166. package/dist/translations/ru.umd.js +1 -1
  167. package/dist/translations/si.js +1 -1
  168. package/dist/translations/si.umd.js +1 -1
  169. package/dist/translations/sk.js +1 -1
  170. package/dist/translations/sk.umd.js +1 -1
  171. package/dist/translations/sq.js +1 -1
  172. package/dist/translations/sq.umd.js +1 -1
  173. package/dist/translations/sr-latn.js +1 -1
  174. package/dist/translations/sr-latn.umd.js +1 -1
  175. package/dist/translations/sr.js +1 -1
  176. package/dist/translations/sr.umd.js +1 -1
  177. package/dist/translations/sv.js +1 -1
  178. package/dist/translations/sv.umd.js +1 -1
  179. package/dist/translations/th.js +1 -1
  180. package/dist/translations/th.umd.js +1 -1
  181. package/dist/translations/ti.js +1 -1
  182. package/dist/translations/ti.umd.js +1 -1
  183. package/dist/translations/tk.js +1 -1
  184. package/dist/translations/tk.umd.js +1 -1
  185. package/dist/translations/tr.js +1 -1
  186. package/dist/translations/tr.umd.js +1 -1
  187. package/dist/translations/ug.js +1 -1
  188. package/dist/translations/ug.umd.js +1 -1
  189. package/dist/translations/uk.js +1 -1
  190. package/dist/translations/uk.umd.js +1 -1
  191. package/dist/translations/ur.js +1 -1
  192. package/dist/translations/ur.umd.js +1 -1
  193. package/dist/translations/uz.js +1 -1
  194. package/dist/translations/uz.umd.js +1 -1
  195. package/dist/translations/vi.js +1 -1
  196. package/dist/translations/vi.umd.js +1 -1
  197. package/dist/translations/zh-cn.js +1 -1
  198. package/dist/translations/zh-cn.umd.js +1 -1
  199. package/dist/translations/zh.js +1 -1
  200. package/dist/translations/zh.umd.js +1 -1
  201. package/dist/types/imageinsert/imageinsertui.d.ts +10 -2
  202. package/dist/types/imageinsert/imageinsertviaurlui.d.ts +31 -9
  203. package/dist/types/imageinsert/ui/imageinserturlview.d.ts +6 -49
  204. package/dist/types/imageupload/imageuploadui.d.ts +18 -1
  205. package/lang/contexts.json +7 -4
  206. package/lang/translations/ar.po +21 -9
  207. package/lang/translations/ast.po +19 -7
  208. package/lang/translations/az.po +19 -7
  209. package/lang/translations/bg.po +21 -9
  210. package/lang/translations/bn.po +21 -9
  211. package/lang/translations/bs.po +21 -9
  212. package/lang/translations/ca.po +21 -9
  213. package/lang/translations/cs.po +21 -9
  214. package/lang/translations/da.po +21 -9
  215. package/lang/translations/de-ch.po +21 -9
  216. package/lang/translations/de.po +21 -9
  217. package/lang/translations/el.po +21 -9
  218. package/lang/translations/en-au.po +21 -9
  219. package/lang/translations/en-gb.po +19 -7
  220. package/lang/translations/en.po +21 -9
  221. package/lang/translations/eo.po +19 -7
  222. package/lang/translations/es.po +21 -9
  223. package/lang/translations/et.po +21 -9
  224. package/lang/translations/eu.po +19 -7
  225. package/lang/translations/fa.po +19 -7
  226. package/lang/translations/fi.po +21 -9
  227. package/lang/translations/fr.po +21 -9
  228. package/lang/translations/gl.po +21 -9
  229. package/lang/translations/he.po +21 -9
  230. package/lang/translations/hi.po +21 -9
  231. package/lang/translations/hr.po +21 -9
  232. package/lang/translations/hu.po +21 -9
  233. package/lang/translations/id.po +21 -9
  234. package/lang/translations/it.po +21 -9
  235. package/lang/translations/ja.po +21 -9
  236. package/lang/translations/jv.po +21 -9
  237. package/lang/translations/km.po +19 -7
  238. package/lang/translations/kn.po +19 -7
  239. package/lang/translations/ko.po +21 -9
  240. package/lang/translations/ku.po +19 -7
  241. package/lang/translations/lt.po +21 -9
  242. package/lang/translations/lv.po +21 -9
  243. package/lang/translations/ms.po +21 -9
  244. package/lang/translations/nb.po +19 -7
  245. package/lang/translations/ne.po +19 -7
  246. package/lang/translations/nl.po +21 -9
  247. package/lang/translations/no.po +21 -9
  248. package/lang/translations/pl.po +21 -9
  249. package/lang/translations/pt-br.po +21 -9
  250. package/lang/translations/pt.po +21 -9
  251. package/lang/translations/ro.po +21 -9
  252. package/lang/translations/ru.po +21 -9
  253. package/lang/translations/si.po +19 -7
  254. package/lang/translations/sk.po +21 -9
  255. package/lang/translations/sq.po +19 -7
  256. package/lang/translations/sr-latn.po +21 -9
  257. package/lang/translations/sr.po +21 -9
  258. package/lang/translations/sv.po +21 -9
  259. package/lang/translations/th.po +21 -9
  260. package/lang/translations/ti.po +20 -8
  261. package/lang/translations/tk.po +19 -7
  262. package/lang/translations/tr.po +21 -9
  263. package/lang/translations/ug.po +20 -8
  264. package/lang/translations/uk.po +21 -9
  265. package/lang/translations/ur.po +19 -7
  266. package/lang/translations/uz.po +21 -9
  267. package/lang/translations/vi.po +21 -9
  268. package/lang/translations/zh-cn.po +21 -9
  269. package/lang/translations/zh.po +21 -9
  270. package/package.json +3 -3
  271. package/src/image/imageinlineediting.js +4 -9
  272. package/src/imageinsert/imageinsertui.d.ts +10 -2
  273. package/src/imageinsert/imageinsertui.js +41 -4
  274. package/src/imageinsert/imageinsertviaurlui.d.ts +31 -9
  275. package/src/imageinsert/imageinsertviaurlui.js +111 -64
  276. package/src/imageinsert/ui/imageinsertformview.js +0 -17
  277. package/src/imageinsert/ui/imageinserturlview.d.ts +6 -49
  278. package/src/imageinsert/ui/imageinserturlview.js +6 -74
  279. package/src/imageresize/imageresizebuttons.js +2 -2
  280. package/src/imagestyle/utils.js +17 -18
  281. package/src/imageupload/imageuploadui.d.ts +18 -1
  282. package/src/imageupload/imageuploadui.js +59 -38
  283. package/theme/imageinsert.css +3 -0
  284. package/theme/imagestyle.css +47 -34
  285. package/build/translations/es-co.js +0 -1
  286. package/build/translations/tt.js +0 -1
  287. package/dist/translations/es-co.d.ts +0 -8
  288. package/dist/translations/es-co.js +0 -5
  289. package/dist/translations/es-co.umd.js +0 -11
  290. package/dist/translations/tt.d.ts +0 -8
  291. package/dist/translations/tt.js +0 -5
  292. package/dist/translations/tt.umd.js +0 -11
  293. package/lang/translations/es-co.po +0 -178
  294. package/lang/translations/tt.po +0 -178
@@ -85,10 +85,14 @@ msgctxt "The label for the upload image from computer toolbar button."
85
85
  msgid "Upload image from computer"
86
86
  msgstr "Tải hình ảnh lên từ máy tính"
87
87
 
88
- msgctxt "The label for the upload image from computer menu bar button."
88
+ msgctxt "The label for the upload image from computer menu bar button (standalone button)."
89
89
  msgid "Image from computer"
90
90
  msgstr "Hình ảnh từ máy tính"
91
91
 
92
+ msgctxt "The label for the upload image from computer menu bar button (inside 'Image' menu)."
93
+ msgid "From computer"
94
+ msgstr ""
95
+
92
96
  msgctxt "The label for the replace image by upload from computer toolbar button."
93
97
  msgid "Replace image from computer"
94
98
  msgstr "Thay thế hình ảnh từ máy tính"
@@ -133,18 +137,22 @@ msgctxt "The accessibility label of the image resize dropdown for screen readers
133
137
  msgid "Image resize list"
134
138
  msgstr "Danh sách ảnh đã chỉnh kích thước"
135
139
 
136
- msgctxt "The label of the form submit button if the image source URL input has no value."
137
- msgid "Insert"
138
- msgstr "Chèn"
139
-
140
- msgctxt "The label of the form submit button if the image source URL input has a value."
141
- msgid "Update"
142
- msgstr "Cập nhật"
143
-
144
140
  msgctxt "The input label for the Insert image via URL form."
145
141
  msgid "Insert image via URL"
146
142
  msgstr "Chèn ảnh từ URL"
147
143
 
144
+ msgctxt "The label for the insert image via url dropdown button."
145
+ msgid "Insert via URL"
146
+ msgstr ""
147
+
148
+ msgctxt "The label for the insert image via url menu bar button (standalone button)."
149
+ msgid "Image via URL"
150
+ msgstr ""
151
+
152
+ msgctxt "The label for the insert image via url menu bar button (inside 'Image' menu)."
153
+ msgid "Via URL"
154
+ msgstr ""
155
+
148
156
  msgctxt "The input label for the Insert image via URL form for a pre-existing image."
149
157
  msgid "Update image URL"
150
158
  msgstr "Cập nhật ảnh từ URL"
@@ -176,3 +184,7 @@ msgstr "Hoàn tất quá trình tải hình ảnh lên"
176
184
  msgctxt "Aria status message indicating that an error has occurred during image upload. Example: 'Error during image upload'."
177
185
  msgid "Error during image upload"
178
186
  msgstr "Xảy ra lỗi trong quá trình tải hình ảnh lên"
187
+
188
+ msgctxt "Label for the widget inserted by the image feature (as in 'insert image')"
189
+ msgid "Image"
190
+ msgstr ""
@@ -85,10 +85,14 @@ msgctxt "The label for the upload image from computer toolbar button."
85
85
  msgid "Upload image from computer"
86
86
  msgstr "从电脑上传图片"
87
87
 
88
- msgctxt "The label for the upload image from computer menu bar button."
88
+ msgctxt "The label for the upload image from computer menu bar button (standalone button)."
89
89
  msgid "Image from computer"
90
90
  msgstr "从计算机中选择图片"
91
91
 
92
+ msgctxt "The label for the upload image from computer menu bar button (inside 'Image' menu)."
93
+ msgid "From computer"
94
+ msgstr ""
95
+
92
96
  msgctxt "The label for the replace image by upload from computer toolbar button."
93
97
  msgid "Replace image from computer"
94
98
  msgstr "从电脑替换图片"
@@ -133,18 +137,22 @@ msgctxt "The accessibility label of the image resize dropdown for screen readers
133
137
  msgid "Image resize list"
134
138
  msgstr "图片大小列表"
135
139
 
136
- msgctxt "The label of the form submit button if the image source URL input has no value."
137
- msgid "Insert"
138
- msgstr "插入"
139
-
140
- msgctxt "The label of the form submit button if the image source URL input has a value."
141
- msgid "Update"
142
- msgstr "更新"
143
-
144
140
  msgctxt "The input label for the Insert image via URL form."
145
141
  msgid "Insert image via URL"
146
142
  msgstr "通过URL地址插入图片"
147
143
 
144
+ msgctxt "The label for the insert image via url dropdown button."
145
+ msgid "Insert via URL"
146
+ msgstr ""
147
+
148
+ msgctxt "The label for the insert image via url menu bar button (standalone button)."
149
+ msgid "Image via URL"
150
+ msgstr ""
151
+
152
+ msgctxt "The label for the insert image via url menu bar button (inside 'Image' menu)."
153
+ msgid "Via URL"
154
+ msgstr ""
155
+
148
156
  msgctxt "The input label for the Insert image via URL form for a pre-existing image."
149
157
  msgid "Update image URL"
150
158
  msgstr "更新图片URL地址"
@@ -176,3 +184,7 @@ msgstr "图片上传完成"
176
184
  msgctxt "Aria status message indicating that an error has occurred during image upload. Example: 'Error during image upload'."
177
185
  msgid "Error during image upload"
178
186
  msgstr "图片上传时出错"
187
+
188
+ msgctxt "Label for the widget inserted by the image feature (as in 'insert image')"
189
+ msgid "Image"
190
+ msgstr ""
@@ -85,10 +85,14 @@ msgctxt "The label for the upload image from computer toolbar button."
85
85
  msgid "Upload image from computer"
86
86
  msgstr "從電腦上傳圖片"
87
87
 
88
- msgctxt "The label for the upload image from computer menu bar button."
88
+ msgctxt "The label for the upload image from computer menu bar button (standalone button)."
89
89
  msgid "Image from computer"
90
90
  msgstr "來自電腦的圖片"
91
91
 
92
+ msgctxt "The label for the upload image from computer menu bar button (inside 'Image' menu)."
93
+ msgid "From computer"
94
+ msgstr ""
95
+
92
96
  msgctxt "The label for the replace image by upload from computer toolbar button."
93
97
  msgid "Replace image from computer"
94
98
  msgstr "從電腦替換圖片"
@@ -133,18 +137,22 @@ msgctxt "The accessibility label of the image resize dropdown for screen readers
133
137
  msgid "Image resize list"
134
138
  msgstr "圖片縮放清單"
135
139
 
136
- msgctxt "The label of the form submit button if the image source URL input has no value."
137
- msgid "Insert"
138
- msgstr "插入"
139
-
140
- msgctxt "The label of the form submit button if the image source URL input has a value."
141
- msgid "Update"
142
- msgstr "更新"
143
-
144
140
  msgctxt "The input label for the Insert image via URL form."
145
141
  msgid "Insert image via URL"
146
142
  msgstr "使用連結插入圖片"
147
143
 
144
+ msgctxt "The label for the insert image via url dropdown button."
145
+ msgid "Insert via URL"
146
+ msgstr ""
147
+
148
+ msgctxt "The label for the insert image via url menu bar button (standalone button)."
149
+ msgid "Image via URL"
150
+ msgstr ""
151
+
152
+ msgctxt "The label for the insert image via url menu bar button (inside 'Image' menu)."
153
+ msgid "Via URL"
154
+ msgstr ""
155
+
148
156
  msgctxt "The input label for the Insert image via URL form for a pre-existing image."
149
157
  msgid "Update image URL"
150
158
  msgstr "更新圖片連結"
@@ -176,3 +184,7 @@ msgstr "圖片上傳完成"
176
184
  msgctxt "Aria status message indicating that an error has occurred during image upload. Example: 'Error during image upload'."
177
185
  msgid "Error during image upload"
178
186
  msgstr "圖片上傳期間發生錯誤"
187
+
188
+ msgctxt "Label for the widget inserted by the image feature (as in 'insert image')"
189
+ msgid "Image"
190
+ msgstr ""
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ckeditor/ckeditor5-image",
3
- "version": "41.4.2",
3
+ "version": "42.0.0-alpha.1",
4
4
  "description": "Image feature for CKEditor 5.",
5
5
  "keywords": [
6
6
  "ckeditor",
@@ -13,8 +13,8 @@
13
13
  "type": "module",
14
14
  "main": "src/index.js",
15
15
  "dependencies": {
16
- "@ckeditor/ckeditor5-ui": "41.4.2",
17
- "ckeditor5": "41.4.2",
16
+ "@ckeditor/ckeditor5-ui": "42.0.0-alpha.1",
17
+ "ckeditor5": "42.0.0-alpha.1",
18
18
  "lodash-es": "4.17.21"
19
19
  },
20
20
  "author": "CKSource (http://cksource.com/)",
@@ -47,15 +47,10 @@ export default class ImageInlineEditing extends Plugin {
47
47
  // Converters 'alt' and 'srcset' are added in 'ImageEditing' plugin.
48
48
  schema.register('imageInline', {
49
49
  inheritAllFrom: '$inlineObject',
50
- allowAttributes: ['alt', 'src', 'srcset']
51
- });
52
- // Disallow inline images in captions (for now). This is the best spot to do that because
53
- // independent packages can introduce captions (ImageCaption, TableCaption, etc.) so better this
54
- // be future-proof.
55
- schema.addChildCheck((context, childDefinition) => {
56
- if (context.endsWith('caption') && childDefinition.name === 'imageInline') {
57
- return false;
58
- }
50
+ allowAttributes: ['alt', 'src', 'srcset'],
51
+ // Disallow inline images in captions (at least for now).
52
+ // This is the best spot to do that because independent packages can introduce captions (ImageCaption, TableCaption, etc.).
53
+ disallowIn: ['caption']
59
54
  });
60
55
  this._setupConversion();
61
56
  if (editor.plugins.has('ImageBlockEditing')) {
@@ -7,7 +7,7 @@
7
7
  */
8
8
  import { Plugin, type Editor } from 'ckeditor5/src/core.js';
9
9
  import { type Observable } from 'ckeditor5/src/utils.js';
10
- import { type ButtonView, type DropdownView, type FocusableView } from 'ckeditor5/src/ui.js';
10
+ import { type ButtonView, type DropdownView, type FocusableView, type MenuBarMenuListItemButtonView } from 'ckeditor5/src/ui.js';
11
11
  import ImageUtils from '../imageutils.js';
12
12
  /**
13
13
  * The image insert dropdown plugin.
@@ -17,6 +17,9 @@ import ImageUtils from '../imageutils.js';
17
17
  *
18
18
  * Adds the `'insertImage'` dropdown to the {@link module:ui/componentfactory~ComponentFactory UI component factory}
19
19
  * and also the `imageInsert` dropdown as an alias for backward compatibility.
20
+ *
21
+ * Adds the `'menuBar:insertImage'` sub-menu to the {@link module:ui/componentfactory~ComponentFactory UI component factory}, which is
22
+ * by default added to the `'Insert'` menu.
20
23
  */
21
24
  export default class ImageInsertUI extends Plugin {
22
25
  /**
@@ -52,7 +55,7 @@ export default class ImageInsertUI extends Plugin {
52
55
  /**
53
56
  * Registers the insert image dropdown integration.
54
57
  */
55
- registerIntegration({ name, observable, buttonViewCreator, formViewCreator, requiresForm }: {
58
+ registerIntegration({ name, observable, buttonViewCreator, formViewCreator, menuBarButtonViewCreator, requiresForm }: {
56
59
  name: string;
57
60
  observable: (Observable & {
58
61
  isEnabled: boolean;
@@ -61,12 +64,17 @@ export default class ImageInsertUI extends Plugin {
61
64
  });
62
65
  buttonViewCreator: (isOnlyOne: boolean) => ButtonView;
63
66
  formViewCreator: (isOnlyOne: boolean) => FocusableView;
67
+ menuBarButtonViewCreator: (isOnlyOne: boolean) => MenuBarMenuListItemButtonView;
64
68
  requiresForm?: boolean;
65
69
  }): void;
66
70
  /**
67
71
  * Creates the toolbar component.
68
72
  */
69
73
  private _createToolbarComponent;
74
+ /**
75
+ * Creates the menu bar component.
76
+ */
77
+ private _createMenuBarComponent;
70
78
  /**
71
79
  * Validates the integrations list.
72
80
  */
@@ -5,9 +5,9 @@
5
5
  /**
6
6
  * @module image/imageinsert/imageinsertui
7
7
  */
8
- import { Plugin } from 'ckeditor5/src/core.js';
8
+ import { Plugin, icons } from 'ckeditor5/src/core.js';
9
9
  import { logWarning } from 'ckeditor5/src/utils.js';
10
- import { createDropdown, SplitButtonView } from 'ckeditor5/src/ui.js';
10
+ import { createDropdown, MenuBarMenuListItemView, MenuBarMenuListView, MenuBarMenuView, SplitButtonView } from 'ckeditor5/src/ui.js';
11
11
  import ImageInsertFormView from './ui/imageinsertformview.js';
12
12
  import ImageUtils from '../imageutils.js';
13
13
  /**
@@ -18,6 +18,9 @@ import ImageUtils from '../imageutils.js';
18
18
  *
19
19
  * Adds the `'insertImage'` dropdown to the {@link module:ui/componentfactory~ComponentFactory UI component factory}
20
20
  * and also the `imageInsert` dropdown as an alias for backward compatibility.
21
+ *
22
+ * Adds the `'menuBar:insertImage'` sub-menu to the {@link module:ui/componentfactory~ComponentFactory UI component factory}, which is
23
+ * by default added to the `'Insert'` menu.
21
24
  */
22
25
  export default class ImageInsertUI extends Plugin {
23
26
  /**
@@ -59,14 +62,16 @@ export default class ImageInsertUI extends Plugin {
59
62
  this.isImageSelected = imageUtils.isImage(selection.getSelectedElement());
60
63
  });
61
64
  const componentCreator = (locale) => this._createToolbarComponent(locale);
65
+ const menuBarComponentCreator = (locale) => this._createMenuBarComponent(locale);
62
66
  // Register `insertImage` dropdown and add `imageInsert` dropdown as an alias for backward compatibility.
63
67
  editor.ui.componentFactory.add('insertImage', componentCreator);
64
68
  editor.ui.componentFactory.add('imageInsert', componentCreator);
69
+ editor.ui.componentFactory.add('menuBar:insertImage', menuBarComponentCreator);
65
70
  }
66
71
  /**
67
72
  * Registers the insert image dropdown integration.
68
73
  */
69
- registerIntegration({ name, observable, buttonViewCreator, formViewCreator, requiresForm }) {
74
+ registerIntegration({ name, observable, buttonViewCreator, formViewCreator, menuBarButtonViewCreator, requiresForm = false }) {
70
75
  if (this._integrations.has(name)) {
71
76
  /**
72
77
  * There are two insert-image integrations registered with the same name.
@@ -80,8 +85,9 @@ export default class ImageInsertUI extends Plugin {
80
85
  this._integrations.set(name, {
81
86
  observable,
82
87
  buttonViewCreator,
88
+ menuBarButtonViewCreator,
83
89
  formViewCreator,
84
- requiresForm: !!requiresForm
90
+ requiresForm
85
91
  });
86
92
  }
87
93
  /**
@@ -121,6 +127,37 @@ export default class ImageInsertUI extends Plugin {
121
127
  });
122
128
  return dropdownView;
123
129
  }
130
+ /**
131
+ * Creates the menu bar component.
132
+ */
133
+ _createMenuBarComponent(locale) {
134
+ const t = locale.t;
135
+ const integrations = this._prepareIntegrations();
136
+ if (!integrations.length) {
137
+ return null;
138
+ }
139
+ let resultView;
140
+ const firstIntegration = integrations[0];
141
+ if (integrations.length == 1) {
142
+ resultView = firstIntegration.menuBarButtonViewCreator(true);
143
+ }
144
+ else {
145
+ resultView = new MenuBarMenuView(locale);
146
+ const listView = new MenuBarMenuListView(locale);
147
+ resultView.panelView.children.add(listView);
148
+ resultView.buttonView.set({
149
+ icon: icons.image,
150
+ label: t('Image')
151
+ });
152
+ for (const integration of integrations) {
153
+ const listItemView = new MenuBarMenuListItemView(locale, resultView);
154
+ const buttonView = integration.menuBarButtonViewCreator(false);
155
+ listItemView.children.add(buttonView);
156
+ listView.items.add(listItemView);
157
+ }
158
+ }
159
+ return resultView;
160
+ }
124
161
  /**
125
162
  * Validates the integrations list.
126
163
  */
@@ -6,17 +6,22 @@
6
6
  * @module image/imageinsert/imageinsertviaurlui
7
7
  */
8
8
  import { Plugin } from 'ckeditor5/src/core.js';
9
+ import { Dialog } from 'ckeditor5/src/ui.js';
9
10
  import ImageInsertUI from './imageinsertui.js';
10
11
  /**
11
12
  * The image insert via URL plugin (UI part).
12
13
  *
13
- * For a detailed overview, check the {@glink features/images/images-inserting
14
- * Insert images via source URL} documentation.
14
+ * The plugin introduces two UI components to the {@link module:ui/componentfactory~ComponentFactory UI component factory}:
15
15
  *
16
- * This plugin registers the {@link module:image/imageinsert/imageinsertui~ImageInsertUI} integration for `url`.
16
+ * * the `'insertImageViaUrl'` toolbar button,
17
+ * * the `'menuBar:insertImageViaUrl'` menu bar component.
18
+ *
19
+ * It also integrates with the `insertImage` toolbar component and `menuBar:insertImage` menu component, which are default components
20
+ * through which inserting image via URL is available.
17
21
  */
18
22
  export default class ImageInsertViaUrlUI extends Plugin {
19
23
  private _imageInsertUI;
24
+ private _formView?;
20
25
  /**
21
26
  * @inheritDoc
22
27
  */
@@ -24,21 +29,38 @@ export default class ImageInsertViaUrlUI extends Plugin {
24
29
  /**
25
30
  * @inheritDoc
26
31
  */
27
- static get requires(): readonly [typeof ImageInsertUI];
32
+ static get requires(): readonly [typeof ImageInsertUI, typeof Dialog];
33
+ init(): void;
28
34
  /**
29
35
  * @inheritDoc
30
36
  */
31
37
  afterInit(): void;
32
38
  /**
33
- * Creates the view displayed in the dropdown.
39
+ * Creates the base for various kinds of the button component provided by this feature.
40
+ */
41
+ private _createInsertUrlButton;
42
+ /**
43
+ * Creates a simple toolbar button, with an icon and a tooltip.
44
+ */
45
+ private _createToolbarButton;
46
+ /**
47
+ * Creates a button for the dropdown view, with an icon, text and no tooltip.
48
+ */
49
+ private _createDropdownButton;
50
+ /**
51
+ * Creates a button for the menu bar.
52
+ */
53
+ private _createMenuBarButton;
54
+ /**
55
+ * Creates the form view used to submit the image URL.
34
56
  */
35
57
  private _createInsertUrlView;
36
58
  /**
37
- * Creates the toolbar button.
59
+ * Shows the insert image via URL form view in a modal.
38
60
  */
39
- private _createInsertUrlButton;
61
+ private _showModal;
40
62
  /**
41
- * Closes the dropdown.
63
+ * Executes appropriate command depending on selection and form value.
42
64
  */
43
- private _closePanel;
65
+ private _handleSave;
44
66
  }
@@ -6,16 +6,19 @@
6
6
  * @module image/imageinsert/imageinsertviaurlui
7
7
  */
8
8
  import { icons, Plugin } from 'ckeditor5/src/core.js';
9
- import { ButtonView, CollapsibleView, DropdownButtonView } from 'ckeditor5/src/ui.js';
9
+ import { ButtonView, Dialog, MenuBarMenuListItemButtonView } from 'ckeditor5/src/ui.js';
10
10
  import ImageInsertUI from './imageinsertui.js';
11
11
  import ImageInsertUrlView from './ui/imageinserturlview.js';
12
12
  /**
13
13
  * The image insert via URL plugin (UI part).
14
14
  *
15
- * For a detailed overview, check the {@glink features/images/images-inserting
16
- * Insert images via source URL} documentation.
15
+ * The plugin introduces two UI components to the {@link module:ui/componentfactory~ComponentFactory UI component factory}:
17
16
  *
18
- * This plugin registers the {@link module:image/imageinsert/imageinsertui~ImageInsertUI} integration for `url`.
17
+ * * the `'insertImageViaUrl'` toolbar button,
18
+ * * the `'menuBar:insertImageViaUrl'` menu bar component.
19
+ *
20
+ * It also integrates with the `insertImage` toolbar component and `menuBar:insertImage` menu component, which are default components
21
+ * through which inserting image via URL is available.
19
22
  */
20
23
  export default class ImageInsertViaUrlUI extends Plugin {
21
24
  /**
@@ -28,7 +31,11 @@ export default class ImageInsertViaUrlUI extends Plugin {
28
31
  * @inheritDoc
29
32
  */
30
33
  static get requires() {
31
- return [ImageInsertUI];
34
+ return [ImageInsertUI, Dialog];
35
+ }
36
+ init() {
37
+ this.editor.ui.componentFactory.add('insertImageViaUrl', () => this._createToolbarButton());
38
+ this.editor.ui.componentFactory.add('menuBar:insertImageViaUrl', () => this._createMenuBarButton('standalone'));
32
39
  }
33
40
  /**
34
41
  * @inheritDoc
@@ -38,84 +45,124 @@ export default class ImageInsertViaUrlUI extends Plugin {
38
45
  this._imageInsertUI.registerIntegration({
39
46
  name: 'url',
40
47
  observable: () => this.editor.commands.get('insertImage'),
41
- requiresForm: true,
42
- buttonViewCreator: isOnlyOne => this._createInsertUrlButton(isOnlyOne),
43
- formViewCreator: isOnlyOne => this._createInsertUrlView(isOnlyOne)
48
+ buttonViewCreator: () => this._createToolbarButton(),
49
+ formViewCreator: () => this._createDropdownButton(),
50
+ menuBarButtonViewCreator: isOnly => this._createMenuBarButton(isOnly ? 'insertOnly' : 'insertNested')
44
51
  });
45
52
  }
46
53
  /**
47
- * Creates the view displayed in the dropdown.
54
+ * Creates the base for various kinds of the button component provided by this feature.
55
+ */
56
+ _createInsertUrlButton(ButtonClass) {
57
+ const button = new ButtonClass(this.editor.locale);
58
+ button.icon = icons.imageUrl;
59
+ button.on('execute', () => {
60
+ this._showModal();
61
+ });
62
+ return button;
63
+ }
64
+ /**
65
+ * Creates a simple toolbar button, with an icon and a tooltip.
66
+ */
67
+ _createToolbarButton() {
68
+ const t = this.editor.locale.t;
69
+ const button = this._createInsertUrlButton(ButtonView);
70
+ button.tooltip = true;
71
+ button.bind('label').to(this._imageInsertUI, 'isImageSelected', isImageSelected => isImageSelected ? t('Update image URL') : t('Insert image via URL'));
72
+ return button;
73
+ }
74
+ /**
75
+ * Creates a button for the dropdown view, with an icon, text and no tooltip.
76
+ */
77
+ _createDropdownButton() {
78
+ const t = this.editor.locale.t;
79
+ const button = this._createInsertUrlButton(ButtonView);
80
+ button.withText = true;
81
+ button.bind('label').to(this._imageInsertUI, 'isImageSelected', isImageSelected => isImageSelected ? t('Update image URL') : t('Insert via URL'));
82
+ return button;
83
+ }
84
+ /**
85
+ * Creates a button for the menu bar.
86
+ */
87
+ _createMenuBarButton(type) {
88
+ const t = this.editor.locale.t;
89
+ const button = this._createInsertUrlButton(MenuBarMenuListItemButtonView);
90
+ button.withText = true;
91
+ switch (type) {
92
+ case 'standalone':
93
+ button.label = t('Image via URL');
94
+ break;
95
+ case 'insertOnly':
96
+ button.label = t('Image');
97
+ break;
98
+ case 'insertNested':
99
+ button.label = t('Via URL');
100
+ break;
101
+ }
102
+ return button;
103
+ }
104
+ /**
105
+ * Creates the form view used to submit the image URL.
48
106
  */
49
- _createInsertUrlView(isOnlyOne) {
107
+ _createInsertUrlView() {
50
108
  const editor = this.editor;
51
109
  const locale = editor.locale;
52
- const t = locale.t;
53
110
  const replaceImageSourceCommand = editor.commands.get('replaceImageSource');
54
111
  const insertImageCommand = editor.commands.get('insertImage');
55
112
  const imageInsertUrlView = new ImageInsertUrlView(locale);
56
- const collapsibleView = isOnlyOne ? null : new CollapsibleView(locale, [imageInsertUrlView]);
57
113
  imageInsertUrlView.bind('isImageSelected').to(this._imageInsertUI);
58
114
  imageInsertUrlView.bind('isEnabled').toMany([insertImageCommand, replaceImageSourceCommand], 'isEnabled', (...isEnabled) => (isEnabled.some(isCommandEnabled => isCommandEnabled)));
59
- // Set initial value because integrations are created on first dropdown open.
60
- imageInsertUrlView.imageURLInputValue = replaceImageSourceCommand.value || '';
61
- this._imageInsertUI.dropdownView.on('change:isOpen', () => {
62
- if (this._imageInsertUI.dropdownView.isOpen) {
63
- // Make sure that each time the panel shows up, the URL field remains in sync with the value of
64
- // the command. If the user typed in the input, then canceled and re-opened it without changing
65
- // the value of the media command (e.g. because they didn't change the selection), they would see
66
- // the old value instead of the actual value of the command.
67
- imageInsertUrlView.imageURLInputValue = replaceImageSourceCommand.value || '';
68
- if (collapsibleView) {
69
- collapsibleView.isCollapsed = true;
70
- }
71
- }
72
- // Note: Use the low priority to make sure the following listener starts working after the
73
- // default action of the drop-down is executed (i.e. the panel showed up). Otherwise, the
74
- // invisible form/input cannot be focused/selected.
75
- }, { priority: 'low' });
76
- imageInsertUrlView.on('submit', () => {
77
- if (replaceImageSourceCommand.isEnabled) {
78
- editor.execute('replaceImageSource', { source: imageInsertUrlView.imageURLInputValue });
79
- }
80
- else {
81
- editor.execute('insertImage', { source: imageInsertUrlView.imageURLInputValue });
82
- }
83
- this._closePanel();
84
- });
85
- imageInsertUrlView.on('cancel', () => this._closePanel());
86
- if (collapsibleView) {
87
- collapsibleView.set({
88
- isCollapsed: true
89
- });
90
- collapsibleView.bind('label').to(this._imageInsertUI, 'isImageSelected', isImageSelected => isImageSelected ?
91
- t('Update image URL') :
92
- t('Insert image via URL'));
93
- return collapsibleView;
94
- }
95
115
  return imageInsertUrlView;
96
116
  }
97
117
  /**
98
- * Creates the toolbar button.
118
+ * Shows the insert image via URL form view in a modal.
99
119
  */
100
- _createInsertUrlButton(isOnlyOne) {
101
- const ButtonClass = isOnlyOne ? DropdownButtonView : ButtonView;
120
+ _showModal() {
102
121
  const editor = this.editor;
103
- const button = new ButtonClass(editor.locale);
104
- const t = editor.locale.t;
105
- button.set({
106
- icon: icons.imageUrl,
107
- tooltip: true
122
+ const locale = editor.locale;
123
+ const t = locale.t;
124
+ const dialog = editor.plugins.get('Dialog');
125
+ if (!this._formView) {
126
+ this._formView = this._createInsertUrlView();
127
+ this._formView.on('submit', () => this._handleSave());
128
+ }
129
+ const replaceImageSourceCommand = editor.commands.get('replaceImageSource');
130
+ this._formView.imageURLInputValue = replaceImageSourceCommand.value || '';
131
+ dialog.show({
132
+ id: 'insertImageViaUrl',
133
+ title: this._imageInsertUI.isImageSelected ?
134
+ t('Update image URL') :
135
+ t('Insert image via URL'),
136
+ isModal: true,
137
+ content: this._formView,
138
+ actionButtons: [
139
+ {
140
+ label: t('Cancel'),
141
+ withText: true,
142
+ onExecute: () => dialog.hide()
143
+ },
144
+ {
145
+ label: t('Accept'),
146
+ class: 'ck-button-action',
147
+ withText: true,
148
+ onExecute: () => this._handleSave()
149
+ }
150
+ ]
108
151
  });
109
- button.bind('label').to(this._imageInsertUI, 'isImageSelected', isImageSelected => isImageSelected ?
110
- t('Update image URL') :
111
- t('Insert image via URL'));
112
- return button;
113
152
  }
114
153
  /**
115
- * Closes the dropdown.
154
+ * Executes appropriate command depending on selection and form value.
116
155
  */
117
- _closePanel() {
118
- this.editor.editing.view.focus();
119
- this._imageInsertUI.dropdownView.isOpen = false;
156
+ _handleSave() {
157
+ const replaceImageSourceCommand = this.editor.commands.get('replaceImageSource');
158
+ // If an image element is currently selected, we want to replace its source attribute (instead of inserting a new image).
159
+ // We detect if an image is selected by checking `replaceImageSource` command state.
160
+ if (replaceImageSourceCommand.isEnabled) {
161
+ this.editor.execute('replaceImageSource', { source: this._formView.imageURLInputValue });
162
+ }
163
+ else {
164
+ this.editor.execute('insertImage', { source: this._formView.imageURLInputValue });
165
+ }
166
+ this.editor.plugins.get('Dialog').hide();
120
167
  }
121
168
  }
@@ -44,20 +44,6 @@ export default class ImageInsertFormView extends View {
44
44
  this._focusables.addMany(view.children);
45
45
  }
46
46
  }
47
- if (this._focusables.length > 1) {
48
- for (const view of this._focusables) {
49
- if (isViewWithFocusCycler(view)) {
50
- view.focusCycler.on('forwardCycle', evt => {
51
- this._focusCycler.focusNext();
52
- evt.stop();
53
- });
54
- view.focusCycler.on('backwardCycle', evt => {
55
- this._focusCycler.focusPrevious();
56
- evt.stop();
57
- });
58
- }
59
- }
60
- }
61
47
  this.setTemplate({
62
48
  tag: 'form',
63
49
  attributes: {
@@ -107,6 +93,3 @@ export default class ImageInsertFormView extends View {
107
93
  this._focusCycler.focusFirst();
108
94
  }
109
95
  }
110
- function isViewWithFocusCycler(view) {
111
- return 'focusCycler' in view;
112
- }