@ckeditor/ckeditor5-special-characters 0.0.0-nightly-next-20260125.0 → 0.0.0-nightly-20260126.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/build/special-characters.js +5 -0
- package/build/translations/af.js +1 -0
- package/build/translations/ar.js +1 -0
- package/build/translations/ast.js +1 -0
- package/build/translations/az.js +1 -0
- package/build/translations/be.js +1 -0
- package/build/translations/bg.js +1 -0
- package/build/translations/bn.js +1 -0
- package/build/translations/bs.js +1 -0
- package/build/translations/ca.js +1 -0
- package/build/translations/cs.js +1 -0
- package/build/translations/da.js +1 -0
- package/build/translations/de-ch.js +1 -0
- package/build/translations/de.js +1 -0
- package/build/translations/el.js +1 -0
- package/build/translations/en-au.js +1 -0
- package/build/translations/en-gb.js +1 -0
- package/build/translations/eo.js +1 -0
- package/build/translations/es-co.js +1 -0
- package/build/translations/es.js +1 -0
- package/build/translations/et.js +1 -0
- package/build/translations/eu.js +1 -0
- package/build/translations/fa.js +1 -0
- package/build/translations/fi.js +1 -0
- package/build/translations/fr.js +1 -0
- package/build/translations/gl.js +1 -0
- package/build/translations/gu.js +1 -0
- package/build/translations/he.js +1 -0
- package/build/translations/hi.js +1 -0
- package/build/translations/hr.js +1 -0
- package/build/translations/hu.js +1 -0
- package/build/translations/hy.js +1 -0
- package/build/translations/id.js +1 -0
- package/build/translations/it.js +1 -0
- package/build/translations/ja.js +1 -0
- package/build/translations/jv.js +1 -0
- package/build/translations/kk.js +1 -0
- package/build/translations/km.js +1 -0
- package/build/translations/kn.js +1 -0
- package/build/translations/ko.js +1 -0
- package/build/translations/ku.js +1 -0
- package/build/translations/lt.js +1 -0
- package/build/translations/lv.js +1 -0
- package/build/translations/ms.js +1 -0
- package/build/translations/nb.js +1 -0
- package/build/translations/ne.js +1 -0
- package/build/translations/nl.js +1 -0
- package/build/translations/no.js +1 -0
- package/build/translations/oc.js +1 -0
- package/build/translations/pl.js +1 -0
- package/build/translations/pt-br.js +1 -0
- package/build/translations/pt.js +1 -0
- package/build/translations/ro.js +1 -0
- package/build/translations/ru.js +1 -0
- package/build/translations/si.js +1 -0
- package/build/translations/sk.js +1 -0
- package/build/translations/sl.js +1 -0
- package/build/translations/sq.js +1 -0
- package/build/translations/sr-latn.js +1 -0
- package/build/translations/sr.js +1 -0
- package/build/translations/sv.js +1 -0
- package/build/translations/th.js +1 -0
- package/build/translations/ti.js +1 -0
- package/build/translations/tk.js +1 -0
- package/build/translations/tr.js +1 -0
- package/build/translations/tt.js +1 -0
- package/build/translations/ug.js +1 -0
- package/build/translations/uk.js +1 -0
- package/build/translations/ur.js +1 -0
- package/build/translations/uz.js +1 -0
- package/build/translations/vi.js +1 -0
- package/build/translations/zh-cn.js +1 -0
- package/build/translations/zh.js +1 -0
- package/ckeditor5-metadata.json +7 -7
- package/dist/index.js.map +1 -1
- package/lang/contexts.json +267 -0
- package/lang/translations/af.po +1072 -0
- package/lang/translations/ar.po +1074 -0
- package/lang/translations/ast.po +1072 -0
- package/lang/translations/az.po +1072 -0
- package/lang/translations/be.po +1072 -0
- package/lang/translations/bg.po +1076 -0
- package/lang/translations/bn.po +1072 -0
- package/lang/translations/bs.po +1072 -0
- package/lang/translations/ca.po +1072 -0
- package/lang/translations/cs.po +1072 -0
- package/lang/translations/da.po +1072 -0
- package/lang/translations/de-ch.po +1072 -0
- package/lang/translations/de.po +1072 -0
- package/lang/translations/el.po +1072 -0
- package/lang/translations/en-au.po +1072 -0
- package/lang/translations/en-gb.po +1072 -0
- package/lang/translations/en.po +1072 -0
- package/lang/translations/eo.po +1072 -0
- package/lang/translations/es-co.po +1072 -0
- package/lang/translations/es.po +1072 -0
- package/lang/translations/et.po +1072 -0
- package/lang/translations/eu.po +1072 -0
- package/lang/translations/fa.po +1072 -0
- package/lang/translations/fi.po +1072 -0
- package/lang/translations/fr.po +1072 -0
- package/lang/translations/gl.po +1072 -0
- package/lang/translations/gu.po +1072 -0
- package/lang/translations/he.po +1072 -0
- package/lang/translations/hi.po +1072 -0
- package/lang/translations/hr.po +1072 -0
- package/lang/translations/hu.po +1072 -0
- package/lang/translations/hy.po +1072 -0
- package/lang/translations/id.po +1072 -0
- package/lang/translations/it.po +1072 -0
- package/lang/translations/ja.po +1072 -0
- package/lang/translations/jv.po +1072 -0
- package/lang/translations/kk.po +1072 -0
- package/lang/translations/km.po +1072 -0
- package/lang/translations/kn.po +1072 -0
- package/lang/translations/ko.po +1072 -0
- package/lang/translations/ku.po +1072 -0
- package/lang/translations/lt.po +1072 -0
- package/lang/translations/lv.po +1072 -0
- package/lang/translations/ms.po +1072 -0
- package/lang/translations/nb.po +1072 -0
- package/lang/translations/ne.po +1072 -0
- package/lang/translations/nl.po +1074 -0
- package/lang/translations/no.po +1074 -0
- package/lang/translations/oc.po +1072 -0
- package/lang/translations/pl.po +1072 -0
- package/lang/translations/pt-br.po +1072 -0
- package/lang/translations/pt.po +1072 -0
- package/lang/translations/ro.po +1072 -0
- package/lang/translations/ru.po +1072 -0
- package/lang/translations/si.po +1072 -0
- package/lang/translations/sk.po +1072 -0
- package/lang/translations/sl.po +1072 -0
- package/lang/translations/sq.po +1072 -0
- package/lang/translations/sr-latn.po +1072 -0
- package/lang/translations/sr.po +1072 -0
- package/lang/translations/sv.po +1072 -0
- package/lang/translations/th.po +1072 -0
- package/lang/translations/ti.po +1072 -0
- package/lang/translations/tk.po +1072 -0
- package/lang/translations/tr.po +1072 -0
- package/lang/translations/tt.po +1072 -0
- package/lang/translations/ug.po +1072 -0
- package/lang/translations/uk.po +1072 -0
- package/lang/translations/ur.po +1072 -0
- package/lang/translations/uz.po +1072 -0
- package/lang/translations/vi.po +1072 -0
- package/lang/translations/zh-cn.po +1072 -0
- package/lang/translations/zh.po +1072 -0
- package/package.json +47 -23
- package/src/augmentation.js +5 -0
- package/src/index.js +19 -0
- package/{dist → src}/specialcharacters.d.ts +3 -3
- package/src/specialcharacters.js +260 -0
- package/{dist → src}/specialcharactersarrows.d.ts +1 -1
- package/src/specialcharactersarrows.js +66 -0
- package/src/specialcharactersconfig.js +5 -0
- package/{dist → src}/specialcharacterscurrency.d.ts +1 -1
- package/src/specialcharacterscurrency.js +80 -0
- package/{dist → src}/specialcharactersessentials.d.ts +1 -1
- package/src/specialcharactersessentials.js +51 -0
- package/{dist → src}/specialcharacterslatin.d.ts +1 -1
- package/src/specialcharacterslatin.js +172 -0
- package/{dist → src}/specialcharactersmathematical.d.ts +1 -1
- package/src/specialcharactersmathematical.js +88 -0
- package/{dist → src}/specialcharacterstext.d.ts +1 -1
- package/src/specialcharacterstext.js +71 -0
- package/{dist → src}/ui/charactergridview.d.ts +2 -2
- package/src/ui/charactergridview.js +143 -0
- package/{dist → src}/ui/characterinfoview.d.ts +2 -2
- package/src/ui/characterinfoview.js +73 -0
- package/{dist → src}/ui/specialcharacterscategoriesview.d.ts +2 -2
- package/src/ui/specialcharacterscategoriesview.js +98 -0
- package/{dist → src}/ui/specialcharactersview.d.ts +2 -2
- package/src/ui/specialcharactersview.js +108 -0
- package/theme/charactergrid.css +12 -0
- package/theme/characterinfo.css +9 -0
- package/theme/specialcharacters.css +89 -0
- /package/{dist → src}/augmentation.d.ts +0 -0
- /package/{dist → src}/index.d.ts +0 -0
- /package/{dist → src}/specialcharactersconfig.d.ts +0 -0
package/package.json
CHANGED
|
@@ -1,41 +1,65 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ckeditor/ckeditor5-special-characters",
|
|
3
|
-
"version": "0.0.0-nightly-
|
|
3
|
+
"version": "0.0.0-nightly-20260126.0",
|
|
4
4
|
"description": "Special characters feature for CKEditor 5.",
|
|
5
|
-
"license": "SEE LICENSE IN LICENSE.md",
|
|
6
|
-
"author": "CKSource (http://cksource.com/)",
|
|
7
|
-
"homepage": "https://ckeditor.com/ckeditor-5",
|
|
8
|
-
"bugs": "https://github.com/ckeditor/ckeditor5/issues",
|
|
9
|
-
"repository": {
|
|
10
|
-
"type": "git",
|
|
11
|
-
"url": "https://github.com/ckeditor/ckeditor5.git",
|
|
12
|
-
"directory": "packages/ckeditor5-special-characters"
|
|
13
|
-
},
|
|
14
5
|
"keywords": [
|
|
15
6
|
"ckeditor",
|
|
16
7
|
"ckeditor5",
|
|
17
8
|
"ckeditor 5",
|
|
18
9
|
"ckeditor5-feature",
|
|
19
|
-
"ckeditor5-plugin"
|
|
10
|
+
"ckeditor5-plugin",
|
|
11
|
+
"ckeditor5-dll"
|
|
20
12
|
],
|
|
21
13
|
"type": "module",
|
|
22
|
-
"main": "
|
|
23
|
-
"exports": {
|
|
24
|
-
".": "./dist/index.js",
|
|
25
|
-
"./dist/*": "./dist/*",
|
|
26
|
-
"./package.json": "./package.json"
|
|
27
|
-
},
|
|
14
|
+
"main": "src/index.js",
|
|
28
15
|
"dependencies": {
|
|
29
|
-
"
|
|
30
|
-
"@ckeditor/ckeditor5-
|
|
31
|
-
"@ckeditor/ckeditor5-
|
|
32
|
-
"@ckeditor/ckeditor5-
|
|
33
|
-
"@ckeditor/ckeditor5-
|
|
16
|
+
"ckeditor5": "0.0.0-nightly-20260126.0",
|
|
17
|
+
"@ckeditor/ckeditor5-core": "0.0.0-nightly-20260126.0",
|
|
18
|
+
"@ckeditor/ckeditor5-icons": "0.0.0-nightly-20260126.0",
|
|
19
|
+
"@ckeditor/ckeditor5-typing": "0.0.0-nightly-20260126.0",
|
|
20
|
+
"@ckeditor/ckeditor5-ui": "0.0.0-nightly-20260126.0",
|
|
21
|
+
"@ckeditor/ckeditor5-utils": "0.0.0-nightly-20260126.0"
|
|
22
|
+
},
|
|
23
|
+
"author": "CKSource (http://cksource.com/)",
|
|
24
|
+
"license": "SEE LICENSE IN LICENSE.md",
|
|
25
|
+
"homepage": "https://ckeditor.com/ckeditor-5",
|
|
26
|
+
"bugs": "https://github.com/ckeditor/ckeditor5/issues",
|
|
27
|
+
"repository": {
|
|
28
|
+
"type": "git",
|
|
29
|
+
"url": "https://github.com/ckeditor/ckeditor5.git",
|
|
30
|
+
"directory": "packages/ckeditor5-special-characters"
|
|
34
31
|
},
|
|
35
32
|
"files": [
|
|
36
33
|
"dist",
|
|
34
|
+
"lang",
|
|
35
|
+
"src/**/*.js",
|
|
36
|
+
"src/**/*.d.ts",
|
|
37
|
+
"theme",
|
|
38
|
+
"build",
|
|
37
39
|
"ckeditor5-metadata.json",
|
|
38
40
|
"CHANGELOG.md"
|
|
39
41
|
],
|
|
40
|
-
"types": "
|
|
42
|
+
"types": "src/index.d.ts",
|
|
43
|
+
"exports": {
|
|
44
|
+
".": {
|
|
45
|
+
"types": "./src/index.d.ts",
|
|
46
|
+
"import": "./src/index.js",
|
|
47
|
+
"default": "./src/index.js"
|
|
48
|
+
},
|
|
49
|
+
"./dist/*": {
|
|
50
|
+
"types": "./src/index.d.ts",
|
|
51
|
+
"import": "./dist/*",
|
|
52
|
+
"default": "./dist/*"
|
|
53
|
+
},
|
|
54
|
+
"./src/*": {
|
|
55
|
+
"types": "./src/*.d.ts",
|
|
56
|
+
"import": "./src/*",
|
|
57
|
+
"default": "./src/*"
|
|
58
|
+
},
|
|
59
|
+
"./build/*": "./build/*",
|
|
60
|
+
"./lang/*": "./lang/*",
|
|
61
|
+
"./theme/*": "./theme/*",
|
|
62
|
+
"./ckeditor5-metadata.json": "./ckeditor5-metadata.json",
|
|
63
|
+
"./package.json": "./package.json"
|
|
64
|
+
}
|
|
41
65
|
}
|
package/src/index.js
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* @module special-characters
|
|
7
|
+
*/
|
|
8
|
+
export { SpecialCharacters } from './specialcharacters.js';
|
|
9
|
+
export { SpecialCharactersArrows } from './specialcharactersarrows.js';
|
|
10
|
+
export { SpecialCharactersText } from './specialcharacterstext.js';
|
|
11
|
+
export { SpecialCharactersMathematical } from './specialcharactersmathematical.js';
|
|
12
|
+
export { SpecialCharactersLatin } from './specialcharacterslatin.js';
|
|
13
|
+
export { SpecialCharactersEssentials } from './specialcharactersessentials.js';
|
|
14
|
+
export { SpecialCharactersCurrency } from './specialcharacterscurrency.js';
|
|
15
|
+
export { CharacterGridView as _SpecialCharactersGridView } from './ui/charactergridview.js';
|
|
16
|
+
export { CharacterInfoView as _SpecialCharactersInfoView } from './ui/characterinfoview.js';
|
|
17
|
+
export { SpecialCharactersCategoriesView as _SpecialCharactersCategoriesView } from './ui/specialcharacterscategoriesview.js';
|
|
18
|
+
export { SpecialCharactersView as _SpecialCharactersView } from './ui/specialcharactersview.js';
|
|
19
|
+
import './augmentation.js';
|
|
@@ -5,9 +5,9 @@
|
|
|
5
5
|
/**
|
|
6
6
|
* @module special-characters/specialcharacters
|
|
7
7
|
*/
|
|
8
|
-
import { Plugin, type Editor } from '
|
|
9
|
-
import { Typing } from '
|
|
10
|
-
import { Dialog } from '
|
|
8
|
+
import { Plugin, type Editor } from 'ckeditor5/src/core.js';
|
|
9
|
+
import { Typing } from 'ckeditor5/src/typing.js';
|
|
10
|
+
import { Dialog } from 'ckeditor5/src/ui.js';
|
|
11
11
|
import '../theme/specialcharacters.css';
|
|
12
12
|
/**
|
|
13
13
|
* The special characters feature.
|
|
@@ -0,0 +1,260 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* @module special-characters/specialcharacters
|
|
7
|
+
*/
|
|
8
|
+
import { Plugin } from 'ckeditor5/src/core.js';
|
|
9
|
+
import { Typing } from 'ckeditor5/src/typing.js';
|
|
10
|
+
import { IconSpecialCharacters } from 'ckeditor5/src/icons.js';
|
|
11
|
+
import { ButtonView, MenuBarMenuListItemButtonView, DialogViewPosition, Dialog } from 'ckeditor5/src/ui.js';
|
|
12
|
+
import { CKEditorError } from 'ckeditor5/src/utils.js';
|
|
13
|
+
import { CharacterGridView } from './ui/charactergridview.js';
|
|
14
|
+
import { CharacterInfoView } from './ui/characterinfoview.js';
|
|
15
|
+
import { SpecialCharactersView } from './ui/specialcharactersview.js';
|
|
16
|
+
import '../theme/specialcharacters.css';
|
|
17
|
+
import { SpecialCharactersCategoriesView } from './ui/specialcharacterscategoriesview.js';
|
|
18
|
+
const ALL_SPECIAL_CHARACTERS_GROUP = 'All';
|
|
19
|
+
/**
|
|
20
|
+
* The special characters feature.
|
|
21
|
+
*
|
|
22
|
+
* Introduces the `'specialCharacters'` dropdown.
|
|
23
|
+
*/
|
|
24
|
+
export class SpecialCharacters extends Plugin {
|
|
25
|
+
/**
|
|
26
|
+
* Registered characters. A pair of a character name and its symbol.
|
|
27
|
+
*/
|
|
28
|
+
_characters;
|
|
29
|
+
/**
|
|
30
|
+
* Registered groups. Each group contains a displayed label and a collection with symbol names.
|
|
31
|
+
*/
|
|
32
|
+
_groups;
|
|
33
|
+
/**
|
|
34
|
+
* A label describing the "All" special characters category.
|
|
35
|
+
*/
|
|
36
|
+
_allSpecialCharactersGroupLabel;
|
|
37
|
+
/**
|
|
38
|
+
* @inheritDoc
|
|
39
|
+
*/
|
|
40
|
+
static get requires() {
|
|
41
|
+
return [Typing, Dialog];
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* @inheritDoc
|
|
45
|
+
*/
|
|
46
|
+
static get pluginName() {
|
|
47
|
+
return 'SpecialCharacters';
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* @inheritDoc
|
|
51
|
+
* @internal
|
|
52
|
+
*/
|
|
53
|
+
static get licenseFeatureCode() {
|
|
54
|
+
return 'SCH';
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* @inheritDoc
|
|
58
|
+
*/
|
|
59
|
+
static get isOfficialPlugin() {
|
|
60
|
+
return true;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* @inheritDoc
|
|
64
|
+
*/
|
|
65
|
+
static get isPremiumPlugin() {
|
|
66
|
+
return true;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* @inheritDoc
|
|
70
|
+
*/
|
|
71
|
+
constructor(editor) {
|
|
72
|
+
super(editor);
|
|
73
|
+
const t = editor.t;
|
|
74
|
+
this._characters = new Map();
|
|
75
|
+
this._groups = new Map();
|
|
76
|
+
this._allSpecialCharactersGroupLabel = t('All');
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* @inheritDoc
|
|
80
|
+
*/
|
|
81
|
+
init() {
|
|
82
|
+
const editor = this.editor;
|
|
83
|
+
editor.ui.componentFactory.add('specialCharacters', () => {
|
|
84
|
+
const button = this._createDialogButton(ButtonView);
|
|
85
|
+
button.set({
|
|
86
|
+
tooltip: true
|
|
87
|
+
});
|
|
88
|
+
return button;
|
|
89
|
+
});
|
|
90
|
+
editor.ui.componentFactory.add('menuBar:specialCharacters', () => {
|
|
91
|
+
return this._createDialogButton(MenuBarMenuListItemButtonView);
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Adds a collection of special characters to the specified group. The title of a special character must be unique.
|
|
96
|
+
*
|
|
97
|
+
* **Note:** The "All" category name is reserved by the plugin and cannot be used as a new name for a special
|
|
98
|
+
* characters category.
|
|
99
|
+
*/
|
|
100
|
+
addItems(groupName, items, options = { label: groupName }) {
|
|
101
|
+
if (groupName === ALL_SPECIAL_CHARACTERS_GROUP) {
|
|
102
|
+
/**
|
|
103
|
+
* The name "All" for a special category group cannot be used because it is a special category that displays all
|
|
104
|
+
* available special characters.
|
|
105
|
+
*
|
|
106
|
+
* @error special-character-invalid-group-name
|
|
107
|
+
*/
|
|
108
|
+
throw new CKEditorError('special-character-invalid-group-name', null);
|
|
109
|
+
}
|
|
110
|
+
const group = this._getGroup(groupName, options.label);
|
|
111
|
+
for (const item of items) {
|
|
112
|
+
group.items.add(item.title);
|
|
113
|
+
this._characters.set(item.title, item.character);
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* Returns special character groups in an order determined based on configuration and registration sequence.
|
|
118
|
+
*/
|
|
119
|
+
getGroups() {
|
|
120
|
+
const groups = Array.from(this._groups.keys());
|
|
121
|
+
const order = this.editor.config.get('specialCharacters.order') || [];
|
|
122
|
+
const invalidGroup = order.find(item => !groups.includes(item));
|
|
123
|
+
if (invalidGroup) {
|
|
124
|
+
/**
|
|
125
|
+
* One of the special character groups in the "specialCharacters.order" configuration doesn't exist.
|
|
126
|
+
*
|
|
127
|
+
* @error special-character-invalid-order-group-name
|
|
128
|
+
*/
|
|
129
|
+
throw new CKEditorError('special-character-invalid-order-group-name', null, { invalidGroup });
|
|
130
|
+
}
|
|
131
|
+
return new Set([
|
|
132
|
+
...order,
|
|
133
|
+
...groups
|
|
134
|
+
]);
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* Returns a collection of special characters symbol names (titles).
|
|
138
|
+
*/
|
|
139
|
+
getCharactersForGroup(groupName) {
|
|
140
|
+
if (groupName === ALL_SPECIAL_CHARACTERS_GROUP) {
|
|
141
|
+
return new Set(this._characters.keys());
|
|
142
|
+
}
|
|
143
|
+
const group = this._groups.get(groupName);
|
|
144
|
+
if (group) {
|
|
145
|
+
return group.items;
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
/**
|
|
149
|
+
* Returns the symbol of a special character for the specified name. If the special character could not be found, `undefined`
|
|
150
|
+
* is returned.
|
|
151
|
+
*
|
|
152
|
+
* @param title The title of a special character.
|
|
153
|
+
*/
|
|
154
|
+
getCharacter(title) {
|
|
155
|
+
return this._characters.get(title);
|
|
156
|
+
}
|
|
157
|
+
/**
|
|
158
|
+
* Returns a group of special characters. If the group with the specified name does not exist, it will be created.
|
|
159
|
+
*
|
|
160
|
+
* @param groupName The name of the group to create.
|
|
161
|
+
* @param label The label describing the new group.
|
|
162
|
+
*/
|
|
163
|
+
_getGroup(groupName, label) {
|
|
164
|
+
if (!this._groups.has(groupName)) {
|
|
165
|
+
this._groups.set(groupName, {
|
|
166
|
+
items: new Set(),
|
|
167
|
+
label
|
|
168
|
+
});
|
|
169
|
+
}
|
|
170
|
+
return this._groups.get(groupName);
|
|
171
|
+
}
|
|
172
|
+
/**
|
|
173
|
+
* Updates the symbol grid depending on the currently selected character group.
|
|
174
|
+
*/
|
|
175
|
+
_updateGrid(currentGroupName, gridView) {
|
|
176
|
+
// Updating the grid starts with removing all tiles belonging to the old group.
|
|
177
|
+
gridView.tiles.clear();
|
|
178
|
+
const characterTitles = this.getCharactersForGroup(currentGroupName);
|
|
179
|
+
for (const title of characterTitles) {
|
|
180
|
+
const character = this.getCharacter(title);
|
|
181
|
+
gridView.tiles.add(gridView.createTile(character, title));
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
/**
|
|
185
|
+
* Initializes the dropdown, used for lazy loading.
|
|
186
|
+
*
|
|
187
|
+
* @returns An object with `categoriesView`, `gridView` and `infoView` properties, containing UI parts.
|
|
188
|
+
*/
|
|
189
|
+
_createDropdownPanelContent(locale) {
|
|
190
|
+
const groupEntries = Array
|
|
191
|
+
.from(this.getGroups())
|
|
192
|
+
.map(name => ([name, this._groups.get(name).label]));
|
|
193
|
+
// The map contains a name of category (an identifier) and its label (a translational string).
|
|
194
|
+
const specialCharsGroups = new Map([
|
|
195
|
+
// Add a special group that shows all available special characters.
|
|
196
|
+
[ALL_SPECIAL_CHARACTERS_GROUP, this._allSpecialCharactersGroupLabel],
|
|
197
|
+
...groupEntries
|
|
198
|
+
]);
|
|
199
|
+
const categoriesView = new SpecialCharactersCategoriesView(locale, specialCharsGroups);
|
|
200
|
+
const gridView = new CharacterGridView(locale);
|
|
201
|
+
const infoView = new CharacterInfoView(locale);
|
|
202
|
+
gridView.on('tileHover', (evt, data) => {
|
|
203
|
+
infoView.set(data);
|
|
204
|
+
});
|
|
205
|
+
gridView.on('tileFocus', (evt, data) => {
|
|
206
|
+
infoView.set(data);
|
|
207
|
+
});
|
|
208
|
+
// Update the grid of special characters when a user changed the character group.
|
|
209
|
+
categoriesView.on('change:currentGroupName', (evt, propertyName, newValue) => {
|
|
210
|
+
this._updateGrid(newValue, gridView);
|
|
211
|
+
});
|
|
212
|
+
// Set the initial content of the special characters grid.
|
|
213
|
+
this._updateGrid(categoriesView.currentGroupName, gridView);
|
|
214
|
+
return { categoriesView, gridView, infoView };
|
|
215
|
+
}
|
|
216
|
+
/**
|
|
217
|
+
* Creates a button for toolbar and menu bar that will show special characters dialog.
|
|
218
|
+
*/
|
|
219
|
+
_createDialogButton(ButtonClass) {
|
|
220
|
+
const editor = this.editor;
|
|
221
|
+
const locale = editor.locale;
|
|
222
|
+
const buttonView = new ButtonClass(editor.locale);
|
|
223
|
+
const command = editor.commands.get('insertText');
|
|
224
|
+
const t = locale.t;
|
|
225
|
+
const dialogPlugin = this.editor.plugins.get('Dialog');
|
|
226
|
+
buttonView.set({
|
|
227
|
+
label: t('Special characters'),
|
|
228
|
+
icon: IconSpecialCharacters,
|
|
229
|
+
isToggleable: true
|
|
230
|
+
});
|
|
231
|
+
buttonView.bind('isOn').to(dialogPlugin, 'id', id => id === 'specialCharacters');
|
|
232
|
+
buttonView.bind('isEnabled').to(command, 'isEnabled');
|
|
233
|
+
buttonView.on('execute', () => {
|
|
234
|
+
if (dialogPlugin.id === 'specialCharacters') {
|
|
235
|
+
dialogPlugin.hide();
|
|
236
|
+
return;
|
|
237
|
+
}
|
|
238
|
+
this._showDialog();
|
|
239
|
+
});
|
|
240
|
+
return buttonView;
|
|
241
|
+
}
|
|
242
|
+
_showDialog() {
|
|
243
|
+
const editor = this.editor;
|
|
244
|
+
const dialog = editor.plugins.get('Dialog');
|
|
245
|
+
const locale = editor.locale;
|
|
246
|
+
const t = locale.t;
|
|
247
|
+
const { categoriesView, gridView, infoView } = this._createDropdownPanelContent(locale);
|
|
248
|
+
const content = new SpecialCharactersView(locale, categoriesView, gridView, infoView);
|
|
249
|
+
gridView.on('execute', (evt, data) => {
|
|
250
|
+
editor.execute('insertText', { text: data.character });
|
|
251
|
+
});
|
|
252
|
+
dialog.show({
|
|
253
|
+
id: 'specialCharacters',
|
|
254
|
+
title: t('Special characters'),
|
|
255
|
+
className: 'ck-special-characters',
|
|
256
|
+
content,
|
|
257
|
+
position: DialogViewPosition.EDITOR_TOP_SIDE
|
|
258
|
+
});
|
|
259
|
+
}
|
|
260
|
+
}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* @module special-characters/specialcharactersarrows
|
|
7
|
+
*/
|
|
8
|
+
import { Plugin } from 'ckeditor5/src/core.js';
|
|
9
|
+
/**
|
|
10
|
+
* A plugin that provides special characters for the "Arrows" category.
|
|
11
|
+
*
|
|
12
|
+
* ```ts
|
|
13
|
+
* ClassicEditor
|
|
14
|
+
* .create( {
|
|
15
|
+
* plugins: [ ..., SpecialCharacters, SpecialCharactersArrows ],
|
|
16
|
+
* } )
|
|
17
|
+
* .then( ... )
|
|
18
|
+
* .catch( ... );
|
|
19
|
+
* ```
|
|
20
|
+
*/
|
|
21
|
+
export class SpecialCharactersArrows extends Plugin {
|
|
22
|
+
/**
|
|
23
|
+
* @inheritDoc
|
|
24
|
+
*/
|
|
25
|
+
static get pluginName() {
|
|
26
|
+
return 'SpecialCharactersArrows';
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* @inheritDoc
|
|
30
|
+
*/
|
|
31
|
+
static get isOfficialPlugin() {
|
|
32
|
+
return true;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* @inheritDoc
|
|
36
|
+
*/
|
|
37
|
+
init() {
|
|
38
|
+
const editor = this.editor;
|
|
39
|
+
const t = editor.t;
|
|
40
|
+
const plugin = editor.plugins.get('SpecialCharacters');
|
|
41
|
+
plugin.addItems('Arrows', [
|
|
42
|
+
{ title: t('leftwards simple arrow'), character: '←' },
|
|
43
|
+
{ title: t('rightwards simple arrow'), character: '→' },
|
|
44
|
+
{ title: t('upwards simple arrow'), character: '↑' },
|
|
45
|
+
{ title: t('downwards simple arrow'), character: '↓' },
|
|
46
|
+
{ title: t('leftwards double arrow'), character: '⇐' },
|
|
47
|
+
{ title: t('rightwards double arrow'), character: '⇒' },
|
|
48
|
+
{ title: t('upwards double arrow'), character: '⇑' },
|
|
49
|
+
{ title: t('downwards double arrow'), character: '⇓' },
|
|
50
|
+
{ title: t('leftwards dashed arrow'), character: '⇠' },
|
|
51
|
+
{ title: t('rightwards dashed arrow'), character: '⇢' },
|
|
52
|
+
{ title: t('upwards dashed arrow'), character: '⇡' },
|
|
53
|
+
{ title: t('downwards dashed arrow'), character: '⇣' },
|
|
54
|
+
{ title: t('leftwards arrow to bar'), character: '⇤' },
|
|
55
|
+
{ title: t('rightwards arrow to bar'), character: '⇥' },
|
|
56
|
+
{ title: t('upwards arrow to bar'), character: '⤒' },
|
|
57
|
+
{ title: t('downwards arrow to bar'), character: '⤓' },
|
|
58
|
+
{ title: t('up down arrow with base'), character: '↨' },
|
|
59
|
+
{ title: t('back with leftwards arrow above'), character: '🔙' },
|
|
60
|
+
{ title: t('end with leftwards arrow above'), character: '🔚' },
|
|
61
|
+
{ title: t('on with exclamation mark with left right arrow above'), character: '🔛' },
|
|
62
|
+
{ title: t('soon with rightwards arrow above'), character: '🔜' },
|
|
63
|
+
{ title: t('top with upwards arrow above'), character: '🔝' }
|
|
64
|
+
], { label: t('Arrows') });
|
|
65
|
+
}
|
|
66
|
+
}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* @module special-characters/specialcharacterscurrency
|
|
7
|
+
*/
|
|
8
|
+
import { Plugin } from 'ckeditor5/src/core.js';
|
|
9
|
+
/**
|
|
10
|
+
* A plugin that provides special characters for the "Currency" category.
|
|
11
|
+
*
|
|
12
|
+
* ```ts
|
|
13
|
+
* ClassicEditor
|
|
14
|
+
* .create( {
|
|
15
|
+
* plugins: [ ..., SpecialCharacters, SpecialCharactersCurrency ],
|
|
16
|
+
* } )
|
|
17
|
+
* .then( ... )
|
|
18
|
+
* .catch( ... );
|
|
19
|
+
* ```
|
|
20
|
+
*/
|
|
21
|
+
export class SpecialCharactersCurrency extends Plugin {
|
|
22
|
+
/**
|
|
23
|
+
* @inheritDoc
|
|
24
|
+
*/
|
|
25
|
+
static get pluginName() {
|
|
26
|
+
return 'SpecialCharactersCurrency';
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* @inheritDoc
|
|
30
|
+
*/
|
|
31
|
+
static get isOfficialPlugin() {
|
|
32
|
+
return true;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* @inheritDoc
|
|
36
|
+
*/
|
|
37
|
+
init() {
|
|
38
|
+
const editor = this.editor;
|
|
39
|
+
const t = editor.t;
|
|
40
|
+
const plugin = editor.plugins.get('SpecialCharacters');
|
|
41
|
+
plugin.addItems('Currency', [
|
|
42
|
+
{ character: '$', title: t('Dollar sign') },
|
|
43
|
+
{ character: '€', title: t('Euro sign') },
|
|
44
|
+
{ character: '¥', title: t('Yen sign') },
|
|
45
|
+
{ character: '£', title: t('Pound sign') },
|
|
46
|
+
{ character: '¢', title: t('Cent sign') },
|
|
47
|
+
{ character: '₠', title: t('Euro-currency sign') },
|
|
48
|
+
{ character: '₡', title: t('Colon sign') },
|
|
49
|
+
{ character: '₢', title: t('Cruzeiro sign') },
|
|
50
|
+
{ character: '₣', title: t('French franc sign') },
|
|
51
|
+
{ character: '₤', title: t('Lira sign') },
|
|
52
|
+
{ character: '¤', title: t('Currency sign') },
|
|
53
|
+
{ character: '₿', title: t('Bitcoin sign') },
|
|
54
|
+
{ character: '₥', title: t('Mill sign') },
|
|
55
|
+
{ character: '₦', title: t('Naira sign') },
|
|
56
|
+
{ character: '₧', title: t('Peseta sign') },
|
|
57
|
+
{ character: '₨', title: t('Rupee sign') },
|
|
58
|
+
{ character: '₩', title: t('Won sign') },
|
|
59
|
+
{ character: '₪', title: t('New sheqel sign') },
|
|
60
|
+
{ character: '₫', title: t('Dong sign') },
|
|
61
|
+
{ character: '₭', title: t('Kip sign') },
|
|
62
|
+
{ character: '₮', title: t('Tugrik sign') },
|
|
63
|
+
{ character: '₯', title: t('Drachma sign') },
|
|
64
|
+
{ character: '₰', title: t('German penny sign') },
|
|
65
|
+
{ character: '₱', title: t('Peso sign') },
|
|
66
|
+
{ character: '₲', title: t('Guarani sign') },
|
|
67
|
+
{ character: '₳', title: t('Austral sign') },
|
|
68
|
+
{ character: '₴', title: t('Hryvnia sign') },
|
|
69
|
+
{ character: '₵', title: t('Cedi sign') },
|
|
70
|
+
{ character: '₶', title: t('Livre tournois sign') },
|
|
71
|
+
{ character: '₷', title: t('Spesmilo sign') },
|
|
72
|
+
{ character: '₸', title: t('Tenge sign') },
|
|
73
|
+
{ character: '₹', title: t('Indian rupee sign') },
|
|
74
|
+
{ character: '₺', title: t('Turkish lira sign') },
|
|
75
|
+
{ character: '₻', title: t('Nordic mark sign') },
|
|
76
|
+
{ character: '₼', title: t('Manat sign') },
|
|
77
|
+
{ character: '₽', title: t('Ruble sign') }
|
|
78
|
+
], { label: t('Currency') });
|
|
79
|
+
}
|
|
80
|
+
}
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
/**
|
|
6
6
|
* @module special-characters/specialcharactersessentials
|
|
7
7
|
*/
|
|
8
|
-
import { Plugin } from '
|
|
8
|
+
import { Plugin } from 'ckeditor5/src/core.js';
|
|
9
9
|
import { SpecialCharactersCurrency } from './specialcharacterscurrency.js';
|
|
10
10
|
import { SpecialCharactersMathematical } from './specialcharactersmathematical.js';
|
|
11
11
|
import { SpecialCharactersArrows } from './specialcharactersarrows.js';
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* @module special-characters/specialcharactersessentials
|
|
7
|
+
*/
|
|
8
|
+
import { Plugin } from 'ckeditor5/src/core.js';
|
|
9
|
+
import { SpecialCharactersCurrency } from './specialcharacterscurrency.js';
|
|
10
|
+
import { SpecialCharactersMathematical } from './specialcharactersmathematical.js';
|
|
11
|
+
import { SpecialCharactersArrows } from './specialcharactersarrows.js';
|
|
12
|
+
import { SpecialCharactersLatin } from './specialcharacterslatin.js';
|
|
13
|
+
import { SpecialCharactersText } from './specialcharacterstext.js';
|
|
14
|
+
/**
|
|
15
|
+
* A plugin combining a basic set of characters for the special characters plugin.
|
|
16
|
+
*
|
|
17
|
+
* ```ts
|
|
18
|
+
* ClassicEditor
|
|
19
|
+
* .create( {
|
|
20
|
+
* plugins: [ ..., SpecialCharacters, SpecialCharactersEssentials ],
|
|
21
|
+
* } )
|
|
22
|
+
* .then( ... )
|
|
23
|
+
* .catch( ... );
|
|
24
|
+
* ```
|
|
25
|
+
*/
|
|
26
|
+
export class SpecialCharactersEssentials extends Plugin {
|
|
27
|
+
/**
|
|
28
|
+
* @inheritDoc
|
|
29
|
+
*/
|
|
30
|
+
static get pluginName() {
|
|
31
|
+
return 'SpecialCharactersEssentials';
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* @inheritDoc
|
|
35
|
+
*/
|
|
36
|
+
static get isOfficialPlugin() {
|
|
37
|
+
return true;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* @inheritDoc
|
|
41
|
+
*/
|
|
42
|
+
static get requires() {
|
|
43
|
+
return [
|
|
44
|
+
SpecialCharactersCurrency,
|
|
45
|
+
SpecialCharactersText,
|
|
46
|
+
SpecialCharactersMathematical,
|
|
47
|
+
SpecialCharactersArrows,
|
|
48
|
+
SpecialCharactersLatin
|
|
49
|
+
];
|
|
50
|
+
}
|
|
51
|
+
}
|