@ckeditor/ckeditor5-media-embed 41.4.1 → 42.0.0-alpha.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 (227) hide show
  1. package/README.md +6 -0
  2. package/build/media-embed.js +2 -2
  3. package/build/translations/ar.js +1 -1
  4. package/build/translations/az.js +1 -1
  5. package/build/translations/bg.js +1 -1
  6. package/build/translations/bn.js +1 -1
  7. package/build/translations/ca.js +1 -1
  8. package/build/translations/cs.js +1 -1
  9. package/build/translations/da.js +1 -1
  10. package/build/translations/de-ch.js +1 -1
  11. package/build/translations/de.js +1 -1
  12. package/build/translations/el.js +1 -1
  13. package/build/translations/en-au.js +1 -1
  14. package/build/translations/en-gb.js +1 -1
  15. package/build/translations/es.js +1 -1
  16. package/build/translations/et.js +1 -1
  17. package/build/translations/fa.js +1 -1
  18. package/build/translations/fi.js +1 -1
  19. package/build/translations/fr.js +1 -1
  20. package/build/translations/gl.js +1 -1
  21. package/build/translations/he.js +1 -1
  22. package/build/translations/hi.js +1 -1
  23. package/build/translations/hr.js +1 -1
  24. package/build/translations/hu.js +1 -1
  25. package/build/translations/id.js +1 -1
  26. package/build/translations/it.js +1 -1
  27. package/build/translations/ja.js +1 -1
  28. package/build/translations/ko.js +1 -1
  29. package/build/translations/ku.js +1 -1
  30. package/build/translations/lt.js +1 -1
  31. package/build/translations/lv.js +1 -1
  32. package/build/translations/ms.js +1 -1
  33. package/build/translations/ne.js +1 -1
  34. package/build/translations/nl.js +1 -1
  35. package/build/translations/no.js +1 -1
  36. package/build/translations/pl.js +1 -1
  37. package/build/translations/pt-br.js +1 -1
  38. package/build/translations/pt.js +1 -1
  39. package/build/translations/ro.js +1 -1
  40. package/build/translations/ru.js +1 -1
  41. package/build/translations/sk.js +1 -1
  42. package/build/translations/sq.js +1 -1
  43. package/build/translations/sr-latn.js +1 -1
  44. package/build/translations/sr.js +1 -1
  45. package/build/translations/sv.js +1 -1
  46. package/build/translations/th.js +1 -1
  47. package/build/translations/tk.js +1 -1
  48. package/build/translations/tr.js +1 -1
  49. package/build/translations/uk.js +1 -1
  50. package/build/translations/ur.js +1 -1
  51. package/build/translations/uz.js +1 -1
  52. package/build/translations/vi.js +1 -1
  53. package/build/translations/zh-cn.js +1 -1
  54. package/build/translations/zh.js +1 -1
  55. package/dist/index-editor.css +5 -0
  56. package/dist/index.css +6 -0
  57. package/dist/index.css.map +1 -1
  58. package/dist/index.js +436 -379
  59. package/dist/index.js.map +1 -1
  60. package/dist/translations/ar.js +1 -1
  61. package/dist/translations/ar.umd.js +1 -1
  62. package/dist/translations/az.js +1 -1
  63. package/dist/translations/az.umd.js +1 -1
  64. package/dist/translations/bg.js +1 -1
  65. package/dist/translations/bg.umd.js +1 -1
  66. package/dist/translations/bn.js +1 -1
  67. package/dist/translations/bn.umd.js +1 -1
  68. package/dist/translations/ca.js +1 -1
  69. package/dist/translations/ca.umd.js +1 -1
  70. package/dist/translations/cs.js +1 -1
  71. package/dist/translations/cs.umd.js +1 -1
  72. package/dist/translations/da.js +1 -1
  73. package/dist/translations/da.umd.js +1 -1
  74. package/dist/translations/de-ch.js +1 -1
  75. package/dist/translations/de-ch.umd.js +1 -1
  76. package/dist/translations/de.js +1 -1
  77. package/dist/translations/de.umd.js +1 -1
  78. package/dist/translations/el.js +1 -1
  79. package/dist/translations/el.umd.js +1 -1
  80. package/dist/translations/en-au.js +1 -1
  81. package/dist/translations/en-au.umd.js +1 -1
  82. package/dist/translations/en-gb.js +1 -1
  83. package/dist/translations/en-gb.umd.js +1 -1
  84. package/dist/translations/en.js +1 -1
  85. package/dist/translations/en.umd.js +1 -1
  86. package/dist/translations/es.js +1 -1
  87. package/dist/translations/es.umd.js +1 -1
  88. package/dist/translations/et.js +1 -1
  89. package/dist/translations/et.umd.js +1 -1
  90. package/dist/translations/fa.js +1 -1
  91. package/dist/translations/fa.umd.js +1 -1
  92. package/dist/translations/fi.js +1 -1
  93. package/dist/translations/fi.umd.js +1 -1
  94. package/dist/translations/fr.js +1 -1
  95. package/dist/translations/fr.umd.js +1 -1
  96. package/dist/translations/gl.js +1 -1
  97. package/dist/translations/gl.umd.js +1 -1
  98. package/dist/translations/he.js +1 -1
  99. package/dist/translations/he.umd.js +1 -1
  100. package/dist/translations/hi.js +1 -1
  101. package/dist/translations/hi.umd.js +1 -1
  102. package/dist/translations/hr.js +1 -1
  103. package/dist/translations/hr.umd.js +1 -1
  104. package/dist/translations/hu.js +1 -1
  105. package/dist/translations/hu.umd.js +1 -1
  106. package/dist/translations/id.js +1 -1
  107. package/dist/translations/id.umd.js +1 -1
  108. package/dist/translations/it.js +1 -1
  109. package/dist/translations/it.umd.js +1 -1
  110. package/dist/translations/ja.js +1 -1
  111. package/dist/translations/ja.umd.js +1 -1
  112. package/dist/translations/ko.js +1 -1
  113. package/dist/translations/ko.umd.js +1 -1
  114. package/dist/translations/ku.js +1 -1
  115. package/dist/translations/ku.umd.js +1 -1
  116. package/dist/translations/lt.js +1 -1
  117. package/dist/translations/lt.umd.js +1 -1
  118. package/dist/translations/lv.js +1 -1
  119. package/dist/translations/lv.umd.js +1 -1
  120. package/dist/translations/ms.js +1 -1
  121. package/dist/translations/ms.umd.js +1 -1
  122. package/dist/translations/ne.js +1 -1
  123. package/dist/translations/ne.umd.js +1 -1
  124. package/dist/translations/nl.js +1 -1
  125. package/dist/translations/nl.umd.js +1 -1
  126. package/dist/translations/no.js +1 -1
  127. package/dist/translations/no.umd.js +1 -1
  128. package/dist/translations/pl.js +1 -1
  129. package/dist/translations/pl.umd.js +1 -1
  130. package/dist/translations/pt-br.js +1 -1
  131. package/dist/translations/pt-br.umd.js +1 -1
  132. package/dist/translations/pt.js +1 -1
  133. package/dist/translations/pt.umd.js +1 -1
  134. package/dist/translations/ro.js +1 -1
  135. package/dist/translations/ro.umd.js +1 -1
  136. package/dist/translations/ru.js +1 -1
  137. package/dist/translations/ru.umd.js +1 -1
  138. package/dist/translations/sk.js +1 -1
  139. package/dist/translations/sk.umd.js +1 -1
  140. package/dist/translations/sq.js +1 -1
  141. package/dist/translations/sq.umd.js +1 -1
  142. package/dist/translations/sr-latn.js +1 -1
  143. package/dist/translations/sr-latn.umd.js +1 -1
  144. package/dist/translations/sr.js +1 -1
  145. package/dist/translations/sr.umd.js +1 -1
  146. package/dist/translations/sv.js +1 -1
  147. package/dist/translations/sv.umd.js +1 -1
  148. package/dist/translations/th.js +1 -1
  149. package/dist/translations/th.umd.js +1 -1
  150. package/dist/translations/tk.js +1 -1
  151. package/dist/translations/tk.umd.js +1 -1
  152. package/dist/translations/tr.js +1 -1
  153. package/dist/translations/tr.umd.js +1 -1
  154. package/dist/translations/uk.js +1 -1
  155. package/dist/translations/uk.umd.js +1 -1
  156. package/dist/translations/ur.js +1 -1
  157. package/dist/translations/ur.umd.js +1 -1
  158. package/dist/translations/uz.js +1 -1
  159. package/dist/translations/uz.umd.js +1 -1
  160. package/dist/translations/vi.js +1 -1
  161. package/dist/translations/vi.umd.js +1 -1
  162. package/dist/translations/zh-cn.js +1 -1
  163. package/dist/translations/zh-cn.umd.js +1 -1
  164. package/dist/translations/zh.js +1 -1
  165. package/dist/translations/zh.umd.js +1 -1
  166. package/dist/types/mediaembedui.d.ts +9 -2
  167. package/dist/types/ui/mediaformview.d.ts +2 -28
  168. package/lang/contexts.json +1 -0
  169. package/lang/translations/ar.po +4 -0
  170. package/lang/translations/az.po +4 -0
  171. package/lang/translations/bg.po +4 -0
  172. package/lang/translations/bn.po +4 -0
  173. package/lang/translations/ca.po +4 -0
  174. package/lang/translations/cs.po +4 -0
  175. package/lang/translations/da.po +4 -0
  176. package/lang/translations/de-ch.po +4 -0
  177. package/lang/translations/de.po +4 -0
  178. package/lang/translations/el.po +4 -0
  179. package/lang/translations/en-au.po +4 -0
  180. package/lang/translations/en-gb.po +4 -0
  181. package/lang/translations/en.po +4 -0
  182. package/lang/translations/es.po +4 -0
  183. package/lang/translations/et.po +4 -0
  184. package/lang/translations/fa.po +4 -0
  185. package/lang/translations/fi.po +4 -0
  186. package/lang/translations/fr.po +4 -0
  187. package/lang/translations/gl.po +4 -0
  188. package/lang/translations/he.po +4 -0
  189. package/lang/translations/hi.po +4 -0
  190. package/lang/translations/hr.po +4 -0
  191. package/lang/translations/hu.po +4 -0
  192. package/lang/translations/id.po +4 -0
  193. package/lang/translations/it.po +4 -0
  194. package/lang/translations/ja.po +4 -0
  195. package/lang/translations/ko.po +4 -0
  196. package/lang/translations/ku.po +4 -0
  197. package/lang/translations/lt.po +4 -0
  198. package/lang/translations/lv.po +4 -0
  199. package/lang/translations/ms.po +4 -0
  200. package/lang/translations/ne.po +4 -0
  201. package/lang/translations/nl.po +4 -0
  202. package/lang/translations/no.po +4 -0
  203. package/lang/translations/pl.po +4 -0
  204. package/lang/translations/pt-br.po +4 -0
  205. package/lang/translations/pt.po +4 -0
  206. package/lang/translations/ro.po +4 -0
  207. package/lang/translations/ru.po +4 -0
  208. package/lang/translations/sk.po +4 -0
  209. package/lang/translations/sq.po +4 -0
  210. package/lang/translations/sr-latn.po +4 -0
  211. package/lang/translations/sr.po +4 -0
  212. package/lang/translations/sv.po +4 -0
  213. package/lang/translations/th.po +4 -0
  214. package/lang/translations/tk.po +4 -0
  215. package/lang/translations/tr.po +4 -0
  216. package/lang/translations/uk.po +4 -0
  217. package/lang/translations/ur.po +4 -0
  218. package/lang/translations/uz.po +4 -0
  219. package/lang/translations/vi.po +4 -0
  220. package/lang/translations/zh-cn.po +4 -0
  221. package/lang/translations/zh.po +4 -0
  222. package/package.json +3 -3
  223. package/src/mediaembedui.d.ts +9 -2
  224. package/src/mediaembedui.js +73 -50
  225. package/src/ui/mediaformview.d.ts +2 -28
  226. package/src/ui/mediaformview.js +8 -69
  227. package/theme/mediaform.css +6 -0
