@ckeditor/ckeditor5-special-characters 39.0.1 → 40.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.md +1 -1
- package/README.md +3 -3
- package/build/special-characters.js.map +1 -0
- package/build/translations/pt-br.js +1 -1
- package/lang/translations/ar.po +1 -0
- package/lang/translations/az.po +1 -0
- package/lang/translations/bg.po +1 -0
- package/lang/translations/bn.po +1 -0
- package/lang/translations/ca.po +1 -0
- package/lang/translations/cs.po +1 -0
- package/lang/translations/da.po +1 -0
- package/lang/translations/de.po +1 -0
- package/lang/translations/el.po +1 -0
- package/lang/translations/en-au.po +1 -0
- package/lang/translations/en.po +1 -0
- package/lang/translations/es.po +1 -0
- package/lang/translations/et.po +1 -0
- package/lang/translations/fa.po +1 -0
- package/lang/translations/fi.po +1 -0
- package/lang/translations/fr.po +1 -0
- package/lang/translations/gl.po +1 -0
- package/lang/translations/he.po +1 -0
- package/lang/translations/hi.po +1 -0
- package/lang/translations/hr.po +1 -0
- package/lang/translations/hu.po +1 -0
- package/lang/translations/id.po +1 -0
- package/lang/translations/it.po +1 -0
- package/lang/translations/ja.po +1 -0
- package/lang/translations/ko.po +1 -0
- package/lang/translations/lt.po +1 -0
- package/lang/translations/lv.po +1 -0
- package/lang/translations/ms.po +1 -0
- package/lang/translations/nl.po +1 -0
- package/lang/translations/no.po +1 -0
- package/lang/translations/pl.po +1 -0
- package/lang/translations/pt-br.po +42 -41
- package/lang/translations/pt.po +1 -0
- package/lang/translations/ro.po +1 -0
- package/lang/translations/ru.po +1 -0
- package/lang/translations/sk.po +1 -0
- package/lang/translations/sq.po +1 -0
- package/lang/translations/sr-latn.po +1 -0
- package/lang/translations/sr.po +1 -0
- package/lang/translations/sv.po +1 -0
- package/lang/translations/th.po +1 -0
- package/lang/translations/tk.po +1 -0
- package/lang/translations/tr.po +1 -0
- package/lang/translations/uk.po +1 -0
- package/lang/translations/ur.po +1 -0
- package/lang/translations/uz.po +1 -0
- package/lang/translations/vi.po +1 -0
- package/lang/translations/zh-cn.po +1 -0
- package/lang/translations/zh.po +1 -0
- package/package.json +2 -6
- package/src/augmentation.d.ts +24 -24
- package/src/augmentation.js +5 -5
- package/src/index.d.ts +16 -16
- package/src/index.js +15 -15
- package/src/specialcharacters.d.ts +96 -96
- package/src/specialcharacters.js +206 -206
- package/src/specialcharactersarrows.d.ts +30 -30
- package/src/specialcharactersarrows.js +60 -60
- package/src/specialcharactersconfig.d.ts +51 -51
- package/src/specialcharactersconfig.js +5 -5
- package/src/specialcharacterscurrency.d.ts +30 -30
- package/src/specialcharacterscurrency.js +74 -74
- package/src/specialcharactersessentials.d.ts +35 -35
- package/src/specialcharactersessentials.js +45 -45
- package/src/specialcharacterslatin.d.ts +30 -30
- package/src/specialcharacterslatin.js +166 -166
- package/src/specialcharactersmathematical.d.ts +30 -30
- package/src/specialcharactersmathematical.js +82 -82
- package/src/specialcharacterstext.d.ts +30 -30
- package/src/specialcharacterstext.js +65 -65
- package/src/ui/charactergridview.d.ts +94 -94
- package/src/ui/charactergridview.js +129 -129
- package/src/ui/characterinfoview.d.ts +35 -35
- package/src/ui/characterinfoview.js +71 -71
- package/src/ui/specialcharactersnavigationview.d.ts +59 -59
- package/src/ui/specialcharactersnavigationview.js +95 -95
- package/src/ui/specialcharactersview.d.ts +65 -65
- package/src/ui/specialcharactersview.js +78 -78
|
@@ -1,95 +1,95 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
4
|
-
*/
|
|
5
|
-
/**
|
|
6
|
-
* @module special-characters/ui/specialcharactersnavigationview
|
|
7
|
-
*/
|
|
8
|
-
import { Collection } from 'ckeditor5/src/utils';
|
|
9
|
-
import { addListToDropdown, createDropdown, Model, FormHeaderView } from 'ckeditor5/src/ui';
|
|
10
|
-
/**
|
|
11
|
-
* A class representing the navigation part of the special characters UI. It is responsible
|
|
12
|
-
* for describing the feature and allowing the user to select a particular character group.
|
|
13
|
-
*/
|
|
14
|
-
export default class SpecialCharactersNavigationView extends FormHeaderView {
|
|
15
|
-
/**
|
|
16
|
-
* Creates an instance of the {@link module:special-characters/ui/specialcharactersnavigationview~SpecialCharactersNavigationView}
|
|
17
|
-
* class.
|
|
18
|
-
*
|
|
19
|
-
* @param locale The localization services instance.
|
|
20
|
-
* @param groupNames The names of the character groups and their displayed labels.
|
|
21
|
-
*/
|
|
22
|
-
constructor(locale, groupNames) {
|
|
23
|
-
super(locale);
|
|
24
|
-
const t = locale.t;
|
|
25
|
-
this.set('class', 'ck-special-characters-navigation');
|
|
26
|
-
this.groupDropdownView = this._createGroupDropdown(groupNames);
|
|
27
|
-
this.groupDropdownView.panelPosition = locale.uiLanguageDirection === 'rtl' ? 'se' : 'sw';
|
|
28
|
-
this.label = t('Special characters');
|
|
29
|
-
this.children.add(this.groupDropdownView);
|
|
30
|
-
}
|
|
31
|
-
/**
|
|
32
|
-
* Returns the name of the character group currently selected in the {@link #groupDropdownView}.
|
|
33
|
-
*/
|
|
34
|
-
get currentGroupName() {
|
|
35
|
-
return this.groupDropdownView.value;
|
|
36
|
-
}
|
|
37
|
-
/**
|
|
38
|
-
* Focuses the character categories dropdown.
|
|
39
|
-
*/
|
|
40
|
-
focus() {
|
|
41
|
-
this.groupDropdownView.focus();
|
|
42
|
-
}
|
|
43
|
-
/**
|
|
44
|
-
* Returns a dropdown that allows selecting character groups.
|
|
45
|
-
*
|
|
46
|
-
* @param groupNames The names of the character groups and their displayed labels.
|
|
47
|
-
*/
|
|
48
|
-
_createGroupDropdown(groupNames) {
|
|
49
|
-
const locale = this.locale;
|
|
50
|
-
const t = locale.t;
|
|
51
|
-
const dropdown = createDropdown(locale);
|
|
52
|
-
const groupDefinitions = this._getCharacterGroupListItemDefinitions(dropdown, groupNames);
|
|
53
|
-
const accessibleLabel = t('Character categories');
|
|
54
|
-
dropdown.set('value', groupDefinitions.first.model.name);
|
|
55
|
-
dropdown.buttonView.bind('label').to(dropdown, 'value', value => groupNames.get(value));
|
|
56
|
-
dropdown.buttonView.set({
|
|
57
|
-
isOn: false,
|
|
58
|
-
withText: true,
|
|
59
|
-
tooltip: accessibleLabel,
|
|
60
|
-
class: ['ck-dropdown__button_label-width_auto'],
|
|
61
|
-
ariaLabel: accessibleLabel,
|
|
62
|
-
ariaLabelledBy: undefined
|
|
63
|
-
});
|
|
64
|
-
dropdown.on('execute', evt => {
|
|
65
|
-
dropdown.value = evt.source.name;
|
|
66
|
-
});
|
|
67
|
-
dropdown.delegate('execute').to(this);
|
|
68
|
-
addListToDropdown(dropdown, groupDefinitions, {
|
|
69
|
-
ariaLabel: accessibleLabel,
|
|
70
|
-
role: 'menu'
|
|
71
|
-
});
|
|
72
|
-
return dropdown;
|
|
73
|
-
}
|
|
74
|
-
/**
|
|
75
|
-
* Returns list item definitions to be used in the character group dropdown
|
|
76
|
-
* representing specific character groups.
|
|
77
|
-
*
|
|
78
|
-
* @param dropdown Dropdown view element
|
|
79
|
-
* @param groupNames The names of the character groups and their displayed labels.
|
|
80
|
-
*/
|
|
81
|
-
_getCharacterGroupListItemDefinitions(dropdown, groupNames) {
|
|
82
|
-
const groupDefs = new Collection();
|
|
83
|
-
for (const [name, label] of groupNames) {
|
|
84
|
-
const model = new Model({
|
|
85
|
-
name,
|
|
86
|
-
label,
|
|
87
|
-
withText: true,
|
|
88
|
-
role: 'menuitemradio'
|
|
89
|
-
});
|
|
90
|
-
model.bind('isOn').to(dropdown, 'value', value => value === model.name);
|
|
91
|
-
groupDefs.add({ type: 'button', model });
|
|
92
|
-
}
|
|
93
|
-
return groupDefs;
|
|
94
|
-
}
|
|
95
|
-
}
|
|
1
|
+
/**
|
|
2
|
+
* @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* @module special-characters/ui/specialcharactersnavigationview
|
|
7
|
+
*/
|
|
8
|
+
import { Collection } from 'ckeditor5/src/utils';
|
|
9
|
+
import { addListToDropdown, createDropdown, Model, FormHeaderView } from 'ckeditor5/src/ui';
|
|
10
|
+
/**
|
|
11
|
+
* A class representing the navigation part of the special characters UI. It is responsible
|
|
12
|
+
* for describing the feature and allowing the user to select a particular character group.
|
|
13
|
+
*/
|
|
14
|
+
export default class SpecialCharactersNavigationView extends FormHeaderView {
|
|
15
|
+
/**
|
|
16
|
+
* Creates an instance of the {@link module:special-characters/ui/specialcharactersnavigationview~SpecialCharactersNavigationView}
|
|
17
|
+
* class.
|
|
18
|
+
*
|
|
19
|
+
* @param locale The localization services instance.
|
|
20
|
+
* @param groupNames The names of the character groups and their displayed labels.
|
|
21
|
+
*/
|
|
22
|
+
constructor(locale, groupNames) {
|
|
23
|
+
super(locale);
|
|
24
|
+
const t = locale.t;
|
|
25
|
+
this.set('class', 'ck-special-characters-navigation');
|
|
26
|
+
this.groupDropdownView = this._createGroupDropdown(groupNames);
|
|
27
|
+
this.groupDropdownView.panelPosition = locale.uiLanguageDirection === 'rtl' ? 'se' : 'sw';
|
|
28
|
+
this.label = t('Special characters');
|
|
29
|
+
this.children.add(this.groupDropdownView);
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Returns the name of the character group currently selected in the {@link #groupDropdownView}.
|
|
33
|
+
*/
|
|
34
|
+
get currentGroupName() {
|
|
35
|
+
return this.groupDropdownView.value;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Focuses the character categories dropdown.
|
|
39
|
+
*/
|
|
40
|
+
focus() {
|
|
41
|
+
this.groupDropdownView.focus();
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Returns a dropdown that allows selecting character groups.
|
|
45
|
+
*
|
|
46
|
+
* @param groupNames The names of the character groups and their displayed labels.
|
|
47
|
+
*/
|
|
48
|
+
_createGroupDropdown(groupNames) {
|
|
49
|
+
const locale = this.locale;
|
|
50
|
+
const t = locale.t;
|
|
51
|
+
const dropdown = createDropdown(locale);
|
|
52
|
+
const groupDefinitions = this._getCharacterGroupListItemDefinitions(dropdown, groupNames);
|
|
53
|
+
const accessibleLabel = t('Character categories');
|
|
54
|
+
dropdown.set('value', groupDefinitions.first.model.name);
|
|
55
|
+
dropdown.buttonView.bind('label').to(dropdown, 'value', value => groupNames.get(value));
|
|
56
|
+
dropdown.buttonView.set({
|
|
57
|
+
isOn: false,
|
|
58
|
+
withText: true,
|
|
59
|
+
tooltip: accessibleLabel,
|
|
60
|
+
class: ['ck-dropdown__button_label-width_auto'],
|
|
61
|
+
ariaLabel: accessibleLabel,
|
|
62
|
+
ariaLabelledBy: undefined
|
|
63
|
+
});
|
|
64
|
+
dropdown.on('execute', evt => {
|
|
65
|
+
dropdown.value = evt.source.name;
|
|
66
|
+
});
|
|
67
|
+
dropdown.delegate('execute').to(this);
|
|
68
|
+
addListToDropdown(dropdown, groupDefinitions, {
|
|
69
|
+
ariaLabel: accessibleLabel,
|
|
70
|
+
role: 'menu'
|
|
71
|
+
});
|
|
72
|
+
return dropdown;
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Returns list item definitions to be used in the character group dropdown
|
|
76
|
+
* representing specific character groups.
|
|
77
|
+
*
|
|
78
|
+
* @param dropdown Dropdown view element
|
|
79
|
+
* @param groupNames The names of the character groups and their displayed labels.
|
|
80
|
+
*/
|
|
81
|
+
_getCharacterGroupListItemDefinitions(dropdown, groupNames) {
|
|
82
|
+
const groupDefs = new Collection();
|
|
83
|
+
for (const [name, label] of groupNames) {
|
|
84
|
+
const model = new Model({
|
|
85
|
+
name,
|
|
86
|
+
label,
|
|
87
|
+
withText: true,
|
|
88
|
+
role: 'menuitemradio'
|
|
89
|
+
});
|
|
90
|
+
model.bind('isOn').to(dropdown, 'value', value => value === model.name);
|
|
91
|
+
groupDefs.add({ type: 'button', model });
|
|
92
|
+
}
|
|
93
|
+
return groupDefs;
|
|
94
|
+
}
|
|
95
|
+
}
|
|
@@ -1,65 +1,65 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
4
|
-
*/
|
|
5
|
-
/**
|
|
6
|
-
* @module special-characters/ui/specialcharactersview
|
|
7
|
-
*/
|
|
8
|
-
import { View, FocusCycler, type ViewCollection } from 'ckeditor5/src/ui';
|
|
9
|
-
import { FocusTracker, KeystrokeHandler, type Locale } from 'ckeditor5/src/utils';
|
|
10
|
-
import type CharacterGridView from './charactergridview';
|
|
11
|
-
import type CharacterInfoView from './characterinfoview';
|
|
12
|
-
import type SpecialCharactersNavigationView from './specialcharactersnavigationview';
|
|
13
|
-
/**
|
|
14
|
-
* A view that glues pieces of the special characters dropdown panel together:
|
|
15
|
-
*
|
|
16
|
-
* * the navigation view (allows selecting the category),
|
|
17
|
-
* * the grid view (displays characters as a grid),
|
|
18
|
-
* * and the info view (displays detailed info about a specific character).
|
|
19
|
-
*/
|
|
20
|
-
export default class SpecialCharactersView extends View<HTMLDivElement> {
|
|
21
|
-
/**
|
|
22
|
-
* A collection of the focusable children of the view.
|
|
23
|
-
*/
|
|
24
|
-
readonly items: ViewCollection;
|
|
25
|
-
/**
|
|
26
|
-
* Tracks information about the DOM focus in the view.
|
|
27
|
-
*/
|
|
28
|
-
readonly focusTracker: FocusTracker;
|
|
29
|
-
/**
|
|
30
|
-
* An instance of the {@link module:utils/keystrokehandler~KeystrokeHandler}.
|
|
31
|
-
*/
|
|
32
|
-
readonly keystrokes: KeystrokeHandler;
|
|
33
|
-
/**
|
|
34
|
-
* Helps cycling over focusable {@link #items} in the view.
|
|
35
|
-
*/
|
|
36
|
-
protected readonly _focusCycler: FocusCycler;
|
|
37
|
-
/**
|
|
38
|
-
* An instance of the `SpecialCharactersNavigationView`.
|
|
39
|
-
*/
|
|
40
|
-
navigationView: SpecialCharactersNavigationView;
|
|
41
|
-
/**
|
|
42
|
-
* An instance of the `CharacterGridView`.
|
|
43
|
-
*/
|
|
44
|
-
gridView: CharacterGridView;
|
|
45
|
-
/**
|
|
46
|
-
* An instance of the `CharacterInfoView`.
|
|
47
|
-
*/
|
|
48
|
-
infoView: CharacterInfoView;
|
|
49
|
-
/**
|
|
50
|
-
* Creates an instance of the `SpecialCharactersView`.
|
|
51
|
-
*/
|
|
52
|
-
constructor(locale: Locale, navigationView: SpecialCharactersNavigationView, gridView: CharacterGridView, infoView: CharacterInfoView);
|
|
53
|
-
/**
|
|
54
|
-
* @inheritDoc
|
|
55
|
-
*/
|
|
56
|
-
render(): void;
|
|
57
|
-
/**
|
|
58
|
-
* @inheritDoc
|
|
59
|
-
*/
|
|
60
|
-
destroy(): void;
|
|
61
|
-
/**
|
|
62
|
-
* Focuses the first focusable in {@link #items}.
|
|
63
|
-
*/
|
|
64
|
-
focus(): void;
|
|
65
|
-
}
|
|
1
|
+
/**
|
|
2
|
+
* @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* @module special-characters/ui/specialcharactersview
|
|
7
|
+
*/
|
|
8
|
+
import { View, FocusCycler, type ViewCollection } from 'ckeditor5/src/ui';
|
|
9
|
+
import { FocusTracker, KeystrokeHandler, type Locale } from 'ckeditor5/src/utils';
|
|
10
|
+
import type CharacterGridView from './charactergridview';
|
|
11
|
+
import type CharacterInfoView from './characterinfoview';
|
|
12
|
+
import type SpecialCharactersNavigationView from './specialcharactersnavigationview';
|
|
13
|
+
/**
|
|
14
|
+
* A view that glues pieces of the special characters dropdown panel together:
|
|
15
|
+
*
|
|
16
|
+
* * the navigation view (allows selecting the category),
|
|
17
|
+
* * the grid view (displays characters as a grid),
|
|
18
|
+
* * and the info view (displays detailed info about a specific character).
|
|
19
|
+
*/
|
|
20
|
+
export default class SpecialCharactersView extends View<HTMLDivElement> {
|
|
21
|
+
/**
|
|
22
|
+
* A collection of the focusable children of the view.
|
|
23
|
+
*/
|
|
24
|
+
readonly items: ViewCollection;
|
|
25
|
+
/**
|
|
26
|
+
* Tracks information about the DOM focus in the view.
|
|
27
|
+
*/
|
|
28
|
+
readonly focusTracker: FocusTracker;
|
|
29
|
+
/**
|
|
30
|
+
* An instance of the {@link module:utils/keystrokehandler~KeystrokeHandler}.
|
|
31
|
+
*/
|
|
32
|
+
readonly keystrokes: KeystrokeHandler;
|
|
33
|
+
/**
|
|
34
|
+
* Helps cycling over focusable {@link #items} in the view.
|
|
35
|
+
*/
|
|
36
|
+
protected readonly _focusCycler: FocusCycler;
|
|
37
|
+
/**
|
|
38
|
+
* An instance of the `SpecialCharactersNavigationView`.
|
|
39
|
+
*/
|
|
40
|
+
navigationView: SpecialCharactersNavigationView;
|
|
41
|
+
/**
|
|
42
|
+
* An instance of the `CharacterGridView`.
|
|
43
|
+
*/
|
|
44
|
+
gridView: CharacterGridView;
|
|
45
|
+
/**
|
|
46
|
+
* An instance of the `CharacterInfoView`.
|
|
47
|
+
*/
|
|
48
|
+
infoView: CharacterInfoView;
|
|
49
|
+
/**
|
|
50
|
+
* Creates an instance of the `SpecialCharactersView`.
|
|
51
|
+
*/
|
|
52
|
+
constructor(locale: Locale, navigationView: SpecialCharactersNavigationView, gridView: CharacterGridView, infoView: CharacterInfoView);
|
|
53
|
+
/**
|
|
54
|
+
* @inheritDoc
|
|
55
|
+
*/
|
|
56
|
+
render(): void;
|
|
57
|
+
/**
|
|
58
|
+
* @inheritDoc
|
|
59
|
+
*/
|
|
60
|
+
destroy(): void;
|
|
61
|
+
/**
|
|
62
|
+
* Focuses the first focusable in {@link #items}.
|
|
63
|
+
*/
|
|
64
|
+
focus(): void;
|
|
65
|
+
}
|
|
@@ -1,78 +1,78 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
4
|
-
*/
|
|
5
|
-
/**
|
|
6
|
-
* @module special-characters/ui/specialcharactersview
|
|
7
|
-
*/
|
|
8
|
-
import { View, FocusCycler } from 'ckeditor5/src/ui';
|
|
9
|
-
import { FocusTracker, KeystrokeHandler } from 'ckeditor5/src/utils';
|
|
10
|
-
/**
|
|
11
|
-
* A view that glues pieces of the special characters dropdown panel together:
|
|
12
|
-
*
|
|
13
|
-
* * the navigation view (allows selecting the category),
|
|
14
|
-
* * the grid view (displays characters as a grid),
|
|
15
|
-
* * and the info view (displays detailed info about a specific character).
|
|
16
|
-
*/
|
|
17
|
-
export default class SpecialCharactersView extends View {
|
|
18
|
-
/**
|
|
19
|
-
* Creates an instance of the `SpecialCharactersView`.
|
|
20
|
-
*/
|
|
21
|
-
constructor(locale, navigationView, gridView, infoView) {
|
|
22
|
-
super(locale);
|
|
23
|
-
this.navigationView = navigationView;
|
|
24
|
-
this.gridView = gridView;
|
|
25
|
-
this.infoView = infoView;
|
|
26
|
-
this.items = this.createCollection();
|
|
27
|
-
this.focusTracker = new FocusTracker();
|
|
28
|
-
this.keystrokes = new KeystrokeHandler();
|
|
29
|
-
this._focusCycler = new FocusCycler({
|
|
30
|
-
focusables: this.items,
|
|
31
|
-
focusTracker: this.focusTracker,
|
|
32
|
-
keystrokeHandler: this.keystrokes,
|
|
33
|
-
actions: {
|
|
34
|
-
focusPrevious: 'shift + tab',
|
|
35
|
-
focusNext: 'tab'
|
|
36
|
-
}
|
|
37
|
-
});
|
|
38
|
-
this.setTemplate({
|
|
39
|
-
tag: 'div',
|
|
40
|
-
children: [
|
|
41
|
-
this.navigationView,
|
|
42
|
-
this.gridView,
|
|
43
|
-
this.infoView
|
|
44
|
-
],
|
|
45
|
-
attributes: {
|
|
46
|
-
// Avoid focus loss when the user clicks the area of the grid that is not a button.
|
|
47
|
-
// https://github.com/ckeditor/ckeditor5/pull/12319#issuecomment-1231779819
|
|
48
|
-
tabindex: '-1'
|
|
49
|
-
}
|
|
50
|
-
});
|
|
51
|
-
this.items.add(this.navigationView.groupDropdownView.buttonView);
|
|
52
|
-
this.items.add(this.gridView);
|
|
53
|
-
}
|
|
54
|
-
/**
|
|
55
|
-
* @inheritDoc
|
|
56
|
-
*/
|
|
57
|
-
render() {
|
|
58
|
-
super.render();
|
|
59
|
-
this.focusTracker.add(this.navigationView.groupDropdownView.buttonView.element);
|
|
60
|
-
this.focusTracker.add(this.gridView.element);
|
|
61
|
-
// Start listening for the keystrokes coming from #element.
|
|
62
|
-
this.keystrokes.listenTo(this.element);
|
|
63
|
-
}
|
|
64
|
-
/**
|
|
65
|
-
* @inheritDoc
|
|
66
|
-
*/
|
|
67
|
-
destroy() {
|
|
68
|
-
super.destroy();
|
|
69
|
-
this.focusTracker.destroy();
|
|
70
|
-
this.keystrokes.destroy();
|
|
71
|
-
}
|
|
72
|
-
/**
|
|
73
|
-
* Focuses the first focusable in {@link #items}.
|
|
74
|
-
*/
|
|
75
|
-
focus() {
|
|
76
|
-
this.navigationView.focus();
|
|
77
|
-
}
|
|
78
|
-
}
|
|
1
|
+
/**
|
|
2
|
+
* @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* @module special-characters/ui/specialcharactersview
|
|
7
|
+
*/
|
|
8
|
+
import { View, FocusCycler } from 'ckeditor5/src/ui';
|
|
9
|
+
import { FocusTracker, KeystrokeHandler } from 'ckeditor5/src/utils';
|
|
10
|
+
/**
|
|
11
|
+
* A view that glues pieces of the special characters dropdown panel together:
|
|
12
|
+
*
|
|
13
|
+
* * the navigation view (allows selecting the category),
|
|
14
|
+
* * the grid view (displays characters as a grid),
|
|
15
|
+
* * and the info view (displays detailed info about a specific character).
|
|
16
|
+
*/
|
|
17
|
+
export default class SpecialCharactersView extends View {
|
|
18
|
+
/**
|
|
19
|
+
* Creates an instance of the `SpecialCharactersView`.
|
|
20
|
+
*/
|
|
21
|
+
constructor(locale, navigationView, gridView, infoView) {
|
|
22
|
+
super(locale);
|
|
23
|
+
this.navigationView = navigationView;
|
|
24
|
+
this.gridView = gridView;
|
|
25
|
+
this.infoView = infoView;
|
|
26
|
+
this.items = this.createCollection();
|
|
27
|
+
this.focusTracker = new FocusTracker();
|
|
28
|
+
this.keystrokes = new KeystrokeHandler();
|
|
29
|
+
this._focusCycler = new FocusCycler({
|
|
30
|
+
focusables: this.items,
|
|
31
|
+
focusTracker: this.focusTracker,
|
|
32
|
+
keystrokeHandler: this.keystrokes,
|
|
33
|
+
actions: {
|
|
34
|
+
focusPrevious: 'shift + tab',
|
|
35
|
+
focusNext: 'tab'
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
this.setTemplate({
|
|
39
|
+
tag: 'div',
|
|
40
|
+
children: [
|
|
41
|
+
this.navigationView,
|
|
42
|
+
this.gridView,
|
|
43
|
+
this.infoView
|
|
44
|
+
],
|
|
45
|
+
attributes: {
|
|
46
|
+
// Avoid focus loss when the user clicks the area of the grid that is not a button.
|
|
47
|
+
// https://github.com/ckeditor/ckeditor5/pull/12319#issuecomment-1231779819
|
|
48
|
+
tabindex: '-1'
|
|
49
|
+
}
|
|
50
|
+
});
|
|
51
|
+
this.items.add(this.navigationView.groupDropdownView.buttonView);
|
|
52
|
+
this.items.add(this.gridView);
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* @inheritDoc
|
|
56
|
+
*/
|
|
57
|
+
render() {
|
|
58
|
+
super.render();
|
|
59
|
+
this.focusTracker.add(this.navigationView.groupDropdownView.buttonView.element);
|
|
60
|
+
this.focusTracker.add(this.gridView.element);
|
|
61
|
+
// Start listening for the keystrokes coming from #element.
|
|
62
|
+
this.keystrokes.listenTo(this.element);
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* @inheritDoc
|
|
66
|
+
*/
|
|
67
|
+
destroy() {
|
|
68
|
+
super.destroy();
|
|
69
|
+
this.focusTracker.destroy();
|
|
70
|
+
this.keystrokes.destroy();
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Focuses the first focusable in {@link #items}.
|
|
74
|
+
*/
|
|
75
|
+
focus() {
|
|
76
|
+
this.navigationView.focus();
|
|
77
|
+
}
|
|
78
|
+
}
|