@ckeditor/ckeditor5-special-characters 35.0.1 → 35.2.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 (101) hide show
  1. package/build/special-characters.js +2 -2
  2. package/build/special-characters.js.map +1 -0
  3. package/build/translations/ar.js +1 -1
  4. package/build/translations/az.js +1 -1
  5. package/build/translations/bg.js +1 -1
  6. package/build/translations/bn.js +1 -1
  7. package/build/translations/ca.js +1 -1
  8. package/build/translations/cs.js +1 -1
  9. package/build/translations/da.js +1 -1
  10. package/build/translations/de.js +1 -1
  11. package/build/translations/el.js +1 -1
  12. package/build/translations/en-au.js +1 -1
  13. package/build/translations/es.js +1 -1
  14. package/build/translations/et.js +1 -1
  15. package/build/translations/fa.js +1 -1
  16. package/build/translations/fi.js +1 -1
  17. package/build/translations/fr.js +1 -1
  18. package/build/translations/gl.js +1 -1
  19. package/build/translations/he.js +1 -1
  20. package/build/translations/hi.js +1 -1
  21. package/build/translations/hu.js +1 -1
  22. package/build/translations/id.js +1 -1
  23. package/build/translations/it.js +1 -1
  24. package/build/translations/ja.js +1 -1
  25. package/build/translations/ko.js +1 -1
  26. package/build/translations/lt.js +1 -1
  27. package/build/translations/lv.js +1 -1
  28. package/build/translations/ms.js +1 -1
  29. package/build/translations/nl.js +1 -1
  30. package/build/translations/no.js +1 -1
  31. package/build/translations/pl.js +1 -1
  32. package/build/translations/pt-br.js +1 -1
  33. package/build/translations/pt.js +1 -1
  34. package/build/translations/ro.js +1 -1
  35. package/build/translations/ru.js +1 -1
  36. package/build/translations/sk.js +1 -1
  37. package/build/translations/sr-latn.js +1 -1
  38. package/build/translations/sr.js +1 -1
  39. package/build/translations/sv.js +1 -1
  40. package/build/translations/th.js +1 -1
  41. package/build/translations/tk.js +1 -1
  42. package/build/translations/tr.js +1 -1
  43. package/build/translations/uk.js +1 -1
  44. package/build/translations/ur.js +1 -0
  45. package/build/translations/uz.js +1 -1
  46. package/build/translations/vi.js +1 -1
  47. package/build/translations/zh-cn.js +1 -1
  48. package/build/translations/zh.js +1 -1
  49. package/lang/contexts.json +4 -0
  50. package/lang/translations/ar.po +16 -0
  51. package/lang/translations/az.po +16 -0
  52. package/lang/translations/bg.po +16 -0
  53. package/lang/translations/bn.po +16 -0
  54. package/lang/translations/ca.po +16 -0
  55. package/lang/translations/cs.po +16 -0
  56. package/lang/translations/da.po +16 -0
  57. package/lang/translations/de.po +16 -0
  58. package/lang/translations/el.po +16 -0
  59. package/lang/translations/en-au.po +16 -0
  60. package/lang/translations/en.po +16 -0
  61. package/lang/translations/es.po +16 -0
  62. package/lang/translations/et.po +16 -0
  63. package/lang/translations/fa.po +16 -0
  64. package/lang/translations/fi.po +16 -0
  65. package/lang/translations/fr.po +16 -0
  66. package/lang/translations/gl.po +16 -0
  67. package/lang/translations/he.po +16 -0
  68. package/lang/translations/hi.po +16 -0
  69. package/lang/translations/hu.po +16 -0
  70. package/lang/translations/id.po +16 -0
  71. package/lang/translations/it.po +16 -0
  72. package/lang/translations/ja.po +16 -0
  73. package/lang/translations/ko.po +16 -0
  74. package/lang/translations/lt.po +16 -0
  75. package/lang/translations/lv.po +16 -0
  76. package/lang/translations/ms.po +16 -0
  77. package/lang/translations/nl.po +16 -0
  78. package/lang/translations/no.po +16 -0
  79. package/lang/translations/pl.po +16 -0
  80. package/lang/translations/pt-br.po +16 -0
  81. package/lang/translations/pt.po +16 -0
  82. package/lang/translations/ro.po +16 -0
  83. package/lang/translations/ru.po +16 -0
  84. package/lang/translations/sk.po +16 -0
  85. package/lang/translations/sr-latn.po +16 -0
  86. package/lang/translations/sr.po +16 -0
  87. package/lang/translations/sv.po +16 -0
  88. package/lang/translations/th.po +16 -0
  89. package/lang/translations/tk.po +16 -0
  90. package/lang/translations/tr.po +16 -0
  91. package/lang/translations/uk.po +16 -0
  92. package/lang/translations/ur.po +1053 -0
  93. package/lang/translations/uz.po +16 -0
  94. package/lang/translations/vi.po +16 -0
  95. package/lang/translations/zh-cn.po +16 -0
  96. package/lang/translations/zh.po +16 -0
  97. package/package.json +12 -12
  98. package/src/specialcharacters.js +9 -3
  99. package/src/specialcharactersarrows.js +4 -0
  100. package/src/ui/charactergridview.js +72 -1
  101. package/src/ui/specialcharactersview.js +143 -0
