@ckeditor/ckeditor5-style 41.3.0-alpha.4 → 41.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/style.js +1 -1
- package/package.json +2 -3
- package/src/integrations/list.js +2 -1
- package/dist/content-index.css +0 -4
- package/dist/editor-index.css +0 -25
- package/dist/index.css +0 -35
- package/dist/index.css.map +0 -1
- package/dist/translations/ar.d.ts +0 -8
- package/dist/translations/ar.js +0 -5
- package/dist/translations/bg.d.ts +0 -8
- package/dist/translations/bg.js +0 -5
- package/dist/translations/bn.d.ts +0 -8
- package/dist/translations/bn.js +0 -5
- package/dist/translations/ca.d.ts +0 -8
- package/dist/translations/ca.js +0 -5
- package/dist/translations/cs.d.ts +0 -8
- package/dist/translations/cs.js +0 -5
- package/dist/translations/da.d.ts +0 -8
- package/dist/translations/da.js +0 -5
- package/dist/translations/de.d.ts +0 -8
- package/dist/translations/de.js +0 -5
- package/dist/translations/el.d.ts +0 -8
- package/dist/translations/el.js +0 -5
- package/dist/translations/en-au.d.ts +0 -8
- package/dist/translations/en-au.js +0 -5
- package/dist/translations/en.d.ts +0 -8
- package/dist/translations/en.js +0 -5
- package/dist/translations/es.d.ts +0 -8
- package/dist/translations/es.js +0 -5
- package/dist/translations/et.d.ts +0 -8
- package/dist/translations/et.js +0 -5
- package/dist/translations/fi.d.ts +0 -8
- package/dist/translations/fi.js +0 -5
- package/dist/translations/fr.d.ts +0 -8
- package/dist/translations/fr.js +0 -5
- package/dist/translations/gl.d.ts +0 -8
- package/dist/translations/gl.js +0 -5
- package/dist/translations/he.d.ts +0 -8
- package/dist/translations/he.js +0 -5
- package/dist/translations/hi.d.ts +0 -8
- package/dist/translations/hi.js +0 -5
- package/dist/translations/hr.d.ts +0 -8
- package/dist/translations/hr.js +0 -5
- package/dist/translations/hu.d.ts +0 -8
- package/dist/translations/hu.js +0 -5
- package/dist/translations/id.d.ts +0 -8
- package/dist/translations/id.js +0 -5
- package/dist/translations/it.d.ts +0 -8
- package/dist/translations/it.js +0 -5
- package/dist/translations/ja.d.ts +0 -8
- package/dist/translations/ja.js +0 -5
- package/dist/translations/ko.d.ts +0 -8
- package/dist/translations/ko.js +0 -5
- package/dist/translations/lt.d.ts +0 -8
- package/dist/translations/lt.js +0 -5
- package/dist/translations/lv.d.ts +0 -8
- package/dist/translations/lv.js +0 -5
- package/dist/translations/ms.d.ts +0 -8
- package/dist/translations/ms.js +0 -5
- package/dist/translations/nl.d.ts +0 -8
- package/dist/translations/nl.js +0 -5
- package/dist/translations/no.d.ts +0 -8
- package/dist/translations/no.js +0 -5
- package/dist/translations/pl.d.ts +0 -8
- package/dist/translations/pl.js +0 -5
- package/dist/translations/pt-br.d.ts +0 -8
- package/dist/translations/pt-br.js +0 -5
- package/dist/translations/pt.d.ts +0 -8
- package/dist/translations/pt.js +0 -5
- package/dist/translations/ro.d.ts +0 -8
- package/dist/translations/ro.js +0 -5
- package/dist/translations/ru.d.ts +0 -8
- package/dist/translations/ru.js +0 -5
- package/dist/translations/sk.d.ts +0 -8
- package/dist/translations/sk.js +0 -5
- package/dist/translations/sr-latn.d.ts +0 -8
- package/dist/translations/sr-latn.js +0 -5
- package/dist/translations/sr.d.ts +0 -8
- package/dist/translations/sr.js +0 -5
- package/dist/translations/sv.d.ts +0 -8
- package/dist/translations/sv.js +0 -5
- package/dist/translations/th.d.ts +0 -8
- package/dist/translations/th.js +0 -5
- package/dist/translations/tr.d.ts +0 -8
- package/dist/translations/tr.js +0 -5
- package/dist/translations/ug.d.ts +0 -8
- package/dist/translations/ug.js +0 -5
- package/dist/translations/uk.d.ts +0 -8
- package/dist/translations/uk.js +0 -5
- package/dist/translations/ur.d.ts +0 -8
- package/dist/translations/ur.js +0 -5
- package/dist/translations/vi.d.ts +0 -8
- package/dist/translations/vi.js +0 -5
- package/dist/translations/zh-cn.d.ts +0 -8
- package/dist/translations/zh-cn.js +0 -5
- package/dist/translations/zh.d.ts +0 -8
- package/dist/translations/zh.js +0 -5
- package/dist/types/augmentation.d.ts +0 -28
- package/dist/types/index.d.ts +0 -18
- package/dist/types/integrations/link.d.ts +0 -41
- package/dist/types/integrations/list.d.ts +0 -46
- package/dist/types/integrations/table.d.ts +0 -53
- package/dist/types/style.d.ts +0 -30
- package/dist/types/stylecommand.d.ts +0 -86
- package/dist/types/styleconfig.d.ts +0 -91
- package/dist/types/styleediting.d.ts +0 -37
- package/dist/types/styleui.d.ts +0 -34
- package/dist/types/styleutils.d.ts +0 -142
- package/dist/types/ui/stylegridbuttonview.d.ts +0 -38
- package/dist/types/ui/stylegridview.d.ts +0 -76
- package/dist/types/ui/stylegroupview.d.ts +0 -39
- package/dist/types/ui/stylepanelview.d.ts +0 -93
package/dist/types/style.d.ts
DELETED
|
@@ -1,30 +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 style/style
|
|
11
|
-
*/
|
|
12
|
-
import { Plugin } from 'ckeditor5/src/core.js';
|
|
13
|
-
import StyleUI from './styleui.js';
|
|
14
|
-
import StyleEditing from './styleediting.js';
|
|
15
|
-
/**
|
|
16
|
-
* The style plugin.
|
|
17
|
-
*
|
|
18
|
-
* This is a "glue" plugin that loads the {@link module:style/styleediting~StyleEditing style editing feature}
|
|
19
|
-
* and {@link module:style/styleui~StyleUI style UI feature}.
|
|
20
|
-
*/
|
|
21
|
-
export default class Style extends Plugin {
|
|
22
|
-
/**
|
|
23
|
-
* @inheritDoc
|
|
24
|
-
*/
|
|
25
|
-
static get pluginName(): "Style";
|
|
26
|
-
/**
|
|
27
|
-
* @inheritDoc
|
|
28
|
-
*/
|
|
29
|
-
static get requires(): readonly [typeof StyleEditing, typeof StyleUI];
|
|
30
|
-
}
|
|
@@ -1,86 +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
|
-
import { Command, type Editor } from 'ckeditor5/src/core.js';
|
|
10
|
-
import { type NormalizedStyleDefinitions } from './styleutils.js';
|
|
11
|
-
/**
|
|
12
|
-
* Style command.
|
|
13
|
-
*
|
|
14
|
-
* Applies and removes styles from selection and elements.
|
|
15
|
-
*/
|
|
16
|
-
export default class StyleCommand extends Command {
|
|
17
|
-
/**
|
|
18
|
-
* Set of currently applied styles on the current selection.
|
|
19
|
-
*
|
|
20
|
-
* Names of styles correspond to the `name` property of
|
|
21
|
-
* {@link module:style/styleconfig~StyleDefinition configured definitions}.
|
|
22
|
-
*
|
|
23
|
-
* @observable
|
|
24
|
-
*/
|
|
25
|
-
value: Array<string>;
|
|
26
|
-
/**
|
|
27
|
-
* Names of enabled styles (styles that can be applied to the current selection).
|
|
28
|
-
*
|
|
29
|
-
* Names of enabled styles correspond to the `name` property of
|
|
30
|
-
* {@link module:style/styleconfig~StyleDefinition configured definitions}.
|
|
31
|
-
*
|
|
32
|
-
* @observable
|
|
33
|
-
*/
|
|
34
|
-
enabledStyles: Array<string>;
|
|
35
|
-
/**
|
|
36
|
-
* Normalized definitions of the styles.
|
|
37
|
-
*/
|
|
38
|
-
private readonly _styleDefinitions;
|
|
39
|
-
/**
|
|
40
|
-
* The StyleUtils plugin.
|
|
41
|
-
*/
|
|
42
|
-
private _styleUtils;
|
|
43
|
-
/**
|
|
44
|
-
* Creates an instance of the command.
|
|
45
|
-
*
|
|
46
|
-
* @param editor Editor on which this command will be used.
|
|
47
|
-
* @param styleDefinitions Normalized definitions of the styles.
|
|
48
|
-
*/
|
|
49
|
-
constructor(editor: Editor, styleDefinitions: NormalizedStyleDefinitions);
|
|
50
|
-
/**
|
|
51
|
-
* @inheritDoc
|
|
52
|
-
*/
|
|
53
|
-
refresh(): void;
|
|
54
|
-
/**
|
|
55
|
-
* Executes the command – applies the style classes to the selection or removes it from the selection.
|
|
56
|
-
*
|
|
57
|
-
* If the command value already contains the requested style, it will remove the style classes. Otherwise, it will set it.
|
|
58
|
-
*
|
|
59
|
-
* The execution result differs, depending on the {@link module:engine/model/document~Document#selection} and the
|
|
60
|
-
* style type (inline or block):
|
|
61
|
-
*
|
|
62
|
-
* * When applying inline styles:
|
|
63
|
-
* * If the selection is on a range, the command applies the style classes to all nodes in that range.
|
|
64
|
-
* * If the selection is collapsed in a non-empty node, the command applies the style classes to the
|
|
65
|
-
* {@link module:engine/model/document~Document#selection}.
|
|
66
|
-
*
|
|
67
|
-
* * When applying block styles:
|
|
68
|
-
* * If the selection is on a range, the command applies the style classes to the nearest block parent element.
|
|
69
|
-
*
|
|
70
|
-
* @fires execute
|
|
71
|
-
* @param options Command options.
|
|
72
|
-
* @param options.styleName Style name matching the one defined in the
|
|
73
|
-
* {@link module:style/styleconfig~StyleConfig#definitions configuration}.
|
|
74
|
-
* @param options.forceValue Whether the command should add given style (`true`) or remove it (`false`) from the selection.
|
|
75
|
-
* If not set (default), the command will toggle the style basing on the first selected node. Note, that this will not force
|
|
76
|
-
* setting a style on an element that cannot receive given style.
|
|
77
|
-
*/
|
|
78
|
-
execute({ styleName, forceValue }: {
|
|
79
|
-
styleName: string;
|
|
80
|
-
forceValue?: boolean;
|
|
81
|
-
}): void;
|
|
82
|
-
/**
|
|
83
|
-
* Returns a set of elements that should be affected by the block-style change.
|
|
84
|
-
*/
|
|
85
|
-
private _findAffectedBlocks;
|
|
86
|
-
}
|
|
@@ -1,91 +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 style/styleconfig
|
|
11
|
-
*/
|
|
12
|
-
/**
|
|
13
|
-
* The configuration of the style feature.
|
|
14
|
-
*
|
|
15
|
-
* ```ts
|
|
16
|
-
* ClassicEditor
|
|
17
|
-
* .create( {
|
|
18
|
-
* style: ... // Style feature config.
|
|
19
|
-
* } )
|
|
20
|
-
* .then( ... )
|
|
21
|
-
* .catch( ... );
|
|
22
|
-
* ```
|
|
23
|
-
*
|
|
24
|
-
* See {@link module:core/editor/editorconfig~EditorConfig all editor options}.
|
|
25
|
-
*/
|
|
26
|
-
export interface StyleConfig {
|
|
27
|
-
/**
|
|
28
|
-
* The available style definitions.
|
|
29
|
-
*
|
|
30
|
-
* Style definitions are displayed in the `'style'` UI dropdown and get applied by the
|
|
31
|
-
* {@link module:style/stylecommand~StyleCommand style command} to the content of the document.
|
|
32
|
-
*
|
|
33
|
-
* In the `'style'` UI dropdown, definitions are automatically grouped into two categories based on the of the `element` property:
|
|
34
|
-
*
|
|
35
|
-
* * **Block styles**: Can be applied to entire {@link module:html-support/dataschema~DataSchema#registerBlockElement block elements}
|
|
36
|
-
* only (e.g. headings, paragraphs, divs).
|
|
37
|
-
* * **Text styles**: Can by applied to any {@link module:html-support/dataschema~DataSchema#registerInlineElement text} in any element
|
|
38
|
-
* in the document.
|
|
39
|
-
*
|
|
40
|
-
* An example configuration:
|
|
41
|
-
*
|
|
42
|
-
* ```ts
|
|
43
|
-
* [
|
|
44
|
-
* // Definitions of block styles.
|
|
45
|
-
* {
|
|
46
|
-
* name: 'Red heading',
|
|
47
|
-
* element: 'h2',
|
|
48
|
-
* classes: [ 'red-heading' ]
|
|
49
|
-
* },
|
|
50
|
-
* {
|
|
51
|
-
* name: 'Vibrant code',
|
|
52
|
-
* element: 'pre',
|
|
53
|
-
* classes: [ 'vibrant-code' ]
|
|
54
|
-
* },
|
|
55
|
-
*
|
|
56
|
-
* // Definitions of text (inline) styles.
|
|
57
|
-
* {
|
|
58
|
-
* name: 'Marker',
|
|
59
|
-
* element: 'span',
|
|
60
|
-
* classes: [ 'marker' ]
|
|
61
|
-
* },
|
|
62
|
-
*
|
|
63
|
-
* // ...
|
|
64
|
-
* ]
|
|
65
|
-
* ```
|
|
66
|
-
*
|
|
67
|
-
* **Note**: Configuring style definitions will automatically configure the
|
|
68
|
-
* {@glink features/html/general-html-support General HTML Support feature}. **You do not need to repeat the configuration in
|
|
69
|
-
* {@link module:html-support/generalhtmlsupportconfig~GeneralHtmlSupportConfig}**.
|
|
70
|
-
*/
|
|
71
|
-
definitions?: Array<StyleDefinition>;
|
|
72
|
-
}
|
|
73
|
-
/**
|
|
74
|
-
* Style definition.
|
|
75
|
-
*
|
|
76
|
-
* An object describing a style definition. It contains the style `name`, `element` name and an array of CSS `classes`.
|
|
77
|
-
*
|
|
78
|
-
* ```ts
|
|
79
|
-
* // This style will create <h2 class="foo">...</h2> in the document data.
|
|
80
|
-
* {
|
|
81
|
-
* name: 'Example style',
|
|
82
|
-
* element: 'h2',
|
|
83
|
-
* classes: [ 'foo' ]
|
|
84
|
-
* }
|
|
85
|
-
* ```
|
|
86
|
-
*/
|
|
87
|
-
export interface StyleDefinition {
|
|
88
|
-
name: string;
|
|
89
|
-
element: string;
|
|
90
|
-
classes: Array<string>;
|
|
91
|
-
}
|
|
@@ -1,37 +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 style/styleediting
|
|
11
|
-
*/
|
|
12
|
-
import { Plugin } from 'ckeditor5/src/core.js';
|
|
13
|
-
import StyleUtils from './styleutils.js';
|
|
14
|
-
import ListStyleSupport from './integrations/list.js';
|
|
15
|
-
import TableStyleSupport from './integrations/table.js';
|
|
16
|
-
import LinkStyleSupport from './integrations/link.js';
|
|
17
|
-
/**
|
|
18
|
-
* The style engine feature.
|
|
19
|
-
*
|
|
20
|
-
* It configures the {@glink features/html/general-html-support General HTML Support feature} based on
|
|
21
|
-
* {@link module:style/styleconfig~StyleConfig#definitions configured style definitions} and introduces the
|
|
22
|
-
* {@link module:style/stylecommand~StyleCommand style command} that applies styles to the content of the document.
|
|
23
|
-
*/
|
|
24
|
-
export default class StyleEditing extends Plugin {
|
|
25
|
-
/**
|
|
26
|
-
* @inheritDoc
|
|
27
|
-
*/
|
|
28
|
-
static get pluginName(): "StyleEditing";
|
|
29
|
-
/**
|
|
30
|
-
* @inheritDoc
|
|
31
|
-
*/
|
|
32
|
-
static get requires(): readonly ["GeneralHtmlSupport", typeof StyleUtils, typeof ListStyleSupport, typeof TableStyleSupport, typeof LinkStyleSupport];
|
|
33
|
-
/**
|
|
34
|
-
* @inheritDoc
|
|
35
|
-
*/
|
|
36
|
-
init(): void;
|
|
37
|
-
}
|
package/dist/types/styleui.d.ts
DELETED
|
@@ -1,34 +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 style/styleui
|
|
11
|
-
*/
|
|
12
|
-
import { Plugin } from 'ckeditor5/src/core.js';
|
|
13
|
-
import StyleUtils from './styleutils.js';
|
|
14
|
-
import '../theme/style.css';
|
|
15
|
-
/**
|
|
16
|
-
* The UI plugin of the style feature .
|
|
17
|
-
*
|
|
18
|
-
* It registers the `'style'` UI dropdown in the editor's {@link module:ui/componentfactory~ComponentFactory component factory}
|
|
19
|
-
* that displays a grid of styles and allows changing styles of the content.
|
|
20
|
-
*/
|
|
21
|
-
export default class StyleUI extends Plugin {
|
|
22
|
-
/**
|
|
23
|
-
* @inheritDoc
|
|
24
|
-
*/
|
|
25
|
-
static get pluginName(): "StyleUI";
|
|
26
|
-
/**
|
|
27
|
-
* @inheritDoc
|
|
28
|
-
*/
|
|
29
|
-
static get requires(): readonly [typeof StyleUtils];
|
|
30
|
-
/**
|
|
31
|
-
* @inheritDoc
|
|
32
|
-
*/
|
|
33
|
-
init(): void;
|
|
34
|
-
}
|
|
@@ -1,142 +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 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'>;
|
|
@@ -1,38 +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 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
|
-
}
|
|
@@ -1,76 +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 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
|
-
};
|
|
@@ -1,39 +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 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
|
-
}
|
|
@@ -1,93 +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 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
|
-
};
|