@ckeditor/ckeditor5-core 43.1.0-alpha.7 → 43.1.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ckeditor/ckeditor5-core",
3
- "version": "43.1.0-alpha.7",
3
+ "version": "43.1.0",
4
4
  "description": "The core architecture of CKEditor 5 – the best browser-based rich text editor.",
5
5
  "keywords": [
6
6
  "wysiwyg",
@@ -24,9 +24,9 @@
24
24
  "type": "module",
25
25
  "main": "src/index.js",
26
26
  "dependencies": {
27
- "@ckeditor/ckeditor5-engine": "43.1.0-alpha.7",
28
- "@ckeditor/ckeditor5-utils": "43.1.0-alpha.7",
29
- "@ckeditor/ckeditor5-watchdog": "43.1.0-alpha.7",
27
+ "@ckeditor/ckeditor5-engine": "43.1.0",
28
+ "@ckeditor/ckeditor5-utils": "43.1.0",
29
+ "@ckeditor/ckeditor5-watchdog": "43.1.0",
30
30
  "lodash-es": "4.17.21"
31
31
  },
32
32
  "author": "CKSource (http://cksource.com/)",
@@ -5,7 +5,7 @@
5
5
  /**
6
6
  * @module core/editor/editor
7
7
  */
8
- import { Config, CKEditorError, ObservableMixin, logWarning } from '@ckeditor/ckeditor5-utils';
8
+ import { Config, CKEditorError, ObservableMixin } from '@ckeditor/ckeditor5-utils';
9
9
  import { Conversion, DataController, EditingController, Model, StylesProcessor } from '@ckeditor/ckeditor5-engine';
10
10
  import { ContextWatchdog, EditorWatchdog } from '@ckeditor/ckeditor5-watchdog';
11
11
  import Context from '../context.js';
@@ -41,6 +41,16 @@ class Editor extends /* #__PURE__ */ ObservableMixin() {
41
41
  */
42
42
  constructor(config = {}) {
43
43
  super();
44
+ if ('sanitizeHtml' in config) {
45
+ /**
46
+ * Configuration property `config.sanitizeHtml` was removed in CKEditor version 43.1.0 and is no longer supported.
47
+ *
48
+ * Please use `config.htmlEmbed.sanitizeHtml` and/or `config.mergeFields.sanitizeHtml` instead.
49
+ *
50
+ * @error editor-config-sanitizehtml-not-supported
51
+ */
52
+ throw new CKEditorError('editor-config-sanitizehtml-not-supported');
53
+ }
44
54
  const constructor = this.constructor;
45
55
  // We don't pass translations to the config, because its behavior of splitting keys
46
56
  // with dots (e.g. `resize.width` => `resize: { width }`) breaks the translations.
@@ -56,22 +66,6 @@ class Editor extends /* #__PURE__ */ ObservableMixin() {
56
66
  this.config = new Config(rest, defaultConfig);
57
67
  this.config.define('plugins', availablePlugins);
58
68
  this.config.define(this._context._getEditorConfig());
59
- this.config.define('sanitizeHtml', function (rawHtml) {
60
- /**
61
- * One of the editor features directly inserts unsanitized HTML code into the editor.
62
- * It is strongly recommended to define a sanitize function that will clean up the input HTML
63
- * in order to avoid XSS vulnerability.
64
- *
65
- * For a detailed overview, check the {@glink getting-started/setup/html-security "HTML security"} guide.
66
- *
67
- * @error provide-sanitize-function
68
- */
69
- logWarning('provide-sanitize-function');
70
- return {
71
- html: rawHtml,
72
- hasChanged: false
73
- };
74
- });
75
69
  this.plugins = new PluginCollection(this, availablePlugins, this._context.plugins);
76
70
  this.locale = this._context.locale;
77
71
  this.t = this.locale.t;
@@ -805,43 +805,6 @@ export interface EditorConfig {
805
805
  * Translations to be used in the editor.
806
806
  */
807
807
  translations?: ArrayOrItem<Translations>;
808
- /**
809
- * Callback used to sanitize the HTML provided by the user when generating previews of it in the editor.
810
- *
811
- * We strongly recommend overwriting the default function to avoid XSS vulnerabilities.
812
- *
813
- * Read more about the security aspect of this feature in the {@glink getting-started/setup/html-security "HTML security"}
814
- * guide.
815
- *
816
- * The function receives the input HTML (as a string), and should return an object
817
- * that matches the {@link module:core/editor/editorconfig~SanitizedOutput} interface.
818
- *
819
- * ```ts
820
- * ClassicEditor
821
- * .create( editorElement, {
822
- * sanitizeHtml( inputHtml ) {
823
- * // Strip unsafe elements and attributes, e.g.:
824
- * // the `<script>` elements and `on*` attributes.
825
- * const outputHtml = sanitize( inputHtml );
826
- *
827
- * return {
828
- * html: outputHtml,
829
- * // `true` or `false` depending on whether the sanitizer stripped anything.
830
- * hasChanged: inputHtml !== outputHtml
831
- * };
832
- * } )
833
- * .then( ... )
834
- * .catch( ... );
835
- * ```
836
- *
837
- * This function is used by following features:
838
- *
839
- * * {@glink features/html/html-embed HTML embed}
840
- * (when {@link module:html-embed/htmlembedconfig~HtmlEmbedConfig#showPreviews `showPreviews`} flag is set).
841
- * * {@glink features/merge-fields Merge fields}
842
- * (when {@link module:merge-fields/mergefieldsconfig~MergeFieldsConfig#previewHtmlValues `previewHtmlValues`} flag is set).
843
- */
844
- sanitizeHtml?: HtmlSanitizationCallback;
845
808
  /**
846
809
  * Label text for the `aria-label` attribute set on editor editing area. Used by assistive technologies
847
810
  * to tell apart multiple editor instances (editing areas) on the page. If not set, a default
@@ -1023,17 +986,3 @@ export interface UiConfig {
1023
986
  **/
1024
987
  poweredBy?: PoweredByConfig;
1025
988
  }
1026
- /**
1027
- * An object returned by the {@link module:core/editor/editorconfig~EditorConfig#sanitizeHtml} function.
1028
- */
1029
- export interface SanitizedOutput {
1030
- /**
1031
- * An output (safe) HTML that will be inserted into the {@glink framework/architecture/editing-engine editing view}.
1032
- */
1033
- html: string;
1034
- /**
1035
- * A flag that indicates whether the output HTML is different than the input value.
1036
- */
1037
- hasChanged: boolean;
1038
- }
1039
- export type HtmlSanitizationCallback = (html: string) => SanitizedOutput;
package/src/index.d.ts CHANGED
@@ -15,7 +15,7 @@ export { default as ContextPlugin, type ContextPluginDependencies } from './cont
15
15
  export { type EditingKeystrokeCallback } from './editingkeystrokehandler.js';
16
16
  export type { PartialBy, NonEmptyArray, HexColor } from './typings.js';
17
17
  export { default as Editor, type EditorReadyEvent, type EditorDestroyEvent } from './editor/editor.js';
18
- export type { EditorConfig, LanguageConfig, ToolbarConfig, ToolbarConfigItem, UiConfig, SanitizedOutput } from './editor/editorconfig.js';
18
+ export type { EditorConfig, LanguageConfig, ToolbarConfig, ToolbarConfigItem, UiConfig } from './editor/editorconfig.js';
19
19
  export { default as attachToForm } from './editor/utils/attachtoform.js';
20
20
  export { default as DataApiMixin, type DataApi } from './editor/utils/dataapimixin.js';
21
21
  export { default as ElementApiMixin, type ElementApi } from './editor/utils/elementapimixin.js';