@@ -20,6 +20,22 @@ msgctxt "Name of the special characters plugins, visible in a dropdown and as a
20
20
  msgid "Special characters"
21
21
  msgstr "Maxsus belgilar"
22
22
 
23
+ msgctxt "A label for the \"leftwards simple arrow\" symbol."
24
+ msgid "leftwards simple arrow"
25
+ msgstr ""
26
+
27
+ msgctxt "A label for the \"rightwards simple arrow\" symbol."
28
+ msgid "rightwards simple arrow"
29
+ msgstr ""
30
+
31
+ msgctxt "A label for the \"upwards simple arrow\" symbol."
32
+ msgid "upwards simple arrow"
33
+ msgstr ""
34
+
35
+ msgctxt "A label for the \"downwards simple arrow\" symbol."
36
+ msgid "downwards simple arrow"
37
+ msgstr ""
38
+
23
39
  msgctxt "A label for the \"leftwards double arrow\" symbol."
24
40
  msgid "leftwards double arrow"
25
41
  msgstr ""
@@ -20,6 +20,22 @@ msgctxt "Name of the special characters plugins, visible in a dropdown and as a
20
20
  msgid "Special characters"
21
21
  msgstr "Các ký tự đặc biệt"
22
22
 
23
+ msgctxt "A label for the \"leftwards simple arrow\" symbol."
24
+ msgid "leftwards simple arrow"
25
+ msgstr "mũi tên đơn giản chỉ sang trái"
26
+
27
+ msgctxt "A label for the \"rightwards simple arrow\" symbol."
28
+ msgid "rightwards simple arrow"
29
+ msgstr "mũi tên đơn giản chỉ sang phải"
30
+
31
+ msgctxt "A label for the \"upwards simple arrow\" symbol."
32
+ msgid "upwards simple arrow"
33
+ msgstr "mũi tên đơn giản chỉ lên trên"
34
+
35
+ msgctxt "A label for the \"downwards simple arrow\" symbol."
36
+ msgid "downwards simple arrow"
37
+ msgstr "mũi tên đơn giản chỉ xuống dưới"
38
+
23
39
  msgctxt "A label for the \"leftwards double arrow\" symbol."
24
40
  msgid "leftwards double arrow"
25
41
  msgstr "mũi tên kép hướng sang trái"
@@ -20,6 +20,22 @@ msgctxt "Name of the special characters plugins, visible in a dropdown and as a
20
20
  msgid "Special characters"
21
21
  msgstr "特殊字符"
22
22
 
23
+ msgctxt "A label for the \"leftwards simple arrow\" symbol."
24
+ msgid "leftwards simple arrow"
25
+ msgstr "向左简单箭头"
26
+
27
+ msgctxt "A label for the \"rightwards simple arrow\" symbol."
28
+ msgid "rightwards simple arrow"
29
+ msgstr "向右简单箭头"
30
+
31
+ msgctxt "A label for the \"upwards simple arrow\" symbol."
32
+ msgid "upwards simple arrow"
33
+ msgstr "向上简单箭头"
34
+
35
+ msgctxt "A label for the \"downwards simple arrow\" symbol."
36
+ msgid "downwards simple arrow"
37
+ msgstr "向下简单箭头"
38
+
23
39
  msgctxt "A label for the \"leftwards double arrow\" symbol."
