@ckeditor/ckeditor5-special-characters 38.0.1 → 38.1.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.
@@ -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
+ }