watermark-js-plus 0.0.2 → 0.0.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.
- package/README.md +88 -1
- package/dist/index.js +400 -0
- package/dist/index.min.js +1 -0
- package/package.json +22 -10
- package/.editorconfig +0 -16
- package/.eslintignore +0 -7
- package/.eslintrc.cjs +0 -46
- package/.github/workflows/deploy.yml +0 -29
- package/.github/workflows/npm-publish.yml +0 -32
- package/.husky/commit-msg +0 -4
- package/.husky/pre-commit +0 -4
- package/.prettierrc +0 -10
- package/CHANGELOG.md +0 -18
- package/babel.config.cjs +0 -23
- package/changelog-option.cjs +0 -87
- package/commitlint.config.cjs +0 -26
- package/docs/.vitepress/config.ts +0 -103
- package/docs/.vitepress/locales/zh-CN.ts +0 -51
- package/docs/.vitepress/theme/index.ts +0 -12
- package/docs/config/blind-decode.md +0 -33
- package/docs/config/blind.md +0 -19
- package/docs/config/index.md +0 -178
- package/docs/guide/blind-watermark.md +0 -267
- package/docs/guide/getting-started.md +0 -73
- package/docs/guide/watermark.md +0 -213
- package/docs/guide/what-is-this.md +0 -19
- package/docs/index.md +0 -33
- package/docs/public/favicons/apple-touch-icon.png +0 -0
- package/docs/public/favicons/favicon-64x64.png +0 -0
- package/docs/public/hero-image.png +0 -0
- package/docs/public/logo.png +0 -0
- package/docs/zh/config/blind-decode.md +0 -33
- package/docs/zh/config/blind.md +0 -19
- package/docs/zh/config/index.md +0 -178
- package/docs/zh/guide/blink-watermark.md +0 -288
- package/docs/zh/guide/getting-started.md +0 -48
- package/docs/zh/guide/watermark.md +0 -213
- package/docs/zh/guide/what-is-this.md +0 -19
- package/docs/zh/index.md +0 -33
- package/rollup.config.mjs +0 -40
- package/src/blind.ts +0 -43
- package/src/index.ts +0 -7
- package/src/types/index.ts +0 -69
- package/src/utils/index.ts +0 -63
- package/src/watermark.ts +0 -300
- package/tools/terser.js +0 -19
- package/tsconfig.json +0 -15
|
@@ -1,267 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
layout: doc
|
|
3
|
-
---
|
|
4
|
-
# Blind watermark
|
|
5
|
-
|
|
6
|
-
<script setup lang="ts">
|
|
7
|
-
import VPButton from 'vitepress/dist/client/theme-default/components/VPButton.vue';
|
|
8
|
-
import { ref, getCurrentInstance } from 'vue';
|
|
9
|
-
import { Plus } from '@element-plus/icons-vue';
|
|
10
|
-
import wm from '../../src';
|
|
11
|
-
import { useData } from 'vitepress';
|
|
12
|
-
|
|
13
|
-
const { isDark } = useData();
|
|
14
|
-
const app = getCurrentInstance();
|
|
15
|
-
const decodeBlindImage = ref('');
|
|
16
|
-
|
|
17
|
-
// text blind watermark
|
|
18
|
-
const textBlindWatermark = new wm.BlindWatermark({
|
|
19
|
-
content: 'hello my watermark',
|
|
20
|
-
width: 200,
|
|
21
|
-
height: 200,
|
|
22
|
-
onSuccess: () => {
|
|
23
|
-
app.appContext.config.globalProperties.$message({
|
|
24
|
-
message: 'The text blind watermark added successfully!',
|
|
25
|
-
type: 'success'
|
|
26
|
-
});
|
|
27
|
-
}
|
|
28
|
-
});
|
|
29
|
-
const handleAddTextBlindWatermark = () => {
|
|
30
|
-
if (isDark.value) {
|
|
31
|
-
textBlindWatermark.options.fontColor = '#fff'
|
|
32
|
-
}
|
|
33
|
-
textBlindWatermark.create();
|
|
34
|
-
};
|
|
35
|
-
const handleRemoveTextBlindWatermark = () => {
|
|
36
|
-
textBlindWatermark.destroy();
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
// multiline blind text watermark
|
|
40
|
-
const multiLineTextBlindWatermark = new wm.BlindWatermark({
|
|
41
|
-
contentType: 'multi-line-text',
|
|
42
|
-
content: 'hello my multiline blind watermark',
|
|
43
|
-
fontSize: 30,
|
|
44
|
-
width: 200,
|
|
45
|
-
height: 200,
|
|
46
|
-
onSuccess: () => {
|
|
47
|
-
app.appContext.config.globalProperties.$message({
|
|
48
|
-
message: 'The multiline text blind watermark added successfully!',
|
|
49
|
-
type: 'success'
|
|
50
|
-
});
|
|
51
|
-
}
|
|
52
|
-
});
|
|
53
|
-
const handleAddMultiLineTextBlindWatermark = () => {
|
|
54
|
-
if (isDark.value) {
|
|
55
|
-
multiLineTextBlindWatermark.options.fontColor = '#fff'
|
|
56
|
-
}
|
|
57
|
-
multiLineTextBlindWatermark.create();
|
|
58
|
-
};
|
|
59
|
-
const handleRemoveMultiLineTextBlindWatermark = () => {
|
|
60
|
-
multiLineTextBlindWatermark.destroy();
|
|
61
|
-
};
|
|
62
|
-
|
|
63
|
-
// image blind watermark
|
|
64
|
-
const imageBlindWatermark = new wm.BlindWatermark({
|
|
65
|
-
contentType: 'image',
|
|
66
|
-
image: 'https://cdn.jsdelivr.net/gh/zhensherlock/oss@main/uPic/github-mkWBiK.png',
|
|
67
|
-
imageWidth: 200,
|
|
68
|
-
// imageHeight: 20,
|
|
69
|
-
width: 300,
|
|
70
|
-
height: 300,
|
|
71
|
-
onSuccess: () => {
|
|
72
|
-
app.appContext.config.globalProperties.$message({
|
|
73
|
-
message: '!The image blind watermark added successfully',
|
|
74
|
-
type: 'success'
|
|
75
|
-
});
|
|
76
|
-
}
|
|
77
|
-
});
|
|
78
|
-
const handleAddImageBlindWatermark = () => {
|
|
79
|
-
imageBlindWatermark.create();
|
|
80
|
-
};
|
|
81
|
-
const handleRemoveImageBlindWatermark = () => {
|
|
82
|
-
imageBlindWatermark.destroy();
|
|
83
|
-
};
|
|
84
|
-
|
|
85
|
-
// rich text blind watermark
|
|
86
|
-
const richTextBlindWatermark = new wm.BlindWatermark({
|
|
87
|
-
contentType: 'rich-text',
|
|
88
|
-
content: '<div style="background: #ccc;">The watermark is so <span style="color: #f00">good</span>.</div>',
|
|
89
|
-
width: 300,
|
|
90
|
-
height: 300,
|
|
91
|
-
onSuccess: () => {
|
|
92
|
-
app.appContext.config.globalProperties.$message({
|
|
93
|
-
message: 'The rich text blind watermark added successfully!',
|
|
94
|
-
type: 'success'
|
|
95
|
-
});
|
|
96
|
-
}
|
|
97
|
-
});
|
|
98
|
-
const handleAddRichTextBlindWatermark = () => {
|
|
99
|
-
richTextBlindWatermark.create();
|
|
100
|
-
};
|
|
101
|
-
const handleRemoveRichTextBlindWatermark = () => {
|
|
102
|
-
richTextBlindWatermark.destroy();
|
|
103
|
-
};
|
|
104
|
-
|
|
105
|
-
// decode blind watermark
|
|
106
|
-
const handleSuccess = (uploadFile) => {
|
|
107
|
-
wm.BlindWatermark.decode({
|
|
108
|
-
...(isDark.value ? {
|
|
109
|
-
compositeOperation: 'overlay',
|
|
110
|
-
fillColor: '#fff',
|
|
111
|
-
} : {}),
|
|
112
|
-
url: uploadFile.url,
|
|
113
|
-
onSuccess: (imageBase64) => {
|
|
114
|
-
decodeBlindImage.value = imageBase64
|
|
115
|
-
}
|
|
116
|
-
});
|
|
117
|
-
}
|
|
118
|
-
</script>
|
|
119
|
-
|
|
120
|
-
## Text Blind Watermark
|
|
121
|
-
|
|
122
|
-
```js
|
|
123
|
-
import wm from 'watermark-js-plus' // import watermark plugin
|
|
124
|
-
|
|
125
|
-
const watermark = new wm.BlindWatermark({
|
|
126
|
-
content: 'hello my watermark',
|
|
127
|
-
width: 200,
|
|
128
|
-
height: 200,
|
|
129
|
-
onSuccess: () => {
|
|
130
|
-
app.appContext.config.globalProperties.$message({
|
|
131
|
-
message: 'The text blind watermark added successfully!',
|
|
132
|
-
type: 'success'
|
|
133
|
-
});
|
|
134
|
-
}
|
|
135
|
-
})
|
|
136
|
-
|
|
137
|
-
watermark.create() // add watermark
|
|
138
|
-
|
|
139
|
-
watermark.destroy() // remove watermark
|
|
140
|
-
```
|
|
141
|
-
<el-space>
|
|
142
|
-
<VPButton text="Add Text Blind Watermark" @click="handleAddTextBlindWatermark"></VPButton>
|
|
143
|
-
<VPButton text="Remove Text Blind Watermark" @click="handleRemoveTextBlindWatermark"></VPButton>
|
|
144
|
-
</el-space>
|
|
145
|
-
|
|
146
|
-
## Multiline Text Blind Watermark
|
|
147
|
-
|
|
148
|
-
```js
|
|
149
|
-
import wm from 'watermark-js-plus' // import watermark plugin
|
|
150
|
-
|
|
151
|
-
const watermark = new wm.BlindWatermark({
|
|
152
|
-
contentType: 'multi-line-text',
|
|
153
|
-
content: 'hello my multiline blind watermark',
|
|
154
|
-
fontSize: 30,
|
|
155
|
-
width: 200,
|
|
156
|
-
height: 200,
|
|
157
|
-
onSuccess: () => {
|
|
158
|
-
app.appContext.config.globalProperties.$message({
|
|
159
|
-
message: 'The multiline text blind watermark added successfully!',
|
|
160
|
-
type: 'success'
|
|
161
|
-
});
|
|
162
|
-
}
|
|
163
|
-
})
|
|
164
|
-
|
|
165
|
-
watermark.create() // add watermark
|
|
166
|
-
|
|
167
|
-
watermark.destroy() // remove watermark
|
|
168
|
-
```
|
|
169
|
-
<el-space>
|
|
170
|
-
<VPButton text="Add Multiline Text Blind Watermark" @click="handleAddMultiLineTextBlindWatermark"></VPButton>
|
|
171
|
-
<VPButton text="Remove Multiline Text Blind Watermark" @click="handleRemoveMultiLineTextBlindWatermark"></VPButton>
|
|
172
|
-
</el-space>
|
|
173
|
-
|
|
174
|
-
## Image Blind Watermark
|
|
175
|
-
|
|
176
|
-
```js
|
|
177
|
-
import wm from 'watermark-js-plus' // import watermark plugin
|
|
178
|
-
|
|
179
|
-
const watermark = new wm.BlindWatermark({
|
|
180
|
-
contentType: 'image',
|
|
181
|
-
content: 'http://upic-service.test.upcdn.net/uPic/github-JxMIKf.png',
|
|
182
|
-
width: 300,
|
|
183
|
-
height: 300,
|
|
184
|
-
imageWidth: 100, // image width
|
|
185
|
-
// imageHeight: 20, // image height
|
|
186
|
-
onSuccess: () => {
|
|
187
|
-
app.appContext.config.globalProperties.$message({
|
|
188
|
-
message: 'The image blind watermark added successfully!',
|
|
189
|
-
type: 'success'
|
|
190
|
-
});
|
|
191
|
-
}
|
|
192
|
-
})
|
|
193
|
-
|
|
194
|
-
watermark.create() // add watermark
|
|
195
|
-
|
|
196
|
-
watermark.destroy() // remove watermark
|
|
197
|
-
```
|
|
198
|
-
<el-space>
|
|
199
|
-
<VPButton text="Add Image Blind Watermark" @click="handleAddImageBlindWatermark"></VPButton>
|
|
200
|
-
<VPButton text="Remove Image Blind Watermark" @click="handleRemoveImageBlindWatermark"></VPButton>
|
|
201
|
-
</el-space>
|
|
202
|
-
|
|
203
|
-
## Rich Text Blind Watermark
|
|
204
|
-
|
|
205
|
-
```js
|
|
206
|
-
import wm from 'watermark-js-plus' // import watermark plugin
|
|
207
|
-
|
|
208
|
-
const watermark = new wm.BlindWatermark({
|
|
209
|
-
contentType: 'rich-text',
|
|
210
|
-
content: '<div style="background: #ccc;">The watermark is so <span style="color: #f00">good</span>.</div>',
|
|
211
|
-
width: 300,
|
|
212
|
-
height: 300,
|
|
213
|
-
onSuccess: () => {
|
|
214
|
-
app.appContext.config.globalProperties.$message({
|
|
215
|
-
message: 'The rich text blind watermark added successfully!',
|
|
216
|
-
type: 'success'
|
|
217
|
-
});
|
|
218
|
-
}
|
|
219
|
-
})
|
|
220
|
-
|
|
221
|
-
watermark.create() // add watermark
|
|
222
|
-
|
|
223
|
-
watermark.destroy() // remove watermark
|
|
224
|
-
```
|
|
225
|
-
<el-space>
|
|
226
|
-
<VPButton text="Add RichText Blind Watermark" @click="handleAddRichTextBlindWatermark"></VPButton>
|
|
227
|
-
<VPButton text="Remove Rich Text Blind Watermark" @click="handleRemoveRichTextBlindWatermark"></VPButton>
|
|
228
|
-
</el-space>
|
|
229
|
-
|
|
230
|
-
## Decode Blind Watermark
|
|
231
|
-
|
|
232
|
-
```js
|
|
233
|
-
import wm from 'watermark-js-plus' // import watermark plugin
|
|
234
|
-
|
|
235
|
-
wm.BlindWatermark.decode({
|
|
236
|
-
url: uploadFile.url, // image url
|
|
237
|
-
onSuccess: (imageBase64) => { // success callback
|
|
238
|
-
}
|
|
239
|
-
});
|
|
240
|
-
```
|
|
241
|
-
|
|
242
|
-
<div>
|
|
243
|
-
<el-upload
|
|
244
|
-
list-type="picture-card"
|
|
245
|
-
accept="image/*"
|
|
246
|
-
:auto-upload="false"
|
|
247
|
-
:show-file-list="false"
|
|
248
|
-
:on-change="handleSuccess"
|
|
249
|
-
>
|
|
250
|
-
<el-icon><Plus /></el-icon>
|
|
251
|
-
</el-upload>
|
|
252
|
-
<el-image
|
|
253
|
-
v-if="decodeBlindImage"
|
|
254
|
-
style="width: 400px; height: 400px;margin-top: 20px;"
|
|
255
|
-
:src="decodeBlindImage"
|
|
256
|
-
:preview-src-list="[decodeBlindImage]"
|
|
257
|
-
fit="cover"
|
|
258
|
-
/>
|
|
259
|
-
</div>
|
|
260
|
-
|
|
261
|
-
[//]: # (<div style="position: relative;">)
|
|
262
|
-
|
|
263
|
-
[//]: # ( <div style="position: absolute;top:0;bottom: 0;left: 0;right: 0;mix-blend-mode: color-burn;background: #000;"></div>)
|
|
264
|
-
|
|
265
|
-
[//]: # ( <img width="200" src="http://upic-service.test.upcdn.net/uPic/iShot_2022-11-28_10.35.29-RP6dBG.png" alt="">)
|
|
266
|
-
|
|
267
|
-
[//]: # (</div>)
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
layout: doc
|
|
3
|
-
---
|
|
4
|
-
|
|
5
|
-
# Getting Started
|
|
6
|
-
|
|
7
|
-
## Installing
|
|
8
|
-
|
|
9
|
-
Using npm:
|
|
10
|
-
|
|
11
|
-
```bash
|
|
12
|
-
$ npm install watermark-js-plus
|
|
13
|
-
```
|
|
14
|
-
|
|
15
|
-
[//]: # (Using bower:)
|
|
16
|
-
|
|
17
|
-
[//]: # ()
|
|
18
|
-
[//]: # (```bash)
|
|
19
|
-
|
|
20
|
-
[//]: # ($ bower install watermark-js-plus)
|
|
21
|
-
|
|
22
|
-
[//]: # (```)
|
|
23
|
-
|
|
24
|
-
Using yarn:
|
|
25
|
-
|
|
26
|
-
```bash
|
|
27
|
-
$ yarn add watermark-js-plus
|
|
28
|
-
```
|
|
29
|
-
|
|
30
|
-
[//]: # ()
|
|
31
|
-
[//]: # (Using jsDelivr CDN:)
|
|
32
|
-
|
|
33
|
-
[//]: # ()
|
|
34
|
-
[//]: # (```html)
|
|
35
|
-
|
|
36
|
-
[//]: # (<script src="https://cdn.jsdelivr.net/npm/axios/dist/axios.min.js"></script>)
|
|
37
|
-
|
|
38
|
-
[//]: # (```)
|
|
39
|
-
|
|
40
|
-
[//]: # ()
|
|
41
|
-
[//]: # (Using unpkg CDN:)
|
|
42
|
-
|
|
43
|
-
[//]: # ()
|
|
44
|
-
[//]: # (```html)
|
|
45
|
-
|
|
46
|
-
[//]: # (<script src="https://unpkg.com/axios/dist/axios.min.js"></script>)
|
|
47
|
-
|
|
48
|
-
[//]: # (```)
|
|
49
|
-
|
|
50
|
-
## Usage
|
|
51
|
-
|
|
52
|
-
1. Import watermark plugin
|
|
53
|
-
```ts
|
|
54
|
-
import wm from 'watermark-js-plus' // 引入水印插件
|
|
55
|
-
```
|
|
56
|
-
2. instantiation
|
|
57
|
-
```ts
|
|
58
|
-
const watermark = new wm.Watermark({
|
|
59
|
-
content: 'hello my watermark',
|
|
60
|
-
width: 200,
|
|
61
|
-
height: 200,
|
|
62
|
-
onSuccess: () => {
|
|
63
|
-
app.appContext.config.globalProperties.$message({
|
|
64
|
-
message: 'text watermark added successfully!',
|
|
65
|
-
type: 'success'
|
|
66
|
-
});
|
|
67
|
-
}
|
|
68
|
-
})
|
|
69
|
-
```
|
|
70
|
-
3. Add a watermark to the web page
|
|
71
|
-
```ts
|
|
72
|
-
watermark.create()
|
|
73
|
-
```
|
package/docs/guide/watermark.md
DELETED
|
@@ -1,213 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
layout: doc
|
|
3
|
-
---
|
|
4
|
-
# Watemark
|
|
5
|
-
|
|
6
|
-
<script setup lang="ts">
|
|
7
|
-
import VPButton from 'vitepress/dist/client/theme-default/components/VPButton.vue';
|
|
8
|
-
import { ref, getCurrentInstance } from 'vue';
|
|
9
|
-
import wm from '../../src';
|
|
10
|
-
import { useData } from 'vitepress';
|
|
11
|
-
|
|
12
|
-
const { isDark } = useData();
|
|
13
|
-
const decodeBlindImage = ref('');
|
|
14
|
-
const app = getCurrentInstance();
|
|
15
|
-
|
|
16
|
-
// text watermark
|
|
17
|
-
const textWatermark = new wm.Watermark({
|
|
18
|
-
content: 'hello my text watermark',
|
|
19
|
-
width: 200,
|
|
20
|
-
height: 200,
|
|
21
|
-
onSuccess: () => {
|
|
22
|
-
app.appContext.config.globalProperties.$message({
|
|
23
|
-
message: 'The text watermark added successfully!',
|
|
24
|
-
type: 'success'
|
|
25
|
-
});
|
|
26
|
-
}
|
|
27
|
-
});
|
|
28
|
-
const handleAddTextWatermark = () => {
|
|
29
|
-
if (isDark.value) {
|
|
30
|
-
textWatermark.options.fontColor = '#fff'
|
|
31
|
-
}
|
|
32
|
-
textWatermark.create();
|
|
33
|
-
};
|
|
34
|
-
const handleRemoveTextWatermark = () => {
|
|
35
|
-
textWatermark.destroy();
|
|
36
|
-
};
|
|
37
|
-
|
|
38
|
-
// multiline text watermark
|
|
39
|
-
const multiLineTextWatermark = new wm.Watermark({
|
|
40
|
-
contentType: 'multi-line-text',
|
|
41
|
-
content: 'hello my multi text watermark',
|
|
42
|
-
fontSize: 30,
|
|
43
|
-
width: 200,
|
|
44
|
-
height: 200,
|
|
45
|
-
onSuccess: () => {
|
|
46
|
-
app.appContext.config.globalProperties.$message({
|
|
47
|
-
message: 'The multi text watermark added successfully!',
|
|
48
|
-
type: 'success'
|
|
49
|
-
});
|
|
50
|
-
}
|
|
51
|
-
});
|
|
52
|
-
const handleAddMultiLineTextWatermark = () => {
|
|
53
|
-
if (isDark.value) {
|
|
54
|
-
multiLineTextWatermark.options.fontColor = '#fff'
|
|
55
|
-
}
|
|
56
|
-
multiLineTextWatermark.create();
|
|
57
|
-
};
|
|
58
|
-
const handleRemoveMultiLineTextWatermark = () => {
|
|
59
|
-
multiLineTextWatermark.destroy();
|
|
60
|
-
};
|
|
61
|
-
|
|
62
|
-
// image watermark
|
|
63
|
-
const imageWatermark = new wm.Watermark({
|
|
64
|
-
contentType: 'image',
|
|
65
|
-
image: 'https://cdn.jsdelivr.net/gh/zhensherlock/oss@main/uPic/github-mkWBiK.png',
|
|
66
|
-
imageWidth: 200,
|
|
67
|
-
// imageHeight: 20,
|
|
68
|
-
width: 300,
|
|
69
|
-
height: 300,
|
|
70
|
-
onSuccess: () => {
|
|
71
|
-
app.appContext.config.globalProperties.$message({
|
|
72
|
-
message: 'The image watermark added successfully!',
|
|
73
|
-
type: 'success'
|
|
74
|
-
});
|
|
75
|
-
}
|
|
76
|
-
});
|
|
77
|
-
const handleAddImageWatermark = () => {
|
|
78
|
-
imageWatermark.create();
|
|
79
|
-
};
|
|
80
|
-
const handleRemoveImageWatermark = () => {
|
|
81
|
-
imageWatermark.destroy();
|
|
82
|
-
};
|
|
83
|
-
|
|
84
|
-
// rich text watermark
|
|
85
|
-
const richTextWatermark = new wm.Watermark({
|
|
86
|
-
contentType: 'rich-text',
|
|
87
|
-
content: '<div style="background: #ccc;">The watermark is so <span style="color: #f00">nice</span>.</div>',
|
|
88
|
-
width: 300,
|
|
89
|
-
height: 300,
|
|
90
|
-
onSuccess: () => {
|
|
91
|
-
app.appContext.config.globalProperties.$message({
|
|
92
|
-
message: 'The rich text watermark added successfully!',
|
|
93
|
-
type: 'success'
|
|
94
|
-
});
|
|
95
|
-
}
|
|
96
|
-
});
|
|
97
|
-
const handleAddRichTextWatermark = () => {
|
|
98
|
-
richTextWatermark.create();
|
|
99
|
-
};
|
|
100
|
-
const handleRemoveRichTextWatermark = () => {
|
|
101
|
-
richTextWatermark.destroy();
|
|
102
|
-
};
|
|
103
|
-
</script>
|
|
104
|
-
|
|
105
|
-
## Text Watermark
|
|
106
|
-
|
|
107
|
-
```js
|
|
108
|
-
import wm from 'watermark-js-plus' // import watermark plugin
|
|
109
|
-
|
|
110
|
-
const watermark = new wm.Watermark({
|
|
111
|
-
content: 'hello my watermark',
|
|
112
|
-
width: 200,
|
|
113
|
-
height: 200,
|
|
114
|
-
onSuccess: () => {
|
|
115
|
-
app.appContext.config.globalProperties.$message({
|
|
116
|
-
message: 'The text watermark added successfully!',
|
|
117
|
-
type: 'success'
|
|
118
|
-
});
|
|
119
|
-
}
|
|
120
|
-
})
|
|
121
|
-
|
|
122
|
-
watermark.create() // add watermark
|
|
123
|
-
|
|
124
|
-
watermark.destroy() // remove watermark
|
|
125
|
-
```
|
|
126
|
-
<el-space>
|
|
127
|
-
<VPButton text="Add Text Watermark" @click="handleAddTextWatermark"></VPButton>
|
|
128
|
-
<VPButton text="Remove Text Watermark" @click="handleRemoveTextWatermark"></VPButton>
|
|
129
|
-
</el-space>
|
|
130
|
-
|
|
131
|
-
## Multiline Text Watermark
|
|
132
|
-
|
|
133
|
-
```js
|
|
134
|
-
import wm from 'watermark-js-plus' // import watermark plugin
|
|
135
|
-
|
|
136
|
-
const watermark = new wm.Watermark({
|
|
137
|
-
contentType: 'multi-line-text',
|
|
138
|
-
content: 'hello my watermark watermark',
|
|
139
|
-
fontSize: 30,
|
|
140
|
-
width: 200,
|
|
141
|
-
height: 200,
|
|
142
|
-
onSuccess: () => {
|
|
143
|
-
app.appContext.config.globalProperties.$message({
|
|
144
|
-
message: 'The multiline text watermark added successfully!',
|
|
145
|
-
type: 'success'
|
|
146
|
-
});
|
|
147
|
-
}
|
|
148
|
-
})
|
|
149
|
-
|
|
150
|
-
watermark.create() // add watermark
|
|
151
|
-
|
|
152
|
-
watermark.destroy() // remove watermark
|
|
153
|
-
```
|
|
154
|
-
<el-space>
|
|
155
|
-
<VPButton text="Add MultiLine Text Watermark" @click="handleAddMultiLineTextWatermark"></VPButton>
|
|
156
|
-
<VPButton text="Remove MultiLine Text Watermark" @click="handleRemoveMultiLineTextWatermark"></VPButton>
|
|
157
|
-
</el-space>
|
|
158
|
-
|
|
159
|
-
## Image Watermark
|
|
160
|
-
|
|
161
|
-
```js
|
|
162
|
-
import wm from 'watermark-js-plus' // import watermark plugin
|
|
163
|
-
|
|
164
|
-
const watermark = new wm.Watermark({
|
|
165
|
-
contentType: 'image',
|
|
166
|
-
content: 'http://upic-service.test.upcdn.net/uPic/github-JxMIKf.png',
|
|
167
|
-
width: 300,
|
|
168
|
-
height: 300,
|
|
169
|
-
imageWidth: 100, // image width
|
|
170
|
-
// imageHeight: 20, // image height
|
|
171
|
-
onSuccess: () => {
|
|
172
|
-
app.appContext.config.globalProperties.$message({
|
|
173
|
-
message: 'The image watermark added successfully!',
|
|
174
|
-
type: 'success'
|
|
175
|
-
});
|
|
176
|
-
}
|
|
177
|
-
})
|
|
178
|
-
|
|
179
|
-
watermark.create() // add watermark
|
|
180
|
-
|
|
181
|
-
watermark.destroy() // remove watermark
|
|
182
|
-
```
|
|
183
|
-
<el-space>
|
|
184
|
-
<VPButton text="Add Image Watermark" @click="handleAddImageWatermark"></VPButton>
|
|
185
|
-
<VPButton text="Remove Image Watermark" @click="handleRemoveImageWatermark"></VPButton>
|
|
186
|
-
</el-space>
|
|
187
|
-
|
|
188
|
-
## Rich Text Watermark
|
|
189
|
-
|
|
190
|
-
```js
|
|
191
|
-
import wm from 'watermark-js-plus' // import watermark plugin
|
|
192
|
-
|
|
193
|
-
const watermark = new wm.Watermark({
|
|
194
|
-
contentType: 'rich-text',
|
|
195
|
-
content: '<div style="background: #ccc;">Rich text watermark is so <span style="color: #f00">nice</span></div>',
|
|
196
|
-
width: 300,
|
|
197
|
-
height: 300,
|
|
198
|
-
onSuccess: () => {
|
|
199
|
-
app.appContext.config.globalProperties.$message({
|
|
200
|
-
message: 'The rich text watermark added successfully!',
|
|
201
|
-
type: 'success'
|
|
202
|
-
});
|
|
203
|
-
}
|
|
204
|
-
})
|
|
205
|
-
|
|
206
|
-
watermark.create() // add watermark
|
|
207
|
-
|
|
208
|
-
watermark.destroy() // remove watermark
|
|
209
|
-
```
|
|
210
|
-
<el-space>
|
|
211
|
-
<VPButton text="Add Rich Text Watermark" @click="handleAddRichTextWatermark"></VPButton>
|
|
212
|
-
<VPButton text="Remove Rich Text Watermark" @click="handleRemoveRichTextWatermark"></VPButton>
|
|
213
|
-
</el-space>
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
layout: doc
|
|
3
|
-
---
|
|
4
|
-
|
|
5
|
-
# What is this?
|
|
6
|
-
This is a *canvas-based* watermark for browser.
|
|
7
|
-
|
|
8
|
-
## Features
|
|
9
|
-
- Create watermark and blind watermark
|
|
10
|
-
- Supports text, multi text, image, rich text
|
|
11
|
-
- Watching for DOM changes
|
|
12
|
-
- Supports typescript
|
|
13
|
-
- Rich configuration
|
|
14
|
-
|
|
15
|
-
## Browser Support
|
|
16
|
-
|
|
17
|
-
|  |  |  |  |  |  |
|
|
18
|
-
|:-------------------------------------------------------------------------------------------------:|:----------------------------------------------------------------------------------------------------:|:-------------------------------------------------------------------------------------------------:|:----------------------------------------------------------------------------------------------:|:-------------------------------------------------------------------------------------------:|:---------------------------------------------------------------------------------------------------------------------------------------:|
|
|
19
|
-
| Latest ✔ | Latest ✔ | Latest ✔ | Latest ✔ | Latest ✔ | 11 ✔ |
|
package/docs/index.md
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
layout: home
|
|
3
|
-
sidebar: false
|
|
4
|
-
title: watermark-js-plus.js
|
|
5
|
-
titleTemplate: Watermark
|
|
6
|
-
|
|
7
|
-
hero:
|
|
8
|
-
name: watermark-js-plus
|
|
9
|
-
text: Advanced watermark plugin
|
|
10
|
-
tagline: Simple, powerful, and performant.
|
|
11
|
-
image:
|
|
12
|
-
src: /hero-image.png
|
|
13
|
-
alt: watermark-js-plus
|
|
14
|
-
actions:
|
|
15
|
-
- theme: brand
|
|
16
|
-
text: Get Started 👆
|
|
17
|
-
link: /guide/getting-started
|
|
18
|
-
- theme: alt
|
|
19
|
-
text: View on GitHub
|
|
20
|
-
link: https://github.com/zhensherlock/watermark-js-plus
|
|
21
|
-
|
|
22
|
-
features:
|
|
23
|
-
- icon: 🛠️
|
|
24
|
-
title: Rich Features
|
|
25
|
-
details: Supports text, multi-line text, image and rich text.
|
|
26
|
-
- icon: 🔑
|
|
27
|
-
title: Fully Typed APIs
|
|
28
|
-
details: Flexible programmatic APIs with full TypeScript typing..
|
|
29
|
-
- icon: 📦
|
|
30
|
-
title: Extremely light
|
|
31
|
-
details: weighs ~2kb, you will forget it's even there!
|
|
32
|
-
---
|
|
33
|
-
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/docs/public/logo.png
DELETED
|
Binary file
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
layout: doc
|
|
3
|
-
---
|
|
4
|
-
# 解析暗水印
|
|
5
|
-
|
|
6
|
-
## url
|
|
7
|
-
|
|
8
|
-
- **Type:** `string`
|
|
9
|
-
- **Default:** `''`
|
|
10
|
-
|
|
11
|
-
解码暗水印图片路径。
|
|
12
|
-
|
|
13
|
-
## mode
|
|
14
|
-
|
|
15
|
-
- **Type:** `string`
|
|
16
|
-
- **Default:** `'canvas'`
|
|
17
|
-
- **available values**: `'canvas'`
|
|
18
|
-
|
|
19
|
-
解码模式。
|
|
20
|
-
|
|
21
|
-
## fillColor
|
|
22
|
-
|
|
23
|
-
- **Type:** `string`
|
|
24
|
-
- **Default:** `'#000'`
|
|
25
|
-
|
|
26
|
-
解码 fill color.
|
|
27
|
-
|
|
28
|
-
## compositeOperation
|
|
29
|
-
|
|
30
|
-
- **Type:** `string`
|
|
31
|
-
- **Default:** `'color-burn'`
|
|
32
|
-
|
|
33
|
-
解码 composite operation.
|
package/docs/zh/config/blind.md
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
layout: doc
|
|
3
|
-
---
|
|
4
|
-
# 暗水印
|
|
5
|
-
|
|
6
|
-
## globalAlpha
|
|
7
|
-
|
|
8
|
-
- **Type:** `number`
|
|
9
|
-
- **Default:** `0.005`
|
|
10
|
-
|
|
11
|
-
水印的透明度。
|
|
12
|
-
|
|
13
|
-
## mode
|
|
14
|
-
|
|
15
|
-
- **Type:** `string`
|
|
16
|
-
- **Default:** `'blind'`
|
|
17
|
-
- **available values**: `'default' | 'blind'`
|
|
18
|
-
|
|
19
|
-
水印模式。
|