@ckeditor/ckeditor5-style 41.3.0 → 41.4.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/dist/index-content.css +4 -0
- package/dist/index-editor.css +25 -0
- package/dist/index.css +35 -0
- package/dist/index.css.map +1 -0
- package/dist/index.js +1213 -0
- package/dist/index.js.map +1 -0
- package/dist/translations/ar.d.ts +8 -0
- package/dist/translations/ar.js +5 -0
- package/dist/translations/bg.d.ts +8 -0
- package/dist/translations/bg.js +5 -0
- package/dist/translations/bn.d.ts +8 -0
- package/dist/translations/bn.js +5 -0
- package/dist/translations/ca.d.ts +8 -0
- package/dist/translations/ca.js +5 -0
- package/dist/translations/cs.d.ts +8 -0
- package/dist/translations/cs.js +5 -0
- package/dist/translations/da.d.ts +8 -0
- package/dist/translations/da.js +5 -0
- package/dist/translations/de.d.ts +8 -0
- package/dist/translations/de.js +5 -0
- package/dist/translations/el.d.ts +8 -0
- package/dist/translations/el.js +5 -0
- package/dist/translations/en-au.d.ts +8 -0
- package/dist/translations/en-au.js +5 -0
- package/dist/translations/en.d.ts +8 -0
- package/dist/translations/en.js +5 -0
- package/dist/translations/es.d.ts +8 -0
- package/dist/translations/es.js +5 -0
- package/dist/translations/et.d.ts +8 -0
- package/dist/translations/et.js +5 -0
- package/dist/translations/fi.d.ts +8 -0
- package/dist/translations/fi.js +5 -0
- package/dist/translations/fr.d.ts +8 -0
- package/dist/translations/fr.js +5 -0
- package/dist/translations/gl.d.ts +8 -0
- package/dist/translations/gl.js +5 -0
- package/dist/translations/he.d.ts +8 -0
- package/dist/translations/he.js +5 -0
- package/dist/translations/hi.d.ts +8 -0
- package/dist/translations/hi.js +5 -0
- package/dist/translations/hr.d.ts +8 -0
- package/dist/translations/hr.js +5 -0
- package/dist/translations/hu.d.ts +8 -0
- package/dist/translations/hu.js +5 -0
- package/dist/translations/id.d.ts +8 -0
- package/dist/translations/id.js +5 -0
- package/dist/translations/it.d.ts +8 -0
- package/dist/translations/it.js +5 -0
- package/dist/translations/ja.d.ts +8 -0
- package/dist/translations/ja.js +5 -0
- package/dist/translations/ko.d.ts +8 -0
- package/dist/translations/ko.js +5 -0
- package/dist/translations/lt.d.ts +8 -0
- package/dist/translations/lt.js +5 -0
- package/dist/translations/lv.d.ts +8 -0
- package/dist/translations/lv.js +5 -0
- package/dist/translations/ms.d.ts +8 -0
- package/dist/translations/ms.js +5 -0
- package/dist/translations/nl.d.ts +8 -0
- package/dist/translations/nl.js +5 -0
- package/dist/translations/no.d.ts +8 -0
- package/dist/translations/no.js +5 -0
- package/dist/translations/pl.d.ts +8 -0
- package/dist/translations/pl.js +5 -0
- package/dist/translations/pt-br.d.ts +8 -0
- package/dist/translations/pt-br.js +5 -0
- package/dist/translations/pt.d.ts +8 -0
- package/dist/translations/pt.js +5 -0
- package/dist/translations/ro.d.ts +8 -0
- package/dist/translations/ro.js +5 -0
- package/dist/translations/ru.d.ts +8 -0
- package/dist/translations/ru.js +5 -0
- package/dist/translations/sk.d.ts +8 -0
- package/dist/translations/sk.js +5 -0
- package/dist/translations/sr-latn.d.ts +8 -0
- package/dist/translations/sr-latn.js +5 -0
- package/dist/translations/sr.d.ts +8 -0
- package/dist/translations/sr.js +5 -0
- package/dist/translations/sv.d.ts +8 -0
- package/dist/translations/sv.js +5 -0
- package/dist/translations/th.d.ts +8 -0
- package/dist/translations/th.js +5 -0
- package/dist/translations/tr.d.ts +8 -0
- package/dist/translations/tr.js +5 -0
- package/dist/translations/ug.d.ts +8 -0
- package/dist/translations/ug.js +5 -0
- package/dist/translations/uk.d.ts +8 -0
- package/dist/translations/uk.js +5 -0
- package/dist/translations/ur.d.ts +8 -0
- package/dist/translations/ur.js +5 -0
- package/dist/translations/vi.d.ts +8 -0
- package/dist/translations/vi.js +5 -0
- package/dist/translations/zh-cn.d.ts +8 -0
- package/dist/translations/zh-cn.js +5 -0
- package/dist/translations/zh.d.ts +8 -0
- package/dist/translations/zh.js +5 -0
- package/dist/types/augmentation.d.ts +28 -0
- package/dist/types/index.d.ts +18 -0
- package/dist/types/integrations/link.d.ts +41 -0
- package/dist/types/integrations/list.d.ts +46 -0
- package/dist/types/integrations/table.d.ts +53 -0
- package/dist/types/style.d.ts +30 -0
- package/dist/types/stylecommand.d.ts +86 -0
- package/dist/types/styleconfig.d.ts +91 -0
- package/dist/types/styleediting.d.ts +37 -0
- package/dist/types/styleui.d.ts +34 -0
- package/dist/types/styleutils.d.ts +142 -0
- package/dist/types/ui/stylegridbuttonview.d.ts +38 -0
- package/dist/types/ui/stylegridview.d.ts +76 -0
- package/dist/types/ui/stylegroupview.d.ts +39 -0
- package/dist/types/ui/stylepanelview.d.ts +93 -0
- package/package.json +3 -2
|
@@ -0,0 +1,142 @@
|
|
|
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 style/styleutils
|
|
11
|
+
*/
|
|
12
|
+
import { Plugin, type Editor } from 'ckeditor5/src/core.js';
|
|
13
|
+
import type { Element, DocumentSelection, Selectable } from 'ckeditor5/src/engine.js';
|
|
14
|
+
import type { DecoratedMethodEvent } from 'ckeditor5/src/utils.js';
|
|
15
|
+
import type { TemplateDefinition } from 'ckeditor5/src/ui.js';
|
|
16
|
+
import type { DataSchema } from '@ckeditor/ckeditor5-html-support';
|
|
17
|
+
import type { StyleDefinition } from './styleconfig.js';
|
|
18
|
+
export default class StyleUtils extends Plugin {
|
|
19
|
+
private _htmlSupport;
|
|
20
|
+
/**
|
|
21
|
+
* @inheritDoc
|
|
22
|
+
*/
|
|
23
|
+
static get pluginName(): "StyleUtils";
|
|
24
|
+
/**
|
|
25
|
+
* @inheritDoc
|
|
26
|
+
*/
|
|
27
|
+
constructor(editor: Editor);
|
|
28
|
+
/**
|
|
29
|
+
* @inheritDoc
|
|
30
|
+
*/
|
|
31
|
+
init(): void;
|
|
32
|
+
/**
|
|
33
|
+
* Normalizes {@link module:style/styleconfig~StyleConfig#definitions} in the configuration of the styles feature.
|
|
34
|
+
* The structure of normalized styles looks as follows:
|
|
35
|
+
*
|
|
36
|
+
* ```ts
|
|
37
|
+
* {
|
|
38
|
+
* block: [
|
|
39
|
+
* <module:style/style~StyleDefinition>,
|
|
40
|
+
* <module:style/style~StyleDefinition>,
|
|
41
|
+
* ...
|
|
42
|
+
* ],
|
|
43
|
+
* inline: [
|
|
44
|
+
* <module:style/style~StyleDefinition>,
|
|
45
|
+
* <module:style/style~StyleDefinition>,
|
|
46
|
+
* ...
|
|
47
|
+
* ]
|
|
48
|
+
* }
|
|
49
|
+
* ```
|
|
50
|
+
*
|
|
51
|
+
* @returns An object with normalized style definitions grouped into `block` and `inline` categories (arrays).
|
|
52
|
+
*/
|
|
53
|
+
normalizeConfig(dataSchema: DataSchema, styleDefinitions?: Array<StyleDefinition>): NormalizedStyleDefinitions;
|
|
54
|
+
/**
|
|
55
|
+
* Verifies if the given style is applicable to the provided block element.
|
|
56
|
+
*
|
|
57
|
+
* @internal
|
|
58
|
+
*/
|
|
59
|
+
isStyleEnabledForBlock(definition: BlockStyleDefinition, block: Element): boolean;
|
|
60
|
+
/**
|
|
61
|
+
* Returns true if the given style is applied to the specified block element.
|
|
62
|
+
*
|
|
63
|
+
* @internal
|
|
64
|
+
*/
|
|
65
|
+
isStyleActiveForBlock(definition: BlockStyleDefinition, block: Element): boolean;
|
|
66
|
+
/**
|
|
67
|
+
* Returns an array of block elements that style should be applied to.
|
|
68
|
+
*
|
|
69
|
+
* @internal
|
|
70
|
+
*/
|
|
71
|
+
getAffectedBlocks(definition: BlockStyleDefinition, block: Element): Array<Element> | null;
|
|
72
|
+
/**
|
|
73
|
+
* Verifies if the given style is applicable to the provided document selection.
|
|
74
|
+
*
|
|
75
|
+
* @internal
|
|
76
|
+
*/
|
|
77
|
+
isStyleEnabledForInlineSelection(definition: InlineStyleDefinition, selection: DocumentSelection): boolean;
|
|
78
|
+
/**
|
|
79
|
+
* Returns true if the given style is applied to the specified document selection.
|
|
80
|
+
*
|
|
81
|
+
* @internal
|
|
82
|
+
*/
|
|
83
|
+
isStyleActiveForInlineSelection(definition: InlineStyleDefinition, selection: DocumentSelection): boolean;
|
|
84
|
+
/**
|
|
85
|
+
* Returns a selectable that given style should be applied to.
|
|
86
|
+
*
|
|
87
|
+
* @internal
|
|
88
|
+
*/
|
|
89
|
+
getAffectedInlineSelectable(definition: InlineStyleDefinition, selection: DocumentSelection): Selectable;
|
|
90
|
+
/**
|
|
91
|
+
* Returns the `TemplateDefinition` used by styles dropdown to render style preview.
|
|
92
|
+
*
|
|
93
|
+
* @internal
|
|
94
|
+
*/
|
|
95
|
+
getStylePreview(definition: StyleDefinition, children: Iterable<TemplateDefinition>): TemplateDefinition;
|
|
96
|
+
/**
|
|
97
|
+
* Verifies if all classes are present in the given GHS attribute.
|
|
98
|
+
*
|
|
99
|
+
* @internal
|
|
100
|
+
*/
|
|
101
|
+
hasAllClasses(ghsAttributeValue: unknown, classes: Array<string>): boolean;
|
|
102
|
+
/**
|
|
103
|
+
* This is where the styles feature configures the GHS feature. This method translates normalized
|
|
104
|
+
* {@link module:style/styleconfig~StyleDefinition style definitions} to
|
|
105
|
+
* {@link module:engine/view/matcher~MatcherObjectPattern matcher patterns} and feeds them to the GHS
|
|
106
|
+
* {@link module:html-support/datafilter~DataFilter} plugin.
|
|
107
|
+
*
|
|
108
|
+
* @internal
|
|
109
|
+
*/
|
|
110
|
+
configureGHSDataFilter({ block, inline }: NormalizedStyleDefinitions): void;
|
|
111
|
+
/**
|
|
112
|
+
* Checks the attribute value of the first node in the selection that allows the attribute.
|
|
113
|
+
* For the collapsed selection, returns the selection attribute.
|
|
114
|
+
*
|
|
115
|
+
* @param selection The document selection.
|
|
116
|
+
* @param attributeName Name of the GHS attribute.
|
|
117
|
+
* @returns The attribute value.
|
|
118
|
+
*/
|
|
119
|
+
private _getValueFromFirstAllowedNode;
|
|
120
|
+
}
|
|
121
|
+
export interface NormalizedStyleDefinitions {
|
|
122
|
+
block: Array<BlockStyleDefinition>;
|
|
123
|
+
inline: Array<InlineStyleDefinition>;
|
|
124
|
+
}
|
|
125
|
+
export interface BlockStyleDefinition extends StyleDefinition {
|
|
126
|
+
isBlock: true;
|
|
127
|
+
modelElements: Array<string>;
|
|
128
|
+
previewTemplate: TemplateDefinition;
|
|
129
|
+
}
|
|
130
|
+
export interface InlineStyleDefinition extends StyleDefinition {
|
|
131
|
+
ghsAttributes: Array<string>;
|
|
132
|
+
previewTemplate: TemplateDefinition;
|
|
133
|
+
}
|
|
134
|
+
export type NormalizedStyleDefinition = BlockStyleDefinition | InlineStyleDefinition;
|
|
135
|
+
export type StyleUtilsIsEnabledForBlockEvent = DecoratedMethodEvent<StyleUtils, 'isStyleEnabledForBlock'>;
|
|
136
|
+
export type StyleUtilsIsActiveForBlockEvent = DecoratedMethodEvent<StyleUtils, 'isStyleActiveForBlock'>;
|
|
137
|
+
export type StyleUtilsGetAffectedBlocksEvent = DecoratedMethodEvent<StyleUtils, 'getAffectedBlocks'>;
|
|
138
|
+
export type StyleUtilsIsStyleEnabledForInlineSelectionEvent = DecoratedMethodEvent<StyleUtils, 'isStyleEnabledForInlineSelection'>;
|
|
139
|
+
export type StyleUtilsIsStyleActiveForInlineSelectionEvent = DecoratedMethodEvent<StyleUtils, 'isStyleActiveForInlineSelection'>;
|
|
140
|
+
export type StyleUtilsGetAffectedInlineSelectableEvent = DecoratedMethodEvent<StyleUtils, 'getAffectedInlineSelectable'>;
|
|
141
|
+
export type StyleUtilsGetStylePreviewEvent = DecoratedMethodEvent<StyleUtils, 'getStylePreview'>;
|
|
142
|
+
export type StyleUtilsConfigureGHSDataFilterEvent = DecoratedMethodEvent<StyleUtils, 'configureGHSDataFilter'>;
|
|
@@ -0,0 +1,38 @@
|
|
|
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 style/ui/stylegridbuttonview
|
|
11
|
+
*/
|
|
12
|
+
import type { Locale } from 'ckeditor5/src/utils.js';
|
|
13
|
+
import { ButtonView, View } from 'ckeditor5/src/ui.js';
|
|
14
|
+
import type { NormalizedStyleDefinition } from '../styleutils.js';
|
|
15
|
+
/**
|
|
16
|
+
* A class representing an individual button (style) in the grid. Renders a rich preview of the style.
|
|
17
|
+
*/
|
|
18
|
+
export default class StyleGridButtonView extends ButtonView {
|
|
19
|
+
/**
|
|
20
|
+
* Definition of the style the button will apply when executed.
|
|
21
|
+
*/
|
|
22
|
+
readonly styleDefinition: NormalizedStyleDefinition;
|
|
23
|
+
/**
|
|
24
|
+
* The view rendering the preview of the style.
|
|
25
|
+
*/
|
|
26
|
+
readonly previewView: View;
|
|
27
|
+
/**
|
|
28
|
+
* Creates an instance of the {@link module:style/ui/stylegridbuttonview~StyleGridButtonView} class.
|
|
29
|
+
*
|
|
30
|
+
* @param locale The localization services instance.
|
|
31
|
+
* @param styleDefinition Definition of the style.
|
|
32
|
+
*/
|
|
33
|
+
constructor(locale: Locale, styleDefinition: NormalizedStyleDefinition);
|
|
34
|
+
/**
|
|
35
|
+
* Creates the view representing the preview of the style.
|
|
36
|
+
*/
|
|
37
|
+
private _createPreview;
|
|
38
|
+
}
|
|
@@ -0,0 +1,76 @@
|
|
|
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 style/ui/stylegridview
|
|
11
|
+
*/
|
|
12
|
+
import { View, type ViewCollection, type FocusableView } from 'ckeditor5/src/ui.js';
|
|
13
|
+
import { FocusTracker, KeystrokeHandler, type Locale } from 'ckeditor5/src/utils.js';
|
|
14
|
+
import StyleGridButtonView from './stylegridbuttonview.js';
|
|
15
|
+
import type { NormalizedStyleDefinition } from '../styleutils.js';
|
|
16
|
+
import '../../theme/stylegrid.css';
|
|
17
|
+
/**
|
|
18
|
+
* A class representing a grid of styles ({@link module:style/ui/stylegridbuttonview~StyleGridButtonView buttons}).
|
|
19
|
+
* Allows users to select a style.
|
|
20
|
+
*/
|
|
21
|
+
export default class StyleGridView extends View<HTMLDivElement> implements FocusableView {
|
|
22
|
+
/**
|
|
23
|
+
* Tracks information about the DOM focus in the view.
|
|
24
|
+
*/
|
|
25
|
+
readonly focusTracker: FocusTracker;
|
|
26
|
+
/**
|
|
27
|
+
* An instance of the {@link module:utils/keystrokehandler~KeystrokeHandler}.
|
|
28
|
+
*/
|
|
29
|
+
readonly keystrokes: KeystrokeHandler;
|
|
30
|
+
/**
|
|
31
|
+
* A collection of style {@link module:style/ui/stylegridbuttonview~StyleGridButtonView buttons}.
|
|
32
|
+
*/
|
|
33
|
+
readonly children: ViewCollection<StyleGridButtonView>;
|
|
34
|
+
/**
|
|
35
|
+
* Array of active style names. They must correspond to the names of styles from
|
|
36
|
+
* definitions passed to the {@link #constructor}.
|
|
37
|
+
*
|
|
38
|
+
* @observable
|
|
39
|
+
*/
|
|
40
|
+
readonly activeStyles: Array<string>;
|
|
41
|
+
/**
|
|
42
|
+
* Array of enabled style names. They must correspond to the names of styles from
|
|
43
|
+
* definitions passed to the {@link #constructor}.
|
|
44
|
+
*
|
|
45
|
+
* @observable
|
|
46
|
+
*/
|
|
47
|
+
readonly enabledStyles: Array<string>;
|
|
48
|
+
/**
|
|
49
|
+
* Creates an instance of the {@link module:style/ui/stylegridview~StyleGridView} class.
|
|
50
|
+
*
|
|
51
|
+
* @param locale The localization services instance.
|
|
52
|
+
* @param styleDefinitions Definitions of the styles.
|
|
53
|
+
*/
|
|
54
|
+
constructor(locale: Locale, styleDefinitions: Array<NormalizedStyleDefinition>);
|
|
55
|
+
/**
|
|
56
|
+
* @inheritDoc
|
|
57
|
+
*/
|
|
58
|
+
render(): void;
|
|
59
|
+
/**
|
|
60
|
+
* Focuses the first style button in the grid.
|
|
61
|
+
*/
|
|
62
|
+
focus(): void;
|
|
63
|
+
/**
|
|
64
|
+
* @inheritDoc
|
|
65
|
+
*/
|
|
66
|
+
destroy(): void;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Fired when a {@link module:style/ui/stylegridbuttonview~StyleGridButtonView style} was selected (clicked) by the user.
|
|
70
|
+
*
|
|
71
|
+
* @eventName ~StyleGridView#execute
|
|
72
|
+
*/
|
|
73
|
+
export type StyleGridViewExecuteEvent = {
|
|
74
|
+
name: 'execute';
|
|
75
|
+
args: [];
|
|
76
|
+
};
|
|
@@ -0,0 +1,39 @@
|
|
|
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 style/ui/stylegroupview
|
|
11
|
+
*/
|
|
12
|
+
import { LabelView, View } from 'ckeditor5/src/ui.js';
|
|
13
|
+
import type { Locale } from 'ckeditor5/src/utils.js';
|
|
14
|
+
import StyleGridView from './stylegridview.js';
|
|
15
|
+
import type { NormalizedStyleDefinition } from '../styleutils.js';
|
|
16
|
+
import '../../theme/stylegroup.css';
|
|
17
|
+
/**
|
|
18
|
+
* A class representing a group of styles (e.g. "block" or "inline").
|
|
19
|
+
*
|
|
20
|
+
* Renders a {@link module:style/ui/stylegridview~StyleGridView style grid} and a label.
|
|
21
|
+
*/
|
|
22
|
+
export default class StyleGroupView extends View<HTMLDivElement> {
|
|
23
|
+
/**
|
|
24
|
+
* The styles grid of the group.
|
|
25
|
+
*/
|
|
26
|
+
readonly gridView: StyleGridView;
|
|
27
|
+
/**
|
|
28
|
+
* The label of the group.
|
|
29
|
+
*/
|
|
30
|
+
readonly labelView: LabelView;
|
|
31
|
+
/**
|
|
32
|
+
* Creates an instance of the {@link module:style/ui/stylegroupview~StyleGroupView} class.
|
|
33
|
+
*
|
|
34
|
+
* @param locale The localization services instance.
|
|
35
|
+
* @param label The localized label of the group.
|
|
36
|
+
* @param styleDefinitions Definitions of the styles in the group.
|
|
37
|
+
*/
|
|
38
|
+
constructor(locale: Locale, label: string, styleDefinitions: Array<NormalizedStyleDefinition>);
|
|
39
|
+
}
|
|
@@ -0,0 +1,93 @@
|
|
|
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 style/ui/stylepanelview
|
|
11
|
+
*/
|
|
12
|
+
import { FocusCycler, View, ViewCollection } from 'ckeditor5/src/ui.js';
|
|
13
|
+
import { FocusTracker, KeystrokeHandler, type Locale } from 'ckeditor5/src/utils.js';
|
|
14
|
+
import StyleGroupView from './stylegroupview.js';
|
|
15
|
+
import type StyleGridView from './stylegridview.js';
|
|
16
|
+
import type { NormalizedStyleDefinitions } from '../styleutils.js';
|
|
17
|
+
import '../../theme/stylepanel.css';
|
|
18
|
+
/**
|
|
19
|
+
* A class representing a panel with available content styles. It renders styles in button grids, grouped
|
|
20
|
+
* in categories.
|
|
21
|
+
*/
|
|
22
|
+
export default class StylePanelView extends View<HTMLDivElement> {
|
|
23
|
+
/**
|
|
24
|
+
* Tracks information about DOM focus in the panel.
|
|
25
|
+
*/
|
|
26
|
+
readonly focusTracker: FocusTracker;
|
|
27
|
+
/**
|
|
28
|
+
* An instance of the {@link module:utils/keystrokehandler~KeystrokeHandler}.
|
|
29
|
+
*/
|
|
30
|
+
readonly keystrokes: KeystrokeHandler;
|
|
31
|
+
/**
|
|
32
|
+
* A collection of panel children.
|
|
33
|
+
*/
|
|
34
|
+
readonly children: ViewCollection<StyleGroupView>;
|
|
35
|
+
/**
|
|
36
|
+
* A view representing block styles group.
|
|
37
|
+
*/
|
|
38
|
+
readonly blockStylesGroupView: StyleGroupView;
|
|
39
|
+
/**
|
|
40
|
+
* A view representing inline styles group
|
|
41
|
+
*/
|
|
42
|
+
readonly inlineStylesGroupView: StyleGroupView;
|
|
43
|
+
/**
|
|
44
|
+
* Array of active style names. They must correspond to the names of styles from
|
|
45
|
+
* definitions passed to the {@link #constructor}.
|
|
46
|
+
*
|
|
47
|
+
* @observable
|
|
48
|
+
*/
|
|
49
|
+
readonly activeStyles: Array<string>;
|
|
50
|
+
/**
|
|
51
|
+
* Array of enabled style names. They must correspond to the names of styles from
|
|
52
|
+
* definitions passed to the {@link #constructor}.
|
|
53
|
+
*
|
|
54
|
+
* @observable
|
|
55
|
+
*/
|
|
56
|
+
readonly enabledStyles: Array<string>;
|
|
57
|
+
/**
|
|
58
|
+
* A collection of views that can be focused in the panel.
|
|
59
|
+
*/
|
|
60
|
+
protected readonly _focusables: ViewCollection<StyleGridView>;
|
|
61
|
+
/**
|
|
62
|
+
* Helps cycling over {@link #_focusables} in the panel.
|
|
63
|
+
*/
|
|
64
|
+
protected readonly _focusCycler: FocusCycler;
|
|
65
|
+
/**
|
|
66
|
+
* Creates an instance of the {@link module:style/ui/stylegroupview~StyleGroupView} class.
|
|
67
|
+
*
|
|
68
|
+
* @param locale The localization services instance.
|
|
69
|
+
* @param styleDefinitions Normalized definitions of the styles.
|
|
70
|
+
*/
|
|
71
|
+
constructor(locale: Locale, styleDefinitions: NormalizedStyleDefinitions);
|
|
72
|
+
/**
|
|
73
|
+
* @inheritDoc
|
|
74
|
+
*/
|
|
75
|
+
render(): void;
|
|
76
|
+
/**
|
|
77
|
+
* Focuses the first focusable element in the panel.
|
|
78
|
+
*/
|
|
79
|
+
focus(): void;
|
|
80
|
+
/**
|
|
81
|
+
* Focuses the last focusable element in the panel.
|
|
82
|
+
*/
|
|
83
|
+
focusLast(): void;
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Fired when a style was selected (clicked) by the user.
|
|
87
|
+
*
|
|
88
|
+
* @eventName ~StylePanelView#execute
|
|
89
|
+
*/
|
|
90
|
+
export type StylePanelViewExecuteEvent = {
|
|
91
|
+
name: 'execute';
|
|
92
|
+
args: [];
|
|
93
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ckeditor/ckeditor5-style",
|
|
3
|
-
"version": "41.
|
|
3
|
+
"version": "41.4.0-alpha.0",
|
|
4
4
|
"description": "Style feature for CKEditor 5.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ckeditor",
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
"type": "module",
|
|
14
14
|
"main": "src/index.js",
|
|
15
15
|
"dependencies": {
|
|
16
|
-
"ckeditor5": "41.
|
|
16
|
+
"ckeditor5": "41.4.0-alpha.0",
|
|
17
17
|
"lodash-es": "4.17.21"
|
|
18
18
|
},
|
|
19
19
|
"author": "CKSource (http://cksource.com/)",
|
|
@@ -26,6 +26,7 @@
|
|
|
26
26
|
"directory": "packages/ckeditor5-style"
|
|
27
27
|
},
|
|
28
28
|
"files": [
|
|
29
|
+
"dist",
|
|
29
30
|
"lang",
|
|
30
31
|
"src/**/*.js",
|
|
31
32
|
"src/**/*.d.ts",
|