@ckeditor/ckeditor5-html-support 48.2.0-alpha.7 → 48.3.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/augmentation.d.ts +33 -33
- package/dist/converters.d.ts +42 -42
- package/dist/datafilter.d.ts +300 -300
- package/dist/dataschema.d.ts +177 -177
- package/dist/emptyblock.d.ts +56 -56
- package/dist/fullpage.d.ts +52 -52
- package/dist/generalhtmlsupport.d.ts +103 -103
- package/dist/generalhtmlsupportconfig.d.ts +199 -199
- package/dist/htmlcomment.d.ts +68 -68
- package/dist/htmlpagedataprocessor.d.ts +17 -17
- package/dist/index.css.map +1 -1
- package/dist/index.d.ts +30 -30
- package/dist/index.js +3833 -4524
- package/dist/index.js.map +1 -1
- package/dist/integrations/codeblock.d.ts +23 -23
- package/dist/integrations/customelement.d.ts +26 -26
- package/dist/integrations/dualcontent.d.ts +46 -46
- package/dist/integrations/heading.d.ts +30 -30
- package/dist/integrations/horizontalline.d.ts +25 -25
- package/dist/integrations/iframe.d.ts +27 -27
- package/dist/integrations/image.d.ts +25 -25
- package/dist/integrations/integrationutils.d.ts +11 -11
- package/dist/integrations/list.d.ts +27 -27
- package/dist/integrations/mediaembed.d.ts +25 -25
- package/dist/integrations/script.d.ts +25 -25
- package/dist/integrations/style.d.ts +25 -25
- package/dist/integrations/table.d.ts +23 -23
- package/dist/schemadefinitions.d.ts +52 -52
- package/dist/utils.d.ts +54 -54
- package/package.json +12 -12
|
@@ -1,108 +1,108 @@
|
|
|
1
1
|
/**
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
|
4
|
+
*/
|
|
5
5
|
/**
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
import { Plugin } from
|
|
9
|
-
import { type ArrayOrItem } from
|
|
10
|
-
import { DataFilter } from
|
|
11
|
-
import { CodeBlockElementSupport } from
|
|
12
|
-
import { DualContentModelElementSupport } from
|
|
13
|
-
import { HeadingElementSupport } from
|
|
14
|
-
import { ImageElementSupport } from
|
|
15
|
-
import { MediaEmbedElementSupport } from
|
|
16
|
-
import { ScriptElementSupport } from
|
|
17
|
-
import { TableElementSupport } from
|
|
18
|
-
import { StyleElementSupport } from
|
|
19
|
-
import { ListElementSupport } from
|
|
20
|
-
import { HorizontalLineElementSupport } from
|
|
21
|
-
import { IframeElementSupport } from
|
|
22
|
-
import { CustomElementSupport } from
|
|
23
|
-
import type { ModelSelectable } from
|
|
6
|
+
* @module html-support/generalhtmlsupport
|
|
7
|
+
*/
|
|
8
|
+
import { Plugin, type PluginDependenciesOf } from "@ckeditor/ckeditor5-core";
|
|
9
|
+
import { type ArrayOrItem } from "@ckeditor/ckeditor5-utils";
|
|
10
|
+
import { DataFilter } from "./datafilter.js";
|
|
11
|
+
import { CodeBlockElementSupport } from "./integrations/codeblock.js";
|
|
12
|
+
import { DualContentModelElementSupport } from "./integrations/dualcontent.js";
|
|
13
|
+
import { HeadingElementSupport } from "./integrations/heading.js";
|
|
14
|
+
import { ImageElementSupport } from "./integrations/image.js";
|
|
15
|
+
import { MediaEmbedElementSupport } from "./integrations/mediaembed.js";
|
|
16
|
+
import { ScriptElementSupport } from "./integrations/script.js";
|
|
17
|
+
import { TableElementSupport } from "./integrations/table.js";
|
|
18
|
+
import { StyleElementSupport } from "./integrations/style.js";
|
|
19
|
+
import { ListElementSupport } from "./integrations/list.js";
|
|
20
|
+
import { HorizontalLineElementSupport } from "./integrations/horizontalline.js";
|
|
21
|
+
import { IframeElementSupport } from "./integrations/iframe.js";
|
|
22
|
+
import { CustomElementSupport } from "./integrations/customelement.js";
|
|
23
|
+
import type { ModelSelectable } from "@ckeditor/ckeditor5-engine";
|
|
24
24
|
/**
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
25
|
+
* The General HTML Support feature.
|
|
26
|
+
*
|
|
27
|
+
* This is a "glue" plugin which initializes the {@link module:html-support/datafilter~DataFilter data filter} configuration
|
|
28
|
+
* and features integration with the General HTML Support.
|
|
29
|
+
*/
|
|
30
30
|
export declare class GeneralHtmlSupport extends Plugin {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
31
|
+
/**
|
|
32
|
+
* @inheritDoc
|
|
33
|
+
*/
|
|
34
|
+
static get pluginName(): "GeneralHtmlSupport";
|
|
35
|
+
/**
|
|
36
|
+
* @inheritDoc
|
|
37
|
+
*/
|
|
38
|
+
static override get isOfficialPlugin(): true;
|
|
39
|
+
/**
|
|
40
|
+
* @inheritDoc
|
|
41
|
+
*/
|
|
42
|
+
static get requires(): PluginDependenciesOf<[DataFilter, CodeBlockElementSupport, DualContentModelElementSupport, HeadingElementSupport, ImageElementSupport, MediaEmbedElementSupport, ScriptElementSupport, TableElementSupport, StyleElementSupport, ListElementSupport, HorizontalLineElementSupport, IframeElementSupport, CustomElementSupport]>;
|
|
43
|
+
/**
|
|
44
|
+
* @inheritDoc
|
|
45
|
+
*/
|
|
46
|
+
init(): void;
|
|
47
|
+
/**
|
|
48
|
+
* @inheritDoc
|
|
49
|
+
*/
|
|
50
|
+
afterInit(): void;
|
|
51
|
+
/**
|
|
52
|
+
* Returns a GHS model attribute name related to a given view element name.
|
|
53
|
+
*
|
|
54
|
+
* @internal
|
|
55
|
+
* @param viewElementName A view element name.
|
|
56
|
+
*/
|
|
57
|
+
getGhsAttributeNameForElement(viewElementName: string): string;
|
|
58
|
+
/**
|
|
59
|
+
* Updates GHS model attribute for a specified view element name, so it includes the given class name.
|
|
60
|
+
*
|
|
61
|
+
* @internal
|
|
62
|
+
* @param viewElementName A view element name.
|
|
63
|
+
* @param className The css class to add.
|
|
64
|
+
* @param selectable The selection or element to update.
|
|
65
|
+
*/
|
|
66
|
+
addModelHtmlClass(viewElementName: string, className: ArrayOrItem<string>, selectable: ModelSelectable): void;
|
|
67
|
+
/**
|
|
68
|
+
* Updates GHS model attribute for a specified view element name, so it does not include the given class name.
|
|
69
|
+
*
|
|
70
|
+
* @internal
|
|
71
|
+
* @param viewElementName A view element name.
|
|
72
|
+
* @param className The css class to remove.
|
|
73
|
+
* @param selectable The selection or element to update.
|
|
74
|
+
*/
|
|
75
|
+
removeModelHtmlClass(viewElementName: string, className: ArrayOrItem<string>, selectable: ModelSelectable): void;
|
|
76
|
+
/**
|
|
77
|
+
* Updates GHS model attribute for a specified view element name, so it includes the given attribute.
|
|
78
|
+
*
|
|
79
|
+
* @param viewElementName A view element name.
|
|
80
|
+
* @param attributes The object with attributes to set.
|
|
81
|
+
* @param selectable The selection or element to update.
|
|
82
|
+
*/
|
|
83
|
+
private setModelHtmlAttributes;
|
|
84
|
+
/**
|
|
85
|
+
* Updates GHS model attribute for a specified view element name, so it does not include the given attribute.
|
|
86
|
+
*
|
|
87
|
+
* @param viewElementName A view element name.
|
|
88
|
+
* @param attributeName The attribute name (or names) to remove.
|
|
89
|
+
* @param selectable The selection or element to update.
|
|
90
|
+
*/
|
|
91
|
+
private removeModelHtmlAttributes;
|
|
92
|
+
/**
|
|
93
|
+
* Updates GHS model attribute for a specified view element name, so it includes a given style.
|
|
94
|
+
*
|
|
95
|
+
* @param viewElementName A view element name.
|
|
96
|
+
* @param styles The object with styles to set.
|
|
97
|
+
* @param selectable The selection or element to update.
|
|
98
|
+
*/
|
|
99
|
+
private setModelHtmlStyles;
|
|
100
|
+
/**
|
|
101
|
+
* Updates GHS model attribute for a specified view element name, so it does not include a given style.
|
|
102
|
+
*
|
|
103
|
+
* @param viewElementName A view element name.
|
|
104
|
+
* @param properties The style (or styles list) to remove.
|
|
105
|
+
* @param selectable The selection or element to update.
|
|
106
|
+
*/
|
|
107
|
+
private removeModelHtmlStyles;
|
|
108
108
|
}
|
|
@@ -1,209 +1,209 @@
|
|
|
1
1
|
/**
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
|
4
|
+
*/
|
|
5
5
|
/**
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
import type { MatcherObjectPattern } from
|
|
6
|
+
* @module html-support/generalhtmlsupportconfig
|
|
7
|
+
*/
|
|
8
|
+
import type { MatcherObjectPattern } from "@ckeditor/ckeditor5-engine";
|
|
9
9
|
/**
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
10
|
+
* The configuration of the General HTML Support feature.
|
|
11
|
+
* The option is used by the {@link module:html-support/generalhtmlsupport~GeneralHtmlSupport} feature.
|
|
12
|
+
*
|
|
13
|
+
* ```ts
|
|
14
|
+
* ClassicEditor
|
|
15
|
+
* .create( {
|
|
16
|
+
* htmlSupport: ... // General HTML Support feature config.
|
|
17
|
+
* } )
|
|
18
|
+
* .then( ... )
|
|
19
|
+
* .catch( ... );
|
|
20
|
+
* ```
|
|
21
|
+
*
|
|
22
|
+
* See {@link module:core/editor/editorconfig~EditorConfig all editor options}.
|
|
23
|
+
*/
|
|
24
24
|
export interface GeneralHtmlSupportConfig {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
25
|
+
/**
|
|
26
|
+
* The configuration of allowed content rules used by General HTML Support.
|
|
27
|
+
*
|
|
28
|
+
* Setting this configuration option will enable HTML features that are not explicitly supported by any other
|
|
29
|
+
* dedicated CKEditor 5 features.
|
|
30
|
+
*
|
|
31
|
+
* ```ts
|
|
32
|
+
* const htmlSupportConfig.allow = [
|
|
33
|
+
* {
|
|
34
|
+
* name: 'div', // Enable 'div' element support,
|
|
35
|
+
* classes: [ 'special-container' ], // allow 'special-container' class,
|
|
36
|
+
* styles: 'background', // allow 'background' style,
|
|
37
|
+
* attributes: true // allow any attribute (can be empty).
|
|
38
|
+
* },
|
|
39
|
+
* {
|
|
40
|
+
* name: 'p', // Extend existing Paragraph feature,
|
|
41
|
+
* classes: 'highlighted' // with 'highlighted' class,
|
|
42
|
+
* attributes: [
|
|
43
|
+
* { key: 'data-i18n-context, value: true } // and i18n attribute.
|
|
44
|
+
* ]
|
|
45
|
+
* }
|
|
46
|
+
* ];
|
|
47
|
+
* ```
|
|
48
|
+
*/
|
|
49
|
+
allow?: Array<MatcherObjectPattern>;
|
|
50
|
+
/**
|
|
51
|
+
* The configuration of disallowed content rules used by General HTML Support.
|
|
52
|
+
*
|
|
53
|
+
* Setting this configuration option will disable listed HTML features.
|
|
54
|
+
*
|
|
55
|
+
* ```ts
|
|
56
|
+
* const htmlSupportConfig.disallow = [
|
|
57
|
+
* {
|
|
58
|
+
* name: /[\s\S]+/ // For every HTML feature,
|
|
59
|
+
* attributes: {
|
|
60
|
+
* key: /^on.*$/ // disable 'on*' attributes, like 'onClick', 'onError' etc.
|
|
61
|
+
* }
|
|
62
|
+
* }
|
|
63
|
+
* ];
|
|
64
|
+
* ```
|
|
65
|
+
*/
|
|
66
|
+
disallow?: Array<MatcherObjectPattern>;
|
|
67
|
+
/**
|
|
68
|
+
* The configuration of allowed empty inline elements that should not be removed.
|
|
69
|
+
*
|
|
70
|
+
* Note that you should also add an appropriate entry to {@link #allow} list.
|
|
71
|
+
*
|
|
72
|
+
* ```ts
|
|
73
|
+
* const htmlSupportConfig.allowEmpty = [ 'i', 'span' ];
|
|
74
|
+
* ```
|
|
75
|
+
*/
|
|
76
|
+
allowEmpty?: Array<string>;
|
|
77
|
+
/**
|
|
78
|
+
* Whether a filler text (non-breaking space entity — ` `) will be inserted into empty block elements in HTML output.
|
|
79
|
+
* This is used to render block elements properly with line-height.
|
|
80
|
+
*
|
|
81
|
+
* When set to `true`, empty blocks will be preserved in the editing view.
|
|
82
|
+
* When `false` (default), empty blocks are only preserved in the data output.
|
|
83
|
+
*
|
|
84
|
+
* The option is used by the {@link module:html-support/emptyblock~EmptyBlock} feature.
|
|
85
|
+
*
|
|
86
|
+
* @default false
|
|
87
|
+
*/
|
|
88
|
+
preserveEmptyBlocksInEditingView?: boolean;
|
|
89
|
+
/**
|
|
90
|
+
* The configuration of the Full page editing feature.
|
|
91
|
+
* The option is used by the {@link module:html-support/fullpage~FullPage} feature.
|
|
92
|
+
*
|
|
93
|
+
* ```ts
|
|
94
|
+
* ClassicEditor
|
|
95
|
+
* .create( {
|
|
96
|
+
* htmlSupport: {
|
|
97
|
+
* fullPage: ... // Full page feature config.
|
|
98
|
+
* }
|
|
99
|
+
* } )
|
|
100
|
+
* .then( ... )
|
|
101
|
+
* .catch( ... );
|
|
102
|
+
* ```
|
|
103
|
+
*/
|
|
104
|
+
fullPage?: GHSFullPageConfig;
|
|
105
|
+
/**
|
|
106
|
+
* Controls the `sandbox` attribute on iframe elements by specifying allowed sandbox flags.
|
|
107
|
+
*
|
|
108
|
+
* **Note:** This option only affects the editing view and does not modify the data output.
|
|
109
|
+
*
|
|
110
|
+
* When set to `false`:
|
|
111
|
+
*
|
|
112
|
+
* * The sandbox attribute will not be modified or added to iframe elements.
|
|
113
|
+
*
|
|
114
|
+
* When set to `true`:
|
|
115
|
+
*
|
|
116
|
+
* * All restrictions are enforced by adding an empty `sandbox` attribute to iframe elements.
|
|
117
|
+
*
|
|
118
|
+
* When set to an array of strings:
|
|
119
|
+
*
|
|
120
|
+
* * Only the specified sandbox flags will be preserved on iframe elements.
|
|
121
|
+
* * Any sandbox flags not in the list will be automatically removed.
|
|
122
|
+
* * If an empty array is provided, the `sandbox` attribute will be added with no flags (enforcing all restrictions).
|
|
123
|
+
*
|
|
124
|
+
* ```ts
|
|
125
|
+
* ClassicEditor
|
|
126
|
+
* .create( {
|
|
127
|
+
* htmlSupport: {
|
|
128
|
+
* // All restrictions are enforced (empty sandbox attribute).
|
|
129
|
+
* htmlIframeSandbox: true
|
|
130
|
+
* }
|
|
131
|
+
* } )
|
|
132
|
+
* .then( ... )
|
|
133
|
+
* .catch( ... );
|
|
134
|
+
* ```
|
|
135
|
+
*
|
|
136
|
+
* @default true
|
|
137
|
+
*/
|
|
138
|
+
htmlIframeSandbox?: boolean | Array<string>;
|
|
139
139
|
}
|
|
140
140
|
/**
|
|
141
|
-
|
|
142
|
-
|
|
141
|
+
* The configuration of the Full page editing feature.
|
|
142
|
+
*/
|
|
143
143
|
export interface GHSFullPageConfig {
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
144
|
+
/**
|
|
145
|
+
* Whether the feature should allow the editor to render styles from the `<head>` section of editor data content.
|
|
146
|
+
*
|
|
147
|
+
* When set to `true`, the editor will render styles from the `<head>` section of editor data content.
|
|
148
|
+
*
|
|
149
|
+
* ```ts
|
|
150
|
+
* ClassicEditor
|
|
151
|
+
* .create( {
|
|
152
|
+
* htmlSupport: {
|
|
153
|
+
* fullPage: {
|
|
154
|
+
* allowRenderStylesFromHead: true
|
|
155
|
+
* }
|
|
156
|
+
* }
|
|
157
|
+
* } )
|
|
158
|
+
* .then( ... )
|
|
159
|
+
* .catch( ... );
|
|
160
|
+
* ```
|
|
161
|
+
*
|
|
162
|
+
* @default false
|
|
163
|
+
*/
|
|
164
|
+
allowRenderStylesFromHead?: boolean;
|
|
165
|
+
/**
|
|
166
|
+
* Callback used to sanitize the CSS provided by the user in editor content
|
|
167
|
+
* when option `htmlSupport.fullPage.allowRenderStylesFromHead` is set to `true`.
|
|
168
|
+
*
|
|
169
|
+
* We strongly recommend overwriting the default function to avoid XSS vulnerabilities.
|
|
170
|
+
*
|
|
171
|
+
* The function receives the CSS (as a string), and should return an object
|
|
172
|
+
* that matches the {@link module:html-support/generalhtmlsupportconfig~GHSCssSanitizeOutput} interface.
|
|
173
|
+
*
|
|
174
|
+
* ```ts
|
|
175
|
+
* ClassicEditor
|
|
176
|
+
* .create( {
|
|
177
|
+
* htmlSupport: {
|
|
178
|
+
* fullPage: {
|
|
179
|
+
* allowRenderStylesFromHead: true,
|
|
180
|
+
*
|
|
181
|
+
* sanitizeCss( CssString ) {
|
|
182
|
+
* const sanitizedCss = sanitize( CssString );
|
|
183
|
+
*
|
|
184
|
+
* return {
|
|
185
|
+
* css: sanitizedCss,
|
|
186
|
+
* // true or false depending on whether the sanitizer stripped anything.
|
|
187
|
+
* hasChanged: ...
|
|
188
|
+
* };
|
|
189
|
+
* }
|
|
190
|
+
* }
|
|
191
|
+
* }
|
|
192
|
+
* } )
|
|
193
|
+
* .then( ... )
|
|
194
|
+
* .catch( ... );
|
|
195
|
+
* ```
|
|
196
|
+
*
|
|
197
|
+
*/
|
|
198
|
+
sanitizeCss?: (css: string) => GHSCssSanitizeOutput;
|
|
199
199
|
}
|
|
200
200
|
export interface GHSCssSanitizeOutput {
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
201
|
+
/**
|
|
202
|
+
* An output (safe) CSS that will be inserted into the document.
|
|
203
|
+
*/
|
|
204
|
+
css: string;
|
|
205
|
+
/**
|
|
206
|
+
* A flag that indicates whether the output CSS is different than the input value.
|
|
207
|
+
*/
|
|
208
|
+
hasChanged: boolean;
|
|
209
209
|
}
|