@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.
Files changed (79) hide show
  1. package/LICENSE.md +1 -1
  2. package/README.md +4 -4
  3. package/build/style.js.map +1 -0
  4. package/lang/translations/ar.po +1 -0
  5. package/lang/translations/bg.po +1 -0
  6. package/lang/translations/bn.po +1 -0
  7. package/lang/translations/ca.po +1 -0
  8. package/lang/translations/cs.po +1 -0
  9. package/lang/translations/da.po +1 -0
  10. package/lang/translations/de.po +1 -0
  11. package/lang/translations/el.po +1 -0
  12. package/lang/translations/en-au.po +1 -0
  13. package/lang/translations/en.po +1 -0
  14. package/lang/translations/es.po +1 -0
  15. package/lang/translations/et.po +1 -0
  16. package/lang/translations/fi.po +1 -0
  17. package/lang/translations/fr.po +1 -0
  18. package/lang/translations/gl.po +1 -0
  19. package/lang/translations/he.po +1 -0
  20. package/lang/translations/hi.po +1 -0
  21. package/lang/translations/hr.po +1 -0
  22. package/lang/translations/hu.po +1 -0
  23. package/lang/translations/id.po +1 -0
  24. package/lang/translations/it.po +1 -0
  25. package/lang/translations/ja.po +1 -0
  26. package/lang/translations/ko.po +1 -0
  27. package/lang/translations/lt.po +1 -0
  28. package/lang/translations/lv.po +1 -0
  29. package/lang/translations/ms.po +1 -0
  30. package/lang/translations/nl.po +1 -0
  31. package/lang/translations/no.po +1 -0
  32. package/lang/translations/pl.po +1 -0
  33. package/lang/translations/pt-br.po +1 -0
  34. package/lang/translations/pt.po +1 -0
  35. package/lang/translations/ro.po +1 -0
  36. package/lang/translations/ru.po +1 -0
  37. package/lang/translations/sk.po +1 -0
  38. package/lang/translations/sr-latn.po +1 -0
  39. package/lang/translations/sr.po +1 -0
  40. package/lang/translations/sv.po +1 -0
  41. package/lang/translations/th.po +1 -0
  42. package/lang/translations/tr.po +1 -0
  43. package/lang/translations/ug.po +1 -0
  44. package/lang/translations/uk.po +1 -0
  45. package/lang/translations/ur.po +1 -0
  46. package/lang/translations/vi.po +1 -0
  47. package/lang/translations/zh-cn.po +1 -0
  48. package/lang/translations/zh.po +1 -0
  49. package/package.json +2 -6
  50. package/src/augmentation.d.ts +24 -24
  51. package/src/augmentation.js +5 -5
  52. package/src/index.d.ts +14 -14
  53. package/src/index.js +12 -12
  54. package/src/integrations/documentlist.d.ts +42 -42
  55. package/src/integrations/documentlist.js +141 -141
  56. package/src/integrations/link.d.ts +37 -37
  57. package/src/integrations/link.js +156 -156
  58. package/src/integrations/table.d.ts +49 -49
  59. package/src/integrations/table.js +115 -115
  60. package/src/style.d.ts +26 -26
  61. package/src/style.js +30 -30
  62. package/src/stylecommand.d.ts +82 -82
  63. package/src/stylecommand.js +200 -200
  64. package/src/styleconfig.d.ts +87 -87
  65. package/src/styleconfig.js +5 -5
  66. package/src/styleediting.d.ts +33 -33
  67. package/src/styleediting.js +46 -46
  68. package/src/styleui.d.ts +30 -30
  69. package/src/styleui.js +94 -94
  70. package/src/styleutils.d.ts +138 -138
  71. package/src/styleutils.js +268 -268
  72. package/src/ui/stylegridbuttonview.d.ts +34 -34
  73. package/src/ui/stylegridbuttonview.js +55 -55
  74. package/src/ui/stylegridview.d.ts +72 -72
  75. package/src/ui/stylegridview.js +89 -89
  76. package/src/ui/stylegroupview.d.ts +35 -35
  77. package/src/ui/stylegroupview.js +45 -45
  78. package/src/ui/stylepanelview.d.ts +89 -89
  79. package/src/ui/stylepanelview.js +95 -95
