diff --git a/dist/doboard-widget-bundle.js b/dist/doboard-widget-bundle.js
index a8cd979..b6270cc 100644
--- a/dist/doboard-widget-bundle.js
+++ b/dist/doboard-widget-bundle.js
@@ -13829,45 +13829,54 @@ class FileUploader {
const currentOrigin = window.location.origin;
- try {
- const domtoimageLib = await this.loadDomToImage();
- if (domtoimageLib) {
- blob = await domtoimageLib.toBlob(document.body, {
- bgcolor: bgColor,
- width: window.innerWidth,
- height: window.innerHeight,
- style: {
- transform: `translate(${-window.scrollX}px, ${-window.scrollY}px)`,
- backgroundColor: bgColor
- },
- filter: (node) => {
- if (node.classList && node.classList.contains('doboard_task_widget')) return false;
- if (node.tagName === 'NOSCRIPT' || node.tagName === 'IFRAME') return false;
-
- if (node.tagName === 'IMG' && node.src && node.src.startsWith('http')) {
- try {
- const url = new URL(node.src);
- if (url.origin !== currentOrigin && !node.crossOrigin) return false;
- } catch (e) {
- return false;
- }
- }
+ let hasCssCorsError = false;
+ for (let i = 0; i < document.styleSheets.length; i++) {
+ try {
+ const rules = document.styleSheets[i].cssRules;
+ } catch (e) {
+ if (e.name === 'SecurityError') {
+ hasCssCorsError = true;
+ break;
+ }
+ }
+ }
- if (node.tagName === 'LINK' && node.rel === 'stylesheet') {
- try {
- if (node.sheet && !node.sheet.cssRules) return false;
- } catch (e) {
- return false;
+ if (!hasCssCorsError) {
+ try {
+ const domtoimageLib = await this.loadDomToImage();
+ if (domtoimageLib) {
+ blob = await domtoimageLib.toBlob(document.body, {
+ bgcolor: bgColor,
+ width: window.innerWidth,
+ height: window.innerHeight,
+ style: {
+ transform: `translate(${-window.scrollX}px, ${-window.scrollY}px)`,
+ backgroundColor: bgColor
+ },
+ filter: (node) => {
+ if (node.classList && node.classList.contains('doboard_task_widget')) return false;
+ if (node.tagName === 'NOSCRIPT' || node.tagName === 'IFRAME') return false;
+
+ if (node.tagName === 'IMG' && node.src && node.src.startsWith('http')) {
+ try {
+ const url = new URL(node.src);
+ if (url.origin !== currentOrigin && !node.crossOrigin) return false;
+ } catch (e) { return false; }
}
+ return true;
}
+ });
- return true;
+ if (blob && blob.size < 100) {
+ blob = null;
}
- });
+ }
+ } catch (error) {
+ console.warn('SpotFix: dom-to-image failed.', error.message);
+ blob = null;
}
- } catch (error) {
- console.warn(error.message);
- blob = null;
+ } else {
+ console.log('SpotFix: html2canvas.');
}
if (!blob) {
diff --git a/dist/doboard-widget-bundle.min.js b/dist/doboard-widget-bundle.min.js
index 0241a78..f31ccc9 100644
--- a/dist/doboard-widget-bundle.min.js
+++ b/dist/doboard-widget-bundle.min.js
@@ -39,7 +39,7 @@
- `),A.querySelector(".doboard_task_widget__file-upload__remove-btn").addEventListener("click",()=>this.removeFile(t)),A}formatFileSize(A){var e;return 0===A?"0 Bytes":(e=Math.floor(Math.log(A)/Math.log(1024)),parseFloat((A/Math.pow(1024,e)).toFixed(2))+" "+this.SIZE_UNITS[e])}showError(A){this.errorMessage&&(this.errorMessage.textContent=A,this.errorMessage.style.display="block")}clearError(){this.errorMessage&&(this.errorMessage.textContent="",this.errorMessage.style.display="none")}hasFiles(){return 0A?.[e],A)}async sendSingleAttachment(A){A=await this.validateFileData(A);return attachmentAddDoboard(A)}async sendAttachmentsForComment(e,t,o){var i={preparedFilesCount:this.files.length,sentFilesCount:0,fileResults:[],success:!0};for(let A=0;A{var t;window.domtoimage?A(window.domtoimage):((t=document.createElement("script")).src="https://cdn.jsdelivr.net/npm/dom-to-image-more@3.1.6/dist/dom-to-image-more.min.js",t.onload=()=>A(window.domtoimage),t.onerror=()=>e(new Error("Failed to load dom-to-image-more")),document.head.appendChild(t))})}async makeScreenshot(){if(!this.files||!Array.isArray(this.files)||this.files.length>=this.maxFiles)console.log("SpotFix: File count limit reached.");else if("function"==typeof this.getTotalSize&&this.getTotalSize()>=this.maxTotalSize)console.log("SpotFix: Size limit reached.");else{let t=null,A=window.getComputedStyle(document.body).backgroundColor,o=("rgba(0, 0, 0, 0)"!==A&&"transparent"!==A||(A="#ffffff"),window.location.origin);try{var e=await this.loadDomToImage();e&&(t=await e.toBlob(document.body,{bgcolor:A,width:window.innerWidth,height:window.innerHeight,style:{transform:`translate(${-window.scrollX}px, ${-window.scrollY}px)`,backgroundColor:A},filter:A=>{if(A.classList&&A.classList.contains("doboard_task_widget"))return!1;if("NOSCRIPT"===A.tagName||"IFRAME"===A.tagName)return!1;if("IMG"===A.tagName&&A.src&&A.src.startsWith("http"))try{if(new URL(A.src).origin!==o&&!A.crossOrigin)return!1}catch(A){return!1}if("LINK"===A.tagName&&"stylesheet"===A.rel)try{if(A.sheet&&!A.sheet.cssRules)return!1}catch(A){return!1}return!0}}))}catch(A){console.warn(A.message),t=null}if(!t)try{if("undefined"==typeof html2canvas)throw new Error("html2canvas is not defined");document.fonts&&document.fonts.ready&&await document.fonts.ready;let e=await html2canvas(document.body,{useCORS:!0,allowTaint:!1,logging:!1,backgroundColor:A,scale:window.devicePixelRatio||1,x:window.scrollX,y:window.scrollY,width:window.innerWidth,height:window.innerHeight,windowWidth:document.documentElement.offsetWidth,windowHeight:document.documentElement.offsetHeight,onclone:A=>{A.querySelectorAll("img").forEach(A=>{try{A.src&&A.src.startsWith("http")&&(new URL(A.src).origin===o||A.crossOrigin||(A.src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7",A.removeAttribute("srcset")))}catch(A){}}),A.querySelectorAll("iframe").forEach(A=>A.remove()),A.querySelectorAll(".doboard_task_widget").forEach(A=>A.style.display="none")}});if(!(t=await new Promise(A=>e.toBlob(A,"image/png"))))throw new Error("html2canvas returned empty canvas")}catch(A){return console.error(A),null}t&&(e=`Screenshot_${(e=new Date).getHours()}-${e.getMinutes()}_${e.getDate()}_${e.getMonth()+1}_${e.getFullYear()}.png`,e=new File([t],e,{type:"image/png",lastModified:Date.now()}),"function"==typeof this.validateFile)&&this.validateFile(e)&&(this.uploaderWrapper?.style&&(this.uploaderWrapper.style.display="block"),"function"==typeof this.clearError&&this.clearError(),"function"==typeof this.addFile)&&this.addFile(e)}}}class SpotFixTemplatesLoader{static getTemplateCode(A){var e=this[A];if("function"!=typeof e)throw new Error(`Template method '${A}' not found`);return e.call(this).trim()}static all_issues(){return`
+ `),A.querySelector(".doboard_task_widget__file-upload__remove-btn").addEventListener("click",()=>this.removeFile(t)),A}formatFileSize(A){var e;return 0===A?"0 Bytes":(e=Math.floor(Math.log(A)/Math.log(1024)),parseFloat((A/Math.pow(1024,e)).toFixed(2))+" "+this.SIZE_UNITS[e])}showError(A){this.errorMessage&&(this.errorMessage.textContent=A,this.errorMessage.style.display="block")}clearError(){this.errorMessage&&(this.errorMessage.textContent="",this.errorMessage.style.display="none")}hasFiles(){return 0A?.[e],A)}async sendSingleAttachment(A){A=await this.validateFileData(A);return attachmentAddDoboard(A)}async sendAttachmentsForComment(e,t,o){var i={preparedFilesCount:this.files.length,sentFilesCount:0,fileResults:[],success:!0};for(let A=0;A{var t;window.domtoimage?A(window.domtoimage):((t=document.createElement("script")).src="https://cdn.jsdelivr.net/npm/dom-to-image-more@3.1.6/dist/dom-to-image-more.min.js",t.onload=()=>A(window.domtoimage),t.onerror=()=>e(new Error("Failed to load dom-to-image-more")),document.head.appendChild(t))})}async makeScreenshot(){if(!this.files||!Array.isArray(this.files)||this.files.length>=this.maxFiles)console.log("SpotFix: File count limit reached.");else if("function"==typeof this.getTotalSize&&this.getTotalSize()>=this.maxTotalSize)console.log("SpotFix: Size limit reached.");else{let t=null,A=window.getComputedStyle(document.body).backgroundColor,o=("rgba(0, 0, 0, 0)"!==A&&"transparent"!==A||(A="#ffffff"),window.location.origin),e=!1;for(let A=0;A{if(A.classList&&A.classList.contains("doboard_task_widget"))return!1;if("NOSCRIPT"===A.tagName||"IFRAME"===A.tagName)return!1;if("IMG"===A.tagName&&A.src&&A.src.startsWith("http"))try{if(new URL(A.src).origin!==o&&!A.crossOrigin)return!1}catch(A){return!1}return!0}}))&&t.size<100&&(t=null)}catch(A){console.warn("SpotFix: dom-to-image failed.",A.message),t=null}if(!t)try{if("undefined"==typeof html2canvas)throw new Error("html2canvas is not defined");document.fonts&&document.fonts.ready&&await document.fonts.ready;let e=await html2canvas(document.body,{useCORS:!0,allowTaint:!1,logging:!1,backgroundColor:A,scale:window.devicePixelRatio||1,x:window.scrollX,y:window.scrollY,width:window.innerWidth,height:window.innerHeight,windowWidth:document.documentElement.offsetWidth,windowHeight:document.documentElement.offsetHeight,onclone:A=>{A.querySelectorAll("img").forEach(A=>{try{A.src&&A.src.startsWith("http")&&(new URL(A.src).origin===o||A.crossOrigin||(A.src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7",A.removeAttribute("srcset")))}catch(A){}}),A.querySelectorAll("iframe").forEach(A=>A.remove()),A.querySelectorAll(".doboard_task_widget").forEach(A=>A.style.display="none")}});if(!(t=await new Promise(A=>e.toBlob(A,"image/png"))))throw new Error("html2canvas returned empty canvas")}catch(A){return console.error(A),null}t&&(i=`Screenshot_${(i=new Date).getHours()}-${i.getMinutes()}_${i.getDate()}_${i.getMonth()+1}_${i.getFullYear()}.png`,i=new File([t],i,{type:"image/png",lastModified:Date.now()}),"function"==typeof this.validateFile)&&this.validateFile(i)&&(this.uploaderWrapper?.style&&(this.uploaderWrapper.style.display="block"),"function"==typeof this.clearError&&this.clearError(),"function"==typeof this.addFile)&&this.addFile(i)}}}class SpotFixTemplatesLoader{static getTemplateCode(A){var e=this[A];if("function"!=typeof e)throw new Error(`Template method '${A}' not found`);return e.call(this).trim()}static all_issues(){return`