Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: fit images and tables to page for Test Runs #295

Merged
merged 1 commit into from
Nov 28, 2024
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
Original file line number Diff line number Diff line change
Expand Up @@ -556,7 +556,7 @@ String adjustCellWidth(@NotNull String html, @NotNull ExportParams exportParams)
// This regexp searches for <td> or <th> elements of regular tables which width in styles specified in pixels ("px").
// <td> or <th> element till "width:" in styles matched into first unnamed group and width value - into second unnamed group.
// Then we replace matched content by first group content plus "auto" instead of value in pixels.
html = RegexMatcher.get("(<t[dh].+?width:.*?)(\\d+px)")
html = RegexMatcher.get("(<t[dh][^>]+?width:.*?)(\\d+px)")
.replace(html, regexEngine -> regexEngine.group(1) + "auto");
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@

<div class="flex-container">
<div class="flex-column">
<div class='property-wrapper only-live-doc'>
<div class='property-wrapper'>
<label for='popup-fit-to-page'>
<input id='popup-fit-to-page' type='checkbox'/>
Fit images and tables to page
Expand Down
3 changes: 2 additions & 1 deletion src/main/resources/webapp/pdf-exporter/js/pdf-exporter.js
Original file line number Diff line number Diff line change
Expand Up @@ -508,6 +508,7 @@ const PdfExporter = {

buildExportParams: function (selectedChapters, numberedListStyles, selectedRoles, fileName) {
const live_doc = this.exportContext.getDocumentType() === ExportParams.DocumentType.LIVE_DOC;
const test_run = this.exportContext.getDocumentType() === ExportParams.DocumentType.TEST_RUN;
return new ExportParams.Builder(this.exportContext.getDocumentType())
.setProjectId(this.exportContext.getProjectId())
.setLocationPath(this.exportContext.getLocationPath())
Expand All @@ -520,7 +521,7 @@ const PdfExporter = {
.setHeadersColor(document.getElementById("popup-headers-color").value)
.setPaperSize(document.getElementById("popup-paper-size-selector").value)
.setOrientation(document.getElementById("popup-orientation-selector").value)
.setFitToPage(live_doc && document.getElementById('popup-fit-to-page').checked)
.setFitToPage((live_doc || test_run) && document.getElementById('popup-fit-to-page').checked)
.setEnableCommentsRendering(live_doc && document.getElementById('popup-enable-comments-rendering').checked)
.setWatermark(document.getElementById("popup-watermark").checked)
.setMarkReferencedWorkitems(live_doc && document.getElementById("popup-mark-referenced-workitems").checked)
Expand Down