@ckeditor/ckeditor5-special-characters 34.2.0 → 35.1.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.
Files changed (63) hide show
  1. package/CHANGELOG.md +30 -0
  2. package/build/special-characters.js +1 -1
  3. package/build/translations/ar.js +1 -0
  4. package/build/translations/bg.js +1 -0
  5. package/build/translations/bn.js +1 -0
  6. package/build/translations/ca.js +1 -0
  7. package/build/translations/da.js +1 -0
  8. package/build/translations/es.js +1 -1
  9. package/build/translations/et.js +1 -1
  10. package/build/translations/fi.js +1 -0
  11. package/build/translations/he.js +1 -0
  12. package/build/translations/hu.js +1 -1
  13. package/build/translations/id.js +1 -1
  14. package/build/translations/ja.js +1 -1
  15. package/build/translations/ko.js +1 -1
  16. package/build/translations/lt.js +1 -0
  17. package/build/translations/lv.js +1 -1
  18. package/build/translations/ms.js +1 -0
  19. package/build/translations/nl.js +1 -1
  20. package/build/translations/no.js +1 -0
  21. package/build/translations/pl.js +1 -1
  22. package/build/translations/pt.js +1 -0
  23. package/build/translations/ro.js +1 -0
  24. package/build/translations/ru.js +1 -1
  25. package/build/translations/sv.js +1 -0
  26. package/build/translations/th.js +1 -0
  27. package/build/translations/uk.js +1 -0
  28. package/build/translations/ur.js +1 -0
  29. package/build/translations/vi.js +1 -0
  30. package/build/translations/zh.js +1 -1
  31. package/lang/translations/ar.po +1039 -0
  32. package/lang/translations/bg.po +1041 -0
  33. package/lang/translations/bn.po +1037 -0
  34. package/lang/translations/ca.po +1037 -0
  35. package/lang/translations/da.po +1037 -0
  36. package/lang/translations/es.po +220 -220
  37. package/lang/translations/et.po +250 -250
  38. package/lang/translations/fi.po +1037 -0
  39. package/lang/translations/he.po +1037 -0
  40. package/lang/translations/hu.po +233 -233
  41. package/lang/translations/id.po +205 -205
  42. package/lang/translations/ja.po +254 -254
  43. package/lang/translations/ko.po +254 -254
  44. package/lang/translations/lt.po +1037 -0
  45. package/lang/translations/lv.po +254 -254
  46. package/lang/translations/ms.po +1037 -0
  47. package/lang/translations/nl.po +138 -136
  48. package/lang/translations/no.po +1039 -0
  49. package/lang/translations/pl.po +220 -220
  50. package/lang/translations/pt.po +1037 -0
  51. package/lang/translations/ro.po +1037 -0
  52. package/lang/translations/ru.po +253 -253
  53. package/lang/translations/sv.po +1037 -0
  54. package/lang/translations/th.po +1037 -0
  55. package/lang/translations/uk.po +1037 -0
  56. package/lang/translations/ur.po +1037 -0
  57. package/lang/translations/vi.po +1037 -0
  58. package/lang/translations/zh.po +242 -242
  59. package/package.json +13 -12
  60. package/src/specialcharacters.js +9 -3
  61. package/src/ui/charactergridview.js +72 -1
  62. package/src/ui/specialcharactersnavigationview.js +7 -0
  63. package/src/ui/specialcharactersview.js +138 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ckeditor/ckeditor5-special-characters",
3
- "version": "34.2.0",
3
+ "version": "35.1.0",
4
4
  "description": "Special characters feature for CKEditor 5.",
5
5
  "keywords": [
6
6
  "ckeditor",
@@ -12,19 +12,19 @@
12
12
  ],
13
13
  "main": "src/index.js",
14
14
  "dependencies": {
15
- "ckeditor5": "^34.2.0"
15
+ "ckeditor5": "^35.1.0"
16
16
  },
