@ckeditor/ckeditor5-special-characters 0.0.0-nightly-20240603.0 → 0.0.0-nightly-20240604.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/README.md +0 -6
- package/dist/index.js +183 -310
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -4,46 +4,25 @@
|
|
|
4
4
|
*/
|
|
5
5
|
import { Plugin } from '@ckeditor/ckeditor5-core/dist/index.js';
|
|
6
6
|
import { Typing } from '@ckeditor/ckeditor5-typing/dist/index.js';
|
|
7
|
-
import { FormHeaderView, createDropdown, addListToDropdown, ViewModel, View,
|
|
7
|
+
import { FormHeaderView, createDropdown, addListToDropdown, ViewModel, View, ButtonView, addKeyboardHandlingForGrid, FocusCycler } from '@ckeditor/ckeditor5-ui/dist/index.js';
|
|
8
8
|
import { Collection, FocusTracker, KeystrokeHandler, global, CKEditorError } from '@ckeditor/ckeditor5-utils/dist/index.js';
|
|
9
9
|
|
|
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
|
-
*/ class SpecialCharactersNavigationView extends FormHeaderView {
|
|
14
|
-
/**
|
|
15
|
-
* A dropdown that allows selecting a group of special characters to be displayed.
|
|
16
|
-
*/ groupDropdownView;
|
|
17
|
-
/**
|
|
18
|
-
* Creates an instance of the {@link module:special-characters/ui/specialcharactersnavigationview~SpecialCharactersNavigationView}
|
|
19
|
-
* class.
|
|
20
|
-
*
|
|
21
|
-
* @param locale The localization services instance.
|
|
22
|
-
* @param groupNames The names of the character groups and their displayed labels.
|
|
23
|
-
*/ constructor(locale, groupNames){
|
|
24
|
-
super(locale);
|
|
25
|
-
const t = locale.t;
|
|
26
|
-
this.set('class', 'ck-special-characters-navigation');
|
|
27
|
-
this.groupDropdownView = this._createGroupDropdown(groupNames);
|
|
28
|
-
this.groupDropdownView.panelPosition = locale.uiLanguageDirection === 'rtl' ? 'se' : 'sw';
|
|
29
|
-
this.label = t('Special characters');
|
|
30
|
-
this.children.add(this.groupDropdownView);
|
|
31
|
-
}
|
|
10
|
+
class SpecialCharactersNavigationView extends FormHeaderView {
|
|
32
11
|
/**
|
|
33
|
-
|
|
34
|
-
|
|
12
|
+
* Returns the name of the character group currently selected in the {@link #groupDropdownView}.
|
|
13
|
+
*/ get currentGroupName() {
|
|
35
14
|
return this.groupDropdownView.value;
|
|
36
15
|
}
|
|
37
16
|
/**
|
|
38
|
-
|
|
39
|
-
|
|
17
|
+
* Focuses the character categories dropdown.
|
|
18
|
+
*/ focus() {
|
|
40
19
|
this.groupDropdownView.focus();
|
|
41
20
|
}
|
|
42
21
|
/**
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
22
|
+
* Returns a dropdown that allows selecting character groups.
|
|
23
|
+
*
|
|
24
|
+
* @param groupNames The names of the character groups and their displayed labels.
|
|
25
|
+
*/ _createGroupDropdown(groupNames) {
|
|
47
26
|
const locale = this.locale;
|
|
48
27
|
const t = locale.t;
|
|
49
28
|
const dropdown = createDropdown(locale);
|
|
@@ -72,12 +51,12 @@ import { Collection, FocusTracker, KeystrokeHandler, global, CKEditorError } fro
|
|
|
72
51
|
return dropdown;
|
|
73
52
|
}
|
|
74
53
|
/**
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
54
|
+
* Returns list item definitions to be used in the character group dropdown
|
|
55
|
+
* representing specific character groups.
|
|
56
|
+
*
|
|
57
|
+
* @param dropdown Dropdown view element
|
|
58
|
+
* @param groupNames The names of the character groups and their displayed labels.
|
|
59
|
+
*/ _getCharacterGroupListItemDefinitions(dropdown, groupNames) {
|
|
81
60
|
const groupDefs = new Collection();
|
|
82
61
|
for (const [name, label] of groupNames){
|
|
83
62
|
const model = new ViewModel({
|
|
@@ -94,66 +73,30 @@ import { Collection, FocusTracker, KeystrokeHandler, global, CKEditorError } fro
|
|
|
94
73
|
}
|
|
95
74
|
return groupDefs;
|
|
96
75
|
}
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
/**
|
|
100
|
-
* A grid of character tiles. It allows browsing special characters and selecting the character to
|
|
101
|
-
* be inserted into the content.
|
|
102
|
-
*/ class CharacterGridView extends View {
|
|
103
|
-
/**
|
|
104
|
-
* A collection of the child tile views. Each tile represents a particular character.
|
|
105
|
-
*/ tiles;
|
|
106
76
|
/**
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
* Creates an instance of a character grid containing tiles representing special characters.
|
|
114
|
-
*
|
|
115
|
-
* @param locale The localization services instance.
|
|
116
|
-
*/ constructor(locale){
|
|
77
|
+
* Creates an instance of the {@link module:special-characters/ui/specialcharactersnavigationview~SpecialCharactersNavigationView}
|
|
78
|
+
* class.
|
|
79
|
+
*
|
|
80
|
+
* @param locale The localization services instance.
|
|
81
|
+
* @param groupNames The names of the character groups and their displayed labels.
|
|
82
|
+
*/ constructor(locale, groupNames){
|
|
117
83
|
super(locale);
|
|
118
|
-
|
|
119
|
-
this.
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
attributes: {
|
|
125
|
-
class: [
|
|
126
|
-
'ck',
|
|
127
|
-
'ck-character-grid__tiles'
|
|
128
|
-
]
|
|
129
|
-
},
|
|
130
|
-
children: this.tiles
|
|
131
|
-
}
|
|
132
|
-
],
|
|
133
|
-
attributes: {
|
|
134
|
-
class: [
|
|
135
|
-
'ck',
|
|
136
|
-
'ck-character-grid'
|
|
137
|
-
]
|
|
138
|
-
}
|
|
139
|
-
});
|
|
140
|
-
this.focusTracker = new FocusTracker();
|
|
141
|
-
this.keystrokes = new KeystrokeHandler();
|
|
142
|
-
addKeyboardHandlingForGrid({
|
|
143
|
-
keystrokeHandler: this.keystrokes,
|
|
144
|
-
focusTracker: this.focusTracker,
|
|
145
|
-
gridItems: this.tiles,
|
|
146
|
-
numberOfColumns: ()=>global.window.getComputedStyle(this.element.firstChild) // Responsive .ck-character-grid__tiles
|
|
147
|
-
.getPropertyValue('grid-template-columns').split(' ').length,
|
|
148
|
-
uiLanguageDirection: this.locale && this.locale.uiLanguageDirection
|
|
149
|
-
});
|
|
84
|
+
const t = locale.t;
|
|
85
|
+
this.set('class', 'ck-special-characters-navigation');
|
|
86
|
+
this.groupDropdownView = this._createGroupDropdown(groupNames);
|
|
87
|
+
this.groupDropdownView.panelPosition = locale.uiLanguageDirection === 'rtl' ? 'se' : 'sw';
|
|
88
|
+
this.label = t('Special characters');
|
|
89
|
+
this.children.add(this.groupDropdownView);
|
|
150
90
|
}
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
class CharacterGridView extends View {
|
|
151
94
|
/**
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
95
|
+
* Creates a new tile for the grid.
|
|
96
|
+
*
|
|
97
|
+
* @param character A human-readable character displayed as the label (e.g. "ε").
|
|
98
|
+
* @param name The name of the character (e.g. "greek small letter epsilon").
|
|
99
|
+
*/ createTile(character, name) {
|
|
157
100
|
const tile = new ButtonView(this.locale);
|
|
158
101
|
tile.set({
|
|
159
102
|
label: character,
|
|
@@ -192,8 +135,8 @@ import { Collection, FocusTracker, KeystrokeHandler, global, CKEditorError } fro
|
|
|
192
135
|
return tile;
|
|
193
136
|
}
|
|
194
137
|
/**
|
|
195
|
-
|
|
196
|
-
|
|
138
|
+
* @inheritDoc
|
|
139
|
+
*/ render() {
|
|
197
140
|
super.render();
|
|
198
141
|
for (const item of this.tiles){
|
|
199
142
|
this.focusTracker.add(item.element);
|
|
@@ -213,22 +156,58 @@ import { Collection, FocusTracker, KeystrokeHandler, global, CKEditorError } fro
|
|
|
213
156
|
this.keystrokes.listenTo(this.element);
|
|
214
157
|
}
|
|
215
158
|
/**
|
|
216
|
-
|
|
217
|
-
|
|
159
|
+
* @inheritDoc
|
|
160
|
+
*/ destroy() {
|
|
218
161
|
super.destroy();
|
|
219
162
|
this.keystrokes.destroy();
|
|
220
163
|
}
|
|
221
164
|
/**
|
|
222
|
-
|
|
223
|
-
|
|
165
|
+
* Focuses the first focusable in {@link ~CharacterGridView#tiles}.
|
|
166
|
+
*/ focus() {
|
|
224
167
|
this.tiles.first.focus();
|
|
225
168
|
}
|
|
169
|
+
/**
|
|
170
|
+
* Creates an instance of a character grid containing tiles representing special characters.
|
|
171
|
+
*
|
|
172
|
+
* @param locale The localization services instance.
|
|
173
|
+
*/ constructor(locale){
|
|
174
|
+
super(locale);
|
|
175
|
+
this.tiles = this.createCollection();
|
|
176
|
+
this.setTemplate({
|
|
177
|
+
tag: 'div',
|
|
178
|
+
children: [
|
|
179
|
+
{
|
|
180
|
+
tag: 'div',
|
|
181
|
+
attributes: {
|
|
182
|
+
class: [
|
|
183
|
+
'ck',
|
|
184
|
+
'ck-character-grid__tiles'
|
|
185
|
+
]
|
|
186
|
+
},
|
|
187
|
+
children: this.tiles
|
|
188
|
+
}
|
|
189
|
+
],
|
|
190
|
+
attributes: {
|
|
191
|
+
class: [
|
|
192
|
+
'ck',
|
|
193
|
+
'ck-character-grid'
|
|
194
|
+
]
|
|
195
|
+
}
|
|
196
|
+
});
|
|
197
|
+
this.focusTracker = new FocusTracker();
|
|
198
|
+
this.keystrokes = new KeystrokeHandler();
|
|
199
|
+
addKeyboardHandlingForGrid({
|
|
200
|
+
keystrokeHandler: this.keystrokes,
|
|
201
|
+
focusTracker: this.focusTracker,
|
|
202
|
+
gridItems: this.tiles,
|
|
203
|
+
numberOfColumns: ()=>global.window.getComputedStyle(this.element.firstChild) // Responsive .ck-character-grid__tiles
|
|
204
|
+
.getPropertyValue('grid-template-columns').split(' ').length,
|
|
205
|
+
uiLanguageDirection: this.locale && this.locale.uiLanguageDirection
|
|
206
|
+
});
|
|
207
|
+
}
|
|
226
208
|
}
|
|
227
209
|
|
|
228
|
-
|
|
229
|
-
* The view displaying detailed information about a special character glyph, e.g. upon
|
|
230
|
-
* hovering it with a mouse.
|
|
231
|
-
*/ class CharacterInfoView extends View {
|
|
210
|
+
class CharacterInfoView extends View {
|
|
232
211
|
constructor(locale){
|
|
233
212
|
super(locale);
|
|
234
213
|
const bind = this.bindTemplate;
|
|
@@ -289,37 +268,31 @@ import { Collection, FocusTracker, KeystrokeHandler, global, CKEditorError } fro
|
|
|
289
268
|
return 'U+' + ('0000' + hexCode).slice(-4);
|
|
290
269
|
}
|
|
291
270
|
|
|
292
|
-
|
|
293
|
-
* A view that glues pieces of the special characters dropdown panel together:
|
|
294
|
-
*
|
|
295
|
-
* * the navigation view (allows selecting the category),
|
|
296
|
-
* * the grid view (displays characters as a grid),
|
|
297
|
-
* * and the info view (displays detailed info about a specific character).
|
|
298
|
-
*/ class SpecialCharactersView extends View {
|
|
299
|
-
/**
|
|
300
|
-
* A collection of the focusable children of the view.
|
|
301
|
-
*/ items;
|
|
302
|
-
/**
|
|
303
|
-
* Tracks information about the DOM focus in the view.
|
|
304
|
-
*/ focusTracker;
|
|
305
|
-
/**
|
|
306
|
-
* An instance of the {@link module:utils/keystrokehandler~KeystrokeHandler}.
|
|
307
|
-
*/ keystrokes;
|
|
308
|
-
/**
|
|
309
|
-
* Helps cycling over focusable {@link #items} in the view.
|
|
310
|
-
*/ _focusCycler;
|
|
271
|
+
class SpecialCharactersView extends View {
|
|
311
272
|
/**
|
|
312
|
-
|
|
313
|
-
|
|
273
|
+
* @inheritDoc
|
|
274
|
+
*/ render() {
|
|
275
|
+
super.render();
|
|
276
|
+
this.focusTracker.add(this.navigationView.groupDropdownView.buttonView.element);
|
|
277
|
+
this.focusTracker.add(this.gridView.element);
|
|
278
|
+
// Start listening for the keystrokes coming from #element.
|
|
279
|
+
this.keystrokes.listenTo(this.element);
|
|
280
|
+
}
|
|
314
281
|
/**
|
|
315
|
-
|
|
316
|
-
|
|
282
|
+
* @inheritDoc
|
|
283
|
+
*/ destroy() {
|
|
284
|
+
super.destroy();
|
|
285
|
+
this.focusTracker.destroy();
|
|
286
|
+
this.keystrokes.destroy();
|
|
287
|
+
}
|
|
317
288
|
/**
|
|
318
|
-
|
|
319
|
-
|
|
289
|
+
* Focuses the first focusable in {@link #items}.
|
|
290
|
+
*/ focus() {
|
|
291
|
+
this.navigationView.focus();
|
|
292
|
+
}
|
|
320
293
|
/**
|
|
321
|
-
|
|
322
|
-
|
|
294
|
+
* Creates an instance of the `SpecialCharactersView`.
|
|
295
|
+
*/ constructor(locale, navigationView, gridView, infoView){
|
|
323
296
|
super(locale);
|
|
324
297
|
this.navigationView = navigationView;
|
|
325
298
|
this.gridView = gridView;
|
|
@@ -352,70 +325,27 @@ import { Collection, FocusTracker, KeystrokeHandler, global, CKEditorError } fro
|
|
|
352
325
|
this.items.add(this.navigationView.groupDropdownView.buttonView);
|
|
353
326
|
this.items.add(this.gridView);
|
|
354
327
|
}
|
|
355
|
-
/**
|
|
356
|
-
* @inheritDoc
|
|
357
|
-
*/ render() {
|
|
358
|
-
super.render();
|
|
359
|
-
this.focusTracker.add(this.navigationView.groupDropdownView.buttonView.element);
|
|
360
|
-
this.focusTracker.add(this.gridView.element);
|
|
361
|
-
// Start listening for the keystrokes coming from #element.
|
|
362
|
-
this.keystrokes.listenTo(this.element);
|
|
363
|
-
}
|
|
364
|
-
/**
|
|
365
|
-
* @inheritDoc
|
|
366
|
-
*/ destroy() {
|
|
367
|
-
super.destroy();
|
|
368
|
-
this.focusTracker.destroy();
|
|
369
|
-
this.keystrokes.destroy();
|
|
370
|
-
}
|
|
371
|
-
/**
|
|
372
|
-
* Focuses the first focusable in {@link #items}.
|
|
373
|
-
*/ focus() {
|
|
374
|
-
this.navigationView.focus();
|
|
375
|
-
}
|
|
376
328
|
}
|
|
377
329
|
|
|
378
330
|
var specialCharactersIcon = "<svg viewBox=\"0 0 20 20\" xmlns=\"http://www.w3.org/2000/svg\"><path d=\"M10 2.5a7.47 7.47 0 0 1 4.231 1.31 7.268 7.268 0 0 1 2.703 3.454 7.128 7.128 0 0 1 .199 4.353c-.39 1.436-1.475 2.72-2.633 3.677h2.013c0-.226.092-.443.254-.603a.876.876 0 0 1 1.229 0c.163.16.254.377.254.603v.853c0 .209-.078.41-.22.567a.873.873 0 0 1-.547.28l-.101.006h-4.695a.517.517 0 0 1-.516-.518v-1.265c0-.21.128-.398.317-.489a5.601 5.601 0 0 0 2.492-2.371 5.459 5.459 0 0 0 .552-3.693 5.53 5.53 0 0 0-1.955-3.2A5.71 5.71 0 0 0 10 4.206 5.708 5.708 0 0 0 6.419 5.46 5.527 5.527 0 0 0 4.46 8.663a5.457 5.457 0 0 0 .554 3.695 5.6 5.6 0 0 0 2.497 2.37.55.55 0 0 1 .317.49v1.264c0 .286-.23.518-.516.518H2.618a.877.877 0 0 1-.614-.25.845.845 0 0 1-.254-.603v-.853c0-.226.091-.443.254-.603a.876.876 0 0 1 1.228 0c.163.16.255.377.255.603h1.925c-1.158-.958-2.155-2.241-2.545-3.678a7.128 7.128 0 0 1 .199-4.352 7.268 7.268 0 0 1 2.703-3.455A7.475 7.475 0 0 1 10 2.5z\"/></svg>";
|
|
379
331
|
|
|
380
332
|
const ALL_SPECIAL_CHARACTERS_GROUP = 'All';
|
|
381
|
-
|
|
382
|
-
* The special characters feature.
|
|
383
|
-
*
|
|
384
|
-
* Introduces the `'specialCharacters'` dropdown.
|
|
385
|
-
*/ class SpecialCharacters extends Plugin {
|
|
333
|
+
class SpecialCharacters extends Plugin {
|
|
386
334
|
/**
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
/**
|
|
390
|
-
* Registered groups. Each group contains a displayed label and a collection with symbol names.
|
|
391
|
-
*/ _groups;
|
|
392
|
-
/**
|
|
393
|
-
* A label describing the "All" special characters category.
|
|
394
|
-
*/ _allSpecialCharactersGroupLabel;
|
|
395
|
-
/**
|
|
396
|
-
* @inheritDoc
|
|
397
|
-
*/ static get requires() {
|
|
335
|
+
* @inheritDoc
|
|
336
|
+
*/ static get requires() {
|
|
398
337
|
return [
|
|
399
338
|
Typing
|
|
400
339
|
];
|
|
401
340
|
}
|
|
402
341
|
/**
|
|
403
|
-
|
|
404
|
-
|
|
342
|
+
* @inheritDoc
|
|
343
|
+
*/ static get pluginName() {
|
|
405
344
|
return 'SpecialCharacters';
|
|
406
345
|
}
|
|
407
346
|
/**
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
super(editor);
|
|
411
|
-
const t = editor.t;
|
|
412
|
-
this._characters = new Map();
|
|
413
|
-
this._groups = new Map();
|
|
414
|
-
this._allSpecialCharactersGroupLabel = t('All');
|
|
415
|
-
}
|
|
416
|
-
/**
|
|
417
|
-
* @inheritDoc
|
|
418
|
-
*/ init() {
|
|
347
|
+
* @inheritDoc
|
|
348
|
+
*/ init() {
|
|
419
349
|
const editor = this.editor;
|
|
420
350
|
const t = editor.t;
|
|
421
351
|
const inputCommand = editor.commands.get('insertText');
|
|
@@ -451,20 +381,20 @@ const ALL_SPECIAL_CHARACTERS_GROUP = 'All';
|
|
|
451
381
|
});
|
|
452
382
|
}
|
|
453
383
|
/**
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
384
|
+
* Adds a collection of special characters to the specified group. The title of a special character must be unique.
|
|
385
|
+
*
|
|
386
|
+
* **Note:** The "All" category name is reserved by the plugin and cannot be used as a new name for a special
|
|
387
|
+
* characters category.
|
|
388
|
+
*/ addItems(groupName, items, options = {
|
|
459
389
|
label: groupName
|
|
460
390
|
}) {
|
|
461
391
|
if (groupName === ALL_SPECIAL_CHARACTERS_GROUP) {
|
|
462
392
|
/**
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
393
|
+
* The name "All" for a special category group cannot be used because it is a special category that displays all
|
|
394
|
+
* available special characters.
|
|
395
|
+
*
|
|
396
|
+
* @error special-character-invalid-group-name
|
|
397
|
+
*/ throw new CKEditorError('special-character-invalid-group-name', null);
|
|
468
398
|
}
|
|
469
399
|
const group = this._getGroup(groupName, options.label);
|
|
470
400
|
for (const item of items){
|
|
@@ -473,17 +403,17 @@ const ALL_SPECIAL_CHARACTERS_GROUP = 'All';
|
|
|
473
403
|
}
|
|
474
404
|
}
|
|
475
405
|
/**
|
|
476
|
-
|
|
477
|
-
|
|
406
|
+
* Returns special character groups in an order determined based on configuration and registration sequence.
|
|
407
|
+
*/ getGroups() {
|
|
478
408
|
const groups = Array.from(this._groups.keys());
|
|
479
409
|
const order = this.editor.config.get('specialCharacters.order') || [];
|
|
480
410
|
const invalidGroup = order.find((item)=>!groups.includes(item));
|
|
481
411
|
if (invalidGroup) {
|
|
482
412
|
/**
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
413
|
+
* One of the special character groups in the "specialCharacters.order" configuration doesn't exist.
|
|
414
|
+
*
|
|
415
|
+
* @error special-character-invalid-order-group-name
|
|
416
|
+
*/ throw new CKEditorError('special-character-invalid-order-group-name', null, {
|
|
487
417
|
invalidGroup
|
|
488
418
|
});
|
|
489
419
|
}
|
|
@@ -493,8 +423,8 @@ const ALL_SPECIAL_CHARACTERS_GROUP = 'All';
|
|
|
493
423
|
]);
|
|
494
424
|
}
|
|
495
425
|
/**
|
|
496
|
-
|
|
497
|
-
|
|
426
|
+
* Returns a collection of special characters symbol names (titles).
|
|
427
|
+
*/ getCharactersForGroup(groupName) {
|
|
498
428
|
if (groupName === ALL_SPECIAL_CHARACTERS_GROUP) {
|
|
499
429
|
return new Set(this._characters.keys());
|
|
500
430
|
}
|
|
@@ -504,19 +434,19 @@ const ALL_SPECIAL_CHARACTERS_GROUP = 'All';
|
|
|
504
434
|
}
|
|
505
435
|
}
|
|
506
436
|
/**
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
437
|
+
* Returns the symbol of a special character for the specified name. If the special character could not be found, `undefined`
|
|
438
|
+
* is returned.
|
|
439
|
+
*
|
|
440
|
+
* @param title The title of a special character.
|
|
441
|
+
*/ getCharacter(title) {
|
|
512
442
|
return this._characters.get(title);
|
|
513
443
|
}
|
|
514
444
|
/**
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
445
|
+
* Returns a group of special characters. If the group with the specified name does not exist, it will be created.
|
|
446
|
+
*
|
|
447
|
+
* @param groupName The name of the group to create.
|
|
448
|
+
* @param label The label describing the new group.
|
|
449
|
+
*/ _getGroup(groupName, label) {
|
|
520
450
|
if (!this._groups.has(groupName)) {
|
|
521
451
|
this._groups.set(groupName, {
|
|
522
452
|
items: new Set(),
|
|
@@ -526,8 +456,8 @@ const ALL_SPECIAL_CHARACTERS_GROUP = 'All';
|
|
|
526
456
|
return this._groups.get(groupName);
|
|
527
457
|
}
|
|
528
458
|
/**
|
|
529
|
-
|
|
530
|
-
|
|
459
|
+
* Updates the symbol grid depending on the currently selected character group.
|
|
460
|
+
*/ _updateGrid(currentGroupName, gridView) {
|
|
531
461
|
// Updating the grid starts with removing all tiles belonging to the old group.
|
|
532
462
|
gridView.tiles.clear();
|
|
533
463
|
const characterTitles = this.getCharactersForGroup(currentGroupName);
|
|
@@ -537,10 +467,10 @@ const ALL_SPECIAL_CHARACTERS_GROUP = 'All';
|
|
|
537
467
|
}
|
|
538
468
|
}
|
|
539
469
|
/**
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
470
|
+
* Initializes the dropdown, used for lazy loading.
|
|
471
|
+
*
|
|
472
|
+
* @returns An object with `navigationView`, `gridView` and `infoView` properties, containing UI parts.
|
|
473
|
+
*/ _createDropdownPanelContent(locale, dropdownView) {
|
|
544
474
|
const groupEntries = Array.from(this.getGroups()).map((name)=>[
|
|
545
475
|
name,
|
|
546
476
|
this._groups.get(name).label
|
|
@@ -576,28 +506,26 @@ const ALL_SPECIAL_CHARACTERS_GROUP = 'All';
|
|
|
576
506
|
infoView
|
|
577
507
|
};
|
|
578
508
|
}
|
|
509
|
+
/**
|
|
510
|
+
* @inheritDoc
|
|
511
|
+
*/ constructor(editor){
|
|
512
|
+
super(editor);
|
|
513
|
+
const t = editor.t;
|
|
514
|
+
this._characters = new Map();
|
|
515
|
+
this._groups = new Map();
|
|
516
|
+
this._allSpecialCharactersGroupLabel = t('All');
|
|
517
|
+
}
|
|
579
518
|
}
|
|
580
519
|
|
|
581
|
-
|
|
582
|
-
* A plugin that provides special characters for the "Arrows" category.
|
|
583
|
-
*
|
|
584
|
-
* ```ts
|
|
585
|
-
* ClassicEditor
|
|
586
|
-
* .create( {
|
|
587
|
-
* plugins: [ ..., SpecialCharacters, SpecialCharactersArrows ],
|
|
588
|
-
* } )
|
|
589
|
-
* .then( ... )
|
|
590
|
-
* .catch( ... );
|
|
591
|
-
* ```
|
|
592
|
-
*/ class SpecialCharactersArrows extends Plugin {
|
|
520
|
+
class SpecialCharactersArrows extends Plugin {
|
|
593
521
|
/**
|
|
594
|
-
|
|
595
|
-
|
|
522
|
+
* @inheritDoc
|
|
523
|
+
*/ static get pluginName() {
|
|
596
524
|
return 'SpecialCharactersArrows';
|
|
597
525
|
}
|
|
598
526
|
/**
|
|
599
|
-
|
|
600
|
-
|
|
527
|
+
* @inheritDoc
|
|
528
|
+
*/ init() {
|
|
601
529
|
const editor = this.editor;
|
|
602
530
|
const t = editor.t;
|
|
603
531
|
const plugin = editor.plugins.get('SpecialCharacters');
|
|
@@ -696,26 +624,15 @@ const ALL_SPECIAL_CHARACTERS_GROUP = 'All';
|
|
|
696
624
|
}
|
|
697
625
|
}
|
|
698
626
|
|
|
699
|
-
|
|
700
|
-
* A plugin that provides special characters for the "Text" category.
|
|
701
|
-
*
|
|
702
|
-
* ```ts
|
|
703
|
-
* ClassicEditor
|
|
704
|
-
* .create( {
|
|
705
|
-
* plugins: [ ..., SpecialCharacters, SpecialCharactersText ],
|
|
706
|
-
* } )
|
|
707
|
-
* .then( ... )
|
|
708
|
-
* .catch( ... );
|
|
709
|
-
* ```
|
|
710
|
-
*/ class SpecialCharactersText extends Plugin {
|
|
627
|
+
class SpecialCharactersText extends Plugin {
|
|
711
628
|
/**
|
|
712
|
-
|
|
713
|
-
|
|
629
|
+
* @inheritDoc
|
|
630
|
+
*/ static get pluginName() {
|
|
714
631
|
return 'SpecialCharactersText';
|
|
715
632
|
}
|
|
716
633
|
/**
|
|
717
|
-
|
|
718
|
-
|
|
634
|
+
* @inheritDoc
|
|
635
|
+
*/ init() {
|
|
719
636
|
const editor = this.editor;
|
|
720
637
|
const t = editor.t;
|
|
721
638
|
const plugin = editor.plugins.get('SpecialCharacters');
|
|
@@ -834,26 +751,15 @@ const ALL_SPECIAL_CHARACTERS_GROUP = 'All';
|
|
|
834
751
|
}
|
|
835
752
|
}
|
|
836
753
|
|
|
837
|
-
|
|
838
|
-
* A plugin that provides special characters for the "Mathematical" category.
|
|
839
|
-
*
|
|
840
|
-
* ```ts
|
|
841
|
-
* ClassicEditor
|
|
842
|
-
* .create( {
|
|
843
|
-
* plugins: [ ..., SpecialCharacters, SpecialCharactersMathematical ],
|
|
844
|
-
* } )
|
|
845
|
-
* .then( ... )
|
|
846
|
-
* .catch( ... );
|
|
847
|
-
* ```
|
|
848
|
-
*/ class SpecialCharactersMathematical extends Plugin {
|
|
754
|
+
class SpecialCharactersMathematical extends Plugin {
|
|
849
755
|
/**
|
|
850
|
-
|
|
851
|
-
|
|
756
|
+
* @inheritDoc
|
|
757
|
+
*/ static get pluginName() {
|
|
852
758
|
return 'SpecialCharactersMathematical';
|
|
853
759
|
}
|
|
854
760
|
/**
|
|
855
|
-
|
|
856
|
-
|
|
761
|
+
* @inheritDoc
|
|
762
|
+
*/ init() {
|
|
857
763
|
const editor = this.editor;
|
|
858
764
|
const t = editor.t;
|
|
859
765
|
const plugin = editor.plugins.get('SpecialCharacters');
|
|
@@ -1040,26 +946,15 @@ const ALL_SPECIAL_CHARACTERS_GROUP = 'All';
|
|
|
1040
946
|
}
|
|
1041
947
|
}
|
|
1042
948
|
|
|
1043
|
-
|
|
1044
|
-
* A plugin that provides special characters for the "Latin" category.
|
|
1045
|
-
*
|
|
1046
|
-
* ```ts
|
|
1047
|
-
* ClassicEditor
|
|
1048
|
-
* .create( {
|
|
1049
|
-
* plugins: [ ..., SpecialCharacters, SpecialCharactersLatin ],
|
|
1050
|
-
* } )
|
|
1051
|
-
* .then( ... )
|
|
1052
|
-
* .catch( ... );
|
|
1053
|
-
* ```
|
|
1054
|
-
*/ class SpecialCharactersLatin extends Plugin {
|
|
949
|
+
class SpecialCharactersLatin extends Plugin {
|
|
1055
950
|
/**
|
|
1056
|
-
|
|
1057
|
-
|
|
951
|
+
* @inheritDoc
|
|
952
|
+
*/ static get pluginName() {
|
|
1058
953
|
return 'SpecialCharactersLatin';
|
|
1059
954
|
}
|
|
1060
955
|
/**
|
|
1061
|
-
|
|
1062
|
-
|
|
956
|
+
* @inheritDoc
|
|
957
|
+
*/ init() {
|
|
1063
958
|
const editor = this.editor;
|
|
1064
959
|
const t = editor.t;
|
|
1065
960
|
const plugin = editor.plugins.get('SpecialCharacters');
|
|
@@ -1582,26 +1477,15 @@ const ALL_SPECIAL_CHARACTERS_GROUP = 'All';
|
|
|
1582
1477
|
}
|
|
1583
1478
|
}
|
|
1584
1479
|
|
|
1585
|
-
|
|
1586
|
-
* A plugin that provides special characters for the "Currency" category.
|
|
1587
|
-
*
|
|
1588
|
-
* ```ts
|
|
1589
|
-
* ClassicEditor
|
|
1590
|
-
* .create( {
|
|
1591
|
-
* plugins: [ ..., SpecialCharacters, SpecialCharactersCurrency ],
|
|
1592
|
-
* } )
|
|
1593
|
-
* .then( ... )
|
|
1594
|
-
* .catch( ... );
|
|
1595
|
-
* ```
|
|
1596
|
-
*/ class SpecialCharactersCurrency extends Plugin {
|
|
1480
|
+
class SpecialCharactersCurrency extends Plugin {
|
|
1597
1481
|
/**
|
|
1598
|
-
|
|
1599
|
-
|
|
1482
|
+
* @inheritDoc
|
|
1483
|
+
*/ static get pluginName() {
|
|
1600
1484
|
return 'SpecialCharactersCurrency';
|
|
1601
1485
|
}
|
|
1602
1486
|
/**
|
|
1603
|
-
|
|
1604
|
-
|
|
1487
|
+
* @inheritDoc
|
|
1488
|
+
*/ init() {
|
|
1605
1489
|
const editor = this.editor;
|
|
1606
1490
|
const t = editor.t;
|
|
1607
1491
|
const plugin = editor.plugins.get('SpecialCharacters');
|
|
@@ -1756,26 +1640,15 @@ const ALL_SPECIAL_CHARACTERS_GROUP = 'All';
|
|
|
1756
1640
|
}
|
|
1757
1641
|
}
|
|
1758
1642
|
|
|
1759
|
-
|
|
1760
|
-
* A plugin combining a basic set of characters for the special characters plugin.
|
|
1761
|
-
*
|
|
1762
|
-
* ```ts
|
|
1763
|
-
* ClassicEditor
|
|
1764
|
-
* .create( {
|
|
1765
|
-
* plugins: [ ..., SpecialCharacters, SpecialCharactersEssentials ],
|
|
1766
|
-
* } )
|
|
1767
|
-
* .then( ... )
|
|
1768
|
-
* .catch( ... );
|
|
1769
|
-
* ```
|
|
1770
|
-
*/ class SpecialCharactersEssentials extends Plugin {
|
|
1643
|
+
class SpecialCharactersEssentials extends Plugin {
|
|
1771
1644
|
/**
|
|
1772
|
-
|
|
1773
|
-
|
|
1645
|
+
* @inheritDoc
|
|
1646
|
+
*/ static get pluginName() {
|
|
1774
1647
|
return 'SpecialCharactersEssentials';
|
|
1775
1648
|
}
|
|
1776
1649
|
/**
|
|
1777
|
-
|
|
1778
|
-
|
|
1650
|
+
* @inheritDoc
|
|
1651
|
+
*/ static get requires() {
|
|
1779
1652
|
return [
|
|
1780
1653
|
SpecialCharactersCurrency,
|
|
1781
1654
|
SpecialCharactersText,
|