watermark-js-plus 1.6.3 → 1.6.5

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 (46) hide show
  1. package/dist/es/src/core/watermark.js +49 -53
  2. package/dist/ie/es/node_modules/core-js/internals/array-from.js +11 -3
  3. package/dist/ie/es/node_modules/core-js/internals/array-set-length.js +39 -0
  4. package/dist/ie/es/node_modules/core-js/internals/check-correctness-of-iteration.js +2 -0
  5. package/dist/ie/es/node_modules/core-js/internals/environment-is-ios.js +1 -2
  6. package/dist/ie/es/node_modules/core-js/internals/function-bind-native.js +1 -1
  7. package/dist/ie/es/node_modules/core-js/internals/function-name.js +1 -1
  8. package/dist/ie/es/node_modules/core-js/internals/is-array.js +20 -0
  9. package/dist/ie/es/node_modules/core-js/internals/iterate.js +8 -3
  10. package/dist/ie/es/node_modules/core-js/internals/shared-store.js +3 -3
  11. package/dist/ie/es/node_modules/core-js/internals/to-string-tag-support.js +1 -1
  12. package/dist/ie/es/node_modules/core-js/modules/es.array.fill.js +1 -1
  13. package/dist/ie/es/node_modules/core-js/modules/es.array.from.js +1 -1
  14. package/dist/ie/es/node_modules/core-js/modules/es.array.includes.js +8 -2
  15. package/dist/ie/es/node_modules/core-js/modules/es.promise.js +1 -1
  16. package/dist/ie/es/src/core/watermark.js +49 -53
  17. package/dist/ie/index.cjs.js +135 -69
  18. package/dist/ie/index.cjs.js.map +1 -1
  19. package/dist/ie/index.cjs.min.js +1 -1
  20. package/dist/ie/index.esm.js +135 -69
  21. package/dist/ie/index.esm.js.map +1 -1
  22. package/dist/ie/index.esm.min.js +1 -1
  23. package/dist/ie/index.iife.js +135 -69
  24. package/dist/ie/index.iife.js.map +1 -1
  25. package/dist/ie/index.iife.min.js +1 -1
  26. package/dist/ie/index.umd.js +135 -69
  27. package/dist/ie/index.umd.js.map +1 -1
  28. package/dist/ie/index.umd.min.js +1 -1
  29. package/dist/index.cjs.js +50 -54
  30. package/dist/index.cjs.js.map +1 -1
  31. package/dist/index.cjs.min.js +1 -1
  32. package/dist/index.esm.js +50 -54
  33. package/dist/index.esm.js.map +1 -1
  34. package/dist/index.esm.min.js +1 -1
  35. package/dist/index.iife.js +50 -54
  36. package/dist/index.iife.js.map +1 -1
  37. package/dist/index.iife.min.js +1 -1
  38. package/dist/index.umd.js +50 -54
  39. package/dist/index.umd.js.map +1 -1
  40. package/dist/index.umd.min.js +1 -1
  41. package/dist/types/core/watermark.d.ts +3 -2
  42. package/package.json +57 -51
  43. /package/dist/ie/es/_virtual/{es.array.fill2.js → es2.array.fill.js} +0 -0
  44. /package/dist/ie/es/_virtual/{es.array.from2.js → es2.array.from.js} +0 -0
  45. /package/dist/ie/es/_virtual/{es.array.includes2.js → es2.array.includes.js} +0 -0
  46. /package/dist/ie/es/_virtual/{es.promise2.js → es2.promise.js} +0 -0
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * watermark-js-plus v1.6.3
2
+ * watermark-js-plus v1.6.5
3
3
  * (c) 2022-2024 Michael Sun
4
4
  * Released under the MIT License.
5
5
  */
