@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,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/stylepanelview
|
|
7
|
-
*/
|
|
8
|
-
import { FocusCycler, View, ViewCollection } from 'ckeditor5/src/ui';
|
|
9
|
-
import { FocusTracker, KeystrokeHandler, type Locale } from 'ckeditor5/src/utils';
|
|
10
|
-
import StyleGroupView from './stylegroupview';
|
|
11
|
-
import type StyleGridView from './stylegridview';
|
|
12
|
-
import type { NormalizedStyleDefinitions } from '../styleutils';
|
|
13
|
-
import '../../theme/stylepanel.css';
|
|
14
|
-
/**
|
|
15
|
-
* A class representing a panel with available content styles. It renders styles in button grids, grouped
|
|
16
|
-
* in categories.
|
|
17
|
-
*/
|
|
18
|
-
export default class StylePanelView extends View<HTMLDivElement> {
|
|
19
|
-
/**
|
|
20
|
-
* Tracks information about DOM focus in the panel.
|
|
21
|
-
*/
|
|
22
|
-
readonly focusTracker: FocusTracker;
|
|
23
|
-
/**
|
|
24
|
-
* An instance of the {@link module:utils/keystrokehandler~KeystrokeHandler}.
|
|
25
|
-
*/
|
|
26
|
-
readonly keystrokes: KeystrokeHandler;
|
|
27
|
-
/**
|
|
28
|
-
* A collection of panel children.
|
|
29
|
-
*/
|
|
30
|
-
readonly children: ViewCollection<StyleGroupView>;
|
|
31
|
-
/**
|
|
32
|
-
* A view representing block styles group.
|
|
33
|
-
*/
|
|
34
|
-
readonly blockStylesGroupView: StyleGroupView;
|
|
35
|
-
/**
|
|
36
|
-
* A view representing inline styles group
|
|
37
|
-
*/
|
|
38
|
-
readonly inlineStylesGroupView: StyleGroupView;
|
|
39
|
-
/**
|
|
40
|
-
* Array of active style names. They must correspond to the names of styles from
|
|
41
|
-
* definitions passed to the {@link #constructor}.
|
|
42
|
-
*
|
|
43
|
-
* @observable
|
|
44
|
-
*/
|
|
45
|
-
readonly activeStyles: Array<string>;
|
|
46
|
-
/**
|
|
47
|
-
* Array of enabled style names. They must correspond to the names of styles from
|
|
48
|
-
* definitions passed to the {@link #constructor}.
|
|
49
|
-
*
|
|
50
|
-
* @observable
|
|
51
|
-
*/
|
|
52
|
-
readonly enabledStyles: Array<string>;
|
|
53
|
-
/**
|
|
54
|
-
* A collection of views that can be focused in the panel.
|
|
55
|
-
*/
|
|
56
|
-
protected readonly _focusables: ViewCollection<StyleGridView>;
|
|
57
|
-
/**
|
|
58
|
-
* Helps cycling over {@link #_focusables} in the panel.
|
|
59
|
-
*/
|
|
60
|
-
protected readonly _focusCycler: FocusCycler;
|
|
61
|
-
/**
|
|
62
|
-
* Creates an instance of the {@link module:style/ui/stylegroupview~StyleGroupView} class.
|
|
63
|
-
*
|
|
64
|
-
* @param locale The localization services instance.
|
|
65
|
-
* @param styleDefinitions Normalized definitions of the styles.
|
|
66
|
-
*/
|
|
67
|
-
constructor(locale: Locale, styleDefinitions: NormalizedStyleDefinitions);
|
|
68
|
-
/**
|
|
69
|
-
* @inheritDoc
|
|
70
|
-
*/
|
|
71
|
-
render(): void;
|
|
72
|
-
/**
|
|
73
|
-
* Focuses the first focusable element in the panel.
|
|
74
|
-
*/
|
|
75
|
-
focus(): void;
|
|
76
|
-
/**
|
|
77
|
-
* Focuses the last focusable element in the panel.
|
|
78
|
-
*/
|
|
79
|
-
focusLast(): void;
|
|
80
|
-
}
|
|
81
|
-
/**
|
|
82
|
-
* Fired when a style was selected (clicked) by the user.
|
|
83
|
-
*
|
|
84
|
-
* @eventName ~StylePanelView#execute
|
|
85
|
-
*/
|
|
86
|
-
export type StylePanelViewExecuteEvent = {
|
|
87
|
-
name: 'execute';
|
|
88
|
-
args: [];
|
|
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/stylepanelview
|
|
7
|
+
*/
|
|
8
|
+
import { FocusCycler, View, ViewCollection } from 'ckeditor5/src/ui';
|
|
9
|
+
import { FocusTracker, KeystrokeHandler, type Locale } from 'ckeditor5/src/utils';
|
|
10
|
+
import StyleGroupView from './stylegroupview';
|
|
11
|
+
import type StyleGridView from './stylegridview';
|
|
12
|
+
import type { NormalizedStyleDefinitions } from '../styleutils';
|
|
13
|
+
import '../../theme/stylepanel.css';
|
|
14
|
+
/**
|
|
15
|
+
* A class representing a panel with available content styles. It renders styles in button grids, grouped
|
|
16
|
+
* in categories.
|
|
17
|
+
*/
|
|
18
|
+
export default class StylePanelView extends View<HTMLDivElement> {
|
|
19
|
+
/**
|
|
20
|
+
* Tracks information about DOM focus in the panel.
|
|
21
|
+
*/
|
|
22
|
+
readonly focusTracker: FocusTracker;
|
|
23
|
+
/**
|
|
24
|
+
* An instance of the {@link module:utils/keystrokehandler~KeystrokeHandler}.
|
|
25
|
+
*/
|
|
26
|
+
readonly keystrokes: KeystrokeHandler;
|
|
27
|
+
/**
|
|
28
|
+
* A collection of panel children.
|
|
29
|
+
*/
|
|
30
|
+
readonly children: ViewCollection<StyleGroupView>;
|
|
31
|
+
/**
|
|
32
|
+
* A view representing block styles group.
|
|
33
|
+
*/
|
|
34
|
+
readonly blockStylesGroupView: StyleGroupView;
|
|
35
|
+
/**
|
|
36
|
+
* A view representing inline styles group
|
|
37
|
+
*/
|
|
38
|
+
readonly inlineStylesGroupView: StyleGroupView;
|
|
39
|
+
/**
|
|
40
|
+
* Array of active style names. They must correspond to the names of styles from
|
|
41
|
+
* definitions passed to the {@link #constructor}.
|
|
42
|
+
*
|
|
43
|
+
* @observable
|
|
44
|
+
*/
|
|
45
|
+
readonly activeStyles: Array<string>;
|
|
46
|
+
/**
|
|
47
|
+
* Array of enabled style names. They must correspond to the names of styles from
|
|
48
|
+
* definitions passed to the {@link #constructor}.
|
|
49
|
+
*
|
|
50
|
+
* @observable
|
|
51
|
+
*/
|
|
52
|
+
readonly enabledStyles: Array<string>;
|
|
53
|
+
/**
|
|
54
|
+
* A collection of views that can be focused in the panel.
|
|
55
|
+
*/
|
|
56
|
+
protected readonly _focusables: ViewCollection<StyleGridView>;
|
|
57
|
+
/**
|
|
58
|
+
* Helps cycling over {@link #_focusables} in the panel.
|
|
59
|
+
*/
|
|
60
|
+
protected readonly _focusCycler: FocusCycler;
|
|
61
|
+
/**
|
|
62
|
+
* Creates an instance of the {@link module:style/ui/stylegroupview~StyleGroupView} class.
|
|
63
|
+
*
|
|
64
|
+
* @param locale The localization services instance.
|
|
65
|
+
* @param styleDefinitions Normalized definitions of the styles.
|
|
66
|
+
*/
|
|
67
|
+
constructor(locale: Locale, styleDefinitions: NormalizedStyleDefinitions);
|
|
68
|
+
/**
|
|
69
|
+
* @inheritDoc
|
|
70
|
+
*/
|
|
71
|
+
render(): void;
|
|
72
|
+
/**
|
|
73
|
+
* Focuses the first focusable element in the panel.
|
|
74
|
+
*/
|
|
75
|
+
focus(): void;
|
|
76
|
+
/**
|
|
77
|
+
* Focuses the last focusable element in the panel.
|
|
78
|
+
*/
|
|
79
|
+
focusLast(): void;
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Fired when a style was selected (clicked) by the user.
|
|
83
|
+
*
|
|
84
|
+
* @eventName ~StylePanelView#execute
|
|
85
|
+
*/
|
|
86
|
+
export type StylePanelViewExecuteEvent = {
|
|
87
|
+
name: 'execute';
|
|
88
|
+
args: [];
|
|
89
|
+
};
|
package/src/ui/stylepanelview.js
CHANGED
|
@@ -1,95 +1,95 @@
|
|
|
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/stylepanelview
|
|
7
|
-
*/
|
|
8
|
-
import { FocusCycler, View, ViewCollection } from 'ckeditor5/src/ui';
|
|
9
|
-
import { FocusTracker, KeystrokeHandler } from 'ckeditor5/src/utils';
|
|
10
|
-
import StyleGroupView from './stylegroupview';
|
|
11
|
-
import '../../theme/stylepanel.css';
|
|
12
|
-
/**
|
|
13
|
-
* A class representing a panel with available content styles. It renders styles in button grids, grouped
|
|
14
|
-
* in categories.
|
|
15
|
-
*/
|
|
16
|
-
export default class StylePanelView 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 styleDefinitions Normalized definitions of the styles.
|
|
22
|
-
*/
|
|
23
|
-
constructor(locale, styleDefinitions) {
|
|
24
|
-
super(locale);
|
|
25
|
-
const t = locale.t;
|
|
26
|
-
this.focusTracker = new FocusTracker();
|
|
27
|
-
this.keystrokes = new KeystrokeHandler();
|
|
28
|
-
this.children = this.createCollection();
|
|
29
|
-
this.blockStylesGroupView = new StyleGroupView(locale, t('Block styles'), styleDefinitions.block);
|
|
30
|
-
this.inlineStylesGroupView = new StyleGroupView(locale, t('Text styles'), styleDefinitions.inline);
|
|
31
|
-
this.set('activeStyles', []);
|
|
32
|
-
this.set('enabledStyles', []);
|
|
33
|
-
this._focusables = new ViewCollection();
|
|
34
|
-
this._focusCycler = new FocusCycler({
|
|
35
|
-
focusables: this._focusables,
|
|
36
|
-
focusTracker: this.focusTracker,
|
|
37
|
-
keystrokeHandler: this.keystrokes,
|
|
38
|
-
actions: {
|
|
39
|
-
// Navigate style groups backwards using the <kbd>Shift</kbd> + <kbd>Tab</kbd> keystroke.
|
|
40
|
-
focusPrevious: ['shift + tab'],
|
|
41
|
-
// Navigate style groups forward using the <kbd>Tab</kbd> key.
|
|
42
|
-
focusNext: ['tab']
|
|
43
|
-
}
|
|
44
|
-
});
|
|
45
|
-
if (styleDefinitions.block.length) {
|
|
46
|
-
this.children.add(this.blockStylesGroupView);
|
|
47
|
-
}
|
|
48
|
-
if (styleDefinitions.inline.length) {
|
|
49
|
-
this.children.add(this.inlineStylesGroupView);
|
|
50
|
-
}
|
|
51
|
-
this.blockStylesGroupView.gridView.delegate('execute').to(this);
|
|
52
|
-
this.inlineStylesGroupView.gridView.delegate('execute').to(this);
|
|
53
|
-
this.blockStylesGroupView.gridView
|
|
54
|
-
.bind('activeStyles', 'enabledStyles')
|
|
55
|
-
.to(this, 'activeStyles', 'enabledStyles');
|
|
56
|
-
this.inlineStylesGroupView.gridView
|
|
57
|
-
.bind('activeStyles', 'enabledStyles')
|
|
58
|
-
.to(this, 'activeStyles', 'enabledStyles');
|
|
59
|
-
this.setTemplate({
|
|
60
|
-
tag: 'div',
|
|
61
|
-
attributes: {
|
|
62
|
-
class: [
|
|
63
|
-
'ck',
|
|
64
|
-
'ck-style-panel'
|
|
65
|
-
]
|
|
66
|
-
},
|
|
67
|
-
children: this.children
|
|
68
|
-
});
|
|
69
|
-
}
|
|
70
|
-
/**
|
|
71
|
-
* @inheritDoc
|
|
72
|
-
*/
|
|
73
|
-
render() {
|
|
74
|
-
super.render();
|
|
75
|
-
// Register the views as focusable.
|
|
76
|
-
this._focusables.add(this.blockStylesGroupView.gridView);
|
|
77
|
-
this._focusables.add(this.inlineStylesGroupView.gridView);
|
|
78
|
-
// Register the views in the focus tracker.
|
|
79
|
-
this.focusTracker.add(this.blockStylesGroupView.gridView.element);
|
|
80
|
-
this.focusTracker.add(this.inlineStylesGroupView.gridView.element);
|
|
81
|
-
this.keystrokes.listenTo(this.element);
|
|
82
|
-
}
|
|
83
|
-
/**
|
|
84
|
-
* Focuses the first focusable element in the panel.
|
|
85
|
-
*/
|
|
86
|
-
focus() {
|
|
87
|
-
this._focusCycler.focusFirst();
|
|
88
|
-
}
|
|
89
|
-
/**
|
|
90
|
-
* Focuses the last focusable element in the panel.
|
|
91
|
-
*/
|
|
92
|
-
focusLast() {
|
|
93
|
-
this._focusCycler.focusLast();
|
|
94
|
-
}
|
|
95
|
-
}
|
|
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/stylepanelview
|
|
7
|
+
*/
|
|
8
|
+
import { FocusCycler, View, ViewCollection } from 'ckeditor5/src/ui';
|
|
9
|
+
import { FocusTracker, KeystrokeHandler } from 'ckeditor5/src/utils';
|
|
10
|
+
import StyleGroupView from './stylegroupview';
|
|
11
|
+
import '../../theme/stylepanel.css';
|
|
12
|
+
/**
|
|
13
|
+
* A class representing a panel with available content styles. It renders styles in button grids, grouped
|
|
14
|
+
* in categories.
|
|
15
|
+
*/
|
|
16
|
+
export default class StylePanelView 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 styleDefinitions Normalized definitions of the styles.
|
|
22
|
+
*/
|
|
23
|
+
constructor(locale, styleDefinitions) {
|
|
24
|
+
super(locale);
|
|
25
|
+
const t = locale.t;
|
|
26
|
+
this.focusTracker = new FocusTracker();
|
|
27
|
+
this.keystrokes = new KeystrokeHandler();
|
|
28
|
+
this.children = this.createCollection();
|
|
29
|
+
this.blockStylesGroupView = new StyleGroupView(locale, t('Block styles'), styleDefinitions.block);
|
|
30
|
+
this.inlineStylesGroupView = new StyleGroupView(locale, t('Text styles'), styleDefinitions.inline);
|
|
31
|
+
this.set('activeStyles', []);
|
|
32
|
+
this.set('enabledStyles', []);
|
|
33
|
+
this._focusables = new ViewCollection();
|
|
34
|
+
this._focusCycler = new FocusCycler({
|
|
35
|
+
focusables: this._focusables,
|
|
36
|
+
focusTracker: this.focusTracker,
|
|
37
|
+
keystrokeHandler: this.keystrokes,
|
|
38
|
+
actions: {
|
|
39
|
+
// Navigate style groups backwards using the <kbd>Shift</kbd> + <kbd>Tab</kbd> keystroke.
|
|
40
|
+
focusPrevious: ['shift + tab'],
|
|
41
|
+
// Navigate style groups forward using the <kbd>Tab</kbd> key.
|
|
42
|
+
focusNext: ['tab']
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
if (styleDefinitions.block.length) {
|
|
46
|
+
this.children.add(this.blockStylesGroupView);
|
|
47
|
+
}
|
|
48
|
+
if (styleDefinitions.inline.length) {
|
|
49
|
+
this.children.add(this.inlineStylesGroupView);
|
|
50
|
+
}
|
|
51
|
+
this.blockStylesGroupView.gridView.delegate('execute').to(this);
|
|
52
|
+
this.inlineStylesGroupView.gridView.delegate('execute').to(this);
|
|
53
|
+
this.blockStylesGroupView.gridView
|
|
54
|
+
.bind('activeStyles', 'enabledStyles')
|
|
55
|
+
.to(this, 'activeStyles', 'enabledStyles');
|
|
56
|
+
this.inlineStylesGroupView.gridView
|
|
57
|
+
.bind('activeStyles', 'enabledStyles')
|
|
58
|
+
.to(this, 'activeStyles', 'enabledStyles');
|
|
59
|
+
this.setTemplate({
|
|
60
|
+
tag: 'div',
|
|
61
|
+
attributes: {
|
|
62
|
+
class: [
|
|
63
|
+
'ck',
|
|
64
|
+
'ck-style-panel'
|
|
65
|
+
]
|
|
66
|
+
},
|
|
67
|
+
children: this.children
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* @inheritDoc
|
|
72
|
+
*/
|
|
73
|
+
render() {
|
|
74
|
+
super.render();
|
|
75
|
+
// Register the views as focusable.
|
|
76
|
+
this._focusables.add(this.blockStylesGroupView.gridView);
|
|
77
|
+
this._focusables.add(this.inlineStylesGroupView.gridView);
|
|
78
|
+
// Register the views in the focus tracker.
|
|
79
|
+
this.focusTracker.add(this.blockStylesGroupView.gridView.element);
|
|
80
|
+
this.focusTracker.add(this.inlineStylesGroupView.gridView.element);
|
|
81
|
+
this.keystrokes.listenTo(this.element);
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Focuses the first focusable element in the panel.
|
|
85
|
+
*/
|
|
86
|
+
focus() {
|
|
87
|
+
this._focusCycler.focusFirst();
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Focuses the last focusable element in the panel.
|
|
91
|
+
*/
|
|
92
|
+
focusLast() {
|
|
93
|
+
this._focusCycler.focusLast();
|
|
94
|
+
}
|
|
95
|
+
}
|