@@ -45,6 +45,10 @@ msgctxt "Toolbar button tooltip for the Media Embed feature."
45
45
  msgid "Insert media"
46
46
  msgstr "Wstaw media"
47
47
 
48
+ msgctxt "Label describing type of the inserted content (e.g. 'insert media')."
49
+ msgid "Media"
50
+ msgstr ""
51
+
48
52
  msgctxt "The label used by assistive technologies describing an image toolbar attached to an image widget."
49
53
  msgid "Media toolbar"
50
54
  msgstr "Pasek narzędzi mediów"
@@ -45,6 +45,10 @@ msgctxt "Toolbar button tooltip for the Media Embed feature."
45
45
  msgid "Insert media"
46
46
  msgstr "Inserir mídia"
47
47
 
48
+ msgctxt "Label describing type of the inserted content (e.g. 'insert media')."
49
+ msgid "Media"
50
+ msgstr ""
51
+
48
52
  msgctxt "The label used by assistive technologies describing an image toolbar attached to an image widget."
49
53
  msgid "Media toolbar"
50
54
  msgstr "Ferramentas de Mídia"
@@ -45,6 +45,10 @@ msgctxt "Toolbar button tooltip for the Media Embed feature."
45
45
  msgid "Insert media"
46
46
  msgstr "Inserir media"
