@mptw/skylens-ui 1.4.83 → 1.4.85
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/components/SLDownloadButton.vue +14 -0
- package/package.json +1 -1
- package/utils/index.ts +1 -1
|
@@ -223,6 +223,10 @@ export default defineComponent({
|
|
|
223
223
|
}
|
|
224
224
|
|
|
225
225
|
const dataURL = await domToPngDataUrl(imageTarget.value, customFilter.value, customStyle.value, padding.value, dateRanges.value, watermark.value, WatermarkImage);
|
|
226
|
+
if (!dataURL) {
|
|
227
|
+
console.log("Can not generate data URL!");
|
|
228
|
+
return;
|
|
229
|
+
}
|
|
226
230
|
downloadURL(dataURL, `${fileName.value}.png`);
|
|
227
231
|
|
|
228
232
|
if (evCategory.value !== "") {
|
|
@@ -239,6 +243,15 @@ export default defineComponent({
|
|
|
239
243
|
}
|
|
240
244
|
}
|
|
241
245
|
|
|
246
|
+
async function copyImage() {
|
|
247
|
+
const dataURL = await domToPngDataUrl(imageTarget.value, customFilter.value, customStyle.value, padding.value, dateRanges.value, watermark.value, WatermarkImage);
|
|
248
|
+
if (!dataURL) {
|
|
249
|
+
console.log("Can not generate data URL!");
|
|
250
|
+
return;
|
|
251
|
+
}
|
|
252
|
+
return dataURL;
|
|
253
|
+
}
|
|
254
|
+
|
|
242
255
|
onMounted(() => {
|
|
243
256
|
nextTick(() => {
|
|
244
257
|
if (buttonEl.value && popupEl.value) {
|
|
@@ -262,6 +275,7 @@ export default defineComponent({
|
|
|
262
275
|
popupEl,
|
|
263
276
|
onClickedToggle,
|
|
264
277
|
onClickedOption,
|
|
278
|
+
copyImage,
|
|
265
279
|
};
|
|
266
280
|
},
|
|
267
281
|
});
|
package/package.json
CHANGED
package/utils/index.ts
CHANGED
|
@@ -664,7 +664,7 @@ async function addWatermark(dataURL: string, watermarkImg: string) {
|
|
|
664
664
|
export const domToPngDataUrl = async (
|
|
665
665
|
imageTarget: HTMLElement | null,
|
|
666
666
|
customFilter: Function | null,
|
|
667
|
-
customStyle: CSSStyleDeclaration | null,
|
|
667
|
+
customStyle: Partial<CSSStyleDeclaration> | null,
|
|
668
668
|
padding: number = 0,
|
|
669
669
|
dateRanges: (IDateRange | null)[] = [],
|
|
670
670
|
watermark: boolean = true,
|