@@ -15,6 +15,7 @@ msgstr ""
15
15
  "Language-Team: Ukrainian (https://app.transifex.com/ckeditor/teams/11143/uk/)\n"
16
16
  "Language: uk\n"
17
17
  "Plural-Forms: nplurals=4; plural=(n % 1 == 0 && n % 10 == 1 && n % 100 != 11 ? 0 : n % 1 == 0 && n % 10 >= 2 && n % 10 <= 4 && (n % 100 < 12 || n % 100 > 14) ? 1 : n % 1 == 0 && (n % 10 ==0 || (n % 10 >=5 && n % 10 <=9) || (n % 100 >=11 && n % 100 <=14 )) ? 2: 3);\n"
18
+ "Content-Type: text/plain; charset=UTF-8\n"
18
19
 
19
20
  msgctxt "The label of the styles dropdown button in the toolbar displayed when no style is currently active."
20
21
  msgid "Styles"
@@ -15,6 +15,7 @@ msgstr ""
15
15
  "Language-Team: Urdu (https://app.transifex.com/ckeditor/teams/11143/ur/)\n"
16
16
  "Language: ur\n"
17
17
  "Plural-Forms: nplurals=2; plural=(n != 1);\n"
18
+ "Content-Type: text/plain; charset=UTF-8\n"
18
19
 
19
20
  msgctxt "The label of the styles dropdown button in the toolbar displayed when no style is currently active."
20
21
  msgid "Styles"
@@ -15,6 +15,7 @@ msgstr ""
15
15
  "Language-Team: Vietnamese (https://app.transifex.com/ckeditor/teams/11143/vi/)\n"
16
16
  "Language: vi\n"
17
17
  "Plural-Forms: nplurals=1; plural=0;\n"
18
+ "Content-Type: text/plain; charset=UTF-8\n"
18
19
 
19
20
  msgctxt "The label of the styles dropdown button in the toolbar displayed when no style is currently active."
20
21
  msgid "Styles"
@@ -15,6 +15,7 @@ msgstr ""
15
15
  "Language-Team: Chinese (China) (https://app.transifex.com/ckeditor/teams/11143/zh_CN/)\n"
16
16
  "Language: zh_CN\n"
17
17
  "Plural-Forms: nplurals=1; plural=0;\n"
18
+ "Content-Type: text/plain; charset=UTF-8\n"
18
19
 
19
20
  msgctxt "The label of the styles dropdown button in the toolbar displayed when no style is currently active."
20
21
  msgid "Styles"
@@ -15,6 +15,7 @@ msgstr ""
15
15
  "Language-Team: Chinese (Taiwan) (https://app.transifex.com/ckeditor/teams/11143/zh_TW/)\n"
16
16
  "Language: zh_TW\n"
17
17
  "Plural-Forms: nplurals=1; plural=0;\n"
18
+ "Content-Type: text/plain; charset=UTF-8\n"
18
19
 
19
20
  msgctxt "The label of the styles dropdown button in the toolbar displayed when no style is currently active."
20
21
  msgid "Styles"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ckeditor/ckeditor5-style",
3
- "version": "39.0.1",
3
+ "version": "40.0.0",
4
4
  "description": "Style feature for CKEditor 5.",
5
5
  "keywords": [
6
6
  "ckeditor",
@@ -12,13 +12,9 @@
12
12
  ],
13
13
  "main": "src/index.js",
14
14
  "dependencies": {
15
- "ckeditor5": "39.0.1",
15
+ "ckeditor5": "40.0.0",
16
16
  "lodash-es": "4.17.21"
17
17
  },
18
- "engines": {
19
- "node": ">=16.0.0",
20
- "npm": ">=5.7.1"
21
- },
22
18
  "author": "CKSource (http://cksource.com/)",
23
19
  "license": "GPL-2.0-or-later",
24
20
  "homepage": "https://ckeditor.com/ckeditor-5",
