@ckeditor/ckeditor5-bookmark 44.3.0 → 45.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 (314) hide show
  1. package/build/bookmark.js +2 -2
  2. package/build/translations/af.js +1 -1
  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/be.js +1 -0
  7. package/build/translations/bg.js +1 -1
  8. package/build/translations/bn.js +1 -1
  9. package/build/translations/bs.js +1 -1
  10. package/build/translations/ca.js +1 -1
  11. package/build/translations/cs.js +1 -1
  12. package/build/translations/da.js +1 -1
  13. package/build/translations/de-ch.js +1 -1
  14. package/build/translations/de.js +1 -1
  15. package/build/translations/el.js +1 -1
  16. package/build/translations/en-au.js +1 -1
  17. package/build/translations/en-gb.js +1 -1
  18. package/build/translations/eo.js +1 -1
  19. package/build/translations/es-co.js +1 -1
  20. package/build/translations/es.js +1 -1
  21. package/build/translations/et.js +1 -1
  22. package/build/translations/eu.js +1 -1
  23. package/build/translations/fa.js +1 -1
  24. package/build/translations/fi.js +1 -1
  25. package/build/translations/fr.js +1 -1
  26. package/build/translations/gl.js +1 -1
  27. package/build/translations/gu.js +1 -1
  28. package/build/translations/he.js +1 -1
  29. package/build/translations/hi.js +1 -1
  30. package/build/translations/hr.js +1 -1
  31. package/build/translations/hu.js +1 -1
  32. package/build/translations/hy.js +1 -1
  33. package/build/translations/id.js +1 -1
  34. package/build/translations/it.js +1 -1
  35. package/build/translations/ja.js +1 -1
  36. package/build/translations/jv.js +1 -1
  37. package/build/translations/kk.js +1 -1
  38. package/build/translations/km.js +1 -1
  39. package/build/translations/kn.js +1 -1
  40. package/build/translations/ko.js +1 -1
  41. package/build/translations/ku.js +1 -1
  42. package/build/translations/lt.js +1 -1
  43. package/build/translations/lv.js +1 -1
  44. package/build/translations/ms.js +1 -1
  45. package/build/translations/nb.js +1 -1
  46. package/build/translations/ne.js +1 -1
  47. package/build/translations/nl.js +1 -1
  48. package/build/translations/no.js +1 -1
  49. package/build/translations/oc.js +1 -1
  50. package/build/translations/pl.js +1 -1
  51. package/build/translations/pt-br.js +1 -1
  52. package/build/translations/pt.js +1 -1
  53. package/build/translations/ro.js +1 -1
  54. package/build/translations/ru.js +1 -1
  55. package/build/translations/si.js +1 -1
  56. package/build/translations/sk.js +1 -1
  57. package/build/translations/sl.js +1 -1
  58. package/build/translations/sq.js +1 -1
  59. package/build/translations/sr-latn.js +1 -1
  60. package/build/translations/sr.js +1 -1
  61. package/build/translations/sv.js +1 -1
  62. package/build/translations/th.js +1 -1
  63. package/build/translations/ti.js +1 -1
  64. package/build/translations/tk.js +1 -1
  65. package/build/translations/tr.js +1 -1
  66. package/build/translations/tt.js +1 -1
  67. package/build/translations/ug.js +1 -1
  68. package/build/translations/uk.js +1 -1
  69. package/build/translations/ur.js +1 -1
  70. package/build/translations/uz.js +1 -1
  71. package/build/translations/vi.js +1 -1
  72. package/build/translations/zh-cn.js +1 -1
  73. package/build/translations/zh.js +1 -1
  74. package/ckeditor5-metadata.json +1 -1
  75. package/dist/index-editor.css +56 -101
  76. package/dist/index.css +59 -119
  77. package/dist/index.css.map +1 -1
  78. package/dist/index.js +283 -389
  79. package/dist/index.js.map +1 -1
  80. package/dist/translations/af.js +1 -1
  81. package/dist/translations/af.umd.js +1 -1
  82. package/dist/translations/ar.js +1 -1
  83. package/dist/translations/ar.umd.js +1 -1
  84. package/dist/translations/ast.js +1 -1
  85. package/dist/translations/ast.umd.js +1 -1
  86. package/dist/translations/az.js +1 -1
  87. package/dist/translations/az.umd.js +1 -1
  88. package/dist/translations/be.d.ts +8 -0
  89. package/dist/translations/be.js +5 -0
  90. package/dist/translations/be.umd.js +11 -0
  91. package/dist/translations/bg.js +1 -1
  92. package/dist/translations/bg.umd.js +1 -1
  93. package/dist/translations/bn.js +1 -1
  94. package/dist/translations/bn.umd.js +1 -1
  95. package/dist/translations/bs.js +1 -1
  96. package/dist/translations/bs.umd.js +1 -1
  97. package/dist/translations/ca.js +1 -1
  98. package/dist/translations/ca.umd.js +1 -1
  99. package/dist/translations/cs.js +1 -1
  100. package/dist/translations/cs.umd.js +1 -1
  101. package/dist/translations/da.js +1 -1
  102. package/dist/translations/da.umd.js +1 -1
  103. package/dist/translations/de-ch.js +1 -1
  104. package/dist/translations/de-ch.umd.js +1 -1
  105. package/dist/translations/de.js +1 -1
  106. package/dist/translations/de.umd.js +1 -1
  107. package/dist/translations/el.js +1 -1
  108. package/dist/translations/el.umd.js +1 -1
  109. package/dist/translations/en-au.js +1 -1
  110. package/dist/translations/en-au.umd.js +1 -1
  111. package/dist/translations/en-gb.js +1 -1
  112. package/dist/translations/en-gb.umd.js +1 -1
  113. package/dist/translations/en.js +1 -1
  114. package/dist/translations/en.umd.js +1 -1
  115. package/dist/translations/eo.js +1 -1
  116. package/dist/translations/eo.umd.js +1 -1
  117. package/dist/translations/es-co.js +1 -1
  118. package/dist/translations/es-co.umd.js +1 -1
  119. package/dist/translations/es.js +1 -1
  120. package/dist/translations/es.umd.js +1 -1
  121. package/dist/translations/et.js +1 -1
  122. package/dist/translations/et.umd.js +1 -1
  123. package/dist/translations/eu.js +1 -1
  124. package/dist/translations/eu.umd.js +1 -1
  125. package/dist/translations/fa.js +1 -1
  126. package/dist/translations/fa.umd.js +1 -1
  127. package/dist/translations/fi.js +1 -1
  128. package/dist/translations/fi.umd.js +1 -1
  129. package/dist/translations/fr.js +1 -1
  130. package/dist/translations/fr.umd.js +1 -1
  131. package/dist/translations/gl.js +1 -1
  132. package/dist/translations/gl.umd.js +1 -1
  133. package/dist/translations/gu.js +1 -1
  134. package/dist/translations/gu.umd.js +1 -1
  135. package/dist/translations/he.js +1 -1
  136. package/dist/translations/he.umd.js +1 -1
  137. package/dist/translations/hi.js +1 -1
  138. package/dist/translations/hi.umd.js +1 -1
  139. package/dist/translations/hr.js +1 -1
  140. package/dist/translations/hr.umd.js +1 -1
  141. package/dist/translations/hu.js +1 -1
  142. package/dist/translations/hu.umd.js +1 -1
  143. package/dist/translations/hy.js +1 -1
  144. package/dist/translations/hy.umd.js +1 -1
  145. package/dist/translations/id.js +1 -1
  146. package/dist/translations/id.umd.js +1 -1
  147. package/dist/translations/it.js +1 -1
  148. package/dist/translations/it.umd.js +1 -1
  149. package/dist/translations/ja.js +1 -1
  150. package/dist/translations/ja.umd.js +1 -1
  151. package/dist/translations/jv.js +1 -1
  152. package/dist/translations/jv.umd.js +1 -1
  153. package/dist/translations/kk.js +1 -1
  154. package/dist/translations/kk.umd.js +1 -1
  155. package/dist/translations/km.js +1 -1
  156. package/dist/translations/km.umd.js +1 -1
  157. package/dist/translations/kn.js +1 -1
  158. package/dist/translations/kn.umd.js +1 -1
  159. package/dist/translations/ko.js +1 -1
  160. package/dist/translations/ko.umd.js +1 -1
  161. package/dist/translations/ku.js +1 -1
  162. package/dist/translations/ku.umd.js +1 -1
  163. package/dist/translations/lt.js +1 -1
  164. package/dist/translations/lt.umd.js +1 -1
  165. package/dist/translations/lv.js +1 -1
  166. package/dist/translations/lv.umd.js +1 -1
  167. package/dist/translations/ms.js +1 -1
  168. package/dist/translations/ms.umd.js +1 -1
  169. package/dist/translations/nb.js +1 -1
  170. package/dist/translations/nb.umd.js +1 -1
  171. package/dist/translations/ne.js +1 -1
  172. package/dist/translations/ne.umd.js +1 -1
  173. package/dist/translations/nl.js +1 -1
  174. package/dist/translations/nl.umd.js +1 -1
  175. package/dist/translations/no.js +1 -1
  176. package/dist/translations/no.umd.js +1 -1
  177. package/dist/translations/oc.js +1 -1
  178. package/dist/translations/oc.umd.js +1 -1
  179. package/dist/translations/pl.js +1 -1
  180. package/dist/translations/pl.umd.js +1 -1
  181. package/dist/translations/pt-br.js +1 -1
  182. package/dist/translations/pt-br.umd.js +1 -1
  183. package/dist/translations/pt.js +1 -1
  184. package/dist/translations/pt.umd.js +1 -1
  185. package/dist/translations/ro.js +1 -1
  186. package/dist/translations/ro.umd.js +1 -1
  187. package/dist/translations/ru.js +1 -1
  188. package/dist/translations/ru.umd.js +1 -1
  189. package/dist/translations/si.js +1 -1
  190. package/dist/translations/si.umd.js +1 -1
  191. package/dist/translations/sk.js +1 -1
  192. package/dist/translations/sk.umd.js +1 -1
  193. package/dist/translations/sl.js +1 -1
  194. package/dist/translations/sl.umd.js +1 -1
  195. package/dist/translations/sq.js +1 -1
  196. package/dist/translations/sq.umd.js +1 -1
  197. package/dist/translations/sr-latn.js +1 -1
  198. package/dist/translations/sr-latn.umd.js +1 -1
  199. package/dist/translations/sr.js +1 -1
  200. package/dist/translations/sr.umd.js +1 -1
  201. package/dist/translations/sv.js +1 -1
  202. package/dist/translations/sv.umd.js +1 -1
  203. package/dist/translations/th.js +1 -1
  204. package/dist/translations/th.umd.js +1 -1
  205. package/dist/translations/ti.js +1 -1
  206. package/dist/translations/ti.umd.js +1 -1
  207. package/dist/translations/tk.js +1 -1
  208. package/dist/translations/tk.umd.js +1 -1
  209. package/dist/translations/tr.js +1 -1
  210. package/dist/translations/tr.umd.js +1 -1
  211. package/dist/translations/tt.js +1 -1
  212. package/dist/translations/tt.umd.js +1 -1
  213. package/dist/translations/ug.js +1 -1
  214. package/dist/translations/ug.umd.js +1 -1
  215. package/dist/translations/uk.js +1 -1
  216. package/dist/translations/uk.umd.js +1 -1
  217. package/dist/translations/ur.js +1 -1
  218. package/dist/translations/ur.umd.js +1 -1
  219. package/dist/translations/uz.js +1 -1
  220. package/dist/translations/uz.umd.js +1 -1
  221. package/dist/translations/vi.js +1 -1
  222. package/dist/translations/vi.umd.js +1 -1
  223. package/dist/translations/zh-cn.js +1 -1
  224. package/dist/translations/zh-cn.umd.js +1 -1
  225. package/dist/translations/zh.js +1 -1
  226. package/dist/translations/zh.umd.js +1 -1
  227. package/lang/contexts.json +5 -3
  228. package/lang/translations/af.po +16 -8
  229. package/lang/translations/ar.po +16 -8
  230. package/lang/translations/ast.po +16 -8
  231. package/lang/translations/az.po +16 -8
  232. package/lang/translations/be.po +64 -0
  233. package/lang/translations/bg.po +16 -8
  234. package/lang/translations/bn.po +16 -8
  235. package/lang/translations/bs.po +16 -8
  236. package/lang/translations/ca.po +16 -8
  237. package/lang/translations/cs.po +16 -8
  238. package/lang/translations/da.po +16 -8
  239. package/lang/translations/de-ch.po +16 -8
  240. package/lang/translations/de.po +16 -8
  241. package/lang/translations/el.po +16 -8
  242. package/lang/translations/en-au.po +16 -8
  243. package/lang/translations/en-gb.po +16 -8
  244. package/lang/translations/en.po +16 -8
  245. package/lang/translations/eo.po +16 -8
  246. package/lang/translations/es-co.po +16 -8
  247. package/lang/translations/es.po +16 -8
  248. package/lang/translations/et.po +16 -8
  249. package/lang/translations/eu.po +16 -8
  250. package/lang/translations/fa.po +16 -8
  251. package/lang/translations/fi.po +16 -8
  252. package/lang/translations/fr.po +16 -8
  253. package/lang/translations/gl.po +16 -8
  254. package/lang/translations/gu.po +16 -8
  255. package/lang/translations/he.po +16 -8
  256. package/lang/translations/hi.po +16 -8
  257. package/lang/translations/hr.po +16 -8
  258. package/lang/translations/hu.po +16 -8
  259. package/lang/translations/hy.po +16 -8
  260. package/lang/translations/id.po +16 -8
  261. package/lang/translations/it.po +16 -8
  262. package/lang/translations/ja.po +16 -8
  263. package/lang/translations/jv.po +16 -8
  264. package/lang/translations/kk.po +16 -8
  265. package/lang/translations/km.po +16 -8
  266. package/lang/translations/kn.po +16 -8
  267. package/lang/translations/ko.po +16 -8
  268. package/lang/translations/ku.po +16 -8
  269. package/lang/translations/lt.po +16 -8
  270. package/lang/translations/lv.po +16 -8
  271. package/lang/translations/ms.po +16 -8
  272. package/lang/translations/nb.po +16 -8
  273. package/lang/translations/ne.po +16 -8
  274. package/lang/translations/nl.po +16 -8
  275. package/lang/translations/no.po +16 -8
  276. package/lang/translations/oc.po +16 -8
  277. package/lang/translations/pl.po +16 -8
  278. package/lang/translations/pt-br.po +16 -8
  279. package/lang/translations/pt.po +16 -8
  280. package/lang/translations/ro.po +16 -8
  281. package/lang/translations/ru.po +16 -8
  282. package/lang/translations/si.po +16 -8
  283. package/lang/translations/sk.po +16 -8
  284. package/lang/translations/sl.po +16 -8
  285. package/lang/translations/sq.po +16 -8
  286. package/lang/translations/sr-latn.po +16 -8
  287. package/lang/translations/sr.po +16 -8
  288. package/lang/translations/sv.po +16 -8
  289. package/lang/translations/th.po +16 -8
  290. package/lang/translations/ti.po +16 -8
  291. package/lang/translations/tk.po +16 -8
  292. package/lang/translations/tr.po +16 -8
  293. package/lang/translations/tt.po +16 -8
  294. package/lang/translations/ug.po +16 -8
  295. package/lang/translations/uk.po +16 -8
  296. package/lang/translations/ur.po +16 -8
  297. package/lang/translations/uz.po +16 -8
  298. package/lang/translations/vi.po +16 -8
  299. package/lang/translations/zh-cn.po +16 -8
  300. package/lang/translations/zh.po +16 -8
  301. package/package.json +8 -7
  302. package/src/bookmarkconfig.d.ts +24 -0
  303. package/src/bookmarkediting.d.ts +9 -1
  304. package/src/bookmarkediting.js +23 -9
  305. package/src/bookmarkui.d.ts +24 -57
  306. package/src/bookmarkui.js +208 -212
  307. package/src/ui/bookmarkformview.d.ts +24 -14
  308. package/src/ui/bookmarkformview.js +103 -62
  309. package/theme/bookmark.css +0 -46
  310. package/theme/bookmarkform.css +0 -38
  311. package/theme/bookmarktoolbar.css +4 -0
  312. package/src/ui/bookmarkactionsview.d.ts +0 -102
  313. package/src/ui/bookmarkactionsview.js +0 -154
  314. package/theme/bookmarkactions.css +0 -44