47
47
 
48
+ msgctxt "Label describing type of the inserted content (e.g. 'insert media')."
49
+ msgid "Media"
50
+ msgstr ""
51
+
48
52
  msgctxt "The label used by assistive technologies describing an image toolbar attached to an image widget."
49
53
  msgid "Media toolbar"
50
54
  msgstr "Barra de ferramentas de media"
@@ -45,6 +45,10 @@ msgctxt "Toolbar button tooltip for the Media Embed feature."
45
45
  msgid "Insert media"
46
46
  msgstr "Inserează media"
47
47
 
48
+ msgctxt "Label describing type of the inserted content (e.g. 'insert media')."
49
+ msgid "Media"
50
+ msgstr ""
51
+
48
52
  msgctxt "The label used by assistive technologies describing an image toolbar attached to an image widget."
49
53
  msgid "Media toolbar"
50
54
  msgstr "Bară media"
@@ -45,6 +45,10 @@ msgctxt "Toolbar button tooltip for the Media Embed feature."
45
45
  msgid "Insert media"
46
46
  msgstr "Вставить медиа"
47
47
 
48
+ msgctxt "Label describing type of the inserted content (e.g. 'insert media')."
49
+ msgid "Media"
50
+ msgstr ""
51
+
48
52
  msgctxt "The label used by assistive technologies describing an image toolbar attached to an image widget."
49
53
  msgid "Media toolbar"
50
54
  msgstr "Панель инструментов медиа"
@@ -45,6 +45,10 @@ msgctxt "Toolbar button tooltip for the Media Embed feature."
45
45
  msgid "Insert media"
