@ckeditor/ckeditor5-special-characters 42.0.2-alpha.2 → 43.0.0-alpha.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/CHANGELOG.md +1 -27
- package/build/special-characters.js +2 -2
- package/build/translations/ar.js +1 -1
- package/build/translations/az.js +1 -1
- package/build/translations/bg.js +1 -1
- package/build/translations/bn.js +1 -1
- package/build/translations/ca.js +1 -1
- package/build/translations/cs.js +1 -1
- package/build/translations/da.js +1 -1
- package/build/translations/de.js +1 -1
- package/build/translations/el.js +1 -1
- package/build/translations/en-au.js +1 -1
- package/build/translations/es.js +1 -1
- package/build/translations/et.js +1 -1
- package/build/translations/fa.js +1 -1
- package/build/translations/fi.js +1 -1
- package/build/translations/fr.js +1 -1
- package/build/translations/gl.js +1 -1
- package/build/translations/he.js +1 -1
- package/build/translations/hi.js +1 -1
- package/build/translations/hr.js +1 -1
- package/build/translations/hu.js +1 -1
- package/build/translations/id.js +1 -1
- package/build/translations/it.js +1 -1
- package/build/translations/ja.js +1 -1
- package/build/translations/ko.js +1 -1
- package/build/translations/lt.js +1 -1
- package/build/translations/lv.js +1 -1
- package/build/translations/ms.js +1 -1
- package/build/translations/nl.js +1 -1
- package/build/translations/no.js +1 -1
- package/build/translations/pl.js +1 -1
- package/build/translations/pt-br.js +1 -1
- package/build/translations/pt.js +1 -1
- package/build/translations/ro.js +1 -1
- package/build/translations/ru.js +1 -1
- package/build/translations/sk.js +1 -1
- package/build/translations/sq.js +1 -1
- package/build/translations/sr-latn.js +1 -1
- package/build/translations/sr.js +1 -1
- package/build/translations/sv.js +1 -1
- package/build/translations/th.js +1 -1
- package/build/translations/ti.js +1 -1
- package/build/translations/tk.js +1 -1
- package/build/translations/tr.js +1 -1
- package/build/translations/uk.js +1 -1
- package/build/translations/ur.js +1 -1
- package/build/translations/uz.js +1 -1
- package/build/translations/vi.js +1 -1
- package/build/translations/zh-cn.js +1 -1
- package/build/translations/zh.js +1 -1
- package/dist/index-editor.css +77 -1
- package/dist/index.css +96 -0
- package/dist/index.css.map +1 -1
- package/dist/index.js +155 -137
- package/dist/index.js.map +1 -1
- package/dist/specialcharacters.d.ts +8 -2
- package/dist/translations/ar.js +1 -1
- package/dist/translations/ar.umd.js +1 -1
- package/dist/translations/az.js +1 -1
- package/dist/translations/az.umd.js +1 -1
- package/dist/translations/bg.js +1 -1
- package/dist/translations/bg.umd.js +1 -1
- package/dist/translations/bn.js +1 -1
- package/dist/translations/bn.umd.js +1 -1
- package/dist/translations/ca.js +1 -1
- package/dist/translations/ca.umd.js +1 -1
- package/dist/translations/cs.js +1 -1
- package/dist/translations/cs.umd.js +1 -1
- package/dist/translations/da.js +1 -1
- package/dist/translations/da.umd.js +1 -1
- package/dist/translations/de.js +1 -1
- package/dist/translations/de.umd.js +1 -1
- package/dist/translations/el.js +1 -1
- package/dist/translations/el.umd.js +1 -1
- package/dist/translations/en-au.js +1 -1
- package/dist/translations/en-au.umd.js +1 -1
- package/dist/translations/en.js +1 -1
- package/dist/translations/en.umd.js +1 -1
- package/dist/translations/es.js +1 -1
- package/dist/translations/es.umd.js +1 -1
- package/dist/translations/et.js +1 -1
- package/dist/translations/et.umd.js +1 -1
- package/dist/translations/fa.js +1 -1
- package/dist/translations/fa.umd.js +1 -1
- package/dist/translations/fi.js +1 -1
- package/dist/translations/fi.umd.js +1 -1
- package/dist/translations/fr.js +1 -1
- package/dist/translations/fr.umd.js +1 -1
- package/dist/translations/gl.js +1 -1
- package/dist/translations/gl.umd.js +1 -1
- package/dist/translations/he.js +1 -1
- package/dist/translations/he.umd.js +1 -1
- package/dist/translations/hi.js +1 -1
- package/dist/translations/hi.umd.js +1 -1
- package/dist/translations/hr.js +1 -1
- package/dist/translations/hr.umd.js +1 -1
- package/dist/translations/hu.js +1 -1
- package/dist/translations/hu.umd.js +1 -1
- package/dist/translations/id.js +1 -1
- package/dist/translations/id.umd.js +1 -1
- package/dist/translations/it.js +1 -1
- package/dist/translations/it.umd.js +1 -1
- package/dist/translations/ja.js +1 -1
- package/dist/translations/ja.umd.js +1 -1
- package/dist/translations/ko.js +1 -1
- package/dist/translations/ko.umd.js +1 -1
- package/dist/translations/lt.js +1 -1
- package/dist/translations/lt.umd.js +1 -1
- package/dist/translations/lv.js +1 -1
- package/dist/translations/lv.umd.js +1 -1
- package/dist/translations/ms.js +1 -1
- package/dist/translations/ms.umd.js +1 -1
- package/dist/translations/nl.js +1 -1
- package/dist/translations/nl.umd.js +1 -1
- package/dist/translations/no.js +1 -1
- package/dist/translations/no.umd.js +1 -1
- package/dist/translations/pl.js +1 -1
- package/dist/translations/pl.umd.js +1 -1
- package/dist/translations/pt-br.js +1 -1
- package/dist/translations/pt-br.umd.js +1 -1
- package/dist/translations/pt.js +1 -1
- package/dist/translations/pt.umd.js +1 -1
- package/dist/translations/ro.js +1 -1
- package/dist/translations/ro.umd.js +1 -1
- package/dist/translations/ru.js +1 -1
- package/dist/translations/ru.umd.js +1 -1
- package/dist/translations/sk.js +1 -1
- package/dist/translations/sk.umd.js +1 -1
- package/dist/translations/sq.js +1 -1
- package/dist/translations/sq.umd.js +1 -1
- package/dist/translations/sr-latn.js +1 -1
- package/dist/translations/sr-latn.umd.js +1 -1
- package/dist/translations/sr.js +1 -1
- package/dist/translations/sr.umd.js +1 -1
- package/dist/translations/sv.js +1 -1
- package/dist/translations/sv.umd.js +1 -1
- package/dist/translations/th.js +1 -1
- package/dist/translations/th.umd.js +1 -1
- package/dist/translations/ti.js +1 -1
- package/dist/translations/ti.umd.js +1 -1
- package/dist/translations/tk.js +1 -1
- package/dist/translations/tk.umd.js +1 -1
- package/dist/translations/tr.js +1 -1
- package/dist/translations/tr.umd.js +1 -1
- package/dist/translations/uk.js +1 -1
- package/dist/translations/uk.umd.js +1 -1
- package/dist/translations/ur.js +1 -1
- package/dist/translations/ur.umd.js +1 -1
- package/dist/translations/uz.js +1 -1
- package/dist/translations/uz.umd.js +1 -1
- package/dist/translations/vi.js +1 -1
- package/dist/translations/vi.umd.js +1 -1
- package/dist/translations/zh-cn.js +1 -1
- package/dist/translations/zh-cn.umd.js +1 -1
- package/dist/translations/zh.js +1 -1
- package/dist/translations/zh.umd.js +1 -1
- package/dist/ui/specialcharacterscategoriesview.d.ts +45 -0
- package/dist/ui/specialcharactersview.d.ts +4 -4
- package/lang/contexts.json +2 -2
- package/lang/translations/ar.po +4 -4
- package/lang/translations/az.po +4 -4
- package/lang/translations/bg.po +4 -4
- package/lang/translations/bn.po +4 -4
- package/lang/translations/ca.po +4 -4
- package/lang/translations/cs.po +4 -4
- package/lang/translations/da.po +4 -4
- package/lang/translations/de.po +4 -4
- package/lang/translations/el.po +4 -4
- package/lang/translations/en-au.po +4 -4
- package/lang/translations/en.po +4 -4
- package/lang/translations/es.po +4 -4
- package/lang/translations/et.po +4 -4
- package/lang/translations/fa.po +4 -4
- package/lang/translations/fi.po +4 -4
- package/lang/translations/fr.po +4 -4
- package/lang/translations/gl.po +4 -4
- package/lang/translations/he.po +4 -4
- package/lang/translations/hi.po +4 -4
- package/lang/translations/hr.po +4 -4
- package/lang/translations/hu.po +4 -4
- package/lang/translations/id.po +4 -4
- package/lang/translations/it.po +4 -4
- package/lang/translations/ja.po +4 -4
- package/lang/translations/ko.po +4 -4
- package/lang/translations/lt.po +4 -4
- package/lang/translations/lv.po +4 -4
- package/lang/translations/ms.po +4 -4
- package/lang/translations/nl.po +4 -4
- package/lang/translations/no.po +4 -4
- package/lang/translations/pl.po +4 -4
- package/lang/translations/pt-br.po +4 -4
- package/lang/translations/pt.po +4 -4
- package/lang/translations/ro.po +4 -4
- package/lang/translations/ru.po +4 -4
- package/lang/translations/sk.po +4 -4
- package/lang/translations/sq.po +4 -4
- package/lang/translations/sr-latn.po +4 -4
- package/lang/translations/sr.po +4 -4
- package/lang/translations/sv.po +4 -4
- package/lang/translations/th.po +4 -4
- package/lang/translations/ti.po +4 -4
- package/lang/translations/tk.po +4 -4
- package/lang/translations/tr.po +4 -4
- package/lang/translations/uk.po +4 -4
- package/lang/translations/ur.po +4 -4
- package/lang/translations/uz.po +4 -4
- package/lang/translations/vi.po +4 -4
- package/lang/translations/zh-cn.po +4 -4
- package/lang/translations/zh.po +4 -4
- package/package.json +6 -6
- package/src/specialcharacters.d.ts +8 -2
- package/src/specialcharacters.js +60 -38
- package/src/ui/specialcharacterscategoriesview.d.ts +41 -0
- package/src/ui/specialcharacterscategoriesview.js +94 -0
- package/src/ui/specialcharactersview.d.ts +4 -4
- package/src/ui/specialcharactersview.js +6 -6
- package/theme/specialcharacters.css +81 -0
- package/dist/ui/specialcharactersnavigationview.d.ts +0 -63
- package/src/ui/specialcharactersnavigationview.d.ts +0 -59
- package/src/ui/specialcharactersnavigationview.js +0 -95
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ckeditor/ckeditor5-special-characters",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "43.0.0-alpha.0",
|
|
4
4
|
"description": "Special characters feature for CKEditor 5.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ckeditor",
|
|
@@ -13,11 +13,11 @@
|
|
|
13
13
|
"type": "module",
|
|
14
14
|
"main": "src/index.js",
|
|
15
15
|
"dependencies": {
|
|
16
|
-
"
|
|
17
|
-
"@ckeditor/ckeditor5-
|
|
18
|
-
"@ckeditor/ckeditor5-
|
|
19
|
-
"@ckeditor/ckeditor5-
|
|
20
|
-
"ckeditor5": "
|
|
16
|
+
"ckeditor5": "43.0.0-alpha.0",
|
|
17
|
+
"@ckeditor/ckeditor5-core": "43.0.0-alpha.0",
|
|
18
|
+
"@ckeditor/ckeditor5-typing": "43.0.0-alpha.0",
|
|
19
|
+
"@ckeditor/ckeditor5-ui": "43.0.0-alpha.0",
|
|
20
|
+
"@ckeditor/ckeditor5-utils": "43.0.0-alpha.0"
|
|
21
21
|
},
|
|
22
22
|
"author": "CKSource (http://cksource.com/)",
|
|
23
23
|
"license": "GPL-2.0-or-later",
|
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
*/
|
|
8
8
|
import { Plugin, type Editor } from 'ckeditor5/src/core.js';
|
|
9
9
|
import { Typing } from 'ckeditor5/src/typing.js';
|
|
10
|
+
import { Dialog } from 'ckeditor5/src/ui.js';
|
|
10
11
|
import '../theme/specialcharacters.css';
|
|
11
12
|
/**
|
|
12
13
|
* The special characters feature.
|
|
@@ -29,7 +30,7 @@ export default class SpecialCharacters extends Plugin {
|
|
|
29
30
|
/**
|
|
30
31
|
* @inheritDoc
|
|
31
32
|
*/
|
|
32
|
-
static get requires(): readonly [typeof Typing];
|
|
33
|
+
static get requires(): readonly [typeof Typing, typeof Dialog];
|
|
33
34
|
/**
|
|
34
35
|
* @inheritDoc
|
|
35
36
|
*/
|
|
@@ -80,9 +81,14 @@ export default class SpecialCharacters extends Plugin {
|
|
|
80
81
|
/**
|
|
81
82
|
* Initializes the dropdown, used for lazy loading.
|
|
82
83
|
*
|
|
83
|
-
* @returns An object with `
|
|
84
|
+
* @returns An object with `categoriesView`, `gridView` and `infoView` properties, containing UI parts.
|
|
84
85
|
*/
|
|
85
86
|
private _createDropdownPanelContent;
|
|
87
|
+
/**
|
|
88
|
+
* Creates a button for for menu bar that will show special characetrs dialog.
|
|
89
|
+
*/
|
|
90
|
+
private _createDialogButton;
|
|
91
|
+
private _showDialog;
|
|
86
92
|
}
|
|
87
93
|
export interface SpecialCharacterDefinition {
|
|
88
94
|
/**
|
package/src/specialcharacters.js
CHANGED
|
@@ -7,14 +7,14 @@
|
|
|
7
7
|
*/
|
|
8
8
|
import { Plugin } from 'ckeditor5/src/core.js';
|
|
9
9
|
import { Typing } from 'ckeditor5/src/typing.js';
|
|
10
|
-
import {
|
|
10
|
+
import { ButtonView, MenuBarMenuListItemButtonView, DialogViewPosition, Dialog } from 'ckeditor5/src/ui.js';
|
|
11
11
|
import { CKEditorError } from 'ckeditor5/src/utils.js';
|
|
12
|
-
import SpecialCharactersNavigationView from './ui/specialcharactersnavigationview.js';
|
|
13
12
|
import CharacterGridView from './ui/charactergridview.js';
|
|
14
13
|
import CharacterInfoView from './ui/characterinfoview.js';
|
|
15
14
|
import SpecialCharactersView from './ui/specialcharactersview.js';
|
|
16
15
|
import specialCharactersIcon from '../theme/icons/specialcharacters.svg';
|
|
17
16
|
import '../theme/specialcharacters.css';
|
|
17
|
+
import SpecialCharactersCategoriesView from './ui/specialcharacterscategoriesview.js';
|
|
18
18
|
const ALL_SPECIAL_CHARACTERS_GROUP = 'All';
|
|
19
19
|
/**
|
|
20
20
|
* The special characters feature.
|
|
@@ -26,7 +26,7 @@ export default class SpecialCharacters extends Plugin {
|
|
|
26
26
|
* @inheritDoc
|
|
27
27
|
*/
|
|
28
28
|
static get requires() {
|
|
29
|
-
return [Typing];
|
|
29
|
+
return [Typing, Dialog];
|
|
30
30
|
}
|
|
31
31
|
/**
|
|
32
32
|
* @inheritDoc
|
|
@@ -49,35 +49,15 @@ export default class SpecialCharacters extends Plugin {
|
|
|
49
49
|
*/
|
|
50
50
|
init() {
|
|
51
51
|
const editor = this.editor;
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
editor.ui.componentFactory.add('specialCharacters', locale => {
|
|
56
|
-
const dropdownView = createDropdown(locale);
|
|
57
|
-
let dropdownPanelContent;
|
|
58
|
-
dropdownView.buttonView.set({
|
|
59
|
-
label: t('Special characters'),
|
|
60
|
-
icon: specialCharactersIcon,
|
|
52
|
+
editor.ui.componentFactory.add('specialCharacters', () => {
|
|
53
|
+
const button = this._createDialogButton(ButtonView);
|
|
54
|
+
button.set({
|
|
61
55
|
tooltip: true
|
|
62
56
|
});
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
editor.editing.view.focus();
|
|
68
|
-
});
|
|
69
|
-
dropdownView.on('change:isOpen', () => {
|
|
70
|
-
if (!dropdownPanelContent) {
|
|
71
|
-
dropdownPanelContent = this._createDropdownPanelContent(locale, dropdownView);
|
|
72
|
-
const specialCharactersView = new SpecialCharactersView(locale, dropdownPanelContent.navigationView, dropdownPanelContent.gridView, dropdownPanelContent.infoView);
|
|
73
|
-
dropdownView.panelView.children.add(specialCharactersView);
|
|
74
|
-
}
|
|
75
|
-
dropdownPanelContent.infoView.set({
|
|
76
|
-
character: null,
|
|
77
|
-
name: null
|
|
78
|
-
});
|
|
79
|
-
});
|
|
80
|
-
return dropdownView;
|
|
57
|
+
return button;
|
|
58
|
+
});
|
|
59
|
+
editor.ui.componentFactory.add('menuBar:specialCharacters', () => {
|
|
60
|
+
return this._createDialogButton(MenuBarMenuListItemButtonView);
|
|
81
61
|
});
|
|
82
62
|
}
|
|
83
63
|
/**
|
|
@@ -173,9 +153,9 @@ export default class SpecialCharacters extends Plugin {
|
|
|
173
153
|
/**
|
|
174
154
|
* Initializes the dropdown, used for lazy loading.
|
|
175
155
|
*
|
|
176
|
-
* @returns An object with `
|
|
156
|
+
* @returns An object with `categoriesView`, `gridView` and `infoView` properties, containing UI parts.
|
|
177
157
|
*/
|
|
178
|
-
_createDropdownPanelContent(locale
|
|
158
|
+
_createDropdownPanelContent(locale) {
|
|
179
159
|
const groupEntries = Array
|
|
180
160
|
.from(this.getGroups())
|
|
181
161
|
.map(name => ([name, this._groups.get(name).label]));
|
|
@@ -185,10 +165,9 @@ export default class SpecialCharacters extends Plugin {
|
|
|
185
165
|
[ALL_SPECIAL_CHARACTERS_GROUP, this._allSpecialCharactersGroupLabel],
|
|
186
166
|
...groupEntries
|
|
187
167
|
]);
|
|
188
|
-
const
|
|
168
|
+
const categoriesView = new SpecialCharactersCategoriesView(locale, specialCharsGroups);
|
|
189
169
|
const gridView = new CharacterGridView(locale);
|
|
190
170
|
const infoView = new CharacterInfoView(locale);
|
|
191
|
-
gridView.delegate('execute').to(dropdownView);
|
|
192
171
|
gridView.on('tileHover', (evt, data) => {
|
|
193
172
|
infoView.set(data);
|
|
194
173
|
});
|
|
@@ -196,11 +175,54 @@ export default class SpecialCharacters extends Plugin {
|
|
|
196
175
|
infoView.set(data);
|
|
197
176
|
});
|
|
198
177
|
// Update the grid of special characters when a user changed the character group.
|
|
199
|
-
|
|
200
|
-
this._updateGrid(
|
|
178
|
+
categoriesView.on('change:currentGroupName', (evt, propertyName, newValue) => {
|
|
179
|
+
this._updateGrid(newValue, gridView);
|
|
201
180
|
});
|
|
202
181
|
// Set the initial content of the special characters grid.
|
|
203
|
-
this._updateGrid(
|
|
204
|
-
return {
|
|
182
|
+
this._updateGrid(categoriesView.currentGroupName, gridView);
|
|
183
|
+
return { categoriesView, gridView, infoView };
|
|
184
|
+
}
|
|
185
|
+
/**
|
|
186
|
+
* Creates a button for for menu bar that will show special characetrs dialog.
|
|
187
|
+
*/
|
|
188
|
+
_createDialogButton(ButtonClass) {
|
|
189
|
+
const editor = this.editor;
|
|
190
|
+
const locale = editor.locale;
|
|
191
|
+
const buttonView = new ButtonClass(editor.locale);
|
|
192
|
+
const command = editor.commands.get('insertText');
|
|
193
|
+
const t = locale.t;
|
|
194
|
+
const dialogPlugin = this.editor.plugins.get('Dialog');
|
|
195
|
+
buttonView.set({
|
|
196
|
+
label: t('Special characters'),
|
|
197
|
+
icon: specialCharactersIcon
|
|
198
|
+
});
|
|
199
|
+
buttonView.bind('isOn').to(dialogPlugin, 'id', id => id === 'specialCharacters');
|
|
200
|
+
buttonView.bind('isEnabled').to(command, 'isEnabled');
|
|
201
|
+
buttonView.on('execute', () => {
|
|
202
|
+
if (dialogPlugin.id === 'specialCharacters') {
|
|
203
|
+
dialogPlugin.hide();
|
|
204
|
+
return;
|
|
205
|
+
}
|
|
206
|
+
this._showDialog();
|
|
207
|
+
});
|
|
208
|
+
return buttonView;
|
|
209
|
+
}
|
|
210
|
+
_showDialog() {
|
|
211
|
+
const editor = this.editor;
|
|
212
|
+
const dialog = editor.plugins.get('Dialog');
|
|
213
|
+
const locale = editor.locale;
|
|
214
|
+
const t = locale.t;
|
|
215
|
+
const { categoriesView, gridView, infoView } = this._createDropdownPanelContent(locale);
|
|
216
|
+
const content = new SpecialCharactersView(locale, categoriesView, gridView, infoView);
|
|
217
|
+
gridView.on('execute', (evt, data) => {
|
|
218
|
+
editor.execute('insertText', { text: data.character });
|
|
219
|
+
});
|
|
220
|
+
dialog.show({
|
|
221
|
+
id: 'specialCharacters',
|
|
222
|
+
title: t('Special characters'),
|
|
223
|
+
className: 'ck-special-characters',
|
|
224
|
+
content,
|
|
225
|
+
position: DialogViewPosition.EDITOR_TOP_SIDE
|
|
226
|
+
});
|
|
205
227
|
}
|
|
206
228
|
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license Copyright (c) 2003-2024, 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/specialcharacterscategoriesview
|
|
7
|
+
*/
|
|
8
|
+
import { type Locale } from 'ckeditor5/src/utils.js';
|
|
9
|
+
import { View } from 'ckeditor5/src/ui.js';
|
|
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 SpecialCharactersCategoriesView extends View {
|
|
15
|
+
/**
|
|
16
|
+
* Currently selected special characters group's name.
|
|
17
|
+
*/
|
|
18
|
+
currentGroupName: string;
|
|
19
|
+
private _groupNames;
|
|
20
|
+
private _dropdownView;
|
|
21
|
+
/**
|
|
22
|
+
* Creates an instance of the {@link module:special-characters/ui/specialcharacterscategoriesview~SpecialCharactersCategoriesView}
|
|
23
|
+
* class.
|
|
24
|
+
*
|
|
25
|
+
* @param locale The localization services instance.
|
|
26
|
+
* @param groupNames The names of the character groups.
|
|
27
|
+
*/
|
|
28
|
+
constructor(locale: Locale, groupNames: Map<string, string>);
|
|
29
|
+
/**
|
|
30
|
+
* @inheritDoc
|
|
31
|
+
*/
|
|
32
|
+
render(): void;
|
|
33
|
+
/**
|
|
34
|
+
* @inheritDoc
|
|
35
|
+
*/
|
|
36
|
+
focus(): void;
|
|
37
|
+
/**
|
|
38
|
+
* Creates dropdown item list, sets up bindings and fills properties.
|
|
39
|
+
*/
|
|
40
|
+
private _setupDropdown;
|
|
41
|
+
}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license Copyright (c) 2003-2024, 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/specialcharacterscategoriesview
|
|
7
|
+
*/
|
|
8
|
+
import { Collection } from 'ckeditor5/src/utils.js';
|
|
9
|
+
import { addListToDropdown, createLabeledDropdown, LabeledFieldView, View, ViewModel } from 'ckeditor5/src/ui.js';
|
|
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 SpecialCharactersCategoriesView extends View {
|
|
15
|
+
/**
|
|
16
|
+
* Creates an instance of the {@link module:special-characters/ui/specialcharacterscategoriesview~SpecialCharactersCategoriesView}
|
|
17
|
+
* class.
|
|
18
|
+
*
|
|
19
|
+
* @param locale The localization services instance.
|
|
20
|
+
* @param groupNames The names of the character groups.
|
|
21
|
+
*/
|
|
22
|
+
constructor(locale, groupNames) {
|
|
23
|
+
super(locale);
|
|
24
|
+
this.set('currentGroupName', Array.from(groupNames.entries())[0][0]);
|
|
25
|
+
this._groupNames = groupNames;
|
|
26
|
+
this._dropdownView = new LabeledFieldView(locale, createLabeledDropdown);
|
|
27
|
+
this.setTemplate({
|
|
28
|
+
tag: 'div',
|
|
29
|
+
attributes: {
|
|
30
|
+
class: ['ck', 'ck-character-categories']
|
|
31
|
+
},
|
|
32
|
+
children: [
|
|
33
|
+
this._dropdownView
|
|
34
|
+
]
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* @inheritDoc
|
|
39
|
+
*/
|
|
40
|
+
render() {
|
|
41
|
+
super.render();
|
|
42
|
+
this._setupDropdown();
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* @inheritDoc
|
|
46
|
+
*/
|
|
47
|
+
focus() {
|
|
48
|
+
this._dropdownView.focus();
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Creates dropdown item list, sets up bindings and fills properties.
|
|
52
|
+
*/
|
|
53
|
+
_setupDropdown() {
|
|
54
|
+
const items = new Collection();
|
|
55
|
+
for (const [name, label] of this._groupNames) {
|
|
56
|
+
const item = {
|
|
57
|
+
type: 'button',
|
|
58
|
+
model: new ViewModel({
|
|
59
|
+
name,
|
|
60
|
+
label,
|
|
61
|
+
role: 'menuitemradio',
|
|
62
|
+
withText: true
|
|
63
|
+
})
|
|
64
|
+
};
|
|
65
|
+
item.model.bind('isOn').to(this, 'currentGroupName', value => {
|
|
66
|
+
return value === name;
|
|
67
|
+
});
|
|
68
|
+
items.add(item);
|
|
69
|
+
}
|
|
70
|
+
const t = this.locale.t;
|
|
71
|
+
const accessibleLabel = t('Category');
|
|
72
|
+
this._dropdownView.set({
|
|
73
|
+
label: accessibleLabel,
|
|
74
|
+
isEmpty: false
|
|
75
|
+
});
|
|
76
|
+
this._dropdownView.fieldView.panelPosition = this.locale.uiLanguageDirection === 'rtl' ? 'se' : 'sw';
|
|
77
|
+
this._dropdownView.fieldView.buttonView.set({
|
|
78
|
+
withText: true,
|
|
79
|
+
tooltip: accessibleLabel,
|
|
80
|
+
ariaLabel: accessibleLabel,
|
|
81
|
+
ariaLabelledBy: undefined,
|
|
82
|
+
isOn: false
|
|
83
|
+
});
|
|
84
|
+
this._dropdownView.fieldView.buttonView.bind('label')
|
|
85
|
+
.to(this, 'currentGroupName', value => this._groupNames.get(value));
|
|
86
|
+
this._dropdownView.fieldView.on('execute', ({ source }) => {
|
|
87
|
+
this.currentGroupName = source.name;
|
|
88
|
+
});
|
|
89
|
+
addListToDropdown(this._dropdownView.fieldView, items, {
|
|
90
|
+
ariaLabel: accessibleLabel,
|
|
91
|
+
role: 'menu'
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
}
|
|
@@ -9,7 +9,7 @@ import { View, FocusCycler, type ViewCollection, type FocusableView } from 'cked
|
|
|
9
9
|
import { FocusTracker, KeystrokeHandler, type Locale } from 'ckeditor5/src/utils.js';
|
|
10
10
|
import type CharacterGridView from './charactergridview.js';
|
|
11
11
|
import type CharacterInfoView from './characterinfoview.js';
|
|
12
|
-
import type
|
|
12
|
+
import type SpecialCharactersCategoriesView from './specialcharacterscategoriesview.js';
|
|
13
13
|
/**
|
|
14
14
|
* A view that glues pieces of the special characters dropdown panel together:
|
|
15
15
|
*
|
|
@@ -35,9 +35,9 @@ export default class SpecialCharactersView extends View<HTMLDivElement> {
|
|
|
35
35
|
*/
|
|
36
36
|
protected readonly _focusCycler: FocusCycler;
|
|
37
37
|
/**
|
|
38
|
-
* An instance of the `
|
|
38
|
+
* An instance of the `SpecialCharactersCategoriesView`.
|
|
39
39
|
*/
|
|
40
|
-
|
|
40
|
+
categoriesView: SpecialCharactersCategoriesView;
|
|
41
41
|
/**
|
|
42
42
|
* An instance of the `CharacterGridView`.
|
|
43
43
|
*/
|
|
@@ -49,7 +49,7 @@ export default class SpecialCharactersView extends View<HTMLDivElement> {
|
|
|
49
49
|
/**
|
|
50
50
|
* Creates an instance of the `SpecialCharactersView`.
|
|
51
51
|
*/
|
|
52
|
-
constructor(locale: Locale,
|
|
52
|
+
constructor(locale: Locale, categoriesView: SpecialCharactersCategoriesView, gridView: CharacterGridView, infoView: CharacterInfoView);
|
|
53
53
|
/**
|
|
54
54
|
* @inheritDoc
|
|
55
55
|
*/
|
|
@@ -18,9 +18,9 @@ export default class SpecialCharactersView extends View {
|
|
|
18
18
|
/**
|
|
19
19
|
* Creates an instance of the `SpecialCharactersView`.
|
|
20
20
|
*/
|
|
21
|
-
constructor(locale,
|
|
21
|
+
constructor(locale, categoriesView, gridView, infoView) {
|
|
22
22
|
super(locale);
|
|
23
|
-
this.
|
|
23
|
+
this.categoriesView = categoriesView;
|
|
24
24
|
this.gridView = gridView;
|
|
25
25
|
this.infoView = infoView;
|
|
26
26
|
this.items = this.createCollection();
|
|
@@ -38,7 +38,7 @@ export default class SpecialCharactersView extends View {
|
|
|
38
38
|
this.setTemplate({
|
|
39
39
|
tag: 'div',
|
|
40
40
|
children: [
|
|
41
|
-
this.
|
|
41
|
+
this.categoriesView,
|
|
42
42
|
this.gridView,
|
|
43
43
|
this.infoView
|
|
44
44
|
],
|
|
@@ -48,7 +48,7 @@ export default class SpecialCharactersView extends View {
|
|
|
48
48
|
tabindex: '-1'
|
|
49
49
|
}
|
|
50
50
|
});
|
|
51
|
-
this.items.add(this.
|
|
51
|
+
this.items.add(this.categoriesView);
|
|
52
52
|
this.items.add(this.gridView);
|
|
53
53
|
}
|
|
54
54
|
/**
|
|
@@ -56,7 +56,7 @@ export default class SpecialCharactersView extends View {
|
|
|
56
56
|
*/
|
|
57
57
|
render() {
|
|
58
58
|
super.render();
|
|
59
|
-
this.focusTracker.add(this.
|
|
59
|
+
this.focusTracker.add(this.categoriesView.element);
|
|
60
60
|
this.focusTracker.add(this.gridView.element);
|
|
61
61
|
// Start listening for the keystrokes coming from #element.
|
|
62
62
|
this.keystrokes.listenTo(this.element);
|
|
@@ -73,6 +73,6 @@ export default class SpecialCharactersView extends View {
|
|
|
73
73
|
* Focuses the first focusable in {@link #items}.
|
|
74
74
|
*/
|
|
75
75
|
focus() {
|
|
76
|
-
this.
|
|
76
|
+
this._focusCycler.focusFirst();
|
|
77
77
|
}
|
|
78
78
|
}
|
|
@@ -8,3 +8,84 @@
|
|
|
8
8
|
* it acts as a message to the builder telling that it should look for the corresponding styles
|
|
9
9
|
* **in the theme** when compiling the editor.
|
|
10
10
|
*/
|
|
11
|
+
|
|
12
|
+
@import "@ckeditor/ckeditor5-ui/theme/mixins/_rwd.css";
|
|
13
|
+
|
|
14
|
+
.ck.ck-special-characters {
|
|
15
|
+
& > .ck-dialog__content > div {
|
|
16
|
+
width: 350px;
|
|
17
|
+
max-width: 100%;
|
|
18
|
+
height: 100%;
|
|
19
|
+
|
|
20
|
+
display: grid;
|
|
21
|
+
grid-column-gap: 0px;
|
|
22
|
+
grid-row-gap: 0px;
|
|
23
|
+
grid-template-columns: 1fr;
|
|
24
|
+
grid-template-rows: auto 1fr auto;
|
|
25
|
+
|
|
26
|
+
& > .ck-character-categories {
|
|
27
|
+
grid-area: 1 / 1 / 2 / 2;
|
|
28
|
+
padding: var(--ck-spacing-medium) var(--ck-spacing-large);
|
|
29
|
+
|
|
30
|
+
& > .ck-labeled-field-view {
|
|
31
|
+
padding-top: var(--ck-spacing-standard);
|
|
32
|
+
width: 100%;
|
|
33
|
+
|
|
34
|
+
& .ck.ck-labeled-field-view__status {
|
|
35
|
+
background: var(--ck-color-base-error);
|
|
36
|
+
color: var(--ck-color-base-background);
|
|
37
|
+
padding: var(--ck-spacing-small) var(--ck-spacing-medium);
|
|
38
|
+
min-width: var(--ck-table-properties-min-error-width);
|
|
39
|
+
text-align: center;
|
|
40
|
+
|
|
41
|
+
/* The arrow pointing towards the field. */
|
|
42
|
+
&::after {
|
|
43
|
+
border-color: transparent transparent var(--ck-color-base-error) transparent;
|
|
44
|
+
border-width: 0 var(--ck-table-properties-error-arrow-size) var(--ck-table-properties-error-arrow-size) var(--ck-table-properties-error-arrow-size);
|
|
45
|
+
border-style: solid;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
animation: ck-table-form-labeled-view-status-appear .15s ease both;
|
|
49
|
+
|
|
50
|
+
@media (prefers-reduced-motion: reduce) {
|
|
51
|
+
animation: none;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/* Hide the error balloon when the field is blurred. Makes the experience much more clear. */
|
|
56
|
+
& .ck-input.ck-error:not(:focus) + .ck.ck-labeled-field-view__status {
|
|
57
|
+
display: none;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
& > .ck-label {
|
|
61
|
+
font-size: var(--ck-font-size-tiny);
|
|
62
|
+
text-align: center;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
.ck-dropdown {
|
|
67
|
+
display: block;
|
|
68
|
+
width: 100%;
|
|
69
|
+
|
|
70
|
+
& > button {
|
|
71
|
+
&:not(:focus) {
|
|
72
|
+
border: 1px solid var(--ck-color-base-border);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
& > span {
|
|
76
|
+
width: 100%;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
& > .ck-character-grid {
|
|
83
|
+
grid-area: 2 / 1 / 3 / 2;
|
|
84
|
+
max-height: 200px;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
& > .ck-character-info {
|
|
88
|
+
grid-area: 3 / 1 / 4 / 2;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
}
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license Copyright (c) 2003-2024, 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
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
7
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
8
|
-
*/
|
|
9
|
-
/**
|
|
10
|
-
* @module special-characters/ui/specialcharactersnavigationview
|
|
11
|
-
*/
|
|
12
|
-
import { type Locale } from 'ckeditor5/src/utils.js';
|
|
13
|
-
import { FormHeaderView, type DropdownView } from 'ckeditor5/src/ui.js';
|
|
14
|
-
/**
|
|
15
|
-
* A class representing the navigation part of the special characters UI. It is responsible
|
|
16
|
-
* for describing the feature and allowing the user to select a particular character group.
|
|
17
|
-
*/
|
|
18
|
-
export default class SpecialCharactersNavigationView extends FormHeaderView {
|
|
19
|
-
/**
|
|
20
|
-
* A dropdown that allows selecting a group of special characters to be displayed.
|
|
21
|
-
*/
|
|
22
|
-
groupDropdownView: GroupDropdownView;
|
|
23
|
-
/**
|
|
24
|
-
* Creates an instance of the {@link module:special-characters/ui/specialcharactersnavigationview~SpecialCharactersNavigationView}
|
|
25
|
-
* class.
|
|
26
|
-
*
|
|
27
|
-
* @param locale The localization services instance.
|
|
28
|
-
* @param groupNames The names of the character groups and their displayed labels.
|
|
29
|
-
*/
|
|
30
|
-
constructor(locale: Locale, groupNames: GroupNames);
|
|
31
|
-
/**
|
|
32
|
-
* Returns the name of the character group currently selected in the {@link #groupDropdownView}.
|
|
33
|
-
*/
|
|
34
|
-
get currentGroupName(): string;
|
|
35
|
-
/**
|
|
36
|
-
* Focuses the character categories dropdown.
|
|
37
|
-
*/
|
|
38
|
-
focus(): void;
|
|
39
|
-
/**
|
|
40
|
-
* Returns a dropdown that allows selecting character groups.
|
|
41
|
-
*
|
|
42
|
-
* @param groupNames The names of the character groups and their displayed labels.
|
|
43
|
-
*/
|
|
44
|
-
private _createGroupDropdown;
|
|
45
|
-
/**
|
|
46
|
-
* Returns list item definitions to be used in the character group dropdown
|
|
47
|
-
* representing specific character groups.
|
|
48
|
-
*
|
|
49
|
-
* @param dropdown Dropdown view element
|
|
50
|
-
* @param groupNames The names of the character groups and their displayed labels.
|
|
51
|
-
*/
|
|
52
|
-
private _getCharacterGroupListItemDefinitions;
|
|
53
|
-
}
|
|
54
|
-
/**
|
|
55
|
-
* The names of the character groups and their displayed labels.
|
|
56
|
-
*/
|
|
57
|
-
export type GroupNames = Map<string, string>;
|
|
58
|
-
/**
|
|
59
|
-
* `DropdownView` with additional field for the name of the currectly selected character group.
|
|
60
|
-
*/
|
|
61
|
-
export type GroupDropdownView = DropdownView & {
|
|
62
|
-
value: string;
|
|
63
|
-
};
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license Copyright (c) 2003-2024, 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.js';
|
|
9
|
-
import { FormHeaderView, type DropdownView } from 'ckeditor5/src/ui.js';
|
|
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
|
-
};
|