fixed screenshot function. test - #133
Merged
Merged
Conversation
Copilot started reviewing on behalf of
veronika-tseleva-cleantalk
September 8, 2026 15:45
View session
There was a problem hiding this comment.
🟡 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 switchedmakeScreenshot()to use a preloadeddomtoimageglobal (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.jsto 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 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', |
| } | ||
| } | ||
| throw new Error('Screenshot failed due to CORS'); | ||
| return; |
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) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.