46
46
  msgstr "Vložiť média"
47
47
 
48
+ msgctxt "Label describing type of the inserted content (e.g. 'insert media')."
49
+ msgid "Media"
50
+ msgstr ""
51
+
48
52
  msgctxt "The label used by assistive technologies describing an image toolbar attached to an image widget."
49
53
  msgid "Media toolbar"
50
54
  msgstr "Nástroje pre médiá"
@@ -45,6 +45,10 @@ msgctxt "Toolbar button tooltip for the Media Embed feature."
45
45
  msgid "Insert media"
46
46
  msgstr "Shto Medie"
47
47
 
48
+ msgctxt "Label describing type of the inserted content (e.g. 'insert media')."
49
+ msgid "Media"
50
+ msgstr ""
51
+
48
52
  msgctxt "The label used by assistive technologies describing an image toolbar attached to an image widget."
49
53
  msgid "Media toolbar"
50
54
  msgstr "Kokështrirja e mediave"
@@ -45,6 +45,10 @@ msgctxt "Toolbar button tooltip for the Media Embed feature."
45
45
  msgid "Insert media"
46
46
  msgstr "Dodaj media"
47
47
 
48
+ msgctxt "Label describing type of the inserted content (e.g. 'insert media')."
49
+ msgid "Media"
50
+ msgstr ""
51
+
48
52
  msgctxt "The label used by assistive technologies describing an image toolbar attached to an image widget."
49
53
  msgid "Media toolbar"
50
54
  msgstr "Mediji traka sa alatkama"
@@ -45,6 +45,10 @@ msgctxt "Toolbar button tooltip for the Media Embed feature."
45
45
  msgid "Insert media"
46
46
  msgstr "Додај медиа"
47
47
 
48
+ msgctxt "Label describing type of the inserted content (e.g. 'insert media')."
49
+ msgid "Media"
50
+ msgstr ""
51
+
48
52
  msgctxt "The label used by assistive technologies describing an image toolbar attached to an image widget."
49
53
  msgid "Media toolbar"
50
54
  msgstr "Медији трака са алаткама"
@@ -45,6 +45,10 @@ msgctxt "Toolbar button tooltip for the Media Embed feature."
45
45
  msgid "Insert media"
46
46
  msgstr "Lägg in media"
47
47
 
48
+ msgctxt "Label describing type of the inserted content (e.g. 'insert media')."
49
+ msgid "Media"
50
+ msgstr ""
51
+
48
52
  msgctxt "The label used by assistive technologies describing an image toolbar attached to an image widget."
49
53
  msgid "Media toolbar"
50
54
  msgstr "Medieverktygsfält"
@@ -45,6 +45,10 @@ msgctxt "Toolbar button tooltip for the Media Embed feature."
45
45
  msgid "Insert media"
46
46
  msgstr "แทรกสื่อ"
47
47
 
48
+ msgctxt "Label describing type of the inserted content (e.g. 'insert media')."
49
+ msgid "Media"
50
+ msgstr ""
51
+
48
52
  msgctxt "The label used by assistive technologies describing an image toolbar attached to an image widget."
49
53
  msgid "Media toolbar"
50
54
  msgstr "แถบเครื่องมือสื่อ"
@@ -45,6 +45,10 @@ msgctxt "Toolbar button tooltip for the Media Embed feature."
45
45
  msgid "Insert media"
46
46
  msgstr "Mediýa goýuň"
47
47
 
48
+ msgctxt "Label describing type of the inserted content (e.g. 'insert media')."
49
+ msgid "Media"
50
+ msgstr ""
51
+
48
52
  msgctxt "The label used by assistive technologies describing an image toolbar attached to an image widget."
49
53
  msgid "Media toolbar"
50
54
  msgstr "Mediýa gurallar paneli"
@@ -45,6 +45,10 @@ msgctxt "Toolbar button tooltip for the Media Embed feature."
45
45
  msgid "Insert media"
46
46
  msgstr "Medya Ekle"
47
47
 
48
+ msgctxt "Label describing type of the inserted content (e.g. 'insert media')."
49
+ msgid "Media"
50
+ msgstr ""
51
+
48
52
  msgctxt "The label used by assistive technologies describing an image toolbar attached to an image widget."
49
53
  msgid "Media toolbar"
50
54
  msgstr "Medya araç çubuğu"
@@ -45,6 +45,10 @@ msgctxt "Toolbar button tooltip for the Media Embed feature."
45
45
  msgid "Insert media"
46
46
  msgstr "Вставити медіа"
47
47
 
48
+ msgctxt "Label describing type of the inserted content (e.g. 'insert media')."
49
+ msgid "Media"
50
+ msgstr ""
51
+
48
52
  msgctxt "The label used by assistive technologies describing an image toolbar attached to an image widget."
49
53
  msgid "Media toolbar"
50
54
  msgstr "Панель інструментів медіа"
@@ -45,6 +45,10 @@ msgctxt "Toolbar button tooltip for the Media Embed feature."
45
45
  msgid "Insert media"
