@univerjs/watermark 0.6.0 → 0.6.1
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/lib/cjs/facade.js +1 -1
- package/lib/cjs/index.js +1 -1
- package/lib/es/facade.js +15 -8
- package/lib/es/index.js +99 -175
- package/lib/types/common/const.d.ts +1 -3
- package/lib/types/controllers/config.schema.d.ts +1 -1
- package/lib/types/facade/f-univer.d.ts +6 -1
- package/lib/types/index.d.ts +1 -4
- package/lib/types/services/watermark.service.d.ts +1 -1
- package/lib/umd/facade.js +1 -1
- package/lib/umd/index.js +1 -1
- package/package.json +6 -6
- package/lib/types/common/type.d.ts +0 -59
- package/lib/types/util.d.ts +0 -7
- package/lib/types/views/extensions/watermark-layer.d.ts +0 -11
package/lib/cjs/facade.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const
|
|
1
|
+
"use strict";const t=require("@univerjs/core/facade"),e=require("@univerjs/engine-render"),r=require("@univerjs/watermark");class k extends t.FUniver{addWatermark(a,n){const m=this._injector.get(r.WatermarkService);if(a===e.IWatermarkTypeEnum.Text)m.updateWatermarkConfig({type:e.IWatermarkTypeEnum.Text,config:{text:{...r.WatermarkTextBaseConfig,...n}}});else if(a===e.IWatermarkTypeEnum.Image)m.updateWatermarkConfig({type:e.IWatermarkTypeEnum.Image,config:{image:{...r.WatermarkImageBaseConfig,...n}}});else throw new Error("Unknown watermark type");return this}deleteWatermark(){return this._injector.get(r.WatermarkService).deleteWatermarkConfig(),this}}class s{get IWatermarkTypeEnum(){return e.IWatermarkTypeEnum}}t.FUniver.extend(k);t.FEnum.extend(s);
|
package/lib/cjs/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var E=Object.defineProperty;var I=(a,e,r)=>e in a?E(a,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):a[e]=r;var _=(a,e,r)=>I(a,typeof e!="symbol"?e+"":e,r);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("@univerjs/core"),o=require("@univerjs/engine-render"),f=require("rxjs"),d=["image/png","image/jpeg","image/jpg","image/bmp"],v={content:"",fontSize:16,color:"rgb(0,0,0)",bold:!1,italic:!1,direction:"ltr",x:60,y:36,repeat:!0,spacingX:200,spacingY:100,rotate:0,opacity:.15},u={url:"",width:100,height:100,maintainAspectRatio:!0,originRatio:1,x:60,y:36,repeat:!0,spacingX:200,spacingY:100,rotate:0,opacity:.15},R={name:!0,email:!1,phone:!1,uid:!1,fontSize:16,color:"rgb(0,0,0)",bold:!1,italic:!1,direction:"ltr",x:60,y:60,repeat:!0,spacingX:200,spacingY:100,rotate:-30,opacity:.15},p="watermark.config",h={};var W=Object.getOwnPropertyDescriptor,A=(a,e,r,t)=>{for(var i=t>1?void 0:t?W(e,r):e,s=a.length-1,c;s>=0;s--)(c=a[s])&&(i=c(i)||i);return i},k=(a,e)=>(r,t)=>e(r,t,a);exports.WatermarkService=class extends n.Disposable{constructor(r){super();_(this,"_updateConfig$",new f.Subject);_(this,"updateConfig$",this._updateConfig$.asObservable());_(this,"_refresh$",new f.Subject);_(this,"refresh$",this._refresh$.asObservable());this._localStorageService=r}async getWatermarkConfig(){return await this._localStorageService.getItem(o.UNIVER_WATERMARK_STORAGE_KEY)}updateWatermarkConfig(r){this._localStorageService.setItem(o.UNIVER_WATERMARK_STORAGE_KEY,r),this._updateConfig$.next(r)}deleteWatermarkConfig(){this._localStorageService.removeItem(o.UNIVER_WATERMARK_STORAGE_KEY),this._updateConfig$.next(null)}refresh(){this._refresh$.next(Math.random())}dispose(){this._refresh$.complete(),this._updateConfig$.complete()}};exports.WatermarkService=A([k(0,n.Inject(n.ILocalStorageService))],exports.WatermarkService);var y=Object.getOwnPropertyDescriptor,T=(a,e,r,t)=>{for(var i=t>1?void 0:t?y(e,r):e,s=a.length-1,c;s>=0;s--)(c=a[s])&&(i=c(i)||i);return i},m=(a,e)=>(r,t)=>e(r,t,a);let S=class extends n.RxDisposable{constructor(e,r,t,i){super();_(this,"_watermarkLayer");this._context=e,this._watermarkService=r,this._localStorageService=t,this._userManagerService=i,this._watermarkLayer=new o.WatermarkLayer(e.scene,[],o.UNIVER_WATERMARK_LAYER_INDEX),this._initAddRender(),this._initWatermarkUpdate(),this._initWatermarkConfig()}_initAddRender(){const{scene:e}=this._context;e.addLayer(this._watermarkLayer)}async _initWatermarkConfig(){var r;const e=await this._localStorageService.getItem(o.UNIVER_WATERMARK_STORAGE_KEY);e&&(this._watermarkService.updateWatermarkConfig(e),(r=this._context.mainComponent)==null||r.makeDirty())}_initWatermarkUpdate(){this.disposeWithMe(this._watermarkService.updateConfig$.subscribe(e=>{var r,t;if(!e){this._watermarkLayer.updateConfig(),(r=this._context.mainComponent)==null||r.makeDirty();return}e.type===o.IWatermarkTypeEnum.UserInfo?this._watermarkLayer.updateConfig(e,this._userManagerService.getCurrentUser()):this._watermarkLayer.updateConfig(e),(t=this._context.mainComponent)==null||t.makeDirty()}))}};S=T([m(1,n.Inject(exports.WatermarkService)),m(2,n.Inject(n.ILocalStorageService)),m(3,n.Inject(n.UserManagerService))],S);var C=Object.getOwnPropertyDescriptor,M=(a,e,r,t)=>{for(var i=t>1?void 0:t?C(e,r):e,s=a.length-1,c;s>=0;s--)(c=a[s])&&(i=c(i)||i);return i},g=(a,e)=>(r,t)=>e(r,t,a);const U="UNIVER_WATERMARK_PLUGIN";var l;exports.UniverWatermarkPlugin=(l=class extends n.Plugin{constructor(e=h,r,t,i,s){super(),this._config=e,this._injector=r,this._configService=t,this._renderManagerSrv=i,this._localStorageService=s;const{...c}=n.merge({},h,this._config);this._configService.setConfig(p,c),this._initWatermarkStorage(),this._initDependencies()}async _initWatermarkStorage(){const e=this._configService.getConfig(p);if(!e)return;const{userWatermarkSettings:r,textWatermarkSettings:t,imageWatermarkSettings:i}=e;if(r)this._localStorageService.setItem(o.UNIVER_WATERMARK_STORAGE_KEY,{type:o.IWatermarkTypeEnum.UserInfo,config:{userInfo:n.merge({},R,r)}});else if(t)this._localStorageService.setItem(o.UNIVER_WATERMARK_STORAGE_KEY,{type:o.IWatermarkTypeEnum.Text,config:{text:n.merge({},v,t)}});else if(i)this._localStorageService.setItem(o.UNIVER_WATERMARK_STORAGE_KEY,{type:o.IWatermarkTypeEnum.Image,config:{image:n.merge({},u,i)}});else{const s=await this._localStorageService.getItem(o.UNIVER_WATERMARK_STORAGE_KEY);(s==null?void 0:s.type)===o.IWatermarkTypeEnum.UserInfo&&this._localStorageService.removeItem(o.UNIVER_WATERMARK_STORAGE_KEY)}}_initDependencies(){[[exports.WatermarkService]].forEach(e=>{this._injector.add(e)})}onRendered(){this._injector.get(exports.WatermarkService),this._initRenderDependencies()}_initRenderDependencies(){[[S]].forEach(e=>{this._renderManagerSrv.registerRenderModule(n.UniverInstanceType.UNIVER_SHEET,e),this._renderManagerSrv.registerRenderModule(n.UniverInstanceType.UNIVER_DOC,e)})}},_(l,"pluginName",U),l);exports.UniverWatermarkPlugin=M([g(1,n.Inject(n.Injector)),g(2,n.IConfigService),g(3,o.IRenderManagerService),g(4,n.Inject(n.ILocalStorageService))],exports.UniverWatermarkPlugin);exports.WATERMARK_IMAGE_ALLOW_IMAGE_LIST=d;exports.WatermarkImageBaseConfig=u;exports.WatermarkTextBaseConfig=v;exports.WatermarkUserInfoBaseConfig=R;
|
package/lib/es/facade.js
CHANGED
|
@@ -1,14 +1,15 @@
|
|
|
1
|
-
import { FUniver as
|
|
2
|
-
import {
|
|
3
|
-
|
|
1
|
+
import { FUniver as n, FEnum as o } from "@univerjs/core/facade";
|
|
2
|
+
import { IWatermarkTypeEnum as e } from "@univerjs/engine-render";
|
|
3
|
+
import { WatermarkService as m, WatermarkTextBaseConfig as k, WatermarkImageBaseConfig as s } from "@univerjs/watermark";
|
|
4
|
+
class g extends n {
|
|
4
5
|
addWatermark(r, t) {
|
|
5
|
-
const a = this._injector.get(
|
|
6
|
+
const a = this._injector.get(m);
|
|
6
7
|
if (r === e.Text)
|
|
7
8
|
a.updateWatermarkConfig({
|
|
8
9
|
type: e.Text,
|
|
9
10
|
config: {
|
|
10
11
|
text: {
|
|
11
|
-
...
|
|
12
|
+
...k,
|
|
12
13
|
...t
|
|
13
14
|
}
|
|
14
15
|
}
|
|
@@ -18,7 +19,7 @@ class k extends m {
|
|
|
18
19
|
type: e.Image,
|
|
19
20
|
config: {
|
|
20
21
|
image: {
|
|
21
|
-
...
|
|
22
|
+
...s,
|
|
22
23
|
...t
|
|
23
24
|
}
|
|
24
25
|
}
|
|
@@ -28,7 +29,13 @@ class k extends m {
|
|
|
28
29
|
return this;
|
|
29
30
|
}
|
|
30
31
|
deleteWatermark() {
|
|
31
|
-
return this._injector.get(
|
|
32
|
+
return this._injector.get(m).deleteWatermarkConfig(), this;
|
|
32
33
|
}
|
|
33
34
|
}
|
|
34
|
-
|
|
35
|
+
class W {
|
|
36
|
+
get IWatermarkTypeEnum() {
|
|
37
|
+
return e;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
n.extend(g);
|
|
41
|
+
o.extend(W);
|
package/lib/es/index.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
import { Inject as
|
|
5
|
-
import {
|
|
6
|
-
import { Subject as
|
|
7
|
-
const
|
|
1
|
+
var y = Object.defineProperty;
|
|
2
|
+
var R = (t, e, r) => e in t ? y(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r;
|
|
3
|
+
var c = (t, e, r) => R(t, typeof e != "symbol" ? e + "" : e, r);
|
|
4
|
+
import { Inject as g, ILocalStorageService as v, Disposable as W, UserManagerService as w, RxDisposable as E, Injector as x, IConfigService as A, Plugin as M, merge as m, UniverInstanceType as S } from "@univerjs/core";
|
|
5
|
+
import { UNIVER_WATERMARK_STORAGE_KEY as s, WatermarkLayer as U, UNIVER_WATERMARK_LAYER_INDEX as $, IWatermarkTypeEnum as _, IRenderManagerService as b } from "@univerjs/engine-render";
|
|
6
|
+
import { Subject as u } from "rxjs";
|
|
7
|
+
const H = ["image/png", "image/jpeg", "image/jpg", "image/bmp"], D = {
|
|
8
8
|
content: "",
|
|
9
9
|
fontSize: 16,
|
|
10
10
|
color: "rgb(0,0,0)",
|
|
@@ -18,7 +18,7 @@ const _ = "UNIVER_WATERMARK_STORAGE_KEY", F = 10, pe = ["image/png", "image/jpeg
|
|
|
18
18
|
spacingY: 100,
|
|
19
19
|
rotate: 0,
|
|
20
20
|
opacity: 0.15
|
|
21
|
-
},
|
|
21
|
+
}, L = {
|
|
22
22
|
url: "",
|
|
23
23
|
width: 100,
|
|
24
24
|
height: 100,
|
|
@@ -31,7 +31,7 @@ const _ = "UNIVER_WATERMARK_STORAGE_KEY", F = 10, pe = ["image/png", "image/jpeg
|
|
|
31
31
|
spacingY: 100,
|
|
32
32
|
rotate: 0,
|
|
33
33
|
opacity: 0.15
|
|
34
|
-
},
|
|
34
|
+
}, O = {
|
|
35
35
|
name: !0,
|
|
36
36
|
email: !1,
|
|
37
37
|
phone: !1,
|
|
@@ -48,31 +48,29 @@ const _ = "UNIVER_WATERMARK_STORAGE_KEY", F = 10, pe = ["image/png", "image/jpeg
|
|
|
48
48
|
spacingY: 100,
|
|
49
49
|
rotate: -30,
|
|
50
50
|
opacity: 0.15
|
|
51
|
-
};
|
|
52
|
-
var
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
let W = class extends Y {
|
|
60
|
-
constructor(t) {
|
|
51
|
+
}, I = "watermark.config", C = {};
|
|
52
|
+
var P = Object.getOwnPropertyDescriptor, j = (t, e, r, a) => {
|
|
53
|
+
for (var i = a > 1 ? void 0 : a ? P(e, r) : e, n = t.length - 1, o; n >= 0; n--)
|
|
54
|
+
(o = t[n]) && (i = o(i) || i);
|
|
55
|
+
return i;
|
|
56
|
+
}, N = (t, e) => (r, a) => e(r, a, t);
|
|
57
|
+
let l = class extends W {
|
|
58
|
+
constructor(e) {
|
|
61
59
|
super();
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
this._localStorageService =
|
|
60
|
+
c(this, "_updateConfig$", new u());
|
|
61
|
+
c(this, "updateConfig$", this._updateConfig$.asObservable());
|
|
62
|
+
c(this, "_refresh$", new u());
|
|
63
|
+
c(this, "refresh$", this._refresh$.asObservable());
|
|
64
|
+
this._localStorageService = e;
|
|
67
65
|
}
|
|
68
66
|
async getWatermarkConfig() {
|
|
69
|
-
return await this._localStorageService.getItem(
|
|
67
|
+
return await this._localStorageService.getItem(s);
|
|
70
68
|
}
|
|
71
|
-
updateWatermarkConfig(
|
|
72
|
-
this._localStorageService.setItem(
|
|
69
|
+
updateWatermarkConfig(e) {
|
|
70
|
+
this._localStorageService.setItem(s, e), this._updateConfig$.next(e);
|
|
73
71
|
}
|
|
74
72
|
deleteWatermarkConfig() {
|
|
75
|
-
this._localStorageService.removeItem(
|
|
73
|
+
this._localStorageService.removeItem(s), this._updateConfig$.next(null);
|
|
76
74
|
}
|
|
77
75
|
refresh() {
|
|
78
76
|
this._refresh$.next(Math.random());
|
|
@@ -81,196 +79,122 @@ let W = class extends Y {
|
|
|
81
79
|
this._refresh$.complete(), this._updateConfig$.complete();
|
|
82
80
|
}
|
|
83
81
|
};
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
],
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
return;
|
|
95
|
-
let c = "";
|
|
96
|
-
if (p && (c += `${r.name} `), !c)
|
|
97
|
-
return;
|
|
98
|
-
e.save(), e.globalAlpha = m, e.direction = o;
|
|
99
|
-
let d = "";
|
|
100
|
-
if (u && (d += "italic "), k && (d += "bold "), d += `${I}px Arial`, e.font = d, e.fillStyle = y, n) {
|
|
101
|
-
const f = e.canvas.width, h = e.canvas.height;
|
|
102
|
-
for (let A = a; A < h; A += I + S)
|
|
103
|
-
for (let M = i; M < f; M += e.measureText(c).width + s)
|
|
104
|
-
e.save(), e.translate(M, A), e.rotate(Math.PI / 180 * v), e.fillText(c, 0, 0), e.restore();
|
|
105
|
-
} else
|
|
106
|
-
e.save(), e.translate(i, a), e.rotate(Math.PI / 180 * v), e.fillText(c, 0, 0), e.restore();
|
|
107
|
-
e.restore();
|
|
108
|
-
}
|
|
109
|
-
function ae(e, t) {
|
|
110
|
-
const { x: r, y: i, repeat: a, spacingX: n, spacingY: s, rotate: S, opacity: v, content: m, fontSize: p, color: I, bold: y, italic: k, direction: u } = t;
|
|
111
|
-
e.save(), e.globalAlpha = v, e.direction = u;
|
|
112
|
-
let o = "";
|
|
113
|
-
if (k && (o += "italic "), y && (o += "bold "), o += `${p}px Arial`, e.font = o, e.fillStyle = I, m)
|
|
114
|
-
if (a) {
|
|
115
|
-
const c = e.canvas.width, d = e.canvas.height;
|
|
116
|
-
for (let f = i; f < d; f += p + s)
|
|
117
|
-
for (let h = r; h < c; h += e.measureText(m).width + n)
|
|
118
|
-
e.save(), e.translate(h, f), e.rotate(Math.PI / 180 * S), e.fillText(m, 0, 0), e.restore();
|
|
119
|
-
} else
|
|
120
|
-
e.save(), e.translate(r, i), e.rotate(Math.PI / 180 * S), e.fillText(m, 0, 0), e.restore();
|
|
121
|
-
e.restore();
|
|
122
|
-
}
|
|
123
|
-
function ie(e, t, r) {
|
|
124
|
-
const { x: i, y: a, repeat: n, spacingX: s, spacingY: S, rotate: v, opacity: m, width: p, height: I, maintainAspectRatio: y, originRatio: k } = t;
|
|
125
|
-
if (!(r != null && r.complete))
|
|
126
|
-
return;
|
|
127
|
-
e.save(), e.globalAlpha = m;
|
|
128
|
-
const u = p, o = y ? p / k : I;
|
|
129
|
-
if (n) {
|
|
130
|
-
const c = e.canvas.width, d = e.canvas.height;
|
|
131
|
-
for (let f = a; f < d; f += o + S)
|
|
132
|
-
for (let h = i; h < c; h += u + s)
|
|
133
|
-
e.save(), e.translate(h, f), e.rotate(Math.PI / 180 * v), e.drawImage(r, 0, 0, u, o), e.restore();
|
|
134
|
-
} else
|
|
135
|
-
e.save(), e.translate(i, a), e.rotate(Math.PI / 180 * v), e.drawImage(r, 0, 0, u, o), e.restore();
|
|
136
|
-
e.restore();
|
|
137
|
-
}
|
|
138
|
-
class ne extends z {
|
|
139
|
-
constructor() {
|
|
140
|
-
super(...arguments);
|
|
141
|
-
l(this, "_config");
|
|
142
|
-
l(this, "_image");
|
|
143
|
-
l(this, "_user");
|
|
144
|
-
}
|
|
145
|
-
render(r, i = !1) {
|
|
146
|
-
var n;
|
|
147
|
-
super.render(r, i);
|
|
148
|
-
const a = r || ((n = this.scene.getEngine()) == null ? void 0 : n.getCanvas().getContext());
|
|
149
|
-
return a && a.getId() && this._renderWatermark(a), this;
|
|
150
|
-
}
|
|
151
|
-
updateConfig(r, i) {
|
|
152
|
-
var a;
|
|
153
|
-
this._config = r, ((a = this._config) == null ? void 0 : a.type) === g.Image && this._config.config.image && (this._image = new Image(), this._image.src = this._config.config.image.url), i && (this._user = i);
|
|
154
|
-
}
|
|
155
|
-
_renderWatermark(r) {
|
|
156
|
-
this._config && te(r, this._config, this._image, this._user);
|
|
157
|
-
}
|
|
158
|
-
}
|
|
159
|
-
var se = Object.getOwnPropertyDescriptor, oe = (e, t, r, i) => {
|
|
160
|
-
for (var a = i > 1 ? void 0 : i ? se(t, r) : t, n = e.length - 1, s; n >= 0; n--)
|
|
161
|
-
(s = e[n]) && (a = s(a) || a);
|
|
162
|
-
return a;
|
|
163
|
-
}, E = (e, t) => (r, i) => t(r, i, e);
|
|
164
|
-
let U = class extends K {
|
|
165
|
-
constructor(t, r, i, a) {
|
|
82
|
+
l = j([
|
|
83
|
+
N(0, g(v))
|
|
84
|
+
], l);
|
|
85
|
+
var T = Object.getOwnPropertyDescriptor, G = (t, e, r, a) => {
|
|
86
|
+
for (var i = a > 1 ? void 0 : a ? T(e, r) : e, n = t.length - 1, o; n >= 0; n--)
|
|
87
|
+
(o = t[n]) && (i = o(i) || i);
|
|
88
|
+
return i;
|
|
89
|
+
}, h = (t, e) => (r, a) => e(r, a, t);
|
|
90
|
+
let d = class extends E {
|
|
91
|
+
constructor(e, r, a, i) {
|
|
166
92
|
super();
|
|
167
|
-
|
|
168
|
-
this._context =
|
|
93
|
+
c(this, "_watermarkLayer");
|
|
94
|
+
this._context = e, this._watermarkService = r, this._localStorageService = a, this._userManagerService = i, this._watermarkLayer = new U(e.scene, [], $), this._initAddRender(), this._initWatermarkUpdate(), this._initWatermarkConfig();
|
|
169
95
|
}
|
|
170
96
|
_initAddRender() {
|
|
171
|
-
const { scene:
|
|
172
|
-
|
|
97
|
+
const { scene: e } = this._context;
|
|
98
|
+
e.addLayer(this._watermarkLayer);
|
|
173
99
|
}
|
|
174
100
|
async _initWatermarkConfig() {
|
|
175
101
|
var r;
|
|
176
|
-
const
|
|
177
|
-
|
|
102
|
+
const e = await this._localStorageService.getItem(s);
|
|
103
|
+
e && (this._watermarkService.updateWatermarkConfig(e), (r = this._context.mainComponent) == null || r.makeDirty());
|
|
178
104
|
}
|
|
179
105
|
_initWatermarkUpdate() {
|
|
180
106
|
this.disposeWithMe(
|
|
181
|
-
this._watermarkService.updateConfig$.subscribe((
|
|
182
|
-
var r,
|
|
183
|
-
if (!
|
|
107
|
+
this._watermarkService.updateConfig$.subscribe((e) => {
|
|
108
|
+
var r, a;
|
|
109
|
+
if (!e) {
|
|
184
110
|
this._watermarkLayer.updateConfig(), (r = this._context.mainComponent) == null || r.makeDirty();
|
|
185
111
|
return;
|
|
186
112
|
}
|
|
187
|
-
|
|
113
|
+
e.type === _.UserInfo ? this._watermarkLayer.updateConfig(e, this._userManagerService.getCurrentUser()) : this._watermarkLayer.updateConfig(e), (a = this._context.mainComponent) == null || a.makeDirty();
|
|
188
114
|
})
|
|
189
115
|
);
|
|
190
116
|
}
|
|
191
117
|
};
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
],
|
|
197
|
-
var
|
|
198
|
-
for (var
|
|
199
|
-
(
|
|
200
|
-
return
|
|
201
|
-
},
|
|
202
|
-
const
|
|
203
|
-
var
|
|
204
|
-
let
|
|
205
|
-
constructor(
|
|
206
|
-
super(), this._config =
|
|
207
|
-
const { ...n } =
|
|
118
|
+
d = G([
|
|
119
|
+
h(1, g(l)),
|
|
120
|
+
h(2, g(v)),
|
|
121
|
+
h(3, g(w))
|
|
122
|
+
], d);
|
|
123
|
+
var K = Object.getOwnPropertyDescriptor, Y = (t, e, r, a) => {
|
|
124
|
+
for (var i = a > 1 ? void 0 : a ? K(e, r) : e, n = t.length - 1, o; n >= 0; n--)
|
|
125
|
+
(o = t[n]) && (i = o(i) || i);
|
|
126
|
+
return i;
|
|
127
|
+
}, f = (t, e) => (r, a) => e(r, a, t);
|
|
128
|
+
const V = "UNIVER_WATERMARK_PLUGIN";
|
|
129
|
+
var p;
|
|
130
|
+
let k = (p = class extends M {
|
|
131
|
+
constructor(t = C, e, r, a, i) {
|
|
132
|
+
super(), this._config = t, this._injector = e, this._configService = r, this._renderManagerSrv = a, this._localStorageService = i;
|
|
133
|
+
const { ...n } = m(
|
|
208
134
|
{},
|
|
209
|
-
|
|
135
|
+
C,
|
|
210
136
|
this._config
|
|
211
137
|
);
|
|
212
|
-
this._configService.setConfig(
|
|
138
|
+
this._configService.setConfig(I, n), this._initWatermarkStorage(), this._initDependencies();
|
|
213
139
|
}
|
|
214
140
|
async _initWatermarkStorage() {
|
|
215
|
-
const
|
|
216
|
-
if (!
|
|
141
|
+
const t = this._configService.getConfig(I);
|
|
142
|
+
if (!t)
|
|
217
143
|
return;
|
|
218
|
-
const { userWatermarkSettings:
|
|
219
|
-
if (
|
|
220
|
-
this._localStorageService.setItem(
|
|
221
|
-
type:
|
|
144
|
+
const { userWatermarkSettings: e, textWatermarkSettings: r, imageWatermarkSettings: a } = t;
|
|
145
|
+
if (e)
|
|
146
|
+
this._localStorageService.setItem(s, {
|
|
147
|
+
type: _.UserInfo,
|
|
222
148
|
config: {
|
|
223
|
-
userInfo:
|
|
149
|
+
userInfo: m({}, O, e)
|
|
224
150
|
}
|
|
225
151
|
});
|
|
226
152
|
else if (r)
|
|
227
|
-
this._localStorageService.setItem(
|
|
228
|
-
type:
|
|
153
|
+
this._localStorageService.setItem(s, {
|
|
154
|
+
type: _.Text,
|
|
229
155
|
config: {
|
|
230
|
-
text:
|
|
156
|
+
text: m({}, D, r)
|
|
231
157
|
}
|
|
232
158
|
});
|
|
233
|
-
else if (
|
|
234
|
-
this._localStorageService.setItem(
|
|
235
|
-
type:
|
|
159
|
+
else if (a)
|
|
160
|
+
this._localStorageService.setItem(s, {
|
|
161
|
+
type: _.Image,
|
|
236
162
|
config: {
|
|
237
|
-
image:
|
|
163
|
+
image: m({}, L, a)
|
|
238
164
|
}
|
|
239
165
|
});
|
|
240
166
|
else {
|
|
241
|
-
const
|
|
242
|
-
(
|
|
167
|
+
const i = await this._localStorageService.getItem(s);
|
|
168
|
+
(i == null ? void 0 : i.type) === _.UserInfo && this._localStorageService.removeItem(s);
|
|
243
169
|
}
|
|
244
170
|
}
|
|
245
171
|
_initDependencies() {
|
|
246
|
-
[[
|
|
247
|
-
this._injector.add(
|
|
172
|
+
[[l]].forEach((t) => {
|
|
173
|
+
this._injector.add(t);
|
|
248
174
|
});
|
|
249
175
|
}
|
|
250
176
|
onRendered() {
|
|
251
|
-
this._injector.get(
|
|
177
|
+
this._injector.get(l), this._initRenderDependencies();
|
|
252
178
|
}
|
|
253
179
|
_initRenderDependencies() {
|
|
254
180
|
[
|
|
255
|
-
[
|
|
256
|
-
].forEach((
|
|
257
|
-
this._renderManagerSrv.registerRenderModule(
|
|
181
|
+
[d]
|
|
182
|
+
].forEach((t) => {
|
|
183
|
+
this._renderManagerSrv.registerRenderModule(S.UNIVER_SHEET, t), this._renderManagerSrv.registerRenderModule(S.UNIVER_DOC, t);
|
|
258
184
|
});
|
|
259
185
|
}
|
|
260
|
-
},
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
],
|
|
186
|
+
}, c(p, "pluginName", V), p);
|
|
187
|
+
k = Y([
|
|
188
|
+
f(1, g(x)),
|
|
189
|
+
f(2, A),
|
|
190
|
+
f(3, b),
|
|
191
|
+
f(4, g(v))
|
|
192
|
+
], k);
|
|
267
193
|
export {
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
q as WatermarkTextBaseConfig,
|
|
275
|
-
Q as WatermarkUserInfoBaseConfig
|
|
194
|
+
k as UniverWatermarkPlugin,
|
|
195
|
+
H as WATERMARK_IMAGE_ALLOW_IMAGE_LIST,
|
|
196
|
+
L as WatermarkImageBaseConfig,
|
|
197
|
+
l as WatermarkService,
|
|
198
|
+
D as WatermarkTextBaseConfig,
|
|
199
|
+
O as WatermarkUserInfoBaseConfig
|
|
276
200
|
};
|
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
import { IImageWatermarkConfig, ITextWatermarkConfig, IUserInfoWatermarkConfig } from '
|
|
1
|
+
import { IImageWatermarkConfig, ITextWatermarkConfig, IUserInfoWatermarkConfig } from '@univerjs/engine-render';
|
|
2
2
|
export declare const UNIVER_WATERMARK_MENU = "UNIVER_WATERMARK_MENU";
|
|
3
3
|
export declare const WATERMARK_PANEL = "WATERMARK_PANEL";
|
|
4
4
|
export declare const WATERMARK_PANEL_FOOTER = "WATERMARK_PANEL_FOOTER";
|
|
5
|
-
export declare const UNIVER_WATERMARK_STORAGE_KEY = "UNIVER_WATERMARK_STORAGE_KEY";
|
|
6
|
-
export declare const UNIVER_WATERMARK_LAYER_INDEX = 10;
|
|
7
5
|
export declare const WATERMARK_IMAGE_ALLOW_IMAGE_LIST: string[];
|
|
8
6
|
export declare const WatermarkTextBaseConfig: ITextWatermarkConfig;
|
|
9
7
|
export declare const WatermarkImageBaseConfig: IImageWatermarkConfig;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IImageWatermarkConfig, ITextWatermarkConfig, IUserInfoWatermarkConfig } from '
|
|
1
|
+
import { IImageWatermarkConfig, ITextWatermarkConfig, IUserInfoWatermarkConfig } from '@univerjs/engine-render';
|
|
2
2
|
export declare const WATERMARK_PLUGIN_CONFIG_KEY = "watermark.config";
|
|
3
3
|
export declare const configSymbol: unique symbol;
|
|
4
4
|
export interface IUniverWatermarkConfig {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IImageWatermarkConfig, ITextWatermarkConfig, IWatermarkTypeEnum } from '@univerjs/
|
|
1
|
+
import { IImageWatermarkConfig, ITextWatermarkConfig, IWatermarkTypeEnum } from '@univerjs/engine-render';
|
|
2
2
|
import { FUniver } from '@univerjs/core/facade';
|
|
3
3
|
/**
|
|
4
4
|
* @ignore
|
|
@@ -27,7 +27,12 @@ export declare class FUniverWatermarkMixin extends FUniver {
|
|
|
27
27
|
addWatermark(type: IWatermarkTypeEnum.Image, config: IImageWatermarkConfig): FUniver;
|
|
28
28
|
deleteWatermark(): FUniver;
|
|
29
29
|
}
|
|
30
|
+
export declare class FWatermarkEnum {
|
|
31
|
+
get IWatermarkTypeEnum(): typeof IWatermarkTypeEnum;
|
|
32
|
+
}
|
|
30
33
|
declare module '@univerjs/core/facade' {
|
|
31
34
|
interface FUniver extends IFUniverWatermarkMixin {
|
|
32
35
|
}
|
|
36
|
+
interface FEnum extends FWatermarkEnum {
|
|
37
|
+
}
|
|
33
38
|
}
|
package/lib/types/index.d.ts
CHANGED
|
@@ -14,8 +14,5 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
export { UniverWatermarkPlugin } from './plugin';
|
|
17
|
-
export {
|
|
18
|
-
export type { IImageWatermarkConfig, ITextWatermarkConfig } from './common/type';
|
|
19
|
-
export { IWatermarkTypeEnum } from './common/type';
|
|
17
|
+
export { WATERMARK_IMAGE_ALLOW_IMAGE_LIST, WatermarkImageBaseConfig, WatermarkTextBaseConfig, WatermarkUserInfoBaseConfig } from './common/const';
|
|
20
18
|
export { WatermarkService } from './services/watermark.service';
|
|
21
|
-
export type { IWatermarkConfig, IWatermarkConfigWithType } from './common/type';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Nullable, Disposable, ILocalStorageService } from '@univerjs/core';
|
|
2
|
-
import { IWatermarkConfigWithType } from '
|
|
2
|
+
import { IWatermarkConfigWithType } from '@univerjs/engine-render';
|
|
3
3
|
export declare class WatermarkService extends Disposable {
|
|
4
4
|
private _localStorageService;
|
|
5
5
|
private readonly _updateConfig$;
|
package/lib/umd/facade.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(r
|
|
1
|
+
(function(e,r){typeof exports=="object"&&typeof module<"u"?r(require("@univerjs/core/facade"),require("@univerjs/engine-render"),require("@univerjs/watermark")):typeof define=="function"&&define.amd?define(["@univerjs/core/facade","@univerjs/engine-render","@univerjs/watermark"],r):(e=typeof globalThis<"u"?globalThis:e||self,r(e.UniverCoreFacade,e.UniverEngineRender,e.UniverWatermark))})(this,function(e,r,t){"use strict";class m extends e.FUniver{addWatermark(a,n){const i=this._injector.get(t.WatermarkService);if(a===r.IWatermarkTypeEnum.Text)i.updateWatermarkConfig({type:r.IWatermarkTypeEnum.Text,config:{text:{...t.WatermarkTextBaseConfig,...n}}});else if(a===r.IWatermarkTypeEnum.Image)i.updateWatermarkConfig({type:r.IWatermarkTypeEnum.Image,config:{image:{...t.WatermarkImageBaseConfig,...n}}});else throw new Error("Unknown watermark type");return this}deleteWatermark(){return this._injector.get(t.WatermarkService).deleteWatermarkConfig(),this}}class u{get IWatermarkTypeEnum(){return r.IWatermarkTypeEnum}}e.FUniver.extend(m),e.FEnum.extend(u)});
|
package/lib/umd/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(a,t){typeof exports=="object"&&typeof module<"u"?t(exports,require("@univerjs/core"),require("@univerjs/engine-render"),require("rxjs")):typeof define=="function"&&define.amd?define(["exports","@univerjs/core","@univerjs/engine-render","rxjs"],t):(a=typeof globalThis<"u"?globalThis:a||self,t(a.UniverWatermark={},a.UniverCore,a.UniverEngineRender,a.rxjs))})(this,function(a,t,n,S){"use strict";var M=Object.defineProperty;var j=(a,t,n)=>t in a?M(a,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):a[t]=n;var m=(a,t,n)=>j(a,typeof t!="symbol"?t+"":t,n);var u;const W=["image/png","image/jpeg","image/jpg","image/bmp"],h={content:"",fontSize:16,color:"rgb(0,0,0)",bold:!1,italic:!1,direction:"ltr",x:60,y:36,repeat:!0,spacingX:200,spacingY:100,rotate:0,opacity:.15},v={url:"",width:100,height:100,maintainAspectRatio:!0,originRatio:1,x:60,y:36,repeat:!0,spacingX:200,spacingY:100,rotate:0,opacity:.15},p={name:!0,email:!1,phone:!1,uid:!1,fontSize:16,color:"rgb(0,0,0)",bold:!1,italic:!1,direction:"ltr",x:60,y:60,repeat:!0,spacingX:200,spacingY:100,rotate:-30,opacity:.15},E="watermark.config",I={};var d=Object.getOwnPropertyDescriptor,k=(o,e,r,i)=>{for(var s=i>1?void 0:i?d(e,r):e,c=o.length-1,_;c>=0;c--)(_=o[c])&&(s=_(s)||s);return s},A=(o,e)=>(r,i)=>e(r,i,o);a.WatermarkService=class extends t.Disposable{constructor(r){super();m(this,"_updateConfig$",new S.Subject);m(this,"updateConfig$",this._updateConfig$.asObservable());m(this,"_refresh$",new S.Subject);m(this,"refresh$",this._refresh$.asObservable());this._localStorageService=r}async getWatermarkConfig(){return await this._localStorageService.getItem(n.UNIVER_WATERMARK_STORAGE_KEY)}updateWatermarkConfig(r){this._localStorageService.setItem(n.UNIVER_WATERMARK_STORAGE_KEY,r),this._updateConfig$.next(r)}deleteWatermarkConfig(){this._localStorageService.removeItem(n.UNIVER_WATERMARK_STORAGE_KEY),this._updateConfig$.next(null)}refresh(){this._refresh$.next(Math.random())}dispose(){this._refresh$.complete(),this._updateConfig$.complete()}},a.WatermarkService=k([A(0,t.Inject(t.ILocalStorageService))],a.WatermarkService);var R=Object.getOwnPropertyDescriptor,y=(o,e,r,i)=>{for(var s=i>1?void 0:i?R(e,r):e,c=o.length-1,_;c>=0;c--)(_=o[c])&&(s=_(s)||s);return s},f=(o,e)=>(r,i)=>e(r,i,o);let l=class extends t.RxDisposable{constructor(e,r,i,s){super();m(this,"_watermarkLayer");this._context=e,this._watermarkService=r,this._localStorageService=i,this._userManagerService=s,this._watermarkLayer=new n.WatermarkLayer(e.scene,[],n.UNIVER_WATERMARK_LAYER_INDEX),this._initAddRender(),this._initWatermarkUpdate(),this._initWatermarkConfig()}_initAddRender(){const{scene:e}=this._context;e.addLayer(this._watermarkLayer)}async _initWatermarkConfig(){var r;const e=await this._localStorageService.getItem(n.UNIVER_WATERMARK_STORAGE_KEY);e&&(this._watermarkService.updateWatermarkConfig(e),(r=this._context.mainComponent)==null||r.makeDirty())}_initWatermarkUpdate(){this.disposeWithMe(this._watermarkService.updateConfig$.subscribe(e=>{var r,i;if(!e){this._watermarkLayer.updateConfig(),(r=this._context.mainComponent)==null||r.makeDirty();return}e.type===n.IWatermarkTypeEnum.UserInfo?this._watermarkLayer.updateConfig(e,this._userManagerService.getCurrentUser()):this._watermarkLayer.updateConfig(e),(i=this._context.mainComponent)==null||i.makeDirty()}))}};l=y([f(1,t.Inject(a.WatermarkService)),f(2,t.Inject(t.ILocalStorageService)),f(3,t.Inject(t.UserManagerService))],l);var T=Object.getOwnPropertyDescriptor,C=(o,e,r,i)=>{for(var s=i>1?void 0:i?T(e,r):e,c=o.length-1,_;c>=0;c--)(_=o[c])&&(s=_(s)||s);return s},g=(o,e)=>(r,i)=>e(r,i,o);const U="UNIVER_WATERMARK_PLUGIN";a.UniverWatermarkPlugin=(u=class extends t.Plugin{constructor(e=I,r,i,s,c){super(),this._config=e,this._injector=r,this._configService=i,this._renderManagerSrv=s,this._localStorageService=c;const{..._}=t.merge({},I,this._config);this._configService.setConfig(E,_),this._initWatermarkStorage(),this._initDependencies()}async _initWatermarkStorage(){const e=this._configService.getConfig(E);if(!e)return;const{userWatermarkSettings:r,textWatermarkSettings:i,imageWatermarkSettings:s}=e;if(r)this._localStorageService.setItem(n.UNIVER_WATERMARK_STORAGE_KEY,{type:n.IWatermarkTypeEnum.UserInfo,config:{userInfo:t.merge({},p,r)}});else if(i)this._localStorageService.setItem(n.UNIVER_WATERMARK_STORAGE_KEY,{type:n.IWatermarkTypeEnum.Text,config:{text:t.merge({},h,i)}});else if(s)this._localStorageService.setItem(n.UNIVER_WATERMARK_STORAGE_KEY,{type:n.IWatermarkTypeEnum.Image,config:{image:t.merge({},v,s)}});else{const c=await this._localStorageService.getItem(n.UNIVER_WATERMARK_STORAGE_KEY);(c==null?void 0:c.type)===n.IWatermarkTypeEnum.UserInfo&&this._localStorageService.removeItem(n.UNIVER_WATERMARK_STORAGE_KEY)}}_initDependencies(){[[a.WatermarkService]].forEach(e=>{this._injector.add(e)})}onRendered(){this._injector.get(a.WatermarkService),this._initRenderDependencies()}_initRenderDependencies(){[[l]].forEach(e=>{this._renderManagerSrv.registerRenderModule(t.UniverInstanceType.UNIVER_SHEET,e),this._renderManagerSrv.registerRenderModule(t.UniverInstanceType.UNIVER_DOC,e)})}},m(u,"pluginName",U),u),a.UniverWatermarkPlugin=C([g(1,t.Inject(t.Injector)),g(2,t.IConfigService),g(3,n.IRenderManagerService),g(4,t.Inject(t.ILocalStorageService))],a.UniverWatermarkPlugin),a.WATERMARK_IMAGE_ALLOW_IMAGE_LIST=W,a.WatermarkImageBaseConfig=v,a.WatermarkTextBaseConfig=h,a.WatermarkUserInfoBaseConfig=p,Object.defineProperty(a,Symbol.toStringTag,{value:"Module"})});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@univerjs/watermark",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.1",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "univer watermark plugin",
|
|
6
6
|
"author": "DreamNum <developer@univer.ai>",
|
|
@@ -59,15 +59,15 @@
|
|
|
59
59
|
},
|
|
60
60
|
"dependencies": {
|
|
61
61
|
"clsx": "^2.1.1",
|
|
62
|
-
"@univerjs/
|
|
63
|
-
"@univerjs/
|
|
62
|
+
"@univerjs/core": "0.6.1",
|
|
63
|
+
"@univerjs/engine-render": "0.6.1"
|
|
64
64
|
},
|
|
65
65
|
"devDependencies": {
|
|
66
66
|
"rxjs": "^7.8.1",
|
|
67
67
|
"typescript": "^5.7.3",
|
|
68
|
-
"vite": "^6.1.
|
|
69
|
-
"vitest": "^3.0.
|
|
70
|
-
"@univerjs-infra/shared": "0.6.
|
|
68
|
+
"vite": "^6.1.1",
|
|
69
|
+
"vitest": "^3.0.6",
|
|
70
|
+
"@univerjs-infra/shared": "0.6.1"
|
|
71
71
|
},
|
|
72
72
|
"scripts": {
|
|
73
73
|
"test": "vitest run",
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright 2023-present DreamNum Co., Ltd.
|
|
3
|
-
*
|
|
4
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
-
* you may not use this file except in compliance with the License.
|
|
6
|
-
* You may obtain a copy of the License at
|
|
7
|
-
*
|
|
8
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
-
*
|
|
10
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
-
* See the License for the specific language governing permissions and
|
|
14
|
-
* limitations under the License.
|
|
15
|
-
*/
|
|
16
|
-
export declare enum IWatermarkTypeEnum {
|
|
17
|
-
UserInfo = "userInfo",
|
|
18
|
-
Text = "text",
|
|
19
|
-
Image = "image"
|
|
20
|
-
}
|
|
21
|
-
export interface IGeneralWatermarkConfig {
|
|
22
|
-
x: number;
|
|
23
|
-
y: number;
|
|
24
|
-
repeat: boolean;
|
|
25
|
-
spacingX: number;
|
|
26
|
-
spacingY: number;
|
|
27
|
-
rotate: number;
|
|
28
|
-
opacity: number;
|
|
29
|
-
}
|
|
30
|
-
export interface ITextWatermarkConfig extends IGeneralWatermarkConfig {
|
|
31
|
-
content?: string;
|
|
32
|
-
fontSize: number;
|
|
33
|
-
color: string;
|
|
34
|
-
bold: boolean;
|
|
35
|
-
italic: boolean;
|
|
36
|
-
direction: 'ltr' | 'rtl' | 'inherit';
|
|
37
|
-
}
|
|
38
|
-
export interface IImageWatermarkConfig extends IGeneralWatermarkConfig {
|
|
39
|
-
url: string;
|
|
40
|
-
width: number;
|
|
41
|
-
height: number;
|
|
42
|
-
maintainAspectRatio: boolean;
|
|
43
|
-
originRatio: number;
|
|
44
|
-
}
|
|
45
|
-
export interface IUserInfoWatermarkConfig extends IGeneralWatermarkConfig, Omit<ITextWatermarkConfig, 'content'> {
|
|
46
|
-
name: boolean;
|
|
47
|
-
email: boolean;
|
|
48
|
-
phone: boolean;
|
|
49
|
-
uid: boolean;
|
|
50
|
-
}
|
|
51
|
-
export interface IWatermarkConfig {
|
|
52
|
-
text?: ITextWatermarkConfig;
|
|
53
|
-
image?: IImageWatermarkConfig;
|
|
54
|
-
userInfo?: IUserInfoWatermarkConfig;
|
|
55
|
-
}
|
|
56
|
-
export interface IWatermarkConfigWithType {
|
|
57
|
-
config: IWatermarkConfig;
|
|
58
|
-
type: IWatermarkTypeEnum;
|
|
59
|
-
}
|
package/lib/types/util.d.ts
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { IUser, Nullable } from '@univerjs/core';
|
|
2
|
-
import { UniverRenderingContext } from '@univerjs/engine-render';
|
|
3
|
-
import { IImageWatermarkConfig, ITextWatermarkConfig, IUserInfoWatermarkConfig, IWatermarkConfigWithType } from './common/type';
|
|
4
|
-
export declare function renderWatermark(ctx: UniverRenderingContext, config: IWatermarkConfigWithType, image: Nullable<HTMLImageElement>, userInfo: Nullable<IUser>): void;
|
|
5
|
-
export declare function renderUserInfoWatermark(ctx: UniverRenderingContext, config: IUserInfoWatermarkConfig, userInfo: Nullable<IUser>): void;
|
|
6
|
-
export declare function renderTextWatermark(ctx: UniverRenderingContext, config: ITextWatermarkConfig): void;
|
|
7
|
-
export declare function renderImageWatermark(ctx: UniverRenderingContext, config: IImageWatermarkConfig, image: Nullable<HTMLImageElement>): void;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { IUser } from '@univerjs/core';
|
|
2
|
-
import { UniverRenderingContext, Layer } from '@univerjs/engine-render';
|
|
3
|
-
import { IWatermarkConfigWithType } from '../../common/type';
|
|
4
|
-
export declare class WatermarkLayer extends Layer {
|
|
5
|
-
private _config;
|
|
6
|
-
private _image;
|
|
7
|
-
private _user;
|
|
8
|
-
render(ctx?: UniverRenderingContext, isMaxLayer?: boolean): this;
|
|
9
|
-
updateConfig(config?: IWatermarkConfigWithType, user?: IUser): void;
|
|
10
|
-
private _renderWatermark;
|
|
11
|
-
}
|