@@ -1,24 +1,24 @@
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 type { StyleConfig, StyleCommand, Style, StyleEditing, StyleUI, StyleUtils } from './index';
6
- declare module '@ckeditor/ckeditor5-core' {
7
- interface PluginsMap {
8
- [Style.pluginName]: Style;
9
- [StyleEditing.pluginName]: StyleEditing;
10
- [StyleUI.pluginName]: StyleUI;
11
- [StyleUtils.pluginName]: StyleUtils;
12
- }
13
- interface CommandsMap {
14
- style: StyleCommand;
15
- }
16
- interface EditorConfig {
17
- /**
18
- * The configuration of the {@link module:style/style~Style} feature.
19
- *
20
- * Read more in {@link module:style/styleconfig~StyleConfig}.
21
- */
22
- style?: StyleConfig;
23
- }
24
- }
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 type { StyleConfig, StyleCommand, Style, StyleEditing, StyleUI, StyleUtils } from './index';
6
+ declare module '@ckeditor/ckeditor5-core' {
7
+ interface PluginsMap {
8
+ [Style.pluginName]: Style;
9
+ [StyleEditing.pluginName]: StyleEditing;
10
+ [StyleUI.pluginName]: StyleUI;
11
+ [StyleUtils.pluginName]: StyleUtils;
12
+ }
13
+ interface CommandsMap {
14
+ style: StyleCommand;
15
+ }
16
+ interface EditorConfig {
17
+ /**
18
+ * The configuration of the {@link module:style/style~Style} feature.
19
+ *
20
+ * Read more in {@link module:style/styleconfig~StyleConfig}.
21
+ */
22
+ style?: StyleConfig;
23
+ }
24
+ }
@@ -1,5 +1,5 @@
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
- export {};
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
+ export {};
package/src/index.d.ts CHANGED
@@ -1,14 +1,14 @@
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
7
- */
8
- export { default as Style } from './style';
9
- export { default as StyleEditing } from './styleediting';
10
- export { default as StyleUI } from './styleui';
11
- export { default as StyleUtils } from './styleutils';
12
- export type { StyleConfig, StyleDefinition } from './styleconfig';
13
- export type { default as StyleCommand } from './stylecommand';
14
- import './augmentation';
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
7
+ */
8
+ export { default as Style } from './style';
9
+ export { default as StyleEditing } from './styleediting';
10
+ export { default as StyleUI } from './styleui';
11
+ export { default as StyleUtils } from './styleutils';
12
+ export type { StyleConfig, StyleDefinition } from './styleconfig';
13
+ export type { default as StyleCommand } from './stylecommand';
14
+ import './augmentation';
package/src/index.js CHANGED
@@ -1,12 +1,12 @@
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
7
- */
8
- export { default as Style } from './style';
9
- export { default as StyleEditing } from './styleediting';
10
- export { default as StyleUI } from './styleui';
11
- export { default as StyleUtils } from './styleutils';
12
- import './augmentation';
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
7
+ */
8
+ export { default as Style } from './style';
9
+ export { default as StyleEditing } from './styleediting';
10
+ export { default as StyleUI } from './styleui';
11
+ export { default as StyleUtils } from './styleutils';
12
+ import './augmentation';
@@ -1,42 +1,42 @@
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/integrations/documentlist
7
- */
8
- import { Plugin } from 'ckeditor5/src/core';
9
- import StyleUtils from '../styleutils';
10
- export default class DocumentListStyleSupport extends Plugin {
11
- private _documentListUtils;
12
- private _styleUtils;
13
- private _htmlSupport;
14
- /**
15
- * @inheritDoc
16
- */
17
- static get pluginName(): "DocumentListStyleSupport";
18
- /**
19
- * @inheritDoc
20
- */
21
- static get requires(): readonly [typeof StyleUtils, "GeneralHtmlSupport"];
22
- /**
23
- * @inheritDoc
24
- */
25
- init(): void;
26
- /**
27
- * Verifies if the given style is applicable to the provided block element.
28
- */
29
- private _isStyleEnabledForBlock;
30
- /**
31
- * Returns true if the given style is applied to the specified block element.
32
- */
33
- private _isStyleActiveForBlock;
34
- /**
35
- * Returns an array of block elements that style should be applied to.
36
- */
37
- private _getAffectedBlocks;
38
- /**
39
- * Returns a view template definition for the style preview.
40
- */
41
- private _getStylePreview;
42
- }
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/integrations/documentlist
7
+ */
8
+ import { Plugin } from 'ckeditor5/src/core';
9
+ import StyleUtils from '../styleutils';
10
+ export default class DocumentListStyleSupport extends Plugin {
11
+ private _documentListUtils;
12
+ private _styleUtils;
13
+ private _htmlSupport;
14
+ /**
15
+ * @inheritDoc
16
+ */
17
+ static get pluginName(): "DocumentListStyleSupport";
18
+ /**
19
+ * @inheritDoc
20
+ */
21
+ static get requires(): readonly [typeof StyleUtils, "GeneralHtmlSupport"];
22
+ /**
23
+ * @inheritDoc
24
+ */
25
+ init(): void;
26
+ /**
27
+ * Verifies if the given style is applicable to the provided block element.
28
+ */
29
+ private _isStyleEnabledForBlock;
30
+ /**
31
+ * Returns true if the given style is applied to the specified block element.
32
+ */
33
+ private _isStyleActiveForBlock;
34
+ /**
35
+ * Returns an array of block elements that style should be applied to.
36
+ */
37
+ private _getAffectedBlocks;
38
+ /**
39
+ * Returns a view template definition for the style preview.
40
+ */
41
+ private _getStylePreview;
42
+ }
@@ -1,141 +1,141 @@
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/integrations/documentlist
7
- */
8
- import { Plugin } from 'ckeditor5/src/core';
9
- import StyleUtils from '../styleutils';
10
- export default class DocumentListStyleSupport extends Plugin {
11
- /**
12
- * @inheritDoc
13
- */
14
- static get pluginName() {
15
- return 'DocumentListStyleSupport';
16
- }
17
- /**
18
- * @inheritDoc
19
- */
20
- static get requires() {
21
- return [StyleUtils, 'GeneralHtmlSupport'];
22
- }
23
- /**
24
- * @inheritDoc
25
- */
26
- init() {
27
- const editor = this.editor;
28
- if (!editor.plugins.has('DocumentListEditing')) {
29
- return;
30
- }
31
- this._styleUtils = editor.plugins.get(StyleUtils);
32
- this._documentListUtils = this.editor.plugins.get('DocumentListUtils');
33
- this._htmlSupport = this.editor.plugins.get('GeneralHtmlSupport');
34
- this.listenTo(this._styleUtils, 'isStyleEnabledForBlock', (evt, [definition, block]) => {
35
- if (this._isStyleEnabledForBlock(definition, block)) {
36
- evt.return = true;
37
- evt.stop();
38
- }
39
- }, { priority: 'high' });
40
- this.listenTo(this._styleUtils, 'isStyleActiveForBlock', (evt, [definition, block]) => {
41
- if (this._isStyleActiveForBlock(definition, block)) {
42
- evt.return = true;
43
- evt.stop();
44
- }
45
- }, { priority: 'high' });
46
- this.listenTo(this._styleUtils, 'getAffectedBlocks', (evt, [definition, block]) => {
47
- const blocks = this._getAffectedBlocks(definition, block);
48
- if (blocks) {
49
- evt.return = blocks;
50
- evt.stop();
51
- }
52
- }, { priority: 'high' });
53
- this.listenTo(this._styleUtils, 'getStylePreview', (evt, [definition, children]) => {
54
- const templateDefinition = this._getStylePreview(definition, children);
55
- if (templateDefinition) {
56
- evt.return = templateDefinition;
57
- evt.stop();
58
- }
59
- }, { priority: 'high' });
60
- }
61
- /**
62
- * Verifies if the given style is applicable to the provided block element.
63
- */
64
- _isStyleEnabledForBlock(definition, block) {
65
- const model = this.editor.model;
66
- if (!['ol', 'ul', 'li'].includes(definition.element)) {
67
- return false;
68
- }
69
- if (!this._documentListUtils.isListItemBlock(block)) {
70
- return false;
71
- }
72
- const attributeName = this._htmlSupport.getGhsAttributeNameForElement(definition.element);
73
- if (definition.element == 'ol' || definition.element == 'ul') {
74
- if (!model.schema.checkAttribute(block, attributeName)) {
75
- return false;
76
- }
77
- const viewElementName = block.getAttribute('listType') == 'numbered' ? 'ol' : 'ul';
78
- return definition.element == viewElementName;
79
- }
80
- else {
81
- return model.schema.checkAttribute(block, attributeName);
82
- }
83
- }
84
- /**
85
- * Returns true if the given style is applied to the specified block element.
86
- */
87
- _isStyleActiveForBlock(definition, block) {
88
- const attributeName = this._htmlSupport.getGhsAttributeNameForElement(definition.element);
89
- const ghsAttributeValue = block.getAttribute(attributeName);
90
- return this._styleUtils.hasAllClasses(ghsAttributeValue, definition.classes);
91
- }
92
- /**
93
- * Returns an array of block elements that style should be applied to.
94
- */
95
- _getAffectedBlocks(definition, block) {
96
- if (!this._isStyleEnabledForBlock(definition, block)) {
97
- return null;
98
- }
99
- if (definition.element == 'li') {
100
- return this._documentListUtils.expandListBlocksToCompleteItems(block, { withNested: false });
101
- }
102
- else {
103
- return this._documentListUtils.expandListBlocksToCompleteList(block);
104
- }
105
- }
106
- /**
107
- * Returns a view template definition for the style preview.
108
- */
109
- _getStylePreview(definition, children) {
110
- const { element, classes } = definition;
111
- if (element == 'ol' || element == 'ul') {
112
- return {
113
- tag: element,
114
- attributes: {
115
- class: classes
116
- },
117
- children: [
118
- {
119
- tag: 'li',
120
- children
121
- }
122
- ]
123
- };
124
- }
125
- else if (element == 'li') {
126
- return {
127
- tag: 'ol',
128
- children: [
129
- {
130
- tag: element,
131
- attributes: {
132
- class: classes
133
- },
134
- children
135
- }
136
- ]
137
- };
138
- }
139
- return null;
140
- }
141
- }
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/integrations/documentlist
7
+ */
8
+ import { Plugin } from 'ckeditor5/src/core';
9
+ import StyleUtils from '../styleutils';
10
+ export default class DocumentListStyleSupport extends Plugin {
11
+ /**
12
+ * @inheritDoc
13
+ */
14
+ static get pluginName() {
15
+ return 'DocumentListStyleSupport';
16
+ }
17
+ /**
18
+ * @inheritDoc
19
+ */
20
+ static get requires() {
21
+ return [StyleUtils, 'GeneralHtmlSupport'];
22
+ }
23
+ /**
24
+ * @inheritDoc
25
+ */
26
+ init() {
27
+ const editor = this.editor;
28
+ if (!editor.plugins.has('DocumentListEditing')) {
29
+ return;
30
+ }
31
+ this._styleUtils = editor.plugins.get(StyleUtils);
32
+ this._documentListUtils = this.editor.plugins.get('DocumentListUtils');
33
+ this._htmlSupport = this.editor.plugins.get('GeneralHtmlSupport');
34
+ this.listenTo(this._styleUtils, 'isStyleEnabledForBlock', (evt, [definition, block]) => {
35
+ if (this._isStyleEnabledForBlock(definition, block)) {
36
+ evt.return = true;
37
+ evt.stop();
38
+ }
39
+ }, { priority: 'high' });
40
+ this.listenTo(this._styleUtils, 'isStyleActiveForBlock', (evt, [definition, block]) => {
41
+ if (this._isStyleActiveForBlock(definition, block)) {
42
+ evt.return = true;
43
+ evt.stop();
44
+ }
45
+ }, { priority: 'high' });
46
+ this.listenTo(this._styleUtils, 'getAffectedBlocks', (evt, [definition, block]) => {
47
+ const blocks = this._getAffectedBlocks(definition, block);
48
+ if (blocks) {
49
+ evt.return = blocks;
50
+ evt.stop();
51
+ }
52
+ }, { priority: 'high' });
53
+ this.listenTo(this._styleUtils, 'getStylePreview', (evt, [definition, children]) => {
54
+ const templateDefinition = this._getStylePreview(definition, children);
55
+ if (templateDefinition) {
56
+ evt.return = templateDefinition;
57
+ evt.stop();
58
+ }
59
+ }, { priority: 'high' });
60
+ }
61
+ /**
62
+ * Verifies if the given style is applicable to the provided block element.
63
+ */
64
+ _isStyleEnabledForBlock(definition, block) {
65
+ const model = this.editor.model;
66
+ if (!['ol', 'ul', 'li'].includes(definition.element)) {
67
+ return false;
68
+ }
69
+ if (!this._documentListUtils.isListItemBlock(block)) {
70
+ return false;
71
+ }
72
+ const attributeName = this._htmlSupport.getGhsAttributeNameForElement(definition.element);
73
+ if (definition.element == 'ol' || definition.element == 'ul') {
74
+ if (!model.schema.checkAttribute(block, attributeName)) {
75
+ return false;
76
+ }
77
+ const viewElementName = block.getAttribute('listType') == 'numbered' ? 'ol' : 'ul';
78
+ return definition.element == viewElementName;
79
+ }
80
+ else {
81
+ return model.schema.checkAttribute(block, attributeName);
82
+ }
83
+ }
84
+ /**
85
+ * Returns true if the given style is applied to the specified block element.
86
+ */
87
+ _isStyleActiveForBlock(definition, block) {
88
+ const attributeName = this._htmlSupport.getGhsAttributeNameForElement(definition.element);
89
+ const ghsAttributeValue = block.getAttribute(attributeName);
90
+ return this._styleUtils.hasAllClasses(ghsAttributeValue, definition.classes);
91
+ }
92
+ /**
93
+ * Returns an array of block elements that style should be applied to.
94
+ */
95
+ _getAffectedBlocks(definition, block) {
96
+ if (!this._isStyleEnabledForBlock(definition, block)) {
97
+ return null;
98
+ }
99
+ if (definition.element == 'li') {
100
+ return this._documentListUtils.expandListBlocksToCompleteItems(block, { withNested: false });
101
+ }
102
+ else {
103
+ return this._documentListUtils.expandListBlocksToCompleteList(block);
104
+ }
105
+ }
106
+ /**
107
+ * Returns a view template definition for the style preview.
108
+ */
109
+ _getStylePreview(definition, children) {
110
+ const { element, classes } = definition;
111
+ if (element == 'ol' || element == 'ul') {
112
+ return {
113
+ tag: element,
114
+ attributes: {
115
+ class: classes
116
+ },
117
+ children: [
118
+ {
119
+ tag: 'li',
120
+ children
121
+ }
122
+ ]
123
+ };
124
+ }
125
+ else if (element == 'li') {
126
+ return {
127
+ tag: 'ol',
128
+ children: [
129
+ {
130
+ tag: element,
131
+ attributes: {
132
+ class: classes
133
+ },
134
+ children
135
+ }
136
+ ]
137
+ };
138
+ }
139
+ return null;
140
+ }
141
+ }
@@ -1,37 +1,37 @@
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/integrations/link
7
- */
8
- import { Plugin } from 'ckeditor5/src/core';
9
- import StyleUtils from '../styleutils';
10
- export default class LinkStyleSupport extends Plugin {
11
- private _styleUtils;
12
- private _htmlSupport;
13
- /**
14
- * @inheritDoc
15
- */
16
- static get pluginName(): "LinkStyleSupport";
17
- /**
18
- * @inheritDoc
19
- */
20
- static get requires(): readonly [typeof StyleUtils, "GeneralHtmlSupport"];
21
- /**
22
- * @inheritDoc
23
- */
24
- init(): void;
25
- /**
26
- * Verifies if the given style is applicable to the provided document selection.
27
- */
28
- private _isStyleEnabled;
29
- /**
30
- * Returns true if the given style is applied to the specified document selection.
31
- */
32
- private _isStyleActive;
33
- /**
34
- * Returns a selectable that given style should be applied to.
35
- */
36
- private _getAffectedSelectable;
37
- }
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/integrations/link
7
+ */
8
+ import { Plugin } from 'ckeditor5/src/core';
9
+ import StyleUtils from '../styleutils';
10
+ export default class LinkStyleSupport extends Plugin {
11
+ private _styleUtils;
12
+ private _htmlSupport;
13
+ /**
14
+ * @inheritDoc
15
+ */
16
+ static get pluginName(): "LinkStyleSupport";
17
+ /**
18
+ * @inheritDoc
19
+ */
20
+ static get requires(): readonly [typeof StyleUtils, "GeneralHtmlSupport"];
21
+ /**
22
+ * @inheritDoc
23
+ */
24
+ init(): void;
25
+ /**
26
+ * Verifies if the given style is applicable to the provided document selection.
27
+ */
28
+ private _isStyleEnabled;
29
+ /**
30
+ * Returns true if the given style is applied to the specified document selection.
31
+ */
32
+ private _isStyleActive;
33
+ /**
34
+ * Returns a selectable that given style should be applied to.
35
+ */
36
+ private _getAffectedSelectable;
37
+ }