@ckeditor/ckeditor5-bookmark 44.3.0-alpha.7 → 45.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.
- package/build/bookmark.js +2 -2
- package/build/translations/af.js +1 -1
- package/build/translations/ar.js +1 -1
- package/build/translations/ast.js +1 -1
- package/build/translations/az.js +1 -1
- package/build/translations/be.js +1 -0
- package/build/translations/bg.js +1 -1
- package/build/translations/bn.js +1 -1
- package/build/translations/bs.js +1 -1
- package/build/translations/ca.js +1 -1
- package/build/translations/cs.js +1 -1
- package/build/translations/da.js +1 -1
- package/build/translations/de-ch.js +1 -1
- package/build/translations/de.js +1 -1
- package/build/translations/el.js +1 -1
- package/build/translations/en-au.js +1 -1
- package/build/translations/en-gb.js +1 -1
- package/build/translations/eo.js +1 -1
- package/build/translations/es-co.js +1 -1
- package/build/translations/es.js +1 -1
- package/build/translations/et.js +1 -1
- package/build/translations/eu.js +1 -1
- package/build/translations/fa.js +1 -1
- package/build/translations/fi.js +1 -1
- package/build/translations/fr.js +1 -1
- package/build/translations/gl.js +1 -1
- package/build/translations/gu.js +1 -1
- package/build/translations/he.js +1 -1
- package/build/translations/hi.js +1 -1
- package/build/translations/hr.js +1 -1
- package/build/translations/hu.js +1 -1
- package/build/translations/hy.js +1 -1
- package/build/translations/id.js +1 -1
- package/build/translations/it.js +1 -1
- package/build/translations/ja.js +1 -1
- package/build/translations/jv.js +1 -1
- package/build/translations/kk.js +1 -1
- package/build/translations/km.js +1 -1
- package/build/translations/kn.js +1 -1
- package/build/translations/ko.js +1 -1
- package/build/translations/ku.js +1 -1
- package/build/translations/lt.js +1 -1
- package/build/translations/lv.js +1 -1
- package/build/translations/ms.js +1 -1
- package/build/translations/nb.js +1 -1
- package/build/translations/ne.js +1 -1
- package/build/translations/nl.js +1 -1
- package/build/translations/no.js +1 -1
- package/build/translations/oc.js +1 -1
- package/build/translations/pl.js +1 -1
- package/build/translations/pt-br.js +1 -1
- package/build/translations/pt.js +1 -1
- package/build/translations/ro.js +1 -1
- package/build/translations/ru.js +1 -1
- package/build/translations/si.js +1 -1
- package/build/translations/sk.js +1 -1
- package/build/translations/sl.js +1 -1
- package/build/translations/sq.js +1 -1
- package/build/translations/sr-latn.js +1 -1
- package/build/translations/sr.js +1 -1
- package/build/translations/sv.js +1 -1
- package/build/translations/th.js +1 -1
- package/build/translations/ti.js +1 -1
- package/build/translations/tk.js +1 -1
- package/build/translations/tr.js +1 -1
- package/build/translations/tt.js +1 -1
- package/build/translations/ug.js +1 -1
- package/build/translations/uk.js +1 -1
- package/build/translations/ur.js +1 -1
- package/build/translations/uz.js +1 -1
- package/build/translations/vi.js +1 -1
- package/build/translations/zh-cn.js +1 -1
- package/build/translations/zh.js +1 -1
- package/ckeditor5-metadata.json +1 -1
- package/dist/index-editor.css +56 -101
- package/dist/index.css +59 -119
- package/dist/index.css.map +1 -1
- package/dist/index.js +282 -389
- package/dist/index.js.map +1 -1
- package/dist/translations/af.js +1 -1
- package/dist/translations/af.umd.js +1 -1
- package/dist/translations/ar.js +1 -1
- package/dist/translations/ar.umd.js +1 -1
- package/dist/translations/ast.js +1 -1
- package/dist/translations/ast.umd.js +1 -1
- package/dist/translations/az.js +1 -1
- package/dist/translations/az.umd.js +1 -1
- package/dist/translations/be.d.ts +8 -0
- package/dist/translations/be.js +5 -0
- package/dist/translations/be.umd.js +11 -0
- package/dist/translations/bg.js +1 -1
- package/dist/translations/bg.umd.js +1 -1
- package/dist/translations/bn.js +1 -1
- package/dist/translations/bn.umd.js +1 -1
- package/dist/translations/bs.js +1 -1
- package/dist/translations/bs.umd.js +1 -1
- package/dist/translations/ca.js +1 -1
- package/dist/translations/ca.umd.js +1 -1
- package/dist/translations/cs.js +1 -1
- package/dist/translations/cs.umd.js +1 -1
- package/dist/translations/da.js +1 -1
- package/dist/translations/da.umd.js +1 -1
- package/dist/translations/de-ch.js +1 -1
- package/dist/translations/de-ch.umd.js +1 -1
- package/dist/translations/de.js +1 -1
- package/dist/translations/de.umd.js +1 -1
- package/dist/translations/el.js +1 -1
- package/dist/translations/el.umd.js +1 -1
- package/dist/translations/en-au.js +1 -1
- package/dist/translations/en-au.umd.js +1 -1
- package/dist/translations/en-gb.js +1 -1
- package/dist/translations/en-gb.umd.js +1 -1
- package/dist/translations/en.js +1 -1
- package/dist/translations/en.umd.js +1 -1
- package/dist/translations/eo.js +1 -1
- package/dist/translations/eo.umd.js +1 -1
- package/dist/translations/es-co.js +1 -1
- package/dist/translations/es-co.umd.js +1 -1
- package/dist/translations/es.js +1 -1
- package/dist/translations/es.umd.js +1 -1
- package/dist/translations/et.js +1 -1
- package/dist/translations/et.umd.js +1 -1
- package/dist/translations/eu.js +1 -1
- package/dist/translations/eu.umd.js +1 -1
- package/dist/translations/fa.js +1 -1
- package/dist/translations/fa.umd.js +1 -1
- package/dist/translations/fi.js +1 -1
- package/dist/translations/fi.umd.js +1 -1
- package/dist/translations/fr.js +1 -1
- package/dist/translations/fr.umd.js +1 -1
- package/dist/translations/gl.js +1 -1
- package/dist/translations/gl.umd.js +1 -1
- package/dist/translations/gu.js +1 -1
- package/dist/translations/gu.umd.js +1 -1
- package/dist/translations/he.js +1 -1
- package/dist/translations/he.umd.js +1 -1
- package/dist/translations/hi.js +1 -1
- package/dist/translations/hi.umd.js +1 -1
- package/dist/translations/hr.js +1 -1
- package/dist/translations/hr.umd.js +1 -1
- package/dist/translations/hu.js +1 -1
- package/dist/translations/hu.umd.js +1 -1
- package/dist/translations/hy.js +1 -1
- package/dist/translations/hy.umd.js +1 -1
- package/dist/translations/id.js +1 -1
- package/dist/translations/id.umd.js +1 -1
- package/dist/translations/it.js +1 -1
- package/dist/translations/it.umd.js +1 -1
- package/dist/translations/ja.js +1 -1
- package/dist/translations/ja.umd.js +1 -1
- package/dist/translations/jv.js +1 -1
- package/dist/translations/jv.umd.js +1 -1
- package/dist/translations/kk.js +1 -1
- package/dist/translations/kk.umd.js +1 -1
- package/dist/translations/km.js +1 -1
- package/dist/translations/km.umd.js +1 -1
- package/dist/translations/kn.js +1 -1
- package/dist/translations/kn.umd.js +1 -1
- package/dist/translations/ko.js +1 -1
- package/dist/translations/ko.umd.js +1 -1
- package/dist/translations/ku.js +1 -1
- package/dist/translations/ku.umd.js +1 -1
- package/dist/translations/lt.js +1 -1
- package/dist/translations/lt.umd.js +1 -1
- package/dist/translations/lv.js +1 -1
- package/dist/translations/lv.umd.js +1 -1
- package/dist/translations/ms.js +1 -1
- package/dist/translations/ms.umd.js +1 -1
- package/dist/translations/nb.js +1 -1
- package/dist/translations/nb.umd.js +1 -1
- package/dist/translations/ne.js +1 -1
- package/dist/translations/ne.umd.js +1 -1
- package/dist/translations/nl.js +1 -1
- package/dist/translations/nl.umd.js +1 -1
- package/dist/translations/no.js +1 -1
- package/dist/translations/no.umd.js +1 -1
- package/dist/translations/oc.js +1 -1
- package/dist/translations/oc.umd.js +1 -1
- package/dist/translations/pl.js +1 -1
- package/dist/translations/pl.umd.js +1 -1
- package/dist/translations/pt-br.js +1 -1
- package/dist/translations/pt-br.umd.js +1 -1
- package/dist/translations/pt.js +1 -1
- package/dist/translations/pt.umd.js +1 -1
- package/dist/translations/ro.js +1 -1
- package/dist/translations/ro.umd.js +1 -1
- package/dist/translations/ru.js +1 -1
- package/dist/translations/ru.umd.js +1 -1
- package/dist/translations/si.js +1 -1
- package/dist/translations/si.umd.js +1 -1
- package/dist/translations/sk.js +1 -1
- package/dist/translations/sk.umd.js +1 -1
- package/dist/translations/sl.js +1 -1
- package/dist/translations/sl.umd.js +1 -1
- package/dist/translations/sq.js +1 -1
- package/dist/translations/sq.umd.js +1 -1
- package/dist/translations/sr-latn.js +1 -1
- package/dist/translations/sr-latn.umd.js +1 -1
- package/dist/translations/sr.js +1 -1
- package/dist/translations/sr.umd.js +1 -1
- package/dist/translations/sv.js +1 -1
- package/dist/translations/sv.umd.js +1 -1
- package/dist/translations/th.js +1 -1
- package/dist/translations/th.umd.js +1 -1
- package/dist/translations/ti.js +1 -1
- package/dist/translations/ti.umd.js +1 -1
- package/dist/translations/tk.js +1 -1
- package/dist/translations/tk.umd.js +1 -1
- package/dist/translations/tr.js +1 -1
- package/dist/translations/tr.umd.js +1 -1
- package/dist/translations/tt.js +1 -1
- package/dist/translations/tt.umd.js +1 -1
- package/dist/translations/ug.js +1 -1
- package/dist/translations/ug.umd.js +1 -1
- package/dist/translations/uk.js +1 -1
- package/dist/translations/uk.umd.js +1 -1
- package/dist/translations/ur.js +1 -1
- package/dist/translations/ur.umd.js +1 -1
- package/dist/translations/uz.js +1 -1
- package/dist/translations/uz.umd.js +1 -1
- package/dist/translations/vi.js +1 -1
- package/dist/translations/vi.umd.js +1 -1
- package/dist/translations/zh-cn.js +1 -1
- package/dist/translations/zh-cn.umd.js +1 -1
- package/dist/translations/zh.js +1 -1
- package/dist/translations/zh.umd.js +1 -1
- package/lang/contexts.json +5 -3
- package/lang/translations/af.po +16 -8
- package/lang/translations/ar.po +16 -8
- package/lang/translations/ast.po +16 -8
- package/lang/translations/az.po +16 -8
- package/lang/translations/be.po +64 -0
- package/lang/translations/bg.po +16 -8
- package/lang/translations/bn.po +16 -8
- package/lang/translations/bs.po +16 -8
- package/lang/translations/ca.po +16 -8
- package/lang/translations/cs.po +16 -8
- package/lang/translations/da.po +16 -8
- package/lang/translations/de-ch.po +16 -8
- package/lang/translations/de.po +16 -8
- package/lang/translations/el.po +16 -8
- package/lang/translations/en-au.po +16 -8
- package/lang/translations/en-gb.po +16 -8
- package/lang/translations/en.po +16 -8
- package/lang/translations/eo.po +16 -8
- package/lang/translations/es-co.po +16 -8
- package/lang/translations/es.po +16 -8
- package/lang/translations/et.po +16 -8
- package/lang/translations/eu.po +16 -8
- package/lang/translations/fa.po +16 -8
- package/lang/translations/fi.po +16 -8
- package/lang/translations/fr.po +16 -8
- package/lang/translations/gl.po +16 -8
- package/lang/translations/gu.po +16 -8
- package/lang/translations/he.po +16 -8
- package/lang/translations/hi.po +16 -8
- package/lang/translations/hr.po +16 -8
- package/lang/translations/hu.po +16 -8
- package/lang/translations/hy.po +16 -8
- package/lang/translations/id.po +16 -8
- package/lang/translations/it.po +16 -8
- package/lang/translations/ja.po +16 -8
- package/lang/translations/jv.po +16 -8
- package/lang/translations/kk.po +16 -8
- package/lang/translations/km.po +16 -8
- package/lang/translations/kn.po +16 -8
- package/lang/translations/ko.po +16 -8
- package/lang/translations/ku.po +16 -8
- package/lang/translations/lt.po +16 -8
- package/lang/translations/lv.po +16 -8
- package/lang/translations/ms.po +16 -8
- package/lang/translations/nb.po +16 -8
- package/lang/translations/ne.po +16 -8
- package/lang/translations/nl.po +16 -8
- package/lang/translations/no.po +16 -8
- package/lang/translations/oc.po +16 -8
- package/lang/translations/pl.po +16 -8
- package/lang/translations/pt-br.po +16 -8
- package/lang/translations/pt.po +16 -8
- package/lang/translations/ro.po +16 -8
- package/lang/translations/ru.po +16 -8
- package/lang/translations/si.po +16 -8
- package/lang/translations/sk.po +16 -8
- package/lang/translations/sl.po +16 -8
- package/lang/translations/sq.po +16 -8
- package/lang/translations/sr-latn.po +16 -8
- package/lang/translations/sr.po +16 -8
- package/lang/translations/sv.po +16 -8
- package/lang/translations/th.po +16 -8
- package/lang/translations/ti.po +16 -8
- package/lang/translations/tk.po +16 -8
- package/lang/translations/tr.po +16 -8
- package/lang/translations/tt.po +16 -8
- package/lang/translations/ug.po +16 -8
- package/lang/translations/uk.po +16 -8
- package/lang/translations/ur.po +16 -8
- package/lang/translations/uz.po +16 -8
- package/lang/translations/vi.po +16 -8
- package/lang/translations/zh-cn.po +16 -8
- package/lang/translations/zh.po +16 -8
- package/package.json +8 -7
- package/src/bookmarkconfig.d.ts +24 -0
- package/src/bookmarkediting.d.ts +9 -1
- package/src/bookmarkediting.js +23 -9
- package/src/bookmarkui.d.ts +24 -57
- package/src/bookmarkui.js +207 -212
- package/src/ui/bookmarkformview.d.ts +24 -14
- package/src/ui/bookmarkformview.js +103 -62
- package/theme/bookmark.css +0 -46
- package/theme/bookmarkform.css +0 -38
- package/theme/bookmarktoolbar.css +4 -0
- package/src/ui/bookmarkactionsview.d.ts +0 -102
- package/src/ui/bookmarkactionsview.js +0 -154
- 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
|
|
32
|
+
* The Back button view displayed in the header.
|
|
32
33
|
*/
|
|
33
|
-
|
|
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
|
|
88
|
+
* Creates a back button view that cancels the form.
|
|
84
89
|
*/
|
|
85
|
-
private
|
|
90
|
+
private _createBackButton;
|
|
86
91
|
/**
|
|
87
|
-
* Creates
|
|
92
|
+
* Creates a save button view that saves the bookmark.
|
|
88
93
|
*/
|
|
89
|
-
private
|
|
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.
|
|
46
|
-
this.
|
|
47
|
-
|
|
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:
|
|
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.
|
|
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.
|
|
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
|
|
179
|
+
* Creates a back button view that cancels the form.
|
|
132
180
|
*/
|
|
133
|
-
|
|
134
|
-
const
|
|
135
|
-
const
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
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
|
|
194
|
+
* Creates a save button view that saves the bookmark.
|
|
142
195
|
*/
|
|
143
|
-
|
|
144
|
-
const
|
|
145
|
-
const
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
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
|
-
|
|
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
|
*
|
package/theme/bookmark.css
CHANGED
|
@@ -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
|
-
}
|
package/theme/bookmarkform.css
CHANGED
|
@@ -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
|
-
}
|
|
@@ -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
|
-
}
|