24
40
  msgid "leftwards double arrow"
25
41
  msgstr "向左双箭头"
@@ -20,6 +20,22 @@ msgctxt "Name of the special characters plugins, visible in a dropdown and as a
20
20
  msgid "Special characters"
21
21
  msgstr "特殊字元"
22
22
 
23
+ msgctxt "A label for the \"leftwards simple arrow\" symbol."
24
+ msgid "leftwards simple arrow"
25
+ msgstr "向左簡單箭號"
26
+
27
+ msgctxt "A label for the \"rightwards simple arrow\" symbol."
28
+ msgid "rightwards simple arrow"
29
+ msgstr "向右簡單箭號"
30
+
31
+ msgctxt "A label for the \"upwards simple arrow\" symbol."
32
+ msgid "upwards simple arrow"
33
+ msgstr "向上簡單箭號"
34
+
35
+ msgctxt "A label for the \"downwards simple arrow\" symbol."
36
+ msgid "downwards simple arrow"
37
+ msgstr "向下簡單箭號"
38
+
23
39
  msgctxt "A label for the \"leftwards double arrow\" symbol."
24
40
  msgid "leftwards double arrow"
25
41
  msgstr "向左雙箭頭"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ckeditor/ckeditor5-special-characters",
3
- "version": "35.0.1",
3
+ "version": "35.2.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": "^35.0.1"
15
+ "ckeditor5": "^35.2.0"
16
16
  },
17
17
  "devDependencies": {
18
- "@ckeditor/ckeditor5-cloud-services": "^35.0.1",
19
- "@ckeditor/ckeditor5-core": "^35.0.1",
20
- "@ckeditor/ckeditor5-dev-utils": "^30.0.0",
21
- "@ckeditor/ckeditor5-easy-image": "^35.0.1",
22
- "@ckeditor/ckeditor5-editor-classic": "^35.0.1",
23
- "@ckeditor/ckeditor5-image": "^35.0.1",
24
- "@ckeditor/ckeditor5-theme-lark": "^35.0.1",
25
- "@ckeditor/ckeditor5-typing": "^35.0.1",
26
- "@ckeditor/ckeditor5-ui": "^35.0.1",
27
- "@ckeditor/ckeditor5-utils": "^35.0.1",
18
+ "@ckeditor/ckeditor5-cloud-services": "^35.2.0",
19
+ "@ckeditor/ckeditor5-core": "^35.2.0",
20
+ "@ckeditor/ckeditor5-dev-utils": "^31.0.0",
21
+ "@ckeditor/ckeditor5-easy-image": "^35.2.0",
22
+ "@ckeditor/ckeditor5-editor-classic": "^35.2.0",
23
+ "@ckeditor/ckeditor5-image": "^35.2.0",
24
+ "@ckeditor/ckeditor5-theme-lark": "^35.2.0",
25
+ "@ckeditor/ckeditor5-typing": "^35.2.0",
26
+ "@ckeditor/ckeditor5-ui": "^35.2.0",
27
+ "@ckeditor/ckeditor5-utils": "^35.2.0",
28
28
  "webpack": "^5.58.1",
29
29
  "webpack-cli": "^4.9.0"
30
30
  },
@@ -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( {
@@ -37,6 +37,10 @@ export default class SpecialCharactersArrows extends Plugin {
37
37
  const t = editor.t;
38
38
 
39
39
  editor.plugins.get( 'SpecialCharacters' ).addItems( 'Arrows', [
40
+ { title: t( 'leftwards simple arrow' ), character: '←' },
41
+ { title: t( 'rightwards simple arrow' ), character: '→' },
42
+ { title: t( 'upwards simple arrow' ), character: '↑' },
43
+ { title: t( 'downwards simple arrow' ), character: '↓' },
40
44
  { title: t( 'leftwards double arrow' ), character: '⇐' },
41
45
  { title: t( 'rightwards double arrow' ), character: '⇒' },
42
46
  { title: t( 'upwards double arrow' ), character: '⇑' },
@@ -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
  }
@@ -0,0 +1,143 @@
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
+ 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
+ }
143
+ }