roosterjs 8.11.3 → 8.11.4

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.
@@ -1,4 +1,4 @@
1
- // Type definitions for roosterjs (Version 8.11.3)
1
+ // Type definitions for roosterjs (Version 8.11.4)
2
2
  // Generated by dts tool from roosterjs
3
3
  // Project: https://github.com/Microsoft/roosterjs
4
4
 
@@ -2256,6 +2256,7 @@ export interface HtmlSanitizerOptions {
2256
2256
  }
2257
2257
 
2258
2258
  /**
2259
+ * @deprecated
2259
2260
  * Options for sanitizeHtml function
2260
2261
  */
2261
2262
  export interface SanitizeHtmlOptions extends HtmlSanitizerOptions {
@@ -5521,12 +5522,14 @@ export function canUndoAutoComplete(snapshots: Snapshots): boolean;
5521
5522
  */
5522
5523
  export class HtmlSanitizer {
5523
5524
  /**
5525
+ * @deprecated Use new HtmlSanitizer().convertGlobalCssToInlineCss() instead
5524
5526
  * Convert global CSS to inline CSS if any
5525
5527
  * @param html HTML source
5526
5528
  * @param additionalStyleNodes (Optional) additional HTML STYLE elements used as global CSS
5527
5529
  */
5528
5530
  static convertInlineCss(html: string, additionalStyleNodes?: HTMLStyleElement[]): string;
5529
5531
  /**
5532
+ * @deprecated Use new HtmlSanitizer().sanitize() instead
5530
5533
  * Sanitize HTML string, remove any unused HTML node/attribute/CSS.
5531
5534
  * @param html HTML source string
5532
5535
  * @param options Options used for this sanitizing process
@@ -5549,6 +5552,7 @@ export class HtmlSanitizer {
5549
5552
  */
5550
5553
  constructor(options?: HtmlSanitizerOptions);
5551
5554
  /**
5555
+ * @deprecated Use HtmlSanitizer.convertGlobalCssToInlineCss() and HtmlSanitizer.sanitize() instead
5552
5556
  * Sanitize HTML string
5553
5557
  * This function will do the following work:
5554
5558
  * 1. Convert global CSS into inline CSS
@@ -5448,7 +5448,9 @@ function transformToDarkMode(element, getDarkColor) {
5448
5448
  var attrColor = element.getAttribute(names[1 /* HtmlColor */]);
5449
5449
  if (!element.dataset[names[2 /* CssDataSet */]] &&
5450
5450
  !element.dataset[names[3 /* HtmlDataSet */]] &&
5451
- (styleColor || attrColor)) {
5451
+ (styleColor || attrColor) &&
5452
+ styleColor != 'inherit' // For inherit style, no need to change it and let it keep inherit from parent element
5453
+ ) {
5452
5454
  var newColor = getDarkColor(computedValues[index] || styleColor || attrColor);
5453
5455
  element.style.setProperty(names[0 /* CssColor */], newColor, 'important');
5454
5456
  element.dataset[names[2 /* CssDataSet */]] = styleColor || '';
@@ -9236,6 +9238,7 @@ var HtmlSanitizer = /** @class */ (function () {
9236
9238
  this.unknownTagReplacement = options.unknownTagReplacement;
9237
9239
  }
9238
9240
  /**
9241
+ * @deprecated Use new HtmlSanitizer().convertGlobalCssToInlineCss() instead
9239
9242
  * Convert global CSS to inline CSS if any
9240
9243
  * @param html HTML source
9241
9244
  * @param additionalStyleNodes (Optional) additional HTML STYLE elements used as global CSS
@@ -9247,6 +9250,7 @@ var HtmlSanitizer = /** @class */ (function () {
9247
9250
  return sanitizer.exec(html, true /*convertCssOnly*/);
9248
9251
  };
9249
9252
  /**
9253
+ * @deprecated Use new HtmlSanitizer().sanitize() instead
9250
9254
  * Sanitize HTML string, remove any unused HTML node/attribute/CSS.
9251
9255
  * @param html HTML source string
9252
9256
  * @param options Options used for this sanitizing process
@@ -9260,6 +9264,7 @@ var HtmlSanitizer = /** @class */ (function () {
9260
9264
  return sanitizer.exec(html, options.convertCssOnly, currentStyles);
9261
9265
  };
9262
9266
  /**
9267
+ * @deprecated Use HtmlSanitizer.convertGlobalCssToInlineCss() and HtmlSanitizer.sanitize() instead
9263
9268
  * Sanitize HTML string
9264
9269
  * This function will do the following work:
9265
9270
  * 1. Convert global CSS into inline CSS
@@ -9271,7 +9276,7 @@ var HtmlSanitizer = /** @class */ (function () {
9271
9276
  */
9272
9277
  HtmlSanitizer.prototype.exec = function (html, convertCssOnly, currentStyles) {
9273
9278
  var parser = new DOMParser();
9274
- var doc = parser.parseFromString(unsafeConvertToTrustedHTML(html) || '', 'text/html');
9279
+ var doc = parser.parseFromString(html || '', 'text/html');
9275
9280
  if (doc && doc.body && doc.body.firstChild) {
9276
9281
  this.convertGlobalCssToInlineCss(doc);
9277
9282
  if (!convertCssOnly) {
@@ -9477,15 +9482,6 @@ var HtmlSanitizer = /** @class */ (function () {
9477
9482
  return HtmlSanitizer;
9478
9483
  }());
9479
9484
  exports.default = HtmlSanitizer;
9480
- var trustedTypes = window.trustedTypes;
9481
- var policy = trustedTypes === null || trustedTypes === void 0 ? void 0 : trustedTypes.createPolicy('roosterjsUnsafeConvertHTML', {
9482
- // This is unsafe. However, we only use this function for HtmlSanitizer which we will
9483
- // sanitize HTML tree by our own code. So we just directly return the HTML string here.
9484
- createHTML: function (html) { return html; },
9485
- });
9486
- var unsafeConvertToTrustedHTML = policy
9487
- ? function (html) { return policy.createHTML(html || ''); }
9488
- : function (html) { return html; };
9489
9485
 
9490
9486
 
9491
9487
  /***/ }),