46
46
  msgstr "میڈیا نصب کریں"
47
47
 
48
+ msgctxt "Label describing type of the inserted content (e.g. 'insert media')."
49
+ msgid "Media"
50
+ msgstr ""
51
+
48
52
  msgctxt "The label used by assistive technologies describing an image toolbar attached to an image widget."
49
53
  msgid "Media toolbar"
50
54
  msgstr "آلہ جات برائے میڈیا"
@@ -45,6 +45,10 @@ msgctxt "Toolbar button tooltip for the Media Embed feature."
45
45
  msgid "Insert media"
46
46
  msgstr "Mediani joylashtiring"
47
47
 
48
+ msgctxt "Label describing type of the inserted content (e.g. 'insert media')."
49
+ msgid "Media"
50
+ msgstr ""
51
+
48
52
  msgctxt "The label used by assistive technologies describing an image toolbar attached to an image widget."
49
53
  msgid "Media toolbar"
50
54
  msgstr "Media asboblar paneli"
@@ -45,6 +45,10 @@ msgctxt "Toolbar button tooltip for the Media Embed feature."
45
45
  msgid "Insert media"
46
46
  msgstr "Chèn đa phương tiện"
47
47
 
48
+ msgctxt "Label describing type of the inserted content (e.g. 'insert media')."
49
+ msgid "Media"
50
+ msgstr ""
51
+
48
52
  msgctxt "The label used by assistive technologies describing an image toolbar attached to an image widget."
49
53
  msgid "Media toolbar"
50
54
  msgstr "Thanh công cụ đa phương tiện"
@@ -45,6 +45,10 @@ msgctxt "Toolbar button tooltip for the Media Embed feature."
45
45
  msgid "Insert media"
46
46
  msgstr "插入媒体"
47
47
 
48
+ msgctxt "Label describing type of the inserted content (e.g. 'insert media')."
49
+ msgid "Media"
50
+ msgstr ""
51
+
48
52
  msgctxt "The label used by assistive technologies describing an image toolbar attached to an image widget."
49
53
  msgid "Media toolbar"
50
54
  msgstr "媒体工具栏"
@@ -45,6 +45,10 @@ msgctxt "Toolbar button tooltip for the Media Embed feature."
45
45
  msgid "Insert media"
46
46
  msgstr "插入影音"
47
47
 
48
+ msgctxt "Label describing type of the inserted content (e.g. 'insert media')."
49
+ msgid "Media"
50
+ msgstr ""
51
+
48
52
  msgctxt "The label used by assistive technologies describing an image toolbar attached to an image widget."
49
53
  msgid "Media toolbar"
50
54
  msgstr "影音工具"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ckeditor/ckeditor5-media-embed",
3
- "version": "41.4.1",
3
+ "version": "42.0.0-alpha.0",
4
4
  "description": "Media embed 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.1",
17
- "ckeditor5": "41.4.1"
16
+ "@ckeditor/ckeditor5-ui": "42.0.0-alpha.0",
17
+ "ckeditor5": "42.0.0-alpha.0"
18
18
  },
19
19
  "author": "CKSource (http://cksource.com/)",
20
20
  "license": "GPL-2.0-or-later",
@@ -6,6 +6,7 @@
6
6
  * @module media-embed/mediaembedui
7
7
  */
8
8
  import { Plugin } from 'ckeditor5/src/core.js';
9
+ import { Dialog } from 'ckeditor5/src/ui.js';
9
10
  import MediaEmbedEditing from './mediaembedediting.js';
10
11
  /**
11
12
  * The media embed UI plugin.
@@ -14,14 +15,20 @@ export default class MediaEmbedUI extends Plugin {
14
15
  /**
15
16
  * @inheritDoc
16
17
  */
17
- static get requires(): readonly [typeof MediaEmbedEditing];
18
+ static get requires(): readonly [typeof MediaEmbedEditing, typeof Dialog];
18
19
  /**
19
20
  * @inheritDoc
20
21
  */
21
22
  static get pluginName(): "MediaEmbedUI";
23
+ private _formView;
22
24
  /**
23
25
  * @inheritDoc
24
26
  */
25
27
  init(): void;
26
- private _setUpDropdown;
28
+ /**
29
+ * Creates a button for menu bar that will show media embed dialog.
30
+ */
31
+ private _createDialogButton;
32
+ private _showDialog;
33
+ private _handleSubmitForm;
27
34
  }
@@ -6,7 +6,7 @@
6
6
  * @module media-embed/mediaembedui
7
7
  */
8
8
  import { Plugin } from 'ckeditor5/src/core.js';
9
- import { createDropdown, CssTransitionDisablerMixin } from 'ckeditor5/src/ui.js';
9
+ import { ButtonView, CssTransitionDisablerMixin, MenuBarMenuListItemButtonView, Dialog } from 'ckeditor5/src/ui.js';
10
10
  import MediaFormView from './ui/mediaformview.js';
11
11
  import MediaEmbedEditing from './mediaembedediting.js';
12
12
  import mediaIcon from '../theme/icons/media.svg';