@@ -78,7 +78,7 @@ var WatermarkPlus = (function (exports) {
78
78
 
79
79
  functionBindNative = !fails(function () {
80
80
  // eslint-disable-next-line es/no-function-prototype-bind -- safe
81
- var test = (function () { /* empty */ }).bind();
81
+ var test = function () { /* empty */ }.bind();
82
82
  // eslint-disable-next-line no-prototype-builtins -- safe
83
83
  return typeof test != 'function' || test.hasOwnProperty('prototype');
84
84
  });
@@ -557,10 +557,10 @@ var WatermarkPlus = (function (exports) {
557
557
  var store = sharedStore.exports = globalThis[SHARED] || defineGlobalProperty(SHARED, {});
558
558
 
559
559
  (store.versions || (store.versions = [])).push({
560
- version: '3.44.0',
560
+ version: '3.49.0',
561
561
  mode: IS_PURE ? 'pure' : 'global',
562
- copyright: '© 2014-2025 Denis Pushkarev (zloirock.ru)',
563
- license: 'https://github.com/zloirock/core-js/blob/v3.44.0/LICENSE',
562
+ copyright: '© 2013–2025 Denis Pushkarev (zloirock.ru), 2025–2026 CoreJS Company (core-js.io). All rights reserved.',
563
+ license: 'https://github.com/zloirock/core-js/blob/v3.49.0/LICENSE',
564
564
  source: 'https://github.com/zloirock/core-js'
565
565
  });
566
566
  return sharedStore.exports;
@@ -913,7 +913,7 @@ var WatermarkPlus = (function (exports) {
913
913
 
914
914
  var EXISTS = hasOwn(FunctionPrototype, 'name');
915
915
  // additional protection from minified / mangled / dropped function names
916
- var PROPER = EXISTS && (function something() { /* empty */ }).name === 'something';
916
+ var PROPER = EXISTS && function something() { /* empty */ }.name === 'something';
917
917
  var CONFIGURABLE = EXISTS && (!DESCRIPTORS || (DESCRIPTORS && getDescriptor(FunctionPrototype, 'name').configurable));
918
918
 
919
919
  functionName = {
@@ -1655,7 +1655,7 @@ var WatermarkPlus = (function (exports) {
1655
1655
 
1656
1656
  var TO_STRING_TAG = wellKnownSymbol('toStringTag');
1657
1657
  var test = {};
1658
-
1658
+ // eslint-disable-next-line unicorn/no-immediate-mutation -- ES3 syntax limitation
1659
1659
  test[TO_STRING_TAG] = 'z';
1660
1660
 
1661
1661
  toStringTagSupport = String(test) === '[object z]';
@@ -1777,6 +1777,58 @@ var WatermarkPlus = (function (exports) {
1777
1777
  return createProperty;
1778
1778
  }
1779
1779
 
1780
+ var isArray;
1781
+ var hasRequiredIsArray;
1782
+
1783
+ function requireIsArray () {
1784
+ if (hasRequiredIsArray) return isArray;
1785
+ hasRequiredIsArray = 1;
1786
+ var classof = requireClassofRaw();
1787
+
1788
+ // `IsArray` abstract operation
1789
+ // https://tc39.es/ecma262/#sec-isarray
1790
+ // eslint-disable-next-line es/no-array-isarray -- safe
1791
+ isArray = Array.isArray || function isArray(argument) {
1792
+ return classof(argument) === 'Array';
1793
+ };
1794
+ return isArray;
1795
+ }
1796
+
1797
+ var arraySetLength;
1798
+ var hasRequiredArraySetLength;
1799
+
1800
+ function requireArraySetLength () {
1801
+ if (hasRequiredArraySetLength) return arraySetLength;
1802
+ hasRequiredArraySetLength = 1;
1803
+ var DESCRIPTORS = requireDescriptors();
1804
+ var isArray = requireIsArray();
1805
+
1806
+ var $TypeError = TypeError;
1807
+ // eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
1808
+ var getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
1809
+
1810
+ // Safari < 13 does not throw an error in this case
1811
+ var SILENT_ON_NON_WRITABLE_LENGTH_SET = DESCRIPTORS && !function () {
1812
+ // makes no sense without proper strict mode support
1813
+ if (this !== undefined) return true;
1814
+ try {
1815
+ // eslint-disable-next-line es/no-object-defineproperty -- safe
1816
+ Object.defineProperty([], 'length', { writable: false }).length = 1;
1817
+ } catch (error) {
1818
+ return error instanceof TypeError;
1819
+ }
1820
+ }();
1821
+
1822
+ arraySetLength = SILENT_ON_NON_WRITABLE_LENGTH_SET ? function (O, length) {
1823
+ if (isArray(O) && !getOwnPropertyDescriptor(O, 'length').writable) {
1824
+ throw new $TypeError('Cannot set read only .length');
1825
+ } return O.length = length;
1826
+ } : function (O, length) {
1827
+ return O.length = length;
1828
+ };
1829
+ return arraySetLength;
1830
+ }
1831
+
1780
1832
  var getIteratorMethod;
1781
1833
  var hasRequiredGetIteratorMethod;
1782
1834
 
@@ -1835,20 +1887,22 @@ var WatermarkPlus = (function (exports) {
1835
1887
  var isConstructor = requireIsConstructor();
1836
1888
  var lengthOfArrayLike = requireLengthOfArrayLike();
1837
1889
  var createProperty = requireCreateProperty();
1890
+ var setArrayLength = requireArraySetLength();
1838
1891
  var getIterator = requireGetIterator();
1839
1892
  var getIteratorMethod = requireGetIteratorMethod();
1893
+ var iteratorClose = requireIteratorClose();
1840
1894
 
1841
1895
  var $Array = Array;
1842
1896
 
1843
1897
  // `Array.from` method implementation
1844
1898
  // https://tc39.es/ecma262/#sec-array.from
1845
1899
  arrayFrom = function from(arrayLike /* , mapfn = undefined, thisArg = undefined */) {
1846
- var O = toObject(arrayLike);
1847
1900
  var IS_CONSTRUCTOR = isConstructor(this);
1848
1901
  var argumentsLength = arguments.length;
1849
1902
  var mapfn = argumentsLength > 1 ? arguments[1] : undefined;
1850
1903
  var mapping = mapfn !== undefined;
1851
1904
  if (mapping) mapfn = bind(mapfn, argumentsLength > 2 ? arguments[2] : undefined);
1905
+ var O = toObject(arrayLike);
1852
1906
  var iteratorMethod = getIteratorMethod(O);
1853
1907
  var index = 0;
1854
1908
  var length, result, step, iterator, next, value;
@@ -1859,7 +1913,11 @@ var WatermarkPlus = (function (exports) {
1859
1913
  next = iterator.next;
1860
1914
  for (;!(step = call(next, iterator)).done; index++) {
1861
1915
  value = mapping ? callWithSafeIterationClosing(iterator, mapfn, [step.value, index], true) : step.value;
1862
- createProperty(result, index, value);
1916
+ try {
1917
+ createProperty(result, index, value);
1918
+ } catch (error) {
1919
+ iteratorClose(iterator, 'throw', error);
1920
+ }
1863
1921
  }
1864
1922
  } else {
1865
1923
  length = lengthOfArrayLike(O);
@@ -1869,7 +1927,7 @@ var WatermarkPlus = (function (exports) {
1869
1927
  createProperty(result, index, value);
1870
1928
  }
1871
1929
  }
1872
- result.length = index;
1930
+ setArrayLength(result, index);
1873
1931
  return result;
1874
1932
  };
1875
1933
  return arrayFrom;
@@ -1896,6 +1954,7 @@ var WatermarkPlus = (function (exports) {
1896
1954
  SAFE_CLOSING = true;
1897
1955
  }
1898
1956
  };
1957
+ // eslint-disable-next-line unicorn/no-immediate-mutation -- ES3 syntax limitation
1899
1958
  iteratorWithReturn[ITERATOR] = function () {
1900
1959
  return this;
1901
1960
  };
@@ -1910,6 +1969,7 @@ var WatermarkPlus = (function (exports) {
1910
1969
  var ITERATION_SUPPORT = false;
1911
1970
  try {
1912
1971
  var object = {};
1972
+ // eslint-disable-next-line unicorn/no-immediate-mutation -- ES3 syntax limitation
1913
1973
  object[ITERATOR] = function () {
1914
1974
  return {
1915
1975
  next: function () {
@@ -2281,8 +2341,7 @@ var WatermarkPlus = (function (exports) {
2281
2341
  hasRequiredEnvironmentIsIos = 1;
2282
2342
  var userAgent = requireEnvironmentUserAgent();
2283
2343
 
2284
- // eslint-disable-next-line redos/no-vulnerable -- safe
2285
- environmentIsIos = /(?:ipad|iphone|ipod).*applewebkit/i.test(userAgent);
2344
+ environmentIsIos = /ipad|iphone|ipod/i.test(userAgent) && /applewebkit/i.test(userAgent);
2286
2345
  return environmentIsIos;
2287
2346
  }
2288
2347
 
@@ -3042,7 +3101,9 @@ var WatermarkPlus = (function (exports) {
3042
3101
  var iterator, iterFn, index, length, result, next, step;
3043
3102
 
3044
3103
  var stop = function (condition) {
3045
- if (iterator) iteratorClose(iterator, 'normal');
3104
+ var $iterator = iterator;
3105
+ iterator = undefined;
3106
+ if ($iterator) iteratorClose($iterator, 'normal');
3046
3107
  return new Result(true, condition);
3047
3108
  };
3048
3109
 
@@ -3072,10 +3133,13 @@ var WatermarkPlus = (function (exports) {
3072
3133
 
3073
3134
  next = IS_RECORD ? iterable.next : iterator.next;
3074
3135
  while (!(step = call(next, iterator)).done) {
3136
+ // `IteratorValue` errors should propagate without closing the iterator
3137
+ var value = step.value;
3075
3138
  try {
3076
- result = callFn(step.value);
3139
+ result = callFn(value);
3077
3140
  } catch (error) {
3078
- iteratorClose(iterator, 'throw', error);
3141
+ if (iterator) iteratorClose(iterator, 'throw', error);
3142
+ else throw error;
3079
3143
  }
3080
3144
  if (typeof result == 'object' && result && isPrototypeOf(ResultPrototype, result)) return result;
3081
3145
  } return new Result(false);
@@ -3492,9 +3556,15 @@ var WatermarkPlus = (function (exports) {
3492
3556
  return !Array(1).includes();
3493
3557
  });
3494
3558
 
3559
+ // Safari 26.4- bug
3560
+ var BROKEN_ON_SPARSE_WITH_FROM_INDEX = fails(function () {
3561
+ // eslint-disable-next-line no-sparse-arrays, es/no-array-prototype-includes -- detection
3562
+ return [, 1].includes(undefined, 1);
3563
+ });
3564
+
3495
3565
  // `Array.prototype.includes` method
3496
3566
  // https://tc39.es/ecma262/#sec-array.prototype.includes
3497
- $({ target: 'Array', proto: true, forced: BROKEN_ON_SPARSE }, {
3567
+ $({ target: 'Array', proto: true, forced: BROKEN_ON_SPARSE || BROKEN_ON_SPARSE_WITH_FROM_INDEX }, {
3498
3568
  includes: function includes(el /* , fromIndex = 0 */) {
3499
3569
  return $includes(this, el, arguments.length > 1 ? arguments[1] : undefined);
3500
3570
  }
@@ -5208,17 +5278,18 @@ var WatermarkPlus = (function (exports) {
5208
5278
  return [2 /*return*/];
5209
5279
  }
5210
5280
  this.isCreating = true;
5281
+ _h.label = 1;
5282
+ case 1:
5283
+ _h.trys.push([1, , 3, 4]);
5211
5284
  if (!this.validateUnique()) {
5212
- this.isCreating = false;
5213
5285
  return [2 /*return*/];
5214
5286
  }
5215
5287
  if (!this.validateContent()) {
5216
- this.isCreating = false;
5217
5288
  return [2 /*return*/];
5218
5289
  }
5219
5290
  firstDraw = isUndefined(this.watermarkDom);
5220
5291
  return [4 /*yield*/, ((_a = this.watermarkCanvas) === null || _a === void 0 ? void 0 : _a.draw())];
5221
- case 1:
5292
+ case 2:
5222
5293
  _h.sent();
5223
5294
  this.layoutCanvas = renderLayout(this.options, (_b = this.watermarkCanvas) === null || _b === void 0 ? void 0 : _b.getCanvas());
5224
5295
  image = convertImage(this.layoutCanvas);
@@ -5228,22 +5299,25 @@ var WatermarkPlus = (function (exports) {
5228
5299
  this.watermarkDom.__WATERMARK__ = 'watermark';
5229
5300
  this.watermarkDom.__WATERMARK__INSTANCE__ = this;
5230
5301
  parentElementType = this.checkParentElementType();
5231
- this.watermarkDom.style.cssText = "\n z-index:".concat(this.options.zIndex, "!important;display:block!important;visibility:visible!important;transform:none!important;scale:none!important;\n ").concat(parentElementType === 'custom' ? 'top:0!important;bottom:0!important;left:0!important;right:0!important;height:100%!important;pointer-events:none!important;position:absolute!important;' : 'position:relative!important;', "\n ");
5302
+ this.watermarkDom.style.cssText = "\n z-index:".concat(this.options.zIndex, "!important;display:block!important;visibility:visible!important;transform:none!important;scale:none!important;\n ").concat(parentElementType === 'custom' ? 'top:0!important;bottom:0!important;left:0!important;right:0!important;height:100%!important;pointer-events:none!important;position:absolute!important;' : 'position:relative!important;', "\n ");
5232
5303
  backgroundSize = generateBackgroundSize(this.options);
5233
- watermarkInnerDom.style.cssText = "\n display:block!important;visibility:visible!important;pointer-events:none;top:0;bottom:0;left:0;right:0;transform:none!important;scale:none!important;\n position:".concat(parentElementType === 'root' ? 'fixed' : 'absolute', "!important;-webkit-print-color-adjust:exact!important;width:100%!important;height:100%!important;\n z-index:").concat(this.options.zIndex, "!important;background-image:url(").concat(image, ")!important;background-repeat:").concat(this.options.backgroundRepeat, "!important;\n background-size:").concat(backgroundSize[0], "px ").concat(backgroundSize[1], "px!important;background-position:").concat(this.options.backgroundPosition, ";\n ").concat(generateAnimationStyle(this.options.movable, this.options.backgroundRepeat), "\n ");
5304
+ watermarkInnerDom.style.cssText = "\n display:block!important;visibility:visible!important;pointer-events:none;top:0;bottom:0;left:0;right:0;transform:none!important;scale:none!important;\n position:".concat(parentElementType === 'root' ? 'fixed' : 'absolute', "!important;-webkit-print-color-adjust:exact!important;width:100%!important;height:100%!important;\n z-index:").concat(this.options.zIndex, "!important;background-image:url(").concat(image, ")!important;background-repeat:").concat(this.options.backgroundRepeat, "!important;\n background-size:").concat(backgroundSize[0], "px ").concat(backgroundSize[1], "px!important;background-position:").concat(this.options.backgroundPosition, ";\n ").concat(generateAnimationStyle(this.options.movable, this.options.backgroundRepeat), "\n ");
5234
5305
  this.watermarkDom.appendChild(watermarkInnerDom);
5235
5306
  this.parentElement.appendChild(this.watermarkDom);
5236
5307
  if (this.options.mutationObserve) {
5237
5308
  try {
5238
- this.bindMutationObserve();
5309
+ this.bindMutationObserver();
5239
5310
  }
5240
5311
  catch (_j) {
5241
5312
  (_e = (_d = this.options).onObserveError) === null || _e === void 0 ? void 0 : _e.call(_d);
5242
5313
  }
5243
5314
  }
5244
5315
  firstDraw && ((_g = (_f = this.options).onSuccess) === null || _g === void 0 ? void 0 : _g.call(_f));
5316
+ return [3 /*break*/, 4];
5317
+ case 3:
5245
5318
  this.isCreating = false;
5246
- return [2 /*return*/];
5319
+ return [7 /*endfinally*/];
5320
+ case 4: return [2 /*return*/];
5247
5321
  }
5248
5322
  });
5249
5323
  });
@@ -5266,7 +5340,7 @@ var WatermarkPlus = (function (exports) {
5266
5340
  var _a, _b, _c, _d, _e, _f, _g, _h;
5267
5341
  (_b = (_a = this.options).onBeforeDestroy) === null || _b === void 0 ? void 0 : _b.call(_a);
5268
5342
  (_c = this.observer) === null || _c === void 0 ? void 0 : _c.disconnect();
5269
- (_d = this.parentObserve) === null || _d === void 0 ? void 0 : _d.disconnect();
5343
+ (_d = this.parentObserver) === null || _d === void 0 ? void 0 : _d.disconnect();
5270
5344
  (_f = (_e = this.watermarkDom) === null || _e === void 0 ? void 0 : _e.parentNode) === null || _f === void 0 ? void 0 : _f.removeChild(this.watermarkDom);
5271
5345
  (_h = (_g = this.options).onDestroyed) === null || _h === void 0 ? void 0 : _h.call(_g);
5272
5346
  };
@@ -5326,64 +5400,56 @@ var WatermarkPlus = (function (exports) {
5326
5400
  }
5327
5401
  return 'custom';
5328
5402
  };
5329
- Watermark.prototype.bindMutationObserve = function () {
5330
- var _this = this;
5331
- if (!this.watermarkDom) {
5332
- return;
5333
- }
5334
- this.observer = new MutationObserver(function (mutationsList) { return __awaiter(_this, void 0, void 0, function () {
5335
- return __generator(this, function (_a) {
5336
- switch (_a.label) {
5403
+ Watermark.prototype.recreateOnMutation = function () {
5404
+ return __awaiter(this, void 0, void 0, function () {
5405
+ var _b, _c;
5406
+ return __generator(this, function (_d) {
5407
+ switch (_d.label) {
5337
5408
  case 0:
5338
- if (!(mutationsList.length > 0)) return [3 /*break*/, 2];
5409
+ _d.trys.push([0, 2, , 3]);
5339
5410
  this.remove();
5340
5411
  return [4 /*yield*/, this.create()];
5341
5412
  case 1:
5342
- _a.sent();
5343
- _a.label = 2;
5344
- case 2: return [2 /*return*/];
5413
+ _d.sent();
5414
+ return [3 /*break*/, 3];
5415
+ case 2:
5416
+ _d.sent();
5417
+ (_c = (_b = this.options).onObserveError) === null || _c === void 0 ? void 0 : _c.call(_b);
5418
+ return [3 /*break*/, 3];
5419
+ case 3: return [2 /*return*/];
5345
5420
  }
5346
5421
  });
5347
- }); });
5422
+ });
5423
+ };
5424
+ Watermark.prototype.bindMutationObserver = function () {
5425
+ var _this = this;
5426
+ if (!this.watermarkDom) {
5427
+ return;
5428
+ }
5429
+ this.observer = new MutationObserver(function (mutationsList) {
5430
+ if (mutationsList.length > 0) {
5431
+ void _this.recreateOnMutation();
5432
+ }
5433
+ });
5348
5434
  this.observer.observe(this.watermarkDom, {
5349
5435
  attributes: true, // 属性的变动
5436
+ attributeFilter: ['style', 'class', 'hidden', 'id'], // 仅监听会影响水印展示或标识的属性
5350
5437
  childList: true, // 子节点的变动(指新增,删除或者更改)
5351
5438
  subtree: true, // 布尔值,表示是否将该观察器应用于该节点的所有后代节点。
5352
5439
  characterData: true, // 节点内容或节点文本的变动。
5353
5440
  });
5354
- this.parentObserve = new MutationObserver(function (mutationsList) { return __awaiter(_this, void 0, void 0, function () {
5355
- var _i, mutationsList_1, item;
5356
- var _a;
5357
- return __generator(this, function (_b) {
5358
- switch (_b.label) {
5359
- case 0:
5360
- _i = 0, mutationsList_1 = mutationsList;
5361
- _b.label = 1;
5362
- case 1:
5363
- if (!(_i < mutationsList_1.length)) return [3 /*break*/, 4];
5364
- item = mutationsList_1[_i];
5365
- if (!((item === null || item === void 0 ? void 0 : item.target) === this.watermarkDom ||
5366
- ((_a = item === null || item === void 0 ? void 0 : item.removedNodes) === null || _a === void 0 ? void 0 : _a[0]) === this.watermarkDom ||
5367
- (item.type === 'childList' &&
5368
- item.target === this.parentElement &&
5369
- item.target.lastChild !== this.watermarkDom))) return [3 /*break*/, 3];
5370
- this.remove();
5371
- return [4 /*yield*/, this.create()];
5372
- case 2:
5373
- _b.sent();
5374
- _b.label = 3;
5375
- case 3:
5376
- _i++;
5377
- return [3 /*break*/, 1];
5378
- case 4: return [2 /*return*/];
5379
- }
5380
- });
5381
- }); });
5382
- this.parentObserve.observe(this.parentElement, {
5383
- attributes: true, // 属性的变动
5441
+ this.parentObserver = new MutationObserver(function (mutationsList) {
5442
+ var watermarkDom = _this.watermarkDom;
5443
+ if (!watermarkDom) {
5444
+ return;
5445
+ }
5446
+ var watermarkRemoved = mutationsList.some(function (item) { return Array.from(item.removedNodes).includes(watermarkDom); });
5447
+ if (watermarkRemoved) {
5448
+ void _this.recreateOnMutation();
5449
+ }
5450
+ });
5451
+ this.parentObserver.observe(this.parentElement, {
5384
5452
  childList: true, // 子节点的变动(指新增,删除或者更改)
5385
- subtree: true, // 布尔值,表示是否将该观察器应用于该节点的所有后代节点。
5386
- characterData: true, // 节点内容或节点文本的变动。
5387
5453
  });
5388
5454
  };
5389
5455
  return Watermark;