17
17
  "devDependencies": {
18
- "@ckeditor/ckeditor5-cloud-services": "^34.2.0",
19
- "@ckeditor/ckeditor5-core": "^34.2.0",
18
+ "@ckeditor/ckeditor5-cloud-services": "^35.1.0",
19
+ "@ckeditor/ckeditor5-core": "^35.1.0",
20
20
  "@ckeditor/ckeditor5-dev-utils": "^30.0.0",
21
- "@ckeditor/ckeditor5-easy-image": "^34.2.0",
22
- "@ckeditor/ckeditor5-editor-classic": "^34.2.0",
23
- "@ckeditor/ckeditor5-image": "^34.2.0",
24
- "@ckeditor/ckeditor5-theme-lark": "^34.2.0",
25
- "@ckeditor/ckeditor5-typing": "^34.2.0",
26
- "@ckeditor/ckeditor5-ui": "^34.2.0",
27
- "@ckeditor/ckeditor5-utils": "^34.2.0",
21
+ "@ckeditor/ckeditor5-easy-image": "^35.1.0",
22
+ "@ckeditor/ckeditor5-editor-classic": "^35.1.0",
23
+ "@ckeditor/ckeditor5-image": "^35.1.0",
24
+ "@ckeditor/ckeditor5-theme-lark": "^35.1.0",
25
+ "@ckeditor/ckeditor5-typing": "^35.1.0",
26
+ "@ckeditor/ckeditor5-ui": "^35.1.0",
27
+ "@ckeditor/ckeditor5-utils": "^35.1.0",
28
28
  "webpack": "^5.58.1",
29
29
  "webpack-cli": "^4.9.0"
30
30
  },
@@ -46,7 +46,8 @@
46
46
  "src",
47
47
  "theme",
48
48
  "build",
49
- "ckeditor5-metadata.json"
49
+ "ckeditor5-metadata.json",
50
+ "CHANGELOG.md"
50
51
  ],