@@ -18,7 +18,7 @@ export default class MediaEmbedUI extends Plugin {
18
18
  * @inheritDoc
19
19
  */
20
20
  static get requires() {
21
- return [MediaEmbedEditing];
21
+ return [MediaEmbedEditing, Dialog];
22
22
  }
23
23
  /**
24
24
  * @inheritDoc
@@ -31,61 +31,84 @@ export default class MediaEmbedUI extends Plugin {
31
31
  */
32
32
  init() {
33
33
  const editor = this.editor;
34
+ editor.ui.componentFactory.add('mediaEmbed', () => {
35
+ const t = this.editor.locale.t;
36
+ const button = this._createDialogButton(ButtonView);
37
+ button.tooltip = true;
38
+ button.label = t('Insert media');
39
+ return button;
40
+ });
41
+ editor.ui.componentFactory.add('menuBar:mediaEmbed', () => {
42
+ const t = this.editor.locale.t;
43
+ const button = this._createDialogButton(MenuBarMenuListItemButtonView);
44
+ button.label = t('Media');
45
+ return button;
46
+ });
47
+ }
48
+ /**
49
+ * Creates a button for menu bar that will show media embed dialog.
50
+ */
51
+ _createDialogButton(ButtonClass) {
52
+ const editor = this.editor;
53
+ const buttonView = new ButtonClass(editor.locale);
34
54
  const command = editor.commands.get('mediaEmbed');
35
- editor.ui.componentFactory.add('mediaEmbed', locale => {
36
- const dropdown = createDropdown(locale);
37
- this._setUpDropdown(dropdown, command);
38
- return dropdown;
55
+ const dialogPlugin = this.editor.plugins.get('Dialog');
56
+ buttonView.icon = mediaIcon;
57
+ buttonView.bind('isEnabled').to(command, 'isEnabled');
58
+ buttonView.on('execute', () => {
59
+ if (dialogPlugin.id === 'mediaEmbed') {
60
+ dialogPlugin.hide();
61
+ }
62
+ else {
63
+ this._showDialog();
64
+ }
39
65
  });
66
+ return buttonView;
40
67
  }
41
- _setUpDropdown(dropdown, command) {
68
+ _showDialog() {
42
69
  const editor = this.editor;
43
- const t = editor.t;
44
- const button = dropdown.buttonView;
45
- const registry = editor.plugins.get(MediaEmbedEditing).registry;
46
- dropdown.once('change:isOpen', () => {
47
- const form = new (CssTransitionDisablerMixin(MediaFormView))(getFormValidators(editor.t, registry), editor.locale);
48
- dropdown.panelView.children.add(form);
49
- // Note: Use the low priority to make sure the following listener starts working after the
50
- // default action of the drop-down is executed (i.e. the panel showed up). Otherwise, the
51
- // invisible form/input cannot be focused/selected.
52
- button.on('open', () => {
53
- form.disableCssTransitions();
54
- // Make sure that each time the panel shows up, the URL field remains in sync with the value of
55
- // the command. If the user typed in the input, then canceled (`urlInputView#fieldView#value` stays
56
- // unaltered) and re-opened it without changing the value of the media command (e.g. because they
57
- // didn't change the selection), they would see the old value instead of the actual value of the
58
- // command.
59
- form.url = command.value || '';
60
- form.urlInputView.fieldView.select();
61
- form.enableCssTransitions();
62
- }, { priority: 'low' });
63
- dropdown.on('submit', () => {
64
- if (form.isValid()) {
65
- editor.execute('mediaEmbed', form.url);
66
- editor.editing.view.focus();
70
+ const dialog = editor.plugins.get('Dialog');
71
+ const command = editor.commands.get('mediaEmbed');
72
+ const t = editor.locale.t;
73
+ if (!this._formView) {
74
+ const registry = editor.plugins.get(MediaEmbedEditing).registry;
75
+ this._formView = new (CssTransitionDisablerMixin(MediaFormView))(getFormValidators(editor.t, registry), editor.locale);
76
+ this._formView.on('submit', () => this._handleSubmitForm());
77
+ }
78
+ dialog.show({
79
+ id: 'mediaEmbed',
80
+ title: t('Insert media'),
81
+ content: this._formView,
82
+ isModal: true,
83
+ onShow: () => {
84
+ this._formView.url = command.value || '';
85
+ this._formView.resetFormStatus();
86
+ this._formView.urlInputView.fieldView.select();
87
+ },
88
+ actionButtons: [
89
+ {
90
+ label: t('Cancel'),
91
+ withText: true,
92
+ onExecute: () => dialog.hide()
93
+ },
94
+ {
95
+ label: t('Accept'),
96
+ class: 'ck-button-action',
97
+ withText: true,
98
+ onExecute: () => this._handleSubmitForm()
67
99
  }
68
- });
69
- dropdown.on('change:isOpen', () => form.resetFormStatus());
70
- dropdown.on('cancel', () => {
71
- editor.editing.view.focus();
72
- });
73
- form.delegate('submit', 'cancel').to(dropdown);
74
- form.urlInputView.fieldView.bind('value').to(command, 'value');
75
- // Update balloon position when form error changes.
76
- form.urlInputView.on('change:errorText', () => {
77
- editor.ui.update();
78
- });
79
- // Form elements should be read-only when corresponding commands are disabled.
80
- form.urlInputView.bind('isEnabled').to(command, 'isEnabled');
81
- });
82
- dropdown.bind('isEnabled').to(command);
83
- button.set({
84
- label: t('Insert media'),
85
- icon: mediaIcon,
86
- tooltip: true
100
+ ]
87
101
  });
88
102
  }
103
+ _handleSubmitForm() {
104
+ const editor = this.editor;
105
+ const dialog = editor.plugins.get('Dialog');
106
+ if (this._formView.isValid()) {
107
+ editor.execute('mediaEmbed', this._formView.url);
108
+ dialog.hide();
109
+ editor.editing.view.focus();
110
+ }
111
+ }
89
112
  }
90
113
  function getFormValidators(t, registry) {
91
114
  return [
@@ -5,7 +5,7 @@
5
5
  /**
6
6
  * @module media-embed/ui/mediaformview
7
7
  */
8
- import { type InputTextView, ButtonView, LabeledFieldView, View } from 'ckeditor5/src/ui.js';
8
+ import { type InputTextView, LabeledFieldView, View } from 'ckeditor5/src/ui.js';
9
9
  import { FocusTracker, KeystrokeHandler, type Locale } from 'ckeditor5/src/utils.js';
10
10
  import '@ckeditor/ckeditor5-ui/theme/components/responsive-form/responsiveform.css';
11
11
  import '../../theme/mediaform.css';
@@ -31,22 +31,6 @@ export default class MediaFormView extends View {
31
31
  * The URL input view.
32
32
  */
33
33
  urlInputView: LabeledFieldView<InputTextView>;
34
- /**
35
- * The Save button view.
36
- */
37
- saveButtonView: ButtonView;
38
- /**
39
- * The Cancel button view.
40
- */
41
- cancelButtonView: ButtonView;
42
- /**
43
- * A collection of views that can be focused in the form.
44
- */
45
- private readonly _focusables;
46
- /**
47
- * Helps cycling over {@link #_focusables} in the form.
48
- */
49
- private readonly _focusCycler;
50
34
  /**
51
35
  * An array of form validators used by {@link #isValid}.
52
36
  */
@@ -74,7 +58,7 @@ export default class MediaFormView extends View {
74
58
  */
75
59
  destroy(): void;
76
60
  /**
77
- * Focuses the fist {@link #_focusables} in the form.
61
+ * Focuses the {@link #urlInputView}.
78
62
  */
79
63
  focus(): void;
80
64
  /**
@@ -102,14 +86,4 @@ export default class MediaFormView extends View {
102
86
  * @returns Labeled input view instance.
103
87
  */
104
88
  private _createUrlInput;
105
- /**
106
- * Creates a button view.
107
- *
108
- * @param label The button label.
109
- * @param icon The button icon.
110
- * @param className The additional button CSS class name.
111
- * @param eventName An event name that the `ButtonView#execute` event will be delegated to.
112
- * @returns The button view instance.
113
- */
114
- private _createButton;
115
89
  }
@@ -5,9 +5,8 @@
5
5
  /**
6
6
  * @module media-embed/ui/mediaformview
7
7
  */
8
- import { ButtonView, FocusCycler, LabeledFieldView, View, ViewCollection, createLabeledInputText, submitHandler } from 'ckeditor5/src/ui.js';
8
+ import { LabeledFieldView, View, createLabeledInputText, submitHandler } from 'ckeditor5/src/ui.js';
9
9
  import { FocusTracker, KeystrokeHandler } from 'ckeditor5/src/utils.js';
10
- import { icons } from 'ckeditor5/src/core.js';
11
10
  // See: #8833.
12
11
  // eslint-disable-next-line ckeditor5-rules/ckeditor-imports
13
12
  import '@ckeditor/ckeditor5-ui/theme/components/responsive-form/responsiveform.css';
@@ -24,26 +23,10 @@ export default class MediaFormView extends View {
24
23
  */
25
24
  constructor(validators, locale) {
26
25
  super(locale);
27
- const t = locale.t;
28
26
  this.focusTracker = new FocusTracker();
29
27
  this.keystrokes = new KeystrokeHandler();
30
28
  this.set('mediaURLInputValue', '');
31
29
  this.urlInputView = this._createUrlInput();
32
- this.saveButtonView = this._createButton(t('Save'), icons.check, 'ck-button-save');
33
- this.saveButtonView.type = 'submit';
34
- this.cancelButtonView = this._createButton(t('Cancel'), icons.cancel, 'ck-button-cancel', 'cancel');
35
- this._focusables = new ViewCollection();
36
- this._focusCycler = new FocusCycler({
37
- focusables: this._focusables,
38
- focusTracker: this.focusTracker,
39
- keystrokeHandler: this.keystrokes,
40
- actions: {
41
- // Navigate form fields backwards using the <kbd>Shift</kbd> + <kbd>Tab</kbd> keystroke.
42
- focusPrevious: 'shift + tab',
43
- // Navigate form fields forwards using the <kbd>Tab</kbd> key.
44
- focusNext: 'tab'
45
- }
46
- });
47
30
  this._validators = validators;
48
31
  this.setTemplate({
49
32
  tag: 'form',
@@ -56,9 +39,7 @@ export default class MediaFormView extends View {
56
39
  tabindex: '-1'
57
40
  },
58
41
  children: [
59
- this.urlInputView,
60
- this.saveButtonView,
61
- this.cancelButtonView
42
+ this.urlInputView
62
43
  ]
63
44
  });
64
45
  }
@@ -70,27 +51,10 @@ export default class MediaFormView extends View {
70
51
  submitHandler({
71
52
  view: this
72
53
  });
73
- const childViews = [
74
- this.urlInputView,
75
- this.saveButtonView,
76
- this.cancelButtonView
77
- ];
78
- childViews.forEach(v => {
79
- // Register the view as focusable.
80
- this._focusables.add(v);
81
- // Register the view in the focus tracker.
82
- this.focusTracker.add(v.element);
83
- });
54
+ // Register the view in the focus tracker.
55
+ this.focusTracker.add(this.urlInputView.element);
84
56
  // Start listening for the keystrokes coming from #element.
85
57
  this.keystrokes.listenTo(this.element);
86
- const stopPropagation = (data) => data.stopPropagation();
87
- // Since the form is in the dropdown panel which is a child of the toolbar, the toolbar's
88
- // keystroke handler would take over the key management in the URL input. We need to prevent
89
- // this ASAP. Otherwise, the basic caret movement using the arrow keys will be impossible.
90
- this.keystrokes.set('arrowright', stopPropagation);
91
- this.keystrokes.set('arrowleft', stopPropagation);
92
- this.keystrokes.set('arrowup', stopPropagation);
93
- this.keystrokes.set('arrowdown', stopPropagation);
94
58
  }
95
59
  /**
96
60
  * @inheritDoc
@@ -101,10 +65,10 @@ export default class MediaFormView extends View {
101
65
  this.keystrokes.destroy();
102
66
  }
103
67
  /**
104
- * Focuses the fist {@link #_focusables} in the form.
68
+ * Focuses the {@link #urlInputView}.
105
69
  */
106
70
  focus() {
107
- this._focusCycler.focusFirst();
71
+ this.urlInputView.focus();
108
72
  }
109
73
  /**
110
74
  * The native DOM `value` of the {@link #urlInputView} element.
@@ -116,7 +80,7 @@ export default class MediaFormView extends View {
116
80
  return this.urlInputView.fieldView.element.value.trim();
117
81
  }
118
82
  set url(url) {
119
- this.urlInputView.fieldView.element.value = url.trim();
83
+ this.urlInputView.fieldView.value = url.trim();
120
84
  }
121
85
  /**
122
86
  * Validates the form and returns `false` when some fields are invalid.
@@ -157,6 +121,7 @@ export default class MediaFormView extends View {
157
121
  this._urlInputViewInfoTip = t('Tip: Paste the URL into the content to embed faster.');
158
122
  labeledInput.label = t('Media URL');
159
123
  labeledInput.infoText = this._urlInputViewInfoDefault;
124
+ inputField.inputMode = 'url';
160
125
  inputField.on('input', () => {
161
126
  // Display the tip text only when there is some value. Otherwise fall back to the default info text.
162
127
  labeledInput.infoText = inputField.element.value ? this._urlInputViewInfoTip : this._urlInputViewInfoDefault;
@@ -164,30 +129,4 @@ export default class MediaFormView extends View {
164
129
  });
165
130
  return labeledInput;
166
131
  }
167
- /**
168
- * Creates a button view.
169
- *
170
- * @param label The button label.
171
- * @param icon The button icon.
172
- * @param className The additional button CSS class name.
173
- * @param eventName An event name that the `ButtonView#execute` event will be delegated to.
174
- * @returns The button view instance.
175
- */
176
- _createButton(label, icon, className, eventName) {
177
- const button = new ButtonView(this.locale);
178
- button.set({
179
- label,
180
- icon,
181
- tooltip: true
182
- });
183
- button.extendTemplate({
184
- attributes: {
185
- class: className
186
- }
187
- });
188
- if (eventName) {
189
- button.delegate('execute').to(this, eventName);
190
- }
191
- return button;
192
- }
193
132
  }
@@ -10,15 +10,21 @@
10
10
  align-items: flex-start;
11
11
  flex-direction: row;
12
12
  flex-wrap: nowrap;
13
+ width: 400px;
13
14
 
14
15
  & .ck-labeled-field-view {
15
16
  display: inline-block;
17
+ width: 100%;
16
18
  }
17
19
 
18
20
  & .ck-label {
19
21
  display: none;
20
22
  }
21
23
 
24
+ & .ck-input {
25
+ width: 100%;
26
+ }
27
+
22
28
  @mixin ck-media-phone {
23
29
  flex-wrap: wrap;
24
30