Skip to content

fixed screenshot function. test - #133

Merged
veronika-tseleva-cleantalk merged 1 commit into
devfrom
fix_55346-2
Sep 8, 2026
Merged

veronika-tseleva-cleantalk merged 1 commit into
devfrom
fix_55346-2

Conversation

@veronika-tseleva-cleantalk

Copy link
Copy Markdown
Contributor

No description provided.

Copilot AI lite review requested due to automatic review settings September 8, 2026 15:45
@veronika-tseleva-cleantalk
veronika-tseleva-cleantalk merged commit bd55353 into dev Sep 8, 2026
1 check passed

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The build now references a non-existent js/src/lib/dom-to-image.js, and makeScreenshot(false) no longer rejects on failure so existing .catch(...) handlers won’t run.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

This PR aims to fix screenshot capture by removing runtime loading of dom-to-image-more from a CDN and instead bundling a dom-to-image implementation into the widget build, while also adjusting screenshot error handling.

Changes:

  • Removed the dynamic loadDomToImage() script injection and switched makeScreenshot() to use a preloaded domtoimage global (with html2canvas fallback).
  • Updated the gulp JS bundle inputs to include a dom-to-image library before the main widget code.
  • Regenerated dist/doboard-widget-bundle.js to embed the dom-to-image library code.
File summaries
File Description
js/src/fileuploader.js Removes CDN loader and updates screenshot flow / notification helper.
gulpfile.js Adds dom-to-image library to the concatenated bundle inputs.
dist/doboard-widget-bundle.js Updates the built bundle to include dom-to-image and related screenshot changes.
Review details

Suppressed comments (1)

js/src/fileuploader.js:546

  • Same as above: returning from the html2canvas error path resolves the promise, so callers using .catch(...) will never observe the failure.
                return;
  • Files reviewed: 2/5 changed files
  • Comments generated: 3
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread gulpfile.js
Comment on lines 16 to 19
const jsStream = gulp.src([
'js/src/lib/html2canvas.js',
'js/src/lib/dom-to-image.js',
'js/src/localDB.js',
Comment thread js/src/fileuploader.js
}
}
throw new Error('Screenshot failed due to CORS');
return;
Comment thread js/src/fileuploader.js
Comment on lines 399 to +404
/**
* Make a screenshot and add it as a file
* @returns {Promise<void>}
*/

async loadDomToImage() {
return new Promise((resolve, reject) => {
if (window.domtoimage) {
resolve(window.domtoimage);
return;
}

const defineMem = window.define;
if (defineMem && defineMem.amd) {
window.define = undefined;
}

const script = document.createElement('script');
script.src = 'https://cdn.jsdelivr.net/npm/dom-to-image-more@3.1.6/dist/dom-to-image-more.min.js';

script.onload = () => {
if (defineMem && defineMem.amd) {
window.define = defineMem;
}
resolve(window.domtoimage);
};

script.onerror = () => {
if (defineMem && defineMem.amd) {
window.define = defineMem;
}
reject(new Error('Failed to load dom-to-image-more'));
};

document.head.appendChild(script);
showErrorNotification(message) {
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants