@ckeditor/ckeditor5-special-characters 39.0.1 → 40.0.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/LICENSE.md +1 -1
- package/README.md +3 -3
- package/build/special-characters.js.map +1 -0
- package/build/translations/pt-br.js +1 -1
- package/lang/translations/ar.po +1 -0
- package/lang/translations/az.po +1 -0
- package/lang/translations/bg.po +1 -0
- package/lang/translations/bn.po +1 -0
- package/lang/translations/ca.po +1 -0
- package/lang/translations/cs.po +1 -0
- package/lang/translations/da.po +1 -0
- package/lang/translations/de.po +1 -0
- package/lang/translations/el.po +1 -0
- package/lang/translations/en-au.po +1 -0
- package/lang/translations/en.po +1 -0
- package/lang/translations/es.po +1 -0
- package/lang/translations/et.po +1 -0
- package/lang/translations/fa.po +1 -0
- package/lang/translations/fi.po +1 -0
- package/lang/translations/fr.po +1 -0
- package/lang/translations/gl.po +1 -0
- package/lang/translations/he.po +1 -0
- package/lang/translations/hi.po +1 -0
- package/lang/translations/hr.po +1 -0
- package/lang/translations/hu.po +1 -0
- package/lang/translations/id.po +1 -0
- package/lang/translations/it.po +1 -0
- package/lang/translations/ja.po +1 -0
- package/lang/translations/ko.po +1 -0
- package/lang/translations/lt.po +1 -0
- package/lang/translations/lv.po +1 -0
- package/lang/translations/ms.po +1 -0
- package/lang/translations/nl.po +1 -0
- package/lang/translations/no.po +1 -0
- package/lang/translations/pl.po +1 -0
- package/lang/translations/pt-br.po +42 -41
- package/lang/translations/pt.po +1 -0
- package/lang/translations/ro.po +1 -0
- package/lang/translations/ru.po +1 -0
- package/lang/translations/sk.po +1 -0
- package/lang/translations/sq.po +1 -0
- package/lang/translations/sr-latn.po +1 -0
- package/lang/translations/sr.po +1 -0
- package/lang/translations/sv.po +1 -0
- package/lang/translations/th.po +1 -0
- package/lang/translations/tk.po +1 -0
- package/lang/translations/tr.po +1 -0
- package/lang/translations/uk.po +1 -0
- package/lang/translations/ur.po +1 -0
- package/lang/translations/uz.po +1 -0
- package/lang/translations/vi.po +1 -0
- package/lang/translations/zh-cn.po +1 -0
- package/lang/translations/zh.po +1 -0
- package/package.json +2 -6
- package/src/augmentation.d.ts +24 -24
- package/src/augmentation.js +5 -5
- package/src/index.d.ts +16 -16
- package/src/index.js +15 -15
- package/src/specialcharacters.d.ts +96 -96
- package/src/specialcharacters.js +206 -206
- package/src/specialcharactersarrows.d.ts +30 -30
- package/src/specialcharactersarrows.js +60 -60
- package/src/specialcharactersconfig.d.ts +51 -51
- package/src/specialcharactersconfig.js +5 -5
- package/src/specialcharacterscurrency.d.ts +30 -30
- package/src/specialcharacterscurrency.js +74 -74
- package/src/specialcharactersessentials.d.ts +35 -35
- package/src/specialcharactersessentials.js +45 -45
- package/src/specialcharacterslatin.d.ts +30 -30
- package/src/specialcharacterslatin.js +166 -166
- package/src/specialcharactersmathematical.d.ts +30 -30
- package/src/specialcharactersmathematical.js +82 -82
- package/src/specialcharacterstext.d.ts +30 -30
- package/src/specialcharacterstext.js +65 -65
- package/src/ui/charactergridview.d.ts +94 -94
- package/src/ui/charactergridview.js +129 -129
- package/src/ui/characterinfoview.d.ts +35 -35
- package/src/ui/characterinfoview.js +71 -71
- package/src/ui/specialcharactersnavigationview.d.ts +59 -59
- package/src/ui/specialcharactersnavigationview.js +95 -95
- package/src/ui/specialcharactersview.d.ts +65 -65
- package/src/ui/specialcharactersview.js +78 -78
|
@@ -1,129 +1,129 @@
|
|
|
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/charactergridview
|
|
7
|
-
*/
|
|
8
|
-
import { View, ButtonView, addKeyboardHandlingForGrid } from 'ckeditor5/src/ui';
|
|
9
|
-
import { KeystrokeHandler, FocusTracker, global } from 'ckeditor5/src/utils';
|
|
10
|
-
import '../../theme/charactergrid.css';
|
|
11
|
-
/**
|
|
12
|
-
* A grid of character tiles. It allows browsing special characters and selecting the character to
|
|
13
|
-
* be inserted into the content.
|
|
14
|
-
*/
|
|
15
|
-
export default class CharacterGridView extends View {
|
|
16
|
-
/**
|
|
17
|
-
* Creates an instance of a character grid containing tiles representing special characters.
|
|
18
|
-
*
|
|
19
|
-
* @param locale The localization services instance.
|
|
20
|
-
*/
|
|
21
|
-
constructor(locale) {
|
|
22
|
-
super(locale);
|
|
23
|
-
this.tiles = this.createCollection();
|
|
24
|
-
this.setTemplate({
|
|
25
|
-
tag: 'div',
|
|
26
|
-
children: [
|
|
27
|
-
{
|
|
28
|
-
tag: 'div',
|
|
29
|
-
attributes: {
|
|
30
|
-
class: [
|
|
31
|
-
'ck',
|
|
32
|
-
'ck-character-grid__tiles'
|
|
33
|
-
]
|
|
34
|
-
},
|
|
35
|
-
children: this.tiles
|
|
36
|
-
}
|
|
37
|
-
],
|
|
38
|
-
attributes: {
|
|
39
|
-
class: [
|
|
40
|
-
'ck',
|
|
41
|
-
'ck-character-grid'
|
|
42
|
-
]
|
|
43
|
-
}
|
|
44
|
-
});
|
|
45
|
-
this.focusTracker = new FocusTracker();
|
|
46
|
-
this.keystrokes = new KeystrokeHandler();
|
|
47
|
-
addKeyboardHandlingForGrid({
|
|
48
|
-
keystrokeHandler: this.keystrokes,
|
|
49
|
-
focusTracker: this.focusTracker,
|
|
50
|
-
gridItems: this.tiles,
|
|
51
|
-
numberOfColumns: () => global.window
|
|
52
|
-
.getComputedStyle(this.element.firstChild) // Responsive .ck-character-grid__tiles
|
|
53
|
-
.getPropertyValue('grid-template-columns')
|
|
54
|
-
.split(' ')
|
|
55
|
-
.length,
|
|
56
|
-
uiLanguageDirection: this.locale && this.locale.uiLanguageDirection
|
|
57
|
-
});
|
|
58
|
-
}
|
|
59
|
-
/**
|
|
60
|
-
* Creates a new tile for the grid.
|
|
61
|
-
*
|
|
62
|
-
* @param character A human-readable character displayed as the label (e.g. "ε").
|
|
63
|
-
* @param name The name of the character (e.g. "greek small letter epsilon").
|
|
64
|
-
*/
|
|
65
|
-
createTile(character, name) {
|
|
66
|
-
const tile = new ButtonView(this.locale);
|
|
67
|
-
tile.set({
|
|
68
|
-
label: character,
|
|
69
|
-
withText: true,
|
|
70
|
-
class: 'ck-character-grid__tile'
|
|
71
|
-
});
|
|
72
|
-
// Labels are vital for the users to understand what character they're looking at.
|
|
73
|
-
// For now we're using native title attribute for that, see #5817.
|
|
74
|
-
tile.extendTemplate({
|
|
75
|
-
attributes: {
|
|
76
|
-
title: name
|
|
77
|
-
},
|
|
78
|
-
on: {
|
|
79
|
-
mouseover: tile.bindTemplate.to('mouseover'),
|
|
80
|
-
focus: tile.bindTemplate.to('focus')
|
|
81
|
-
}
|
|
82
|
-
});
|
|
83
|
-
tile.on('mouseover', () => {
|
|
84
|
-
this.fire('tileHover', { name, character });
|
|
85
|
-
});
|
|
86
|
-
tile.on('focus', () => {
|
|
87
|
-
this.fire('tileFocus', { name, character });
|
|
88
|
-
});
|
|
89
|
-
tile.on('execute', () => {
|
|
90
|
-
this.fire('execute', { name, character });
|
|
91
|
-
});
|
|
92
|
-
return tile;
|
|
93
|
-
}
|
|
94
|
-
/**
|
|
95
|
-
* @inheritDoc
|
|
96
|
-
*/
|
|
97
|
-
render() {
|
|
98
|
-
super.render();
|
|
99
|
-
for (const item of this.tiles) {
|
|
100
|
-
this.focusTracker.add(item.element);
|
|
101
|
-
}
|
|
102
|
-
this.tiles.on('change', (eventInfo, { added, removed }) => {
|
|
103
|
-
if (added.length > 0) {
|
|
104
|
-
for (const item of added) {
|
|
105
|
-
this.focusTracker.add(item.element);
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
if (removed.length > 0) {
|
|
109
|
-
for (const item of removed) {
|
|
110
|
-
this.focusTracker.remove(item.element);
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
});
|
|
114
|
-
this.keystrokes.listenTo(this.element);
|
|
115
|
-
}
|
|
116
|
-
/**
|
|
117
|
-
* @inheritDoc
|
|
118
|
-
*/
|
|
119
|
-
destroy() {
|
|
120
|
-
super.destroy();
|
|
121
|
-
this.keystrokes.destroy();
|
|
122
|
-
}
|
|
123
|
-
/**
|
|
124
|
-
* Focuses the first focusable in {@link ~CharacterGridView#tiles}.
|
|
125
|
-
*/
|
|
126
|
-
focus() {
|
|
127
|
-
this.tiles.first.focus();
|
|
128
|
-
}
|
|
129
|
-
}
|
|
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/charactergridview
|
|
7
|
+
*/
|
|
8
|
+
import { View, ButtonView, addKeyboardHandlingForGrid } from 'ckeditor5/src/ui';
|
|
9
|
+
import { KeystrokeHandler, FocusTracker, global } from 'ckeditor5/src/utils';
|
|
10
|
+
import '../../theme/charactergrid.css';
|
|
11
|
+
/**
|
|
12
|
+
* A grid of character tiles. It allows browsing special characters and selecting the character to
|
|
13
|
+
* be inserted into the content.
|
|
14
|
+
*/
|
|
15
|
+
export default class CharacterGridView extends View {
|
|
16
|
+
/**
|
|
17
|
+
* Creates an instance of a character grid containing tiles representing special characters.
|
|
18
|
+
*
|
|
19
|
+
* @param locale The localization services instance.
|
|
20
|
+
*/
|
|
21
|
+
constructor(locale) {
|
|
22
|
+
super(locale);
|
|
23
|
+
this.tiles = this.createCollection();
|
|
24
|
+
this.setTemplate({
|
|
25
|
+
tag: 'div',
|
|
26
|
+
children: [
|
|
27
|
+
{
|
|
28
|
+
tag: 'div',
|
|
29
|
+
attributes: {
|
|
30
|
+
class: [
|
|
31
|
+
'ck',
|
|
32
|
+
'ck-character-grid__tiles'
|
|
33
|
+
]
|
|
34
|
+
},
|
|
35
|
+
children: this.tiles
|
|
36
|
+
}
|
|
37
|
+
],
|
|
38
|
+
attributes: {
|
|
39
|
+
class: [
|
|
40
|
+
'ck',
|
|
41
|
+
'ck-character-grid'
|
|
42
|
+
]
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
this.focusTracker = new FocusTracker();
|
|
46
|
+
this.keystrokes = new KeystrokeHandler();
|
|
47
|
+
addKeyboardHandlingForGrid({
|
|
48
|
+
keystrokeHandler: this.keystrokes,
|
|
49
|
+
focusTracker: this.focusTracker,
|
|
50
|
+
gridItems: this.tiles,
|
|
51
|
+
numberOfColumns: () => global.window
|
|
52
|
+
.getComputedStyle(this.element.firstChild) // Responsive .ck-character-grid__tiles
|
|
53
|
+
.getPropertyValue('grid-template-columns')
|
|
54
|
+
.split(' ')
|
|
55
|
+
.length,
|
|
56
|
+
uiLanguageDirection: this.locale && this.locale.uiLanguageDirection
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Creates a new tile for the grid.
|
|
61
|
+
*
|
|
62
|
+
* @param character A human-readable character displayed as the label (e.g. "ε").
|
|
63
|
+
* @param name The name of the character (e.g. "greek small letter epsilon").
|
|
64
|
+
*/
|
|
65
|
+
createTile(character, name) {
|
|
66
|
+
const tile = new ButtonView(this.locale);
|
|
67
|
+
tile.set({
|
|
68
|
+
label: character,
|
|
69
|
+
withText: true,
|
|
70
|
+
class: 'ck-character-grid__tile'
|
|
71
|
+
});
|
|
72
|
+
// Labels are vital for the users to understand what character they're looking at.
|
|
73
|
+
// For now we're using native title attribute for that, see #5817.
|
|
74
|
+
tile.extendTemplate({
|
|
75
|
+
attributes: {
|
|
76
|
+
title: name
|
|
77
|
+
},
|
|
78
|
+
on: {
|
|
79
|
+
mouseover: tile.bindTemplate.to('mouseover'),
|
|
80
|
+
focus: tile.bindTemplate.to('focus')
|
|
81
|
+
}
|
|
82
|
+
});
|
|
83
|
+
tile.on('mouseover', () => {
|
|
84
|
+
this.fire('tileHover', { name, character });
|
|
85
|
+
});
|
|
86
|
+
tile.on('focus', () => {
|
|
87
|
+
this.fire('tileFocus', { name, character });
|
|
88
|
+
});
|
|
89
|
+
tile.on('execute', () => {
|
|
90
|
+
this.fire('execute', { name, character });
|
|
91
|
+
});
|
|
92
|
+
return tile;
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* @inheritDoc
|
|
96
|
+
*/
|
|
97
|
+
render() {
|
|
98
|
+
super.render();
|
|
99
|
+
for (const item of this.tiles) {
|
|
100
|
+
this.focusTracker.add(item.element);
|
|
101
|
+
}
|
|
102
|
+
this.tiles.on('change', (eventInfo, { added, removed }) => {
|
|
103
|
+
if (added.length > 0) {
|
|
104
|
+
for (const item of added) {
|
|
105
|
+
this.focusTracker.add(item.element);
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
if (removed.length > 0) {
|
|
109
|
+
for (const item of removed) {
|
|
110
|
+
this.focusTracker.remove(item.element);
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
});
|
|
114
|
+
this.keystrokes.listenTo(this.element);
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* @inheritDoc
|
|
118
|
+
*/
|
|
119
|
+
destroy() {
|
|
120
|
+
super.destroy();
|
|
121
|
+
this.keystrokes.destroy();
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* Focuses the first focusable in {@link ~CharacterGridView#tiles}.
|
|
125
|
+
*/
|
|
126
|
+
focus() {
|
|
127
|
+
this.tiles.first.focus();
|
|
128
|
+
}
|
|
129
|
+
}
|
|
@@ -1,35 +1,35 @@
|
|
|
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/characterinfoview
|
|
7
|
-
*/
|
|
8
|
-
import type { Locale } from 'ckeditor5/src/utils';
|
|
9
|
-
import { View } from 'ckeditor5/src/ui';
|
|
10
|
-
import '../../theme/characterinfo.css';
|
|
11
|
-
/**
|
|
12
|
-
* The view displaying detailed information about a special character glyph, e.g. upon
|
|
13
|
-
* hovering it with a mouse.
|
|
14
|
-
*/
|
|
15
|
-
export default class CharacterInfoView extends View<HTMLDivElement> {
|
|
16
|
-
/**
|
|
17
|
-
* The character whose information is displayed by the view. For instance, "∑" or "¿".
|
|
18
|
-
*
|
|
19
|
-
* @observable
|
|
20
|
-
*/
|
|
21
|
-
character: string | null;
|
|
22
|
-
/**
|
|
23
|
-
* The name of the {@link #character}. For instance, "N-ary summation" or "Inverted question mark".
|
|
24
|
-
*
|
|
25
|
-
* @observable
|
|
26
|
-
*/
|
|
27
|
-
name: string | null;
|
|
28
|
-
/**
|
|
29
|
-
* The "Unicode string" of the {@link #character}. For instance "U+0061".
|
|
30
|
-
*
|
|
31
|
-
* @observable
|
|
32
|
-
*/
|
|
33
|
-
readonly code: string;
|
|
34
|
-
constructor(locale: Locale);
|
|
35
|
-
}
|
|
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/characterinfoview
|
|
7
|
+
*/
|
|
8
|
+
import type { Locale } from 'ckeditor5/src/utils';
|
|
9
|
+
import { View } from 'ckeditor5/src/ui';
|
|
10
|
+
import '../../theme/characterinfo.css';
|
|
11
|
+
/**
|
|
12
|
+
* The view displaying detailed information about a special character glyph, e.g. upon
|
|
13
|
+
* hovering it with a mouse.
|
|
14
|
+
*/
|
|
15
|
+
export default class CharacterInfoView extends View<HTMLDivElement> {
|
|
16
|
+
/**
|
|
17
|
+
* The character whose information is displayed by the view. For instance, "∑" or "¿".
|
|
18
|
+
*
|
|
19
|
+
* @observable
|
|
20
|
+
*/
|
|
21
|
+
character: string | null;
|
|
22
|
+
/**
|
|
23
|
+
* The name of the {@link #character}. For instance, "N-ary summation" or "Inverted question mark".
|
|
24
|
+
*
|
|
25
|
+
* @observable
|
|
26
|
+
*/
|
|
27
|
+
name: string | null;
|
|
28
|
+
/**
|
|
29
|
+
* The "Unicode string" of the {@link #character}. For instance "U+0061".
|
|
30
|
+
*
|
|
31
|
+
* @observable
|
|
32
|
+
*/
|
|
33
|
+
readonly code: string;
|
|
34
|
+
constructor(locale: Locale);
|
|
35
|
+
}
|
|
@@ -1,71 +1,71 @@
|
|
|
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
|
-
import { View } from 'ckeditor5/src/ui';
|
|
6
|
-
import '../../theme/characterinfo.css';
|
|
7
|
-
/**
|
|
8
|
-
* The view displaying detailed information about a special character glyph, e.g. upon
|
|
9
|
-
* hovering it with a mouse.
|
|
10
|
-
*/
|
|
11
|
-
export default class CharacterInfoView extends View {
|
|
12
|
-
constructor(locale) {
|
|
13
|
-
super(locale);
|
|
14
|
-
const bind = this.bindTemplate;
|
|
15
|
-
this.set('character', null);
|
|
16
|
-
this.set('name', null);
|
|
17
|
-
this.bind('code').to(this, 'character', characterToUnicodeString);
|
|
18
|
-
this.setTemplate({
|
|
19
|
-
tag: 'div',
|
|
20
|
-
children: [
|
|
21
|
-
{
|
|
22
|
-
tag: 'span',
|
|
23
|
-
attributes: {
|
|
24
|
-
class: [
|
|
25
|
-
'ck-character-info__name'
|
|
26
|
-
]
|
|
27
|
-
},
|
|
28
|
-
children: [
|
|
29
|
-
{
|
|
30
|
-
// Note: ZWSP to prevent vertical collapsing.
|
|
31
|
-
text: bind.to('name', name => name ? name : '\u200B')
|
|
32
|
-
}
|
|
33
|
-
]
|
|
34
|
-
},
|
|
35
|
-
{
|
|
36
|
-
tag: 'span',
|
|
37
|
-
attributes: {
|
|
38
|
-
class: [
|
|
39
|
-
'ck-character-info__code'
|
|
40
|
-
]
|
|
41
|
-
},
|
|
42
|
-
children: [
|
|
43
|
-
{
|
|
44
|
-
text: bind.to('code')
|
|
45
|
-
}
|
|
46
|
-
]
|
|
47
|
-
}
|
|
48
|
-
],
|
|
49
|
-
attributes: {
|
|
50
|
-
class: [
|
|
51
|
-
'ck',
|
|
52
|
-
'ck-character-info'
|
|
53
|
-
]
|
|
54
|
-
}
|
|
55
|
-
});
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
/**
|
|
59
|
-
* Converts a character into a "Unicode string", for instance:
|
|
60
|
-
*
|
|
61
|
-
* "$" -> "U+0024"
|
|
62
|
-
*
|
|
63
|
-
* Returns an empty string when the character is `null`.
|
|
64
|
-
*/
|
|
65
|
-
function characterToUnicodeString(character) {
|
|
66
|
-
if (character === null) {
|
|
67
|
-
return '';
|
|
68
|
-
}
|
|
69
|
-
const hexCode = character.codePointAt(0).toString(16);
|
|
70
|
-
return 'U+' + ('0000' + hexCode).slice(-4);
|
|
71
|
-
}
|
|
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
|
+
import { View } from 'ckeditor5/src/ui';
|
|
6
|
+
import '../../theme/characterinfo.css';
|
|
7
|
+
/**
|
|
8
|
+
* The view displaying detailed information about a special character glyph, e.g. upon
|
|
9
|
+
* hovering it with a mouse.
|
|
10
|
+
*/
|
|
11
|
+
export default class CharacterInfoView extends View {
|
|
12
|
+
constructor(locale) {
|
|
13
|
+
super(locale);
|
|
14
|
+
const bind = this.bindTemplate;
|
|
15
|
+
this.set('character', null);
|
|
16
|
+
this.set('name', null);
|
|
17
|
+
this.bind('code').to(this, 'character', characterToUnicodeString);
|
|
18
|
+
this.setTemplate({
|
|
19
|
+
tag: 'div',
|
|
20
|
+
children: [
|
|
21
|
+
{
|
|
22
|
+
tag: 'span',
|
|
23
|
+
attributes: {
|
|
24
|
+
class: [
|
|
25
|
+
'ck-character-info__name'
|
|
26
|
+
]
|
|
27
|
+
},
|
|
28
|
+
children: [
|
|
29
|
+
{
|
|
30
|
+
// Note: ZWSP to prevent vertical collapsing.
|
|
31
|
+
text: bind.to('name', name => name ? name : '\u200B')
|
|
32
|
+
}
|
|
33
|
+
]
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
tag: 'span',
|
|
37
|
+
attributes: {
|
|
38
|
+
class: [
|
|
39
|
+
'ck-character-info__code'
|
|
40
|
+
]
|
|
41
|
+
},
|
|
42
|
+
children: [
|
|
43
|
+
{
|
|
44
|
+
text: bind.to('code')
|
|
45
|
+
}
|
|
46
|
+
]
|
|
47
|
+
}
|
|
48
|
+
],
|
|
49
|
+
attributes: {
|
|
50
|
+
class: [
|
|
51
|
+
'ck',
|
|
52
|
+
'ck-character-info'
|
|
53
|
+
]
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Converts a character into a "Unicode string", for instance:
|
|
60
|
+
*
|
|
61
|
+
* "$" -> "U+0024"
|
|
62
|
+
*
|
|
63
|
+
* Returns an empty string when the character is `null`.
|
|
64
|
+
*/
|
|
65
|
+
function characterToUnicodeString(character) {
|
|
66
|
+
if (character === null) {
|
|
67
|
+
return '';
|
|
68
|
+
}
|
|
69
|
+
const hexCode = character.codePointAt(0).toString(16);
|
|
70
|
+
return 'U+' + ('0000' + hexCode).slice(-4);
|
|
71
|
+
}
|
|
@@ -1,59 +1,59 @@
|
|
|
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/specialcharactersnavigationview
|
|
7
|
-
*/
|
|
8
|
-
import { type Locale } from 'ckeditor5/src/utils';
|
|
9
|
-
import { FormHeaderView, type DropdownView } from 'ckeditor5/src/ui';
|
|
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
|
-
*/
|
|
14
|
-
export default class SpecialCharactersNavigationView extends FormHeaderView {
|
|
15
|
-
/**
|
|
16
|
-
* A dropdown that allows selecting a group of special characters to be displayed.
|
|
17
|
-
*/
|
|
18
|
-
groupDropdownView: GroupDropdownView;
|
|
19
|
-
/**
|
|
20
|
-
* Creates an instance of the {@link module:special-characters/ui/specialcharactersnavigationview~SpecialCharactersNavigationView}
|
|
21
|
-
* class.
|
|
22
|
-
*
|
|
23
|
-
* @param locale The localization services instance.
|
|
24
|
-
* @param groupNames The names of the character groups and their displayed labels.
|
|
25
|
-
*/
|
|
26
|
-
constructor(locale: Locale, groupNames: GroupNames);
|
|
27
|
-
/**
|
|
28
|
-
* Returns the name of the character group currently selected in the {@link #groupDropdownView}.
|
|
29
|
-
*/
|
|
30
|
-
get currentGroupName(): string;
|
|
31
|
-
/**
|
|
32
|
-
* Focuses the character categories dropdown.
|
|
33
|
-
*/
|
|
34
|
-
focus(): void;
|
|
35
|
-
/**
|
|
36
|
-
* Returns a dropdown that allows selecting character groups.
|
|
37
|
-
*
|
|
38
|
-
* @param groupNames The names of the character groups and their displayed labels.
|
|
39
|
-
*/
|
|
40
|
-
private _createGroupDropdown;
|
|
41
|
-
/**
|
|
42
|
-
* Returns list item definitions to be used in the character group dropdown
|
|
43
|
-
* representing specific character groups.
|
|
44
|
-
*
|
|
45
|
-
* @param dropdown Dropdown view element
|
|
46
|
-
* @param groupNames The names of the character groups and their displayed labels.
|
|
47
|
-
*/
|
|
48
|
-
private _getCharacterGroupListItemDefinitions;
|
|
49
|
-
}
|
|
50
|
-
/**
|
|
51
|
-
* The names of the character groups and their displayed labels.
|
|
52
|
-
*/
|
|
53
|
-
export type GroupNames = Map<string, string>;
|
|
54
|
-
/**
|
|
55
|
-
* `DropdownView` with additional field for the name of the currectly selected character group.
|
|
56
|
-
*/
|
|
57
|
-
export type GroupDropdownView = DropdownView & {
|
|
58
|
-
value: string;
|
|
59
|
-
};
|
|
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/specialcharactersnavigationview
|
|
7
|
+
*/
|
|
8
|
+
import { type Locale } from 'ckeditor5/src/utils';
|
|
9
|
+
import { FormHeaderView, type DropdownView } from 'ckeditor5/src/ui';
|
|
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
|
+
*/
|
|
14
|
+
export default class SpecialCharactersNavigationView extends FormHeaderView {
|
|
15
|
+
/**
|
|
16
|
+
* A dropdown that allows selecting a group of special characters to be displayed.
|
|
17
|
+
*/
|
|
18
|
+
groupDropdownView: GroupDropdownView;
|
|
19
|
+
/**
|
|
20
|
+
* Creates an instance of the {@link module:special-characters/ui/specialcharactersnavigationview~SpecialCharactersNavigationView}
|
|
21
|
+
* class.
|
|
22
|
+
*
|
|
23
|
+
* @param locale The localization services instance.
|
|
24
|
+
* @param groupNames The names of the character groups and their displayed labels.
|
|
25
|
+
*/
|
|
26
|
+
constructor(locale: Locale, groupNames: GroupNames);
|
|
27
|
+
/**
|
|
28
|
+
* Returns the name of the character group currently selected in the {@link #groupDropdownView}.
|
|
29
|
+
*/
|
|
30
|
+
get currentGroupName(): string;
|
|
31
|
+
/**
|
|
32
|
+
* Focuses the character categories dropdown.
|
|
33
|
+
*/
|
|
34
|
+
focus(): void;
|
|
35
|
+
/**
|
|
36
|
+
* Returns a dropdown that allows selecting character groups.
|
|
37
|
+
*
|
|
38
|
+
* @param groupNames The names of the character groups and their displayed labels.
|
|
39
|
+
*/
|
|
40
|
+
private _createGroupDropdown;
|
|
41
|
+
/**
|
|
42
|
+
* Returns list item definitions to be used in the character group dropdown
|
|
43
|
+
* representing specific character groups.
|
|
44
|
+
*
|
|
45
|
+
* @param dropdown Dropdown view element
|
|
46
|
+
* @param groupNames The names of the character groups and their displayed labels.
|
|
47
|
+
*/
|
|
48
|
+
private _getCharacterGroupListItemDefinitions;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* The names of the character groups and their displayed labels.
|
|
52
|
+
*/
|
|
53
|
+
export type GroupNames = Map<string, string>;
|
|
54
|
+
/**
|
|
55
|
+
* `DropdownView` with additional field for the name of the currectly selected character group.
|
|
56
|
+
*/
|
|
57
|
+
export type GroupDropdownView = DropdownView & {
|
|
58
|
+
value: string;
|
|
59
|
+
};
|