Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 28 additions & 6 deletions dist/doboard-widget-bundle.js

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions dist/doboard-widget-bundle.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/doboard-widget-bundle.min.js.map

Large diffs are not rendered by default.

19 changes: 14 additions & 5 deletions js/src/fileuploader.js
Original file line number Diff line number Diff line change
Expand Up @@ -409,6 +409,11 @@ class FileUploader {
}

async makeScreenshot() {
if (this.files.length >= this.maxFiles || this.getTotalSize() >= this.maxTotalSize) {
console.log('SpotFix: File count or total size limit reached. Automatic screenshot cancelled.');
return;
}

let blob = null;

let bgColor = window.getComputedStyle(document.body).backgroundColor;
Expand Down Expand Up @@ -493,12 +498,16 @@ class FileUploader {
lastModified: Date.now(),
});

if (this.uploaderWrapper && this.uploaderWrapper.style.display !== 'block') {
this.uploaderWrapper.style.display = 'block';
}
if (this.validateFile(file)) {
if (this.uploaderWrapper && this.uploaderWrapper.style.display !== 'block') {
this.uploaderWrapper.style.display = 'block';
}

this.clearError();
this.addFile(file);
this.clearError();
this.addFile(file);
} else {
console.warn('SpotFix: Automatic screenshot was not added because the total file size would exceed the limit.');
}
}
}
}
13 changes: 13 additions & 0 deletions js/src/widget.js
Original file line number Diff line number Diff line change
Expand Up @@ -940,6 +940,19 @@ class CleanTalkWidgetDoboard {
this.fileUploader = new FileUploader(this.escapeHtml);
this.fileUploader.init();

if (!this.nonRequesting && typeof this.fileUploader.makeScreenshot === 'function') {
const originalDisplay = widgetContainer.style.display;
widgetContainer.style.display = 'none';

try {
await this.fileUploader.makeScreenshot();
} catch (screenshotError) {
console.error('SpotFix: Failed to capture automatic screenshot on open:', screenshotError);
} finally {
widgetContainer.style.display = originalDisplay;
}
}

const savedDescription = localStorage.getItem('spotfix-description-ls') || '';
const fileUploaderDesc = this.fileUploader;

Expand Down
Loading