-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathcustom-glyphs-whitespaces.js
68 lines (63 loc) · 2.23 KB
/
custom-glyphs-whitespaces.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
(function() {
/**
* Add a new group to the top of print editor glyps panel
*/
window.peGlyphs.groups.unshift ({
groupName: 'Stars',
glyphs: [
{
name: '★',
unicode: 'U+2605',
},
{
name: '✰',
unicode: 'U+2730',
},
{
name: '✵',
unicode: 'U+2735',
},
{
name: '✯',
unicode: 'U+272F',
}
],
});
/**
* Add a new group to the bottom of print editor whitespaces panel
*/
window.peWhiteSpaces.groups.push ({
groupId: '5',
whiteSpaces: [
{ name: 'My custom space 1', unicode: 'U+0009' },
{ name: 'My custom space 2', unicode: 'U+0009' },
],
});
/**
* Modifying existing glyphs by removing and replacing the item
*/
const starsGroup = window.peGlyphs.groups.find(group => group.groupName === 'Currency');
const targetGlyphIndex = starsGroup.glyphs.findIndex(glyph => glyph.name === 'Euro');
starsGroup.glyphs.splice(targetGlyphIndex, 1, {
...starsGroup.glyphs[targetGlyphIndex],
unicode: 'U+24BA'
});
/**
* Modifying existing whitespaces unicode by removing and replacing the item
*/
const groupWithId3 = window.peWhiteSpaces.groups.find(group => group.groupId === '3');
const targetWhiteSpaceIndex = groupWithId3.whiteSpaces.findIndex(whiteSpace => whiteSpace.name === 'LBL_HAIR_SPACE');
groupWithId3.whiteSpaces.splice(targetWhiteSpaceIndex, 1, {
...groupWithId3.whiteSpaces[targetWhiteSpaceIndex],
unicode: 'U+0398'
});
/**
* Modifying existing whitespaces shortcuts by removing and replacing the item
*/
const groupWithId2 = window.peWhiteSpaces.groups.find(group => group.groupId === '2');
const targetShortcutIndex = groupWithId2.whiteSpaces.findIndex(whiteSpace => whiteSpace.name === 'LBL_NO_BREAK_SPACE');
groupWithId2.whiteSpaces.splice(targetShortcutIndex, 1, {
...groupWithId2.whiteSpaces[targetShortcutIndex],
shortcut: 'alt+mod+T'
});
})();