@ckeditor/ckeditor5-special-characters 36.0.0 → 37.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.
@@ -2,142 +2,77 @@
2
2
  * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
3
3
  * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4
4
  */
5
-
6
5
  /**
7
6
  * @module special-characters/ui/specialcharactersview
8
7
  */
9
-
10
8
  import { View, FocusCycler } from 'ckeditor5/src/ui';
11
9
  import { FocusTracker, KeystrokeHandler } from 'ckeditor5/src/utils';
12
-
13
10
  /**
14
11
  * A view that glues pieces of the special characters dropdown panel together:
15
12
  *
16
13
  * * the navigation view (allows selecting the category),
17
14
  * * the grid view (displays characters as a grid),
18
15
  * * and the info view (displays detailed info about a specific character).
19
- *
20
- * @extends module:ui/view~View
21
16
  */
22
17
  export default class SpecialCharactersView extends View {
23
- /**
24
- * Creates an instance of the `SpecialCharactersView`.
25
- *
26
- * @param {module:utils/locale~Locale} locale The localization services instance.
27
- * @param {module:special-characters/ui/specialcharactersnavigationview~SpecialCharactersNavigationView} navigationView
28
- * @param {module:special-characters/ui/charactergridview~CharacterGridView} gridView
29
- * @param {module:special-characters/ui/characterinfoview~CharacterInfoView} infoView
30
- */
31
- constructor( locale, navigationView, gridView, infoView ) {
32
- super( locale );
33
-
34
- /**
35
- * A collection of the focusable children of the view.
36
- *
37
- * @readonly
38
- * @member {module:ui/viewcollection~ViewCollection}
39
- */
40
- this.items = this.createCollection();
41
-
42
- /**
43
- * Tracks information about the DOM focus in the view.
44
- *
45
- * @readonly
46
- * @member {module:utils/focustracker~FocusTracker}
47
- */
48
- this.focusTracker = new FocusTracker();
49
-
50
- /**
51
- * An instance of the {@link module:utils/keystrokehandler~KeystrokeHandler}.
52
- *
53
- * @readonly
54
- * @member {module:utils/keystrokehandler~KeystrokeHandler}
55
- */
56
- this.keystrokes = new KeystrokeHandler();
57
-
58
- /**
59
- * Helps cycling over focusable {@link #items} in the view.
60
- *
61
- * @readonly
62
- * @protected
63
- * @member {module:ui/focuscycler~FocusCycler}
64
- */
65
- this._focusCycler = new FocusCycler( {
66
- focusables: this.items,
67
- focusTracker: this.focusTracker,
68
- keystrokeHandler: this.keystrokes,
69
- actions: {
70
- focusPrevious: 'shift + tab',
71
- focusNext: 'tab'
72
- }
73
- } );
74
-
75
- /**
76
- * An instance of the `SpecialCharactersNavigationView`.
77
- *
78
- * @member {module:special-characters/ui/specialcharactersnavigationview~SpecialCharactersNavigationView}
79
- */
80
- this.navigationView = navigationView;
81
-
82
- /**
83
- * An instance of the `CharacterGridView`.
84
- *
85
- * @member {module:special-characters/ui/charactergridview~CharacterGridView}
86
- */
87
- this.gridView = gridView;
88
-
89
- /**
90
- * An instance of the `CharacterInfoView`.
91
- *
92
- * @member {module:special-characters/ui/characterinfoview~CharacterInfoView}
93
- */
94
- this.infoView = infoView;
95
-
96
- this.setTemplate( {
97
- tag: 'div',
98
- children: [
99
- this.navigationView,
100
- this.gridView,
101
- this.infoView
102
- ],
103
- attributes: {
104
- // Avoid focus loss when the user clicks the area of the grid that is not a button.
105
- // https://github.com/ckeditor/ckeditor5/pull/12319#issuecomment-1231779819
106
- tabindex: '-1'
107
- }
108
- } );
109
-
110
- this.items.add( this.navigationView.groupDropdownView.buttonView );
111
- this.items.add( this.gridView );
112
- }
113
-
114
- /**
115
- * @inheritDoc
116
- */
117
- render() {
118
- super.render();
119
-
120
- this.focusTracker.add( this.navigationView.groupDropdownView.buttonView.element );
121
- this.focusTracker.add( this.gridView.element );
122
-
123
- // Start listening for the keystrokes coming from #element.
124
- this.keystrokes.listenTo( this.element );
125
- }
126
-
127
- /**
128
- * @inheritDoc
129
- */
130
- destroy() {
131
- super.destroy();
132
-
133
- this.focusTracker.destroy();
134
- this.keystrokes.destroy();
135
- }
136
-
137
- /**
138
- * Focuses the first focusable in {@link #items}.
139
- */
140
- focus() {
141
- this.navigationView.focus();
142
- }
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
+ }
143
78
  }