@ckeditor/ckeditor5-html-embed 40.0.0 → 40.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.md +2 -2
- package/package.json +2 -2
- package/src/augmentation.d.ts +24 -24
- package/src/augmentation.js +5 -5
- package/src/htmlembed.d.ts +28 -28
- package/src/htmlembed.js +32 -32
- package/src/htmlembedcommand.d.ts +44 -44
- package/src/htmlembedcommand.js +95 -95
- package/src/htmlembedconfig.d.ts +86 -86
- package/src/htmlembedconfig.js +5 -5
- package/src/htmlembedediting.d.ts +40 -40
- package/src/htmlembedediting.js +327 -327
- package/src/htmlembedui.d.ts +21 -21
- package/src/htmlembedui.js +49 -49
- package/src/index.d.ts +13 -13
- package/src/index.js +11 -11
- package/build/html-embed.js.map +0 -1
package/src/htmlembedconfig.d.ts
CHANGED
|
@@ -1,86 +1,86 @@
|
|
|
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 html-embed/htmlembedconfig
|
|
7
|
-
*/
|
|
8
|
-
/**
|
|
9
|
-
* The configuration of the HTML embed feature.
|
|
10
|
-
*
|
|
11
|
-
* ```ts
|
|
12
|
-
* ClassicEditor
|
|
13
|
-
* .create( editorElement, {
|
|
14
|
-
* htmlEmbed: ... // HTML embed feature options.
|
|
15
|
-
* } )
|
|
16
|
-
* .then( ... )
|
|
17
|
-
* .catch( ... );
|
|
18
|
-
* ```
|
|
19
|
-
*
|
|
20
|
-
* See {@link module:core/editor/editorconfig~EditorConfig all editor options}.
|
|
21
|
-
*/
|
|
22
|
-
export interface HtmlEmbedConfig {
|
|
23
|
-
/**
|
|
24
|
-
* Whether the feature should render previews of the embedded HTML.
|
|
25
|
-
*
|
|
26
|
-
* When set to `true`, the feature will produce a preview of the inserted HTML based on a sanitized
|
|
27
|
-
* version of the HTML provided by the user.
|
|
28
|
-
*
|
|
29
|
-
* The function responsible for sanitizing the HTML needs to be specified in
|
|
30
|
-
* {@link module:html-embed/htmlembedconfig~HtmlEmbedConfig#sanitizeHtml `config.htmlEmbed.sanitizeHtml()`}.
|
|
31
|
-
*
|
|
32
|
-
* Read more about the security aspect of this feature in the {@glink features/html/html-embed#security "Security"} section of
|
|
33
|
-
* the {@glink features/html/html-embed HTML embed} feature guide.
|
|
34
|
-
*/
|
|
35
|
-
showPreviews?: boolean;
|
|
36
|
-
/**
|
|
37
|
-
* Callback used to sanitize the HTML provided by the user when generating previews of it in the editor.
|
|
38
|
-
*
|
|
39
|
-
* We strongly recommend overwriting the default function to avoid XSS vulnerabilities.
|
|
40
|
-
*
|
|
41
|
-
* Read more about the security aspect of this feature in the {@glink features/html/html-embed#security "Security"} section of
|
|
42
|
-
* the {@glink features/html/html-embed HTML embed} feature guide.
|
|
43
|
-
*
|
|
44
|
-
* The function receives the input HTML (as a string), and should return an object
|
|
45
|
-
* that matches the {@link module:html-embed/htmlembedconfig~HtmlEmbedSanitizeOutput} interface.
|
|
46
|
-
*
|
|
47
|
-
* ```ts
|
|
48
|
-
* ClassicEditor
|
|
49
|
-
* .create( editorElement, {
|
|
50
|
-
* htmlEmbed: {
|
|
51
|
-
* showPreviews: true,
|
|
52
|
-
* sanitizeHtml( inputHtml ) {
|
|
53
|
-
* // Strip unsafe elements and attributes, e.g.:
|
|
54
|
-
* // the `<script>` elements and `on*` attributes.
|
|
55
|
-
* const outputHtml = sanitize( inputHtml );
|
|
56
|
-
*
|
|
57
|
-
* return {
|
|
58
|
-
* html: outputHtml,
|
|
59
|
-
* // true or false depending on whether the sanitizer stripped anything.
|
|
60
|
-
* hasChanged: ...
|
|
61
|
-
* };
|
|
62
|
-
* },
|
|
63
|
-
* }
|
|
64
|
-
* } )
|
|
65
|
-
* .then( ... )
|
|
66
|
-
* .catch( ... );
|
|
67
|
-
* ```
|
|
68
|
-
*
|
|
69
|
-
* **Note:** The function is used only when the feature
|
|
70
|
-
* {@link module:html-embed/htmlembedconfig~HtmlEmbedConfig#showPreviews is configured to render previews}.
|
|
71
|
-
*/
|
|
72
|
-
sanitizeHtml?: (html: string) => HtmlEmbedSanitizeOutput;
|
|
73
|
-
}
|
|
74
|
-
/**
|
|
75
|
-
* An object returned by the {@link module:html-embed/htmlembedconfig~HtmlEmbedConfig#sanitizeHtml} function.
|
|
76
|
-
*/
|
|
77
|
-
export interface HtmlEmbedSanitizeOutput {
|
|
78
|
-
/**
|
|
79
|
-
* An output (safe) HTML that will be inserted into the {@glink framework/architecture/editing-engine editing view}.
|
|
80
|
-
*/
|
|
81
|
-
html: string;
|
|
82
|
-
/**
|
|
83
|
-
* A flag that indicates whether the output HTML is different than the input value.
|
|
84
|
-
*/
|
|
85
|
-
hasChanged: boolean;
|
|
86
|
-
}
|
|
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 html-embed/htmlembedconfig
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* The configuration of the HTML embed feature.
|
|
10
|
+
*
|
|
11
|
+
* ```ts
|
|
12
|
+
* ClassicEditor
|
|
13
|
+
* .create( editorElement, {
|
|
14
|
+
* htmlEmbed: ... // HTML embed feature options.
|
|
15
|
+
* } )
|
|
16
|
+
* .then( ... )
|
|
17
|
+
* .catch( ... );
|
|
18
|
+
* ```
|
|
19
|
+
*
|
|
20
|
+
* See {@link module:core/editor/editorconfig~EditorConfig all editor options}.
|
|
21
|
+
*/
|
|
22
|
+
export interface HtmlEmbedConfig {
|
|
23
|
+
/**
|
|
24
|
+
* Whether the feature should render previews of the embedded HTML.
|
|
25
|
+
*
|
|
26
|
+
* When set to `true`, the feature will produce a preview of the inserted HTML based on a sanitized
|
|
27
|
+
* version of the HTML provided by the user.
|
|
28
|
+
*
|
|
29
|
+
* The function responsible for sanitizing the HTML needs to be specified in
|
|
30
|
+
* {@link module:html-embed/htmlembedconfig~HtmlEmbedConfig#sanitizeHtml `config.htmlEmbed.sanitizeHtml()`}.
|
|
31
|
+
*
|
|
32
|
+
* Read more about the security aspect of this feature in the {@glink features/html/html-embed#security "Security"} section of
|
|
33
|
+
* the {@glink features/html/html-embed HTML embed} feature guide.
|
|
34
|
+
*/
|
|
35
|
+
showPreviews?: boolean;
|
|
36
|
+
/**
|
|
37
|
+
* Callback used to sanitize the HTML provided by the user when generating previews of it in the editor.
|
|
38
|
+
*
|
|
39
|
+
* We strongly recommend overwriting the default function to avoid XSS vulnerabilities.
|
|
40
|
+
*
|
|
41
|
+
* Read more about the security aspect of this feature in the {@glink features/html/html-embed#security "Security"} section of
|
|
42
|
+
* the {@glink features/html/html-embed HTML embed} feature guide.
|
|
43
|
+
*
|
|
44
|
+
* The function receives the input HTML (as a string), and should return an object
|
|
45
|
+
* that matches the {@link module:html-embed/htmlembedconfig~HtmlEmbedSanitizeOutput} interface.
|
|
46
|
+
*
|
|
47
|
+
* ```ts
|
|
48
|
+
* ClassicEditor
|
|
49
|
+
* .create( editorElement, {
|
|
50
|
+
* htmlEmbed: {
|
|
51
|
+
* showPreviews: true,
|
|
52
|
+
* sanitizeHtml( inputHtml ) {
|
|
53
|
+
* // Strip unsafe elements and attributes, e.g.:
|
|
54
|
+
* // the `<script>` elements and `on*` attributes.
|
|
55
|
+
* const outputHtml = sanitize( inputHtml );
|
|
56
|
+
*
|
|
57
|
+
* return {
|
|
58
|
+
* html: outputHtml,
|
|
59
|
+
* // true or false depending on whether the sanitizer stripped anything.
|
|
60
|
+
* hasChanged: ...
|
|
61
|
+
* };
|
|
62
|
+
* },
|
|
63
|
+
* }
|
|
64
|
+
* } )
|
|
65
|
+
* .then( ... )
|
|
66
|
+
* .catch( ... );
|
|
67
|
+
* ```
|
|
68
|
+
*
|
|
69
|
+
* **Note:** The function is used only when the feature
|
|
70
|
+
* {@link module:html-embed/htmlembedconfig~HtmlEmbedConfig#showPreviews is configured to render previews}.
|
|
71
|
+
*/
|
|
72
|
+
sanitizeHtml?: (html: string) => HtmlEmbedSanitizeOutput;
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* An object returned by the {@link module:html-embed/htmlembedconfig~HtmlEmbedConfig#sanitizeHtml} function.
|
|
76
|
+
*/
|
|
77
|
+
export interface HtmlEmbedSanitizeOutput {
|
|
78
|
+
/**
|
|
79
|
+
* An output (safe) HTML that will be inserted into the {@glink framework/architecture/editing-engine editing view}.
|
|
80
|
+
*/
|
|
81
|
+
html: string;
|
|
82
|
+
/**
|
|
83
|
+
* A flag that indicates whether the output HTML is different than the input value.
|
|
84
|
+
*/
|
|
85
|
+
hasChanged: boolean;
|
|
86
|
+
}
|
package/src/htmlembedconfig.js
CHANGED
|
@@ -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 {};
|
|
@@ -1,40 +1,40 @@
|
|
|
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 html-embed/htmlembedediting
|
|
7
|
-
*/
|
|
8
|
-
import { Plugin, type Editor } from 'ckeditor5/src/core';
|
|
9
|
-
import '../theme/htmlembed.css';
|
|
10
|
-
/**
|
|
11
|
-
* The HTML embed editing feature.
|
|
12
|
-
*/
|
|
13
|
-
export default class HtmlEmbedEditing extends Plugin {
|
|
14
|
-
/**
|
|
15
|
-
* Keeps references to {@link module:ui/button/buttonview~ButtonView edit, save, and cancel} button instances created for
|
|
16
|
-
* each widget so they can be destroyed if they are no longer in DOM after the editing view was re-rendered.
|
|
17
|
-
*/
|
|
18
|
-
private _widgetButtonViewReferences;
|
|
19
|
-
/**
|
|
20
|
-
* @inheritDoc
|
|
21
|
-
*/
|
|
22
|
-
static get pluginName(): "HtmlEmbedEditing";
|
|
23
|
-
/**
|
|
24
|
-
* @inheritDoc
|
|
25
|
-
*/
|
|
26
|
-
constructor(editor: Editor);
|
|
27
|
-
/**
|
|
28
|
-
* @inheritDoc
|
|
29
|
-
*/
|
|
30
|
-
init(): void;
|
|
31
|
-
/**
|
|
32
|
-
* Prepares converters for the feature.
|
|
33
|
-
*/
|
|
34
|
-
private _setupConversion;
|
|
35
|
-
}
|
|
36
|
-
export interface RawHtmlApi {
|
|
37
|
-
makeEditable(): void;
|
|
38
|
-
save(newValue: string): void;
|
|
39
|
-
cancel(): void;
|
|
40
|
-
}
|
|
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 html-embed/htmlembedediting
|
|
7
|
+
*/
|
|
8
|
+
import { Plugin, type Editor } from 'ckeditor5/src/core';
|
|
9
|
+
import '../theme/htmlembed.css';
|
|
10
|
+
/**
|
|
11
|
+
* The HTML embed editing feature.
|
|
12
|
+
*/
|
|
13
|
+
export default class HtmlEmbedEditing extends Plugin {
|
|
14
|
+
/**
|
|
15
|
+
* Keeps references to {@link module:ui/button/buttonview~ButtonView edit, save, and cancel} button instances created for
|
|
16
|
+
* each widget so they can be destroyed if they are no longer in DOM after the editing view was re-rendered.
|
|
17
|
+
*/
|
|
18
|
+
private _widgetButtonViewReferences;
|
|
19
|
+
/**
|
|
20
|
+
* @inheritDoc
|
|
21
|
+
*/
|
|
22
|
+
static get pluginName(): "HtmlEmbedEditing";
|
|
23
|
+
/**
|
|
24
|
+
* @inheritDoc
|
|
25
|
+
*/
|
|
26
|
+
constructor(editor: Editor);
|
|
27
|
+
/**
|
|
28
|
+
* @inheritDoc
|
|
29
|
+
*/
|
|
30
|
+
init(): void;
|
|
31
|
+
/**
|
|
32
|
+
* Prepares converters for the feature.
|
|
33
|
+
*/
|
|
34
|
+
private _setupConversion;
|
|
35
|
+
}
|
|
36
|
+
export interface RawHtmlApi {
|
|
37
|
+
makeEditable(): void;
|
|
38
|
+
save(newValue: string): void;
|
|
39
|
+
cancel(): void;
|
|
40
|
+
}
|