@@ -8,6 +8,7 @@
8
8
  import { ButtonView, LabeledFieldView, View, ViewCollection, type InputTextView } 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
+ import '@ckeditor/ckeditor5-ui/theme/components/form/form.css';
11
12
  import '../../theme/bookmarkform.css';
12
13
  /**
13
14
  * The bookmark form view controller class.
@@ -28,9 +29,13 @@ export default class BookmarkFormView extends View {
28
29
  */
29
30
  idInputView: LabeledFieldView<InputTextView>;
30
31
  /**
31
- * The Submit button view.
32
+ * The Back button view displayed in the header.
32
33
  */
33
- buttonView: ButtonView;
34
+ backButtonView: ButtonView;
35
+ /**
36
+ * A button used to submit the form.
37
+ */
38
+ saveButtonView: ButtonView;
34
39
  /**
35
40
  * A collection of form child views in the form.
36
41
  */
@@ -80,27 +85,23 @@ export default class BookmarkFormView extends View {
80
85
  */
81
86
  resetFormStatus(): void;
82
87
  /**
83
- * Creates header and form view.
88
+ * Creates a back button view that cancels the form.
84
89
  */
85
- private _createViewChildren;
90
+ private _createBackButton;
86
91
  /**
87
- * Creates form content view with input and button.
92
+ * Creates a save button view that saves the bookmark.
88
93
  */
89
- private _createFormContentView;
94
+ private _createSaveButton;
95
+ /**
96
+ * Creates a header view for the form.
97
+ */
98
+ private _createHeaderView;
90
99
  /**
91
100
  * Creates a labeled input view.
92
101
  *
93
102
  * @returns Labeled field view instance.
94
103
  */
95
104
  private _createIdInput;
96
- /**
97
- * Creates a button view.
98
- *
99
- * @param label The button label.
100
- * @param className The additional button CSS class name.
101
- * @returns The button view instance.
102
- */
103
- private _createButton;
104
105
  /**
105
106
  * The native DOM `value` of the {@link #idInputView} element.
106
107
  *
@@ -116,3 +117,12 @@ export default class BookmarkFormView extends View {
116
117
  * If string is returned, it is assumed that the form value is incorrect and the returned string is displayed in the error label
117
118
  */
118
119
  export type BookmarkFormValidatorCallback = (form: BookmarkFormView) => string | undefined;
120
+ /**
121
+ * Fired when the form view is canceled.
122
+ *
123
+ * @eventName ~BookmarkFormView#cancel
124
+ */
125
+ export type BookmarkFormViewCancelEvent = {
126
+ name: 'cancel';
127
+ args: [];
128
+ };
@@ -5,11 +5,14 @@
5
5
  /**
6
6
  * @module bookmark/ui/bookmarkformview
7
7
  */
8
- import { ButtonView, FocusCycler, LabeledFieldView, View, ViewCollection, createLabeledInputText, submitHandler, FormHeaderView } from 'ckeditor5/src/ui.js';
8
+ import { ButtonView, FocusCycler, FormRowView, LabeledFieldView, View, ViewCollection, createLabeledInputText, submitHandler, FormHeaderView } from 'ckeditor5/src/ui.js';
9
9
  import { FocusTracker, KeystrokeHandler } from 'ckeditor5/src/utils.js';
10
+ import { IconPreviousArrow } from '@ckeditor/ckeditor5-icons';
10
11
  // See: #8833.
11
12
  // eslint-disable-next-line ckeditor5-rules/ckeditor-imports
12
13
  import '@ckeditor/ckeditor5-ui/theme/components/responsive-form/responsiveform.css';
14
+ // eslint-disable-next-line ckeditor5-rules/ckeditor-imports
15
+ import '@ckeditor/ckeditor5-ui/theme/components/form/form.css';
13
16
  import '../../theme/bookmarkform.css';
14
17
  /**
15
18
  * The bookmark form view controller class.
@@ -17,6 +20,42 @@ import '../../theme/bookmarkform.css';
17
20
  * See {@link module:bookmark/ui/bookmarkformview~BookmarkFormView}.
18
21
  */
19
22
  export default class BookmarkFormView extends View {
23
+ /**
24
+ * Tracks information about DOM focus in the form.
25
+ */
26
+ focusTracker = new FocusTracker();
27
+ /**
28
+ * An instance of the {@link module:utils/keystrokehandler~KeystrokeHandler}.
29
+ */
30
+ keystrokes = new KeystrokeHandler();
31
+ /**
32
+ * The ID input view.
33
+ */
34
+ idInputView;
35
+ /**
36
+ * The Back button view displayed in the header.
37
+ */
38
+ backButtonView;
39
+ /**
40
+ * A button used to submit the form.
41
+ */
42
+ saveButtonView;
43
+ /**
44
+ * A collection of form child views in the form.
45
+ */
46
+ children;
47
+ /**
48
+ * An array of form validators used by {@link #isValid}.
49
+ */
50
+ _validators;
51
+ /**
52
+ * A collection of views that can be focused in the form.
53
+ */
54
+ _focusables = new ViewCollection();
55
+ /**
56
+ * Helps cycling over {@link #_focusables} in the form.
57
+ */
58
+ _focusCycler;
20
59
  /**
21
60
  * Creates an instance of the {@link module:bookmark/ui/bookmarkformview~BookmarkFormView} class.
22
61
  *
@@ -27,24 +66,28 @@ export default class BookmarkFormView extends View {
27
66
  */
28
67
  constructor(locale, validators) {
29
68
  super(locale);
30
- /**
31
- * Tracks information about DOM focus in the form.
32
- */
33
- this.focusTracker = new FocusTracker();
34
- /**
35
- * An instance of the {@link module:utils/keystrokehandler~KeystrokeHandler}.
36
- */
37
- this.keystrokes = new KeystrokeHandler();
38
- /**
39
- * A collection of views that can be focused in the form.
40
- */
41
- this._focusables = new ViewCollection();
42
- const t = locale.t;
43
69
  this._validators = validators;
70
+ // Create buttons.
71
+ this.backButtonView = this._createBackButton();
72
+ this.saveButtonView = this._createSaveButton();
73
+ // Create input fields.
44
74
  this.idInputView = this._createIdInput();
45
- this.buttonView = this._createButton(t('Insert'), 'ck-button-action ck-button-bold');
46
- this.buttonView.type = 'submit';
47
- this.children = this._createViewChildren();
75
+ this.children = this.createCollection([this._createHeaderView()]);
76
+ this.children.add(new FormRowView(locale, {
77
+ children: [
78
+ this.idInputView,
79
+ this.saveButtonView
80
+ ],
81
+ class: [
82
+ 'ck-form__row_with-submit',
83
+ 'ck-form__row_large-top-padding'
84
+ ]
85
+ }));
86
+ // Close the panel on esc key press when the **form has focus**.
87
+ this.keystrokes.set('Esc', (data, cancel) => {
88
+ this.fire('cancel');
89
+ cancel();
90
+ });
48
91
  this._focusCycler = new FocusCycler({
49
92
  focusables: this._focusables,
50
93
  focusTracker: this.focusTracker,
@@ -56,11 +99,15 @@ export default class BookmarkFormView extends View {
56
99
  focusNext: 'tab'
57
100
  }
58
101
  });
59
- const classList = ['ck', 'ck-bookmark-view'];
60
102
  this.setTemplate({
61
103
  tag: 'form',
62
104
  attributes: {
63
- class: classList,
105
+ class: [
106
+ 'ck',
107
+ 'ck-form',
108
+ 'ck-bookmark-form',
109
+ 'ck-responsive-form'
110
+ ],
64
111
  // https://github.com/ckeditor/ckeditor5-link/issues/90
65
112
  tabindex: '-1'
66
113
  },
@@ -76,8 +123,9 @@ export default class BookmarkFormView extends View {
76
123
  view: this
77
124
  });
78
125
  const childViews = [
126
+ this.backButtonView,
79
127
  this.idInputView,
80
- this.buttonView
128
+ this.saveButtonView
81
129
  ];
82
130
  childViews.forEach(v => {
83
131
  // Register the view as focusable.
@@ -100,7 +148,7 @@ export default class BookmarkFormView extends View {
100
148
  * Focuses the fist {@link #_focusables} in the form.
101
149
  */
102
150
  focus() {
103
- this._focusCycler.focusFirst();
151
+ this.idInputView.focus();
104
152
  }
105
153
  /**
106
154
  * Validates the form and returns `false` when some fields are invalid.
@@ -128,32 +176,44 @@ export default class BookmarkFormView extends View {
128
176
  this.idInputView.errorText = null;
129
177
  }
130
178
  /**
131
- * Creates header and form view.
179
+ * Creates a back button view that cancels the form.
132
180
  */
133
- _createViewChildren() {
134
- const children = this.createCollection();
135
- const t = this.t;
136
- children.add(new FormHeaderView(this.locale, { label: t('Bookmark') }));
137
- children.add(this._createFormContentView());
138
- return children;
181
+ _createBackButton() {
182
+ const t = this.locale.t;
183
+ const backButton = new ButtonView(this.locale);
184
+ backButton.set({
185
+ class: 'ck-button-back',
186
+ label: t('Back'),
187
+ icon: IconPreviousArrow,
188
+ tooltip: true
189
+ });
190
+ backButton.delegate('execute').to(this, 'cancel');
191
+ return backButton;
139
192
  }
140
193
  /**
141
- * Creates form content view with input and button.
194
+ * Creates a save button view that saves the bookmark.
142
195
  */
143
- _createFormContentView() {
144
- const view = new View(this.locale);
145
- const children = this.createCollection();
146
- const classList = ['ck', 'ck-bookmark-form', 'ck-responsive-form'];
147
- children.add(this.idInputView);
148
- children.add(this.buttonView);
149
- view.setTemplate({
150
- tag: 'div',
151
- attributes: {
152
- class: classList
153
- },
154
- children
196
+ _createSaveButton() {
197
+ const t = this.locale.t;
198
+ const saveButton = new ButtonView(this.locale);
199
+ saveButton.set({
200
+ label: t('Save'),
201
+ withText: true,
202
+ type: 'submit',
203
+ class: 'ck-button-action ck-button-bold'
204
+ });
205
+ return saveButton;
206
+ }
207
+ /**
208
+ * Creates a header view for the form.
209
+ */
210
+ _createHeaderView() {
211
+ const t = this.locale.t;
212
+ const header = new FormHeaderView(this.locale, {
213
+ label: t('Bookmark')
155
214
  });
156
- return view;
215
+ header.children.add(this.backButtonView, 0);
216
+ return header;
157
217
  }
158
218
  /**
159
219
  * Creates a labeled input view.
@@ -165,28 +225,9 @@ export default class BookmarkFormView extends View {
165
225
  const labeledInput = new LabeledFieldView(this.locale, createLabeledInputText);
166
226
  labeledInput.label = t('Bookmark name');
167
227
  labeledInput.infoText = t('Enter the bookmark name without spaces.');
228
+ labeledInput.class = 'ck-labeled-field-view_full-width';
168
229
  return labeledInput;
169
230
  }
170
- /**
171
- * Creates a button view.
172
- *
173
- * @param label The button label.
174
- * @param className The additional button CSS class name.
175
- * @returns The button view instance.
176
- */
177
- _createButton(label, className) {
178
- const button = new ButtonView(this.locale);
179
- button.set({
180
- label,
181
- withText: true
182
- });
183
- button.extendTemplate({
184
- attributes: {
185
- class: className
186
- }
187
- });
188
- return button;
189
- }
190
231
  /**
191
232
  * The native DOM `value` of the {@link #idInputView} element.
192
233
  *
@@ -2,49 +2,3 @@
2
2
  * Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
3
3
  * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
4
4
  */
5
-
6
- :root {
7
- --ck-bookmark-icon-hover-fill-color: var(--ck-color-widget-hover-border);
8
- --ck-bookmark-icon-selected-fill-color: var(--ck-color-focus-border);
9
- --ck-bookmark-icon-animation-duration: var(--ck-widget-handler-animation-duration);
10
- --ck-bookmark-icon-animation-curve: var(--ck-widget-handler-animation-curve);
11
- }
12
-
13
- .ck-bookmark {
14
- &.ck-widget {
15
- outline: none;
16
-
17
- & .ck-bookmark__icon .ck-icon__fill {
18
- transition: fill var(--ck-bookmark-icon-animation-duration) var(--ck-bookmark-icon-animation-curve);
19
- }
20
-
21
- &:hover {
22
- & .ck-bookmark__icon .ck-icon__fill {
23
- fill: var(--ck-bookmark-icon-hover-fill-color);
24
- }
25
- }
26
-
27
- &.ck-widget_selected {
28
- .ck-bookmark__icon .ck-icon__fill {
29
- fill: var(--ck-bookmark-icon-selected-fill-color);
30
- }
31
- }
32
-
33
- &.ck-widget_selected,
34
- &.ck-widget_selected:hover {
35
- outline: none;
36
- }
37
-
38
- & .ck-bookmark__icon {
39
- position: relative;
40
- /* To make it align with text baseline. */
41
- top: -0.1em;
42
-
43
- & .ck-icon {
44
- height: 1.2em;
45
- width: auto;
46
- vertical-align: middle;
47
- }
48
- }
49
- }
50
- }
@@ -2,41 +2,3 @@
2
2
  * Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
3
3
  * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
4
4
  */
5
-
6
- @import "@ckeditor/ckeditor5-ui/theme/mixins/_rwd.css";
7
-
8
- .ck.ck-bookmark-view {
9
- &:focus {
10
- outline: none;
11
- }
12
- }
13
-
14
- .ck.ck-bookmark-form {
15
- display: flex;
16
- align-items: flex-start;
17
-
18
- @mixin ck-media-phone {
19
- flex-wrap: wrap;
20
-
21
- & .ck-button,
22
- & .ck-labeled-field-view {
23
- flex-basis: 100%;
24
- }
25
-
26
- & .ck-button {
27
- justify-content: center;
28
- }
29
- }
30
-
31
- &.ck-responsive-form {
32
- & > .ck-button {
33
- @mixin ck-media-phone {
34
- &:nth-last-child(1) {
35
- margin: var(--ck-spacing-large);
36
- padding: 0 var(--ck-spacing-standard);
37
- border-radius: var(--ck-border-radius);
38
- }
39
- }
40
- }
41
- }
42
- }
@@ -0,0 +1,4 @@
1
+ /*
2
+ * Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
3
+ * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
4
+ */
@@ -1,102 +0,0 @@
1
- /**
2
- * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
3
- * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
4
- */
5
- /**
6
- * @module bookmark/ui/bookmarkactionsview
7
- */
8
- import { LabelView, ButtonView, View } from 'ckeditor5/src/ui.js';
9
- import { FocusTracker, KeystrokeHandler, type LocaleTranslate, type Locale } from 'ckeditor5/src/utils.js';
10
- import '@ckeditor/ckeditor5-ui/theme/components/responsive-form/responsiveform.css';
11
- import '../../theme/bookmarkactions.css';
12
- /**
13
- * The bookmark actions view class. This view displays the bookmark preview, allows
14
- * removing or editing the bookmark.
15
- */
16
- export default class BookmarkActionsView extends View {
17
- /**
18
- * Tracks information about DOM focus in the actions.
19
- */
20
- readonly focusTracker: FocusTracker;
21
- /**
22
- * An instance of the {@link module:utils/keystrokehandler~KeystrokeHandler}.
23
- */
24
- readonly keystrokes: KeystrokeHandler;
25
- /**
26
- * The bookmark preview view.
27
- */
28
- bookmarkPreviewView: LabelView;
29
- /**
30
- * The remove button view.
31
- */
32
- removeButtonView: ButtonView;
33
- /**
34
- * The edit bookmark button view.
35
- */
36
- editButtonView: ButtonView;
37
- /**
38
- * The id preview view.
39
- *
40
- * @observable
41
- */
42
- id: string | undefined;
43
- /**
44
- * A collection of views that can be focused in the view.
45
- */
46
- private readonly _focusables;
47
- /**
48
- * Helps cycling over {@link #_focusables} in the view.
49
- */
50
- private readonly _focusCycler;
51
- t: LocaleTranslate;
52
- /**
53
- * @inheritDoc
54
- */
55
- constructor(locale: Locale);
56
- /**
57
- * @inheritDoc
58
- */
59
- render(): void;
60
- /**
61
- * @inheritDoc
62
- */
63
- destroy(): void;
64
- /**
65
- * Focuses the fist {@link #_focusables} in the actions.
66
- */
67
- focus(): void;
68
- /**
69
- * Creates a button view.
70
- *
71
- * @param label The button label.
72
- * @param icon The button icon.
73
- * @param eventName An event name that the `ButtonView#execute` event will be delegated to.
74
- * @param additionalLabel An additional label outside the button.
75
- * @returns The button view instance.
76
- */
77
- private _createButton;
78
- /**
79
- * Creates a bookmark name preview label.
80
- *
81
- * @returns The label view instance.
82
- */
83
- private _createBookmarkPreviewView;
84
- }
85
- /**
86
- * Fired when the {@link ~BookmarkActionsView#editButtonView} is clicked.
87
- *
88
- * @eventName ~BookmarkActionsView#edit
89
- */
90
- export type EditEvent = {
91
- name: 'edit';
92
- args: [];
93
- };
94
- /**
95
- * Fired when the {@link ~BookmarkActionsView#removeButtonView} is clicked.
96
- *
97
- * @eventName ~BookmarkActionsView#remove
98
- */
99
- export type RemoveEvent = {
100
- name: 'remove';
101
- args: [];
102
- };
@@ -1,154 +0,0 @@
1
- /**
2
- * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
3
- * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
4
- */
5
- /**
6
- * @module bookmark/ui/bookmarkactionsview
7
- */
8
- import { LabelView, ButtonView, View, ViewCollection, FocusCycler } from 'ckeditor5/src/ui.js';
9
- import { FocusTracker, KeystrokeHandler } from 'ckeditor5/src/utils.js';
10
- import { icons } from 'ckeditor5/src/core.js';
11
- // eslint-disable-next-line ckeditor5-rules/ckeditor-imports
12
- import '@ckeditor/ckeditor5-ui/theme/components/responsive-form/responsiveform.css';
13
- import '../../theme/bookmarkactions.css';
14
- /**
15
- * The bookmark actions view class. This view displays the bookmark preview, allows
16
- * removing or editing the bookmark.
17
- */
18
- export default class BookmarkActionsView extends View {
19
- /**
20
- * @inheritDoc
21
- */
22
- constructor(locale) {
23
- super(locale);
24
- /**
25
- * Tracks information about DOM focus in the actions.
26
- */
27
- this.focusTracker = new FocusTracker();
28
- /**
29
- * An instance of the {@link module:utils/keystrokehandler~KeystrokeHandler}.
30
- */
31
- this.keystrokes = new KeystrokeHandler();
32
- /**
33
- * A collection of views that can be focused in the view.
34
- */
35
- this._focusables = new ViewCollection();
36
- const t = locale.t;
37
- this.bookmarkPreviewView = this._createBookmarkPreviewView();
38
- this.removeButtonView = this._createButton(t('Remove bookmark'), icons.remove, 'remove', this.bookmarkPreviewView);
39
- this.editButtonView = this._createButton(t('Edit bookmark'), icons.pencil, 'edit', this.bookmarkPreviewView);
40
- this.set('id', undefined);
41
- this._focusCycler = new FocusCycler({
42
- focusables: this._focusables,
43
- focusTracker: this.focusTracker,
44
- keystrokeHandler: this.keystrokes,
45
- actions: {
46
- // Navigate fields backwards using the Shift + Tab keystroke.
47
- focusPrevious: 'shift + tab',
48
- // Navigate fields forwards using the Tab key.
49
- focusNext: 'tab'
50
- }
51
- });
52
- this.setTemplate({
53
- tag: 'div',
54
- attributes: {
55
- class: [
56
- 'ck',
57
- 'ck-bookmark-actions',
58
- 'ck-responsive-form'
59
- ],
60
- // https://github.com/ckeditor/ckeditor5-link/issues/90
61
- tabindex: '-1'
62
- },
63
- children: [
64
- this.bookmarkPreviewView,
65
- this.editButtonView,
66
- this.removeButtonView
67
- ]
68
- });
69
- }
70
- /**
71
- * @inheritDoc
72
- */
73
- render() {
74
- super.render();
75
- const childViews = [
76
- this.editButtonView,
77
- this.removeButtonView
78
- ];
79
- childViews.forEach(v => {
80
- // Register the view as focusable.
81
- this._focusables.add(v);
82
- // Register the view in the focus tracker.
83
- this.focusTracker.add(v.element);
84
- });
85
- // Start listening for the keystrokes coming from #element.
86
- this.keystrokes.listenTo(this.element);
87
- }
88
- /**
89
- * @inheritDoc
90
- */
91
- destroy() {
92
- super.destroy();
93
- this.focusTracker.destroy();
94
- this.keystrokes.destroy();
95
- }
96
- /**
97
- * Focuses the fist {@link #_focusables} in the actions.
98
- */
99
- focus() {
100
- this._focusCycler.focusFirst();
101
- }
102
- /**
103
- * Creates a button view.
104
- *
105
- * @param label The button label.
106
- * @param icon The button icon.
107
- * @param eventName An event name that the `ButtonView#execute` event will be delegated to.
108
- * @param additionalLabel An additional label outside the button.
109
- * @returns The button view instance.
110
- */
111
- _createButton(label, icon, eventName, additionalLabel) {
112
- const button = new ButtonView(this.locale);
113
- button.set({
114
- label,
115
- icon,
116
- tooltip: true
117
- });
118
- button.delegate('execute').to(this, eventName);
119
- // Since button label `id` is bound to the `ariaLabelledBy` property
120
- // we need to modify this binding to include only the first ID token
121
- // as this button will be labeled by multiple labels.
122
- button.labelView.unbind('id');
123
- button.labelView.bind('id').to(button, 'ariaLabelledBy', ariaLabelledBy => {
124
- return getFirstToken(ariaLabelledBy);
125
- });
126
- button.ariaLabelledBy = `${button.ariaLabelledBy} ${additionalLabel.id}`;
127
- return button;
128
- }
129
- /**
130
- * Creates a bookmark name preview label.
131
- *
132
- * @returns The label view instance.
133
- */
134
- _createBookmarkPreviewView() {
135
- const label = new LabelView(this.locale);
136
- label.extendTemplate({
137
- attributes: {
138
- class: [
139
- 'ck',
140
- 'ck-bookmark-actions__preview'
141
- ]
142
- }
143
- });
144
- // Bind label text with the bookmark ID.
145
- label.bind('text').to(this, 'id');
146
- return label;
147
- }
148
- }
149
- /**
150
- * Returns the first token from space separated token list.
151
- */
152
- function getFirstToken(tokenList) {
153
- return tokenList.split(' ')[0];
154
- }