51
52
  "scripts": {
52
53
  "dll:build": "webpack"
@@ -14,6 +14,7 @@ import { CKEditorError } from 'ckeditor5/src/utils';
14
14
  import SpecialCharactersNavigationView from './ui/specialcharactersnavigationview';
15
15
  import CharacterGridView from './ui/charactergridview';
16
16
  import CharacterInfoView from './ui/characterinfoview';
17
+ import SpecialCharactersView from './ui/specialcharactersview';
17
18
 
18
19
  import specialCharactersIcon from '../theme/icons/specialcharacters.svg';
19
20
  import '../theme/specialcharacters.css';
@@ -97,9 +98,14 @@ export default class SpecialCharacters extends Plugin {
97
98
  if ( !dropdownPanelContent ) {
98
99
  dropdownPanelContent = this._createDropdownPanelContent( locale, dropdownView );
99
100
 
100
- dropdownView.panelView.children.add( dropdownPanelContent.navigationView );
101
- dropdownView.panelView.children.add( dropdownPanelContent.gridView );
102
- dropdownView.panelView.children.add( dropdownPanelContent.infoView );
101
+ const specialCharactersView = new SpecialCharactersView(
102
+ locale,
103
+ dropdownPanelContent.navigationView,
104
+ dropdownPanelContent.gridView,
105
+ dropdownPanelContent.infoView
106
+ );
107
+
108
+ dropdownView.panelView.children.add( specialCharactersView );
103
109
  }
104
110
 
105
111
  dropdownPanelContent.infoView.set( {
@@ -7,7 +7,9 @@
7
7
  * @module special-characters/ui/charactergridview
8
8
  */
9
9
 
10
- import { View, ButtonView } from 'ckeditor5/src/ui';
10
+ import { View, ButtonView, addKeyboardHandlingForGrid } from 'ckeditor5/src/ui';
11
+
12
+ import { KeystrokeHandler, FocusTracker, global } from 'ckeditor5/src/utils';
11
13
 
12
14
  import '../../theme/charactergrid.css';
13
15
 
@@ -56,6 +58,33 @@ export default class CharacterGridView extends View {
56
58
  }
57
59
  } );
58
60
 
61
+ /**
62
+ * Tracks information about the DOM focus in the grid.
63
+ *
64
+ * @readonly
65
+ * @member {module:utils/focustracker~FocusTracker}
66
+ */
67
+ this.focusTracker = new FocusTracker();
68
+
69
+ /**
70
+ * An instance of the {@link module:utils/keystrokehandler~KeystrokeHandler}.
71
+ *
72
+ * @readonly
73
+ * @member {module:utils/keystrokehandler~KeystrokeHandler}
74
+ */
75
+ this.keystrokes = new KeystrokeHandler();
76
+
77
+ addKeyboardHandlingForGrid( {
78
+ keystrokeHandler: this.keystrokes,
79
+ focusTracker: this.focusTracker,
80
+ gridItems: this.tiles,
81
+ numberOfColumns: () => global.window
82
+ .getComputedStyle( this.element.firstChild ) // Responsive .ck-character-grid__tiles
83
+ .getPropertyValue( 'grid-template-columns' )
84
+ .split( ' ' )
85
+ .length
86
+ } );
87
+
59
88
  /**
60
89
  * Fired when any of {@link #tiles grid tiles} is clicked.
61
90
  *
@@ -113,4 +142,46 @@ export default class CharacterGridView extends View {
113
142
 
114
143
  return tile;
115
144
  }
145
+
146
+ /**
147
+ * @inheritDoc
148
+ */
149
+ render() {
150
+ super.render();
151
+
152
+ for ( const item of this.tiles ) {
153
+ this.focusTracker.add( item.element );
154
+ }
155
+
156
+ this.tiles.on( 'change', ( eventInfo, { added, removed } ) => {
157
+ if ( added.length > 0 ) {
158
+ for ( const item of added ) {
159
+ this.focusTracker.add( item.element );
160
+ }
161
+ }
162
+ if ( removed.length > 0 ) {
163
+ for ( const item of removed ) {
164
+ this.focusTracker.remove( item.element );
165
+ }
166
+ }
167
+ } );
168
+
169
+ this.keystrokes.listenTo( this.element );
170
+ }
171
+
172
+ /**
173
+ * @inheritDoc
174
+ */
175
+ destroy() {
176
+ super.destroy();
177
+
178
+ this.keystrokes.destroy();
179
+ }
180
+
181
+ /**
182
+ * Focuses the first focusable in {@link #tiles}.
183
+ */
184
+ focus() {
185
+ this.tiles.get( 0 ).focus();
186
+ }
116
187
  }
@@ -59,6 +59,13 @@ export default class SpecialCharactersNavigationView extends FormHeaderView {
59
59
  return this.groupDropdownView.value;
60
60
  }
61
61
 
62
+ /**
63
+ * Focuses the character categories dropdown.
64
+ */
65
+ focus() {
66
+ this.groupDropdownView.focus();
67
+ }
68
+
62
69
  /**
63
70
  * Returns a dropdown that allows selecting character groups.
64
71
  *
@@ -0,0 +1,138 @@
1
+ /**
2
+ * @license Copyright (c) 2003-2022, 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
+ /**
7
+ * @module special-characters/ui/specialcharactersview
8
+ */
9
+
10
+ import { View, FocusCycler } from 'ckeditor5/src/ui';
11
+ import { FocusTracker, KeystrokeHandler } from 'ckeditor5/src/utils';
12
+
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
+ * @extends module:ui/view~View
21
+ */
22
+ 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
+ } );
104
+
105
+ this.items.add( this.navigationView.groupDropdownView.buttonView );
106
+ this.items.add( this.gridView );
107
+ }
108
+
109
+ /**
110
+ * @inheritDoc
111
+ */
112
+ render() {
113
+ super.render();
114
+
115
+ this.focusTracker.add( this.navigationView.groupDropdownView.buttonView.element );
116
+ this.focusTracker.add( this.gridView.element );
117
+
118
+ // Start listening for the keystrokes coming from #element.
119
+ this.keystrokes.listenTo( this.element );
120
+ }
121
+
122
+ /**
123
+ * @inheritDoc
124
+ */
125
+ destroy() {
126
+ super.destroy();
127
+
128
+ this.focusTracker.destroy();
129
+ this.keystrokes.destroy();
130
+ }
131
+
132
+ /**
133
+ * Focuses the first focusable in {@link #items}.
134
+ */
135
+ focus() {
136
+ this.navigationView.focus();
137
+ }
138
+ }