watermark-js-plus 1.5.3 → 1.5.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.
- package/dist/ie/index.cjs.js +25 -20
- package/dist/ie/index.cjs.js.map +1 -1
- package/dist/ie/index.cjs.min.js +1 -1
- package/dist/ie/index.esm.js +25 -20
- package/dist/ie/index.esm.js.map +1 -1
- package/dist/ie/index.esm.min.js +1 -1
- package/dist/ie/index.iife.js +25 -20
- package/dist/ie/index.iife.js.map +1 -1
- package/dist/ie/index.iife.min.js +1 -1
- package/dist/ie/index.umd.js +25 -20
- package/dist/ie/index.umd.js.map +1 -1
- package/dist/ie/index.umd.min.js +1 -1
- package/dist/ie/types/src/core/watermark.d.ts +1 -1
- package/dist/ie/types/src/types/index.d.ts +1 -0
- package/dist/ie/types/src/utils/protection.d.ts +2 -0
- package/dist/index.cjs.js +22 -17
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.cjs.min.js +1 -1
- package/dist/index.esm.js +22 -17
- package/dist/index.esm.js.map +1 -1
- package/dist/index.esm.min.js +1 -1
- package/dist/index.iife.js +22 -17
- package/dist/index.iife.js.map +1 -1
- package/dist/index.iife.min.js +1 -1
- package/dist/index.umd.js +22 -17
- package/dist/index.umd.js.map +1 -1
- package/dist/index.umd.min.js +1 -1
- package/dist/types/src/core/watermark.d.ts +1 -1
- package/dist/types/src/types/index.d.ts +1 -0
- package/dist/types/src/utils/protection.d.ts +2 -0
- package/package.json +18 -18
- package/dist/ie/types/src/utils/bootstrap.d.ts +0 -2
- package/dist/types/src/utils/bootstrap.d.ts +0 -2
package/dist/ie/index.cjs.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* watermark-js-plus v1.5.
|
|
2
|
+
* watermark-js-plus v1.5.5
|
|
3
3
|
* (c) 2022-2024 Michael Sun
|
|
4
4
|
* Released under the MIT License.
|
|
5
5
|
*/
|
|
@@ -322,10 +322,10 @@ var SHARED = '__core-js_shared__';
|
|
|
322
322
|
var store$3 = sharedStore.exports = globalThis$d[SHARED] || defineGlobalProperty$2(SHARED, {});
|
|
323
323
|
|
|
324
324
|
(store$3.versions || (store$3.versions = [])).push({
|
|
325
|
-
version: '3.38.
|
|
325
|
+
version: '3.38.1',
|
|
326
326
|
mode: 'global',
|
|
327
327
|
copyright: '© 2014-2024 Denis Pushkarev (zloirock.ru)',
|
|
328
|
-
license: 'https://github.com/zloirock/core-js/blob/v3.38.
|
|
328
|
+
license: 'https://github.com/zloirock/core-js/blob/v3.38.1/LICENSE',
|
|
329
329
|
source: 'https://github.com/zloirock/core-js'
|
|
330
330
|
});
|
|
331
331
|
|
|
@@ -2045,7 +2045,7 @@ if (FORCED_PROMISE_CONSTRUCTOR$4) {
|
|
|
2045
2045
|
reactions: new Queue(),
|
|
2046
2046
|
rejection: false,
|
|
2047
2047
|
state: PENDING,
|
|
2048
|
-
value:
|
|
2048
|
+
value: null
|
|
2049
2049
|
});
|
|
2050
2050
|
};
|
|
2051
2051
|
|
|
@@ -3289,8 +3289,15 @@ var createSVGElement = function (tagName, attrs, namespaceURI) {
|
|
|
3289
3289
|
var getMultiLineData = function (ctx, text, maxWidth) {
|
|
3290
3290
|
var result = [];
|
|
3291
3291
|
var str = '';
|
|
3292
|
+
var word = '';
|
|
3292
3293
|
for (var i = 0, len = text.length; i < len; i++) {
|
|
3293
|
-
|
|
3294
|
+
word = text.charAt(i);
|
|
3295
|
+
if (word === '\n') {
|
|
3296
|
+
result.push(str);
|
|
3297
|
+
str = '';
|
|
3298
|
+
continue;
|
|
3299
|
+
}
|
|
3300
|
+
str += word;
|
|
3294
3301
|
if (ctx.measureText(str).width > maxWidth) {
|
|
3295
3302
|
result.push(str.substring(0, str.length - 1));
|
|
3296
3303
|
str = '';
|
|
@@ -3402,7 +3409,10 @@ function convertImgToBase64(bodyElement) {
|
|
|
3402
3409
|
});
|
|
3403
3410
|
}
|
|
3404
3411
|
var convertSVGToImage = function (svg) {
|
|
3405
|
-
var richContent = svg.outerHTML
|
|
3412
|
+
var richContent = svg.outerHTML
|
|
3413
|
+
.replace(/<(img|br|input|hr|embed)(.*?)>/g, '<$1$2/>')
|
|
3414
|
+
.replace(/\n/g, '').replace(/\t/g, '')
|
|
3415
|
+
.replace(/#/g, '%23');
|
|
3406
3416
|
return "data:image/svg+xml;charset=utf-8,".concat(richContent);
|
|
3407
3417
|
};
|
|
3408
3418
|
var getValue = function (v1, v2) {
|
|
@@ -3459,6 +3469,7 @@ var initialOptions = {
|
|
|
3459
3469
|
globalAlpha: 0.5,
|
|
3460
3470
|
mode: 'default',
|
|
3461
3471
|
mutationObserve: true,
|
|
3472
|
+
monitorProtection: false,
|
|
3462
3473
|
movable: false,
|
|
3463
3474
|
parent: 'body',
|
|
3464
3475
|
onSuccess: function () { },
|
|
@@ -3711,8 +3722,11 @@ var generateRecommendOptions = function (canvas, options, args) {
|
|
|
3711
3722
|
return result;
|
|
3712
3723
|
};
|
|
3713
3724
|
|
|
3714
|
-
var
|
|
3715
|
-
if (typeof window
|
|
3725
|
+
var protection = (function (need) {
|
|
3726
|
+
if (typeof window === 'undefined') {
|
|
3727
|
+
return;
|
|
3728
|
+
}
|
|
3729
|
+
if (need) {
|
|
3716
3730
|
Object.defineProperty(window, 'MutationObserver', {
|
|
3717
3731
|
writable: false,
|
|
3718
3732
|
configurable: false
|
|
@@ -4080,7 +4094,7 @@ var Watermark = /** @class */ (function () {
|
|
|
4080
4094
|
this.options = __assign(__assign({}, initialOptions), args);
|
|
4081
4095
|
this.changeParentElement(this.options.parent);
|
|
4082
4096
|
this.watermarkCanvas = new WatermarkCanvas(this.props, this.options);
|
|
4083
|
-
|
|
4097
|
+
protection(this.options.monitorProtection);
|
|
4084
4098
|
}
|
|
4085
4099
|
/**
|
|
4086
4100
|
* Change watermark options
|
|
@@ -4097,6 +4111,7 @@ var Watermark = /** @class */ (function () {
|
|
|
4097
4111
|
switch (_a.label) {
|
|
4098
4112
|
case 0:
|
|
4099
4113
|
this.initConfigData(args, mode);
|
|
4114
|
+
protection(this.options.monitorProtection);
|
|
4100
4115
|
if (!redraw) return [3 /*break*/, 2];
|
|
4101
4116
|
this.remove();
|
|
4102
4117
|
return [4 /*yield*/, this.create()];
|
|
@@ -4172,16 +4187,7 @@ var Watermark = /** @class */ (function () {
|
|
|
4172
4187
|
Watermark.prototype.check = function () {
|
|
4173
4188
|
return __awaiter(this, void 0, void 0, function () {
|
|
4174
4189
|
return __generator(this, function (_a) {
|
|
4175
|
-
|
|
4176
|
-
case 0:
|
|
4177
|
-
if (!!this.parentElement.contains(this.watermarkDom)) return [3 /*break*/, 2];
|
|
4178
|
-
this.remove();
|
|
4179
|
-
return [4 /*yield*/, this.create()];
|
|
4180
|
-
case 1:
|
|
4181
|
-
_a.sent();
|
|
4182
|
-
_a.label = 2;
|
|
4183
|
-
case 2: return [2 /*return*/];
|
|
4184
|
-
}
|
|
4190
|
+
return [2 /*return*/, this.parentElement.contains(this.watermarkDom)];
|
|
4185
4191
|
});
|
|
4186
4192
|
});
|
|
4187
4193
|
};
|
|
@@ -4243,7 +4249,6 @@ var Watermark = /** @class */ (function () {
|
|
|
4243
4249
|
case 'text':
|
|
4244
4250
|
return this.options.content.length > 0;
|
|
4245
4251
|
}
|
|
4246
|
-
return false;
|
|
4247
4252
|
};
|
|
4248
4253
|
Watermark.prototype.checkParentElementType = function () {
|
|
4249
4254
|
if (['html', 'body'].includes(this.parentElement.tagName.toLocaleLowerCase())) {
|