Skip to content

Commit

Permalink
fix: fit images and tables to page for Test Runs (#295)
Browse files Browse the repository at this point in the history
Refs: #293
  • Loading branch information
Jumas authored Nov 28, 2024
1 parent a7b4a80 commit 9d77b06
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
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
2 changes: 1 addition & 1 deletion src/main/resources/webapp/pdf-exporter/html/popupForm.html
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

0 comments on commit 9d77b06

Please sign in to comment.