@ckeditor/ckeditor5-style 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 +4 -4
- package/build/style.js.map +1 -0
- package/lang/translations/ar.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/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 +1 -0
- 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/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/tr.po +1 -0
- package/lang/translations/ug.po +1 -0
- package/lang/translations/uk.po +1 -0
- package/lang/translations/ur.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 +14 -14
- package/src/index.js +12 -12
- package/src/integrations/documentlist.d.ts +42 -42
- package/src/integrations/documentlist.js +141 -141
- package/src/integrations/link.d.ts +37 -37
- package/src/integrations/link.js +156 -156
- package/src/integrations/table.d.ts +49 -49
- package/src/integrations/table.js +115 -115
- package/src/style.d.ts +26 -26
- package/src/style.js +30 -30
- package/src/stylecommand.d.ts +82 -82
- package/src/stylecommand.js +200 -200
- package/src/styleconfig.d.ts +87 -87
- package/src/styleconfig.js +5 -5
- package/src/styleediting.d.ts +33 -33
- package/src/styleediting.js +46 -46
- package/src/styleui.d.ts +30 -30
- package/src/styleui.js +94 -94
- package/src/styleutils.d.ts +138 -138
- package/src/styleutils.js +268 -268
- package/src/ui/stylegridbuttonview.d.ts +34 -34
- package/src/ui/stylegridbuttonview.js +55 -55
- package/src/ui/stylegridview.d.ts +72 -72
- package/src/ui/stylegridview.js +89 -89
- package/src/ui/stylegroupview.d.ts +35 -35
- package/src/ui/stylegroupview.js +45 -45
- package/src/ui/stylepanelview.d.ts +89 -89
- package/src/ui/stylepanelview.js +95 -95
|
@@ -1,55 +1,55 @@
|
|
|
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 { ButtonView, View } from 'ckeditor5/src/ui';
|
|
6
|
-
/**
|
|
7
|
-
* A class representing an individual button (style) in the grid. Renders a rich preview of the style.
|
|
8
|
-
*/
|
|
9
|
-
export default class StyleGridButtonView extends ButtonView {
|
|
10
|
-
/**
|
|
11
|
-
* Creates an instance of the {@link module:style/ui/stylegridbuttonview~StyleGridButtonView} class.
|
|
12
|
-
*
|
|
13
|
-
* @param locale The localization services instance.
|
|
14
|
-
* @param styleDefinition Definition of the style.
|
|
15
|
-
*/
|
|
16
|
-
constructor(locale, styleDefinition) {
|
|
17
|
-
super(locale);
|
|
18
|
-
this.styleDefinition = styleDefinition;
|
|
19
|
-
this.previewView = this._createPreview();
|
|
20
|
-
this.set({
|
|
21
|
-
label: styleDefinition.name,
|
|
22
|
-
class: 'ck-style-grid__button',
|
|
23
|
-
withText: true
|
|
24
|
-
});
|
|
25
|
-
this.extendTemplate({
|
|
26
|
-
attributes: {
|
|
27
|
-
role: 'option'
|
|
28
|
-
}
|
|
29
|
-
});
|
|
30
|
-
this.children.add(this.previewView, 0);
|
|
31
|
-
}
|
|
32
|
-
/**
|
|
33
|
-
* Creates the view representing the preview of the style.
|
|
34
|
-
*/
|
|
35
|
-
_createPreview() {
|
|
36
|
-
const previewView = new View(this.locale);
|
|
37
|
-
previewView.setTemplate({
|
|
38
|
-
tag: 'div',
|
|
39
|
-
attributes: {
|
|
40
|
-
class: [
|
|
41
|
-
'ck',
|
|
42
|
-
'ck-reset_all-excluded',
|
|
43
|
-
'ck-style-grid__button__preview',
|
|
44
|
-
'ck-content'
|
|
45
|
-
],
|
|
46
|
-
// The preview "AaBbCcDdEeFfGgHhIiJj" should not be read by screen readers because it is purely presentational.
|
|
47
|
-
'aria-hidden': 'true'
|
|
48
|
-
},
|
|
49
|
-
children: [
|
|
50
|
-
this.styleDefinition.previewTemplate
|
|
51
|
-
]
|
|
52
|
-
});
|
|
53
|
-
return previewView;
|
|
54
|
-
}
|
|
55
|
-
}
|
|
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 { ButtonView, View } from 'ckeditor5/src/ui';
|
|
6
|
+
/**
|
|
7
|
+
* A class representing an individual button (style) in the grid. Renders a rich preview of the style.
|
|
8
|
+
*/
|
|
9
|
+
export default class StyleGridButtonView extends ButtonView {
|
|
10
|
+
/**
|
|
11
|
+
* Creates an instance of the {@link module:style/ui/stylegridbuttonview~StyleGridButtonView} class.
|
|
12
|
+
*
|
|
13
|
+
* @param locale The localization services instance.
|
|
14
|
+
* @param styleDefinition Definition of the style.
|
|
15
|
+
*/
|
|
16
|
+
constructor(locale, styleDefinition) {
|
|
17
|
+
super(locale);
|
|
18
|
+
this.styleDefinition = styleDefinition;
|
|
19
|
+
this.previewView = this._createPreview();
|
|
20
|
+
this.set({
|
|
21
|
+
label: styleDefinition.name,
|
|
22
|
+
class: 'ck-style-grid__button',
|
|
23
|
+
withText: true
|
|
24
|
+
});
|
|
25
|
+
this.extendTemplate({
|
|
26
|
+
attributes: {
|
|
27
|
+
role: 'option'
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
this.children.add(this.previewView, 0);
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Creates the view representing the preview of the style.
|
|
34
|
+
*/
|
|
35
|
+
_createPreview() {
|
|
36
|
+
const previewView = new View(this.locale);
|
|
37
|
+
previewView.setTemplate({
|
|
38
|
+
tag: 'div',
|
|
39
|
+
attributes: {
|
|
40
|
+
class: [
|
|
41
|
+
'ck',
|
|
42
|
+
'ck-reset_all-excluded',
|
|
43
|
+
'ck-style-grid__button__preview',
|
|
44
|
+
'ck-content'
|
|
45
|
+
],
|
|
46
|
+
// The preview "AaBbCcDdEeFfGgHhIiJj" should not be read by screen readers because it is purely presentational.
|
|
47
|
+
'aria-hidden': 'true'
|
|
48
|
+
},
|
|
49
|
+
children: [
|
|
50
|
+
this.styleDefinition.previewTemplate
|
|
51
|
+
]
|
|
52
|
+
});
|
|
53
|
+
return previewView;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
@@ -1,72 +1,72 @@
|
|
|
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 style/ui/stylegridview
|
|
7
|
-
*/
|
|
8
|
-
import { View, type ViewCollection } from 'ckeditor5/src/ui';
|
|
9
|
-
import { FocusTracker, KeystrokeHandler, type Locale } from 'ckeditor5/src/utils';
|
|
10
|
-
import StyleGridButtonView from './stylegridbuttonview';
|
|
11
|
-
import type { NormalizedStyleDefinition } from '../styleutils';
|
|
12
|
-
import '../../theme/stylegrid.css';
|
|
13
|
-
/**
|
|
14
|
-
* A class representing a grid of styles ({@link module:style/ui/stylegridbuttonview~StyleGridButtonView buttons}).
|
|
15
|
-
* Allows users to select a style.
|
|
16
|
-
*/
|
|
17
|
-
export default class StyleGridView extends View<HTMLDivElement> {
|
|
18
|
-
/**
|
|
19
|
-
* Tracks information about the DOM focus in the view.
|
|
20
|
-
*/
|
|
21
|
-
readonly focusTracker: FocusTracker;
|
|
22
|
-
/**
|
|
23
|
-
* An instance of the {@link module:utils/keystrokehandler~KeystrokeHandler}.
|
|
24
|
-
*/
|
|
25
|
-
readonly keystrokes: KeystrokeHandler;
|
|
26
|
-
/**
|
|
27
|
-
* A collection of style {@link module:style/ui/stylegridbuttonview~StyleGridButtonView buttons}.
|
|
28
|
-
*/
|
|
29
|
-
readonly children: ViewCollection<StyleGridButtonView>;
|
|
30
|
-
/**
|
|
31
|
-
* Array of active style names. They must correspond to the names of styles from
|
|
32
|
-
* definitions passed to the {@link #constructor}.
|
|
33
|
-
*
|
|
34
|
-
* @observable
|
|
35
|
-
*/
|
|
36
|
-
readonly activeStyles: Array<string>;
|
|
37
|
-
/**
|
|
38
|
-
* Array of enabled style names. They must correspond to the names of styles from
|
|
39
|
-
* definitions passed to the {@link #constructor}.
|
|
40
|
-
*
|
|
41
|
-
* @observable
|
|
42
|
-
*/
|
|
43
|
-
readonly enabledStyles: Array<string>;
|
|
44
|
-
/**
|
|
45
|
-
* Creates an instance of the {@link module:style/ui/stylegridview~StyleGridView} class.
|
|
46
|
-
*
|
|
47
|
-
* @param locale The localization services instance.
|
|
48
|
-
* @param styleDefinitions Definitions of the styles.
|
|
49
|
-
*/
|
|
50
|
-
constructor(locale: Locale, styleDefinitions: Array<NormalizedStyleDefinition>);
|
|
51
|
-
/**
|
|
52
|
-
* @inheritDoc
|
|
53
|
-
*/
|
|
54
|
-
render(): void;
|
|
55
|
-
/**
|
|
56
|
-
* Focuses the first style button in the grid.
|
|
57
|
-
*/
|
|
58
|
-
focus(): void;
|
|
59
|
-
/**
|
|
60
|
-
* @inheritDoc
|
|
61
|
-
*/
|
|
62
|
-
destroy(): void;
|
|
63
|
-
}
|
|
64
|
-
/**
|
|
65
|
-
* Fired when a {@link module:style/ui/stylegridbuttonview~StyleGridButtonView style} was selected (clicked) by the user.
|
|
66
|
-
*
|
|
67
|
-
* @eventName ~StyleGridView#execute
|
|
68
|
-
*/
|
|
69
|
-
export type StyleGridViewExecuteEvent = {
|
|
70
|
-
name: 'execute';
|
|
71
|
-
args: [];
|
|
72
|
-
};
|
|
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 style/ui/stylegridview
|
|
7
|
+
*/
|
|
8
|
+
import { View, type ViewCollection } from 'ckeditor5/src/ui';
|
|
9
|
+
import { FocusTracker, KeystrokeHandler, type Locale } from 'ckeditor5/src/utils';
|
|
10
|
+
import StyleGridButtonView from './stylegridbuttonview';
|
|
11
|
+
import type { NormalizedStyleDefinition } from '../styleutils';
|
|
12
|
+
import '../../theme/stylegrid.css';
|
|
13
|
+
/**
|
|
14
|
+
* A class representing a grid of styles ({@link module:style/ui/stylegridbuttonview~StyleGridButtonView buttons}).
|
|
15
|
+
* Allows users to select a style.
|
|
16
|
+
*/
|
|
17
|
+
export default class StyleGridView extends View<HTMLDivElement> {
|
|
18
|
+
/**
|
|
19
|
+
* Tracks information about the DOM focus in the view.
|
|
20
|
+
*/
|
|
21
|
+
readonly focusTracker: FocusTracker;
|
|
22
|
+
/**
|
|
23
|
+
* An instance of the {@link module:utils/keystrokehandler~KeystrokeHandler}.
|
|
24
|
+
*/
|
|
25
|
+
readonly keystrokes: KeystrokeHandler;
|
|
26
|
+
/**
|
|
27
|
+
* A collection of style {@link module:style/ui/stylegridbuttonview~StyleGridButtonView buttons}.
|
|
28
|
+
*/
|
|
29
|
+
readonly children: ViewCollection<StyleGridButtonView>;
|
|
30
|
+
/**
|
|
31
|
+
* Array of active style names. They must correspond to the names of styles from
|
|
32
|
+
* definitions passed to the {@link #constructor}.
|
|
33
|
+
*
|
|
34
|
+
* @observable
|
|
35
|
+
*/
|
|
36
|
+
readonly activeStyles: Array<string>;
|
|
37
|
+
/**
|
|
38
|
+
* Array of enabled style names. They must correspond to the names of styles from
|
|
39
|
+
* definitions passed to the {@link #constructor}.
|
|
40
|
+
*
|
|
41
|
+
* @observable
|
|
42
|
+
*/
|
|
43
|
+
readonly enabledStyles: Array<string>;
|
|
44
|
+
/**
|
|
45
|
+
* Creates an instance of the {@link module:style/ui/stylegridview~StyleGridView} class.
|
|
46
|
+
*
|
|
47
|
+
* @param locale The localization services instance.
|
|
48
|
+
* @param styleDefinitions Definitions of the styles.
|
|
49
|
+
*/
|
|
50
|
+
constructor(locale: Locale, styleDefinitions: Array<NormalizedStyleDefinition>);
|
|
51
|
+
/**
|
|
52
|
+
* @inheritDoc
|
|
53
|
+
*/
|
|
54
|
+
render(): void;
|
|
55
|
+
/**
|
|
56
|
+
* Focuses the first style button in the grid.
|
|
57
|
+
*/
|
|
58
|
+
focus(): void;
|
|
59
|
+
/**
|
|
60
|
+
* @inheritDoc
|
|
61
|
+
*/
|
|
62
|
+
destroy(): void;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Fired when a {@link module:style/ui/stylegridbuttonview~StyleGridButtonView style} was selected (clicked) by the user.
|
|
66
|
+
*
|
|
67
|
+
* @eventName ~StyleGridView#execute
|
|
68
|
+
*/
|
|
69
|
+
export type StyleGridViewExecuteEvent = {
|
|
70
|
+
name: 'execute';
|
|
71
|
+
args: [];
|
|
72
|
+
};
|
package/src/ui/stylegridview.js
CHANGED
|
@@ -1,89 +1,89 @@
|
|
|
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 style/ui/stylegridview
|
|
7
|
-
*/
|
|
8
|
-
import { View, addKeyboardHandlingForGrid } from 'ckeditor5/src/ui';
|
|
9
|
-
import { FocusTracker, KeystrokeHandler } from 'ckeditor5/src/utils';
|
|
10
|
-
import StyleGridButtonView from './stylegridbuttonview';
|
|
11
|
-
import '../../theme/stylegrid.css';
|
|
12
|
-
/**
|
|
13
|
-
* A class representing a grid of styles ({@link module:style/ui/stylegridbuttonview~StyleGridButtonView buttons}).
|
|
14
|
-
* Allows users to select a style.
|
|
15
|
-
*/
|
|
16
|
-
export default class StyleGridView extends View {
|
|
17
|
-
/**
|
|
18
|
-
* Creates an instance of the {@link module:style/ui/stylegridview~StyleGridView} class.
|
|
19
|
-
*
|
|
20
|
-
* @param locale The localization services instance.
|
|
21
|
-
* @param styleDefinitions Definitions of the styles.
|
|
22
|
-
*/
|
|
23
|
-
constructor(locale, styleDefinitions) {
|
|
24
|
-
super(locale);
|
|
25
|
-
this.focusTracker = new FocusTracker();
|
|
26
|
-
this.keystrokes = new KeystrokeHandler();
|
|
27
|
-
this.set('activeStyles', []);
|
|
28
|
-
this.set('enabledStyles', []);
|
|
29
|
-
this.children = this.createCollection();
|
|
30
|
-
this.children.delegate('execute').to(this);
|
|
31
|
-
for (const definition of styleDefinitions) {
|
|
32
|
-
const gridTileView = new StyleGridButtonView(locale, definition);
|
|
33
|
-
this.children.add(gridTileView);
|
|
34
|
-
}
|
|
35
|
-
this.on('change:activeStyles', () => {
|
|
36
|
-
for (const child of this.children) {
|
|
37
|
-
child.isOn = this.activeStyles.includes(child.styleDefinition.name);
|
|
38
|
-
}
|
|
39
|
-
});
|
|
40
|
-
this.on('change:enabledStyles', () => {
|
|
41
|
-
for (const child of this.children) {
|
|
42
|
-
child.isEnabled = this.enabledStyles.includes(child.styleDefinition.name);
|
|
43
|
-
}
|
|
44
|
-
});
|
|
45
|
-
this.setTemplate({
|
|
46
|
-
tag: 'div',
|
|
47
|
-
attributes: {
|
|
48
|
-
class: [
|
|
49
|
-
'ck',
|
|
50
|
-
'ck-style-grid'
|
|
51
|
-
],
|
|
52
|
-
role: 'listbox'
|
|
53
|
-
},
|
|
54
|
-
children: this.children
|
|
55
|
-
});
|
|
56
|
-
}
|
|
57
|
-
/**
|
|
58
|
-
* @inheritDoc
|
|
59
|
-
*/
|
|
60
|
-
render() {
|
|
61
|
-
super.render();
|
|
62
|
-
for (const child of this.children) {
|
|
63
|
-
this.focusTracker.add(child.element);
|
|
64
|
-
}
|
|
65
|
-
addKeyboardHandlingForGrid({
|
|
66
|
-
keystrokeHandler: this.keystrokes,
|
|
67
|
-
focusTracker: this.focusTracker,
|
|
68
|
-
gridItems: this.children,
|
|
69
|
-
numberOfColumns: 3,
|
|
70
|
-
uiLanguageDirection: this.locale && this.locale.uiLanguageDirection
|
|
71
|
-
});
|
|
72
|
-
// Start listening for the keystrokes coming from the grid view.
|
|
73
|
-
this.keystrokes.listenTo(this.element);
|
|
74
|
-
}
|
|
75
|
-
/**
|
|
76
|
-
* Focuses the first style button in the grid.
|
|
77
|
-
*/
|
|
78
|
-
focus() {
|
|
79
|
-
this.children.first.focus();
|
|
80
|
-
}
|
|
81
|
-
/**
|
|
82
|
-
* @inheritDoc
|
|
83
|
-
*/
|
|
84
|
-
destroy() {
|
|
85
|
-
super.destroy();
|
|
86
|
-
this.focusTracker.destroy();
|
|
87
|
-
this.keystrokes.destroy();
|
|
88
|
-
}
|
|
89
|
-
}
|
|
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 style/ui/stylegridview
|
|
7
|
+
*/
|
|
8
|
+
import { View, addKeyboardHandlingForGrid } from 'ckeditor5/src/ui';
|
|
9
|
+
import { FocusTracker, KeystrokeHandler } from 'ckeditor5/src/utils';
|
|
10
|
+
import StyleGridButtonView from './stylegridbuttonview';
|
|
11
|
+
import '../../theme/stylegrid.css';
|
|
12
|
+
/**
|
|
13
|
+
* A class representing a grid of styles ({@link module:style/ui/stylegridbuttonview~StyleGridButtonView buttons}).
|
|
14
|
+
* Allows users to select a style.
|
|
15
|
+
*/
|
|
16
|
+
export default class StyleGridView extends View {
|
|
17
|
+
/**
|
|
18
|
+
* Creates an instance of the {@link module:style/ui/stylegridview~StyleGridView} class.
|
|
19
|
+
*
|
|
20
|
+
* @param locale The localization services instance.
|
|
21
|
+
* @param styleDefinitions Definitions of the styles.
|
|
22
|
+
*/
|
|
23
|
+
constructor(locale, styleDefinitions) {
|
|
24
|
+
super(locale);
|
|
25
|
+
this.focusTracker = new FocusTracker();
|
|
26
|
+
this.keystrokes = new KeystrokeHandler();
|
|
27
|
+
this.set('activeStyles', []);
|
|
28
|
+
this.set('enabledStyles', []);
|
|
29
|
+
this.children = this.createCollection();
|
|
30
|
+
this.children.delegate('execute').to(this);
|
|
31
|
+
for (const definition of styleDefinitions) {
|
|
32
|
+
const gridTileView = new StyleGridButtonView(locale, definition);
|
|
33
|
+
this.children.add(gridTileView);
|
|
34
|
+
}
|
|
35
|
+
this.on('change:activeStyles', () => {
|
|
36
|
+
for (const child of this.children) {
|
|
37
|
+
child.isOn = this.activeStyles.includes(child.styleDefinition.name);
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
this.on('change:enabledStyles', () => {
|
|
41
|
+
for (const child of this.children) {
|
|
42
|
+
child.isEnabled = this.enabledStyles.includes(child.styleDefinition.name);
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
this.setTemplate({
|
|
46
|
+
tag: 'div',
|
|
47
|
+
attributes: {
|
|
48
|
+
class: [
|
|
49
|
+
'ck',
|
|
50
|
+
'ck-style-grid'
|
|
51
|
+
],
|
|
52
|
+
role: 'listbox'
|
|
53
|
+
},
|
|
54
|
+
children: this.children
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* @inheritDoc
|
|
59
|
+
*/
|
|
60
|
+
render() {
|
|
61
|
+
super.render();
|
|
62
|
+
for (const child of this.children) {
|
|
63
|
+
this.focusTracker.add(child.element);
|
|
64
|
+
}
|
|
65
|
+
addKeyboardHandlingForGrid({
|
|
66
|
+
keystrokeHandler: this.keystrokes,
|
|
67
|
+
focusTracker: this.focusTracker,
|
|
68
|
+
gridItems: this.children,
|
|
69
|
+
numberOfColumns: 3,
|
|
70
|
+
uiLanguageDirection: this.locale && this.locale.uiLanguageDirection
|
|
71
|
+
});
|
|
72
|
+
// Start listening for the keystrokes coming from the grid view.
|
|
73
|
+
this.keystrokes.listenTo(this.element);
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Focuses the first style button in the grid.
|
|
77
|
+
*/
|
|
78
|
+
focus() {
|
|
79
|
+
this.children.first.focus();
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* @inheritDoc
|
|
83
|
+
*/
|
|
84
|
+
destroy() {
|
|
85
|
+
super.destroy();
|
|
86
|
+
this.focusTracker.destroy();
|
|
87
|
+
this.keystrokes.destroy();
|
|
88
|
+
}
|
|
89
|
+
}
|
|
@@ -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 style/ui/stylegroupview
|
|
7
|
-
*/
|
|
8
|
-
import { LabelView, View } from 'ckeditor5/src/ui';
|
|
9
|
-
import type { Locale } from 'ckeditor5/src/utils';
|
|
10
|
-
import StyleGridView from './stylegridview';
|
|
11
|
-
import type { NormalizedStyleDefinition } from '../styleutils';
|
|
12
|
-
import '../../theme/stylegroup.css';
|
|
13
|
-
/**
|
|
14
|
-
* A class representing a group of styles (e.g. "block" or "inline").
|
|
15
|
-
*
|
|
16
|
-
* Renders a {@link module:style/ui/stylegridview~StyleGridView style grid} and a label.
|
|
17
|
-
*/
|
|
18
|
-
export default class StyleGroupView extends View<HTMLDivElement> {
|
|
19
|
-
/**
|
|
20
|
-
* The styles grid of the group.
|
|
21
|
-
*/
|
|
22
|
-
readonly gridView: StyleGridView;
|
|
23
|
-
/**
|
|
24
|
-
* The label of the group.
|
|
25
|
-
*/
|
|
26
|
-
readonly labelView: LabelView;
|
|
27
|
-
/**
|
|
28
|
-
* Creates an instance of the {@link module:style/ui/stylegroupview~StyleGroupView} class.
|
|
29
|
-
*
|
|
30
|
-
* @param locale The localization services instance.
|
|
31
|
-
* @param label The localized label of the group.
|
|
32
|
-
* @param styleDefinitions Definitions of the styles in the group.
|
|
33
|
-
*/
|
|
34
|
-
constructor(locale: Locale, label: string, styleDefinitions: Array<NormalizedStyleDefinition>);
|
|
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 style/ui/stylegroupview
|
|
7
|
+
*/
|
|
8
|
+
import { LabelView, View } from 'ckeditor5/src/ui';
|
|
9
|
+
import type { Locale } from 'ckeditor5/src/utils';
|
|
10
|
+
import StyleGridView from './stylegridview';
|
|
11
|
+
import type { NormalizedStyleDefinition } from '../styleutils';
|
|
12
|
+
import '../../theme/stylegroup.css';
|
|
13
|
+
/**
|
|
14
|
+
* A class representing a group of styles (e.g. "block" or "inline").
|
|
15
|
+
*
|
|
16
|
+
* Renders a {@link module:style/ui/stylegridview~StyleGridView style grid} and a label.
|
|
17
|
+
*/
|
|
18
|
+
export default class StyleGroupView extends View<HTMLDivElement> {
|
|
19
|
+
/**
|
|
20
|
+
* The styles grid of the group.
|
|
21
|
+
*/
|
|
22
|
+
readonly gridView: StyleGridView;
|
|
23
|
+
/**
|
|
24
|
+
* The label of the group.
|
|
25
|
+
*/
|
|
26
|
+
readonly labelView: LabelView;
|
|
27
|
+
/**
|
|
28
|
+
* Creates an instance of the {@link module:style/ui/stylegroupview~StyleGroupView} class.
|
|
29
|
+
*
|
|
30
|
+
* @param locale The localization services instance.
|
|
31
|
+
* @param label The localized label of the group.
|
|
32
|
+
* @param styleDefinitions Definitions of the styles in the group.
|
|
33
|
+
*/
|
|
34
|
+
constructor(locale: Locale, label: string, styleDefinitions: Array<NormalizedStyleDefinition>);
|
|
35
|
+
}
|
package/src/ui/stylegroupview.js
CHANGED
|
@@ -1,45 +1,45 @@
|
|
|
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 style/ui/stylegroupview
|
|
7
|
-
*/
|
|
8
|
-
import { LabelView, View } from 'ckeditor5/src/ui';
|
|
9
|
-
import StyleGridView from './stylegridview';
|
|
10
|
-
import '../../theme/stylegroup.css';
|
|
11
|
-
/**
|
|
12
|
-
* A class representing a group of styles (e.g. "block" or "inline").
|
|
13
|
-
*
|
|
14
|
-
* Renders a {@link module:style/ui/stylegridview~StyleGridView style grid} and a label.
|
|
15
|
-
*/
|
|
16
|
-
export default class StyleGroupView extends View {
|
|
17
|
-
/**
|
|
18
|
-
* Creates an instance of the {@link module:style/ui/stylegroupview~StyleGroupView} class.
|
|
19
|
-
*
|
|
20
|
-
* @param locale The localization services instance.
|
|
21
|
-
* @param label The localized label of the group.
|
|
22
|
-
* @param styleDefinitions Definitions of the styles in the group.
|
|
23
|
-
*/
|
|
24
|
-
constructor(locale, label, styleDefinitions) {
|
|
25
|
-
super(locale);
|
|
26
|
-
this.labelView = new LabelView(locale);
|
|
27
|
-
this.labelView.text = label;
|
|
28
|
-
this.gridView = new StyleGridView(locale, styleDefinitions);
|
|
29
|
-
this.setTemplate({
|
|
30
|
-
tag: 'div',
|
|
31
|
-
attributes: {
|
|
32
|
-
class: [
|
|
33
|
-
'ck',
|
|
34
|
-
'ck-style-panel__style-group'
|
|
35
|
-
],
|
|
36
|
-
role: 'group',
|
|
37
|
-
'aria-labelledby': this.labelView.id
|
|
38
|
-
},
|
|
39
|
-
children: [
|
|
40
|
-
this.labelView,
|
|
41
|
-
this.gridView
|
|
42
|
-
]
|
|
43
|
-
});
|
|
44
|
-
}
|
|
45
|
-
}
|
|
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 style/ui/stylegroupview
|
|
7
|
+
*/
|
|
8
|
+
import { LabelView, View } from 'ckeditor5/src/ui';
|
|
9
|
+
import StyleGridView from './stylegridview';
|
|
10
|
+
import '../../theme/stylegroup.css';
|
|
11
|
+
/**
|
|
12
|
+
* A class representing a group of styles (e.g. "block" or "inline").
|
|
13
|
+
*
|
|
14
|
+
* Renders a {@link module:style/ui/stylegridview~StyleGridView style grid} and a label.
|
|
15
|
+
*/
|
|
16
|
+
export default class StyleGroupView extends View {
|
|
17
|
+
/**
|
|
18
|
+
* Creates an instance of the {@link module:style/ui/stylegroupview~StyleGroupView} class.
|
|
19
|
+
*
|
|
20
|
+
* @param locale The localization services instance.
|
|
21
|
+
* @param label The localized label of the group.
|
|
22
|
+
* @param styleDefinitions Definitions of the styles in the group.
|
|
23
|
+
*/
|
|
24
|
+
constructor(locale, label, styleDefinitions) {
|
|
25
|
+
super(locale);
|
|
26
|
+
this.labelView = new LabelView(locale);
|
|
27
|
+
this.labelView.text = label;
|
|
28
|
+
this.gridView = new StyleGridView(locale, styleDefinitions);
|
|
29
|
+
this.setTemplate({
|
|
30
|
+
tag: 'div',
|
|
31
|
+
attributes: {
|
|
32
|
+
class: [
|
|
33
|
+
'ck',
|
|
34
|
+
'ck-style-panel__style-group'
|
|
35
|
+
],
|
|
36
|
+
role: 'group',
|
|
37
|
+
'aria-labelledby': this.labelView.id
|
|
38
|
+
},
|
|
39
|
+
children: [
|
|
40
|
+
this.labelView,
|
|
41
|
+
this.gridView
|
|
42
|
+
]
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
}
|