From 51cd4ece3f20353c493b5bdca934c309f3c15040 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Janis=20Daniel=20Da=CC=88hne?=
 <janis.daehne2@student.uni-halle.de>
Date: Tue, 5 Nov 2019 18:51:18 +0100
Subject: [PATCH] - fixed issue where font size was only applied to first file
 when printing editor files

---
 .../aceEditors/multiFileAceEditor.tsx         | 20 +++++++++++--------
 src/constants.ts                              |  2 +-
 2 files changed, 13 insertions(+), 9 deletions(-)

diff --git a/src/components/codeEditors/aceEditors/multiFileAceEditor.tsx b/src/components/codeEditors/aceEditors/multiFileAceEditor.tsx
index 941ce9e6..ba9e5852 100644
--- a/src/components/codeEditors/aceEditors/multiFileAceEditor.tsx
+++ b/src/components/codeEditors/aceEditors/multiFileAceEditor.tsx
@@ -511,7 +511,7 @@ class MultiFileAceEditor extends React.Component<Props, any> {
       }
 
       innerHtml += markdown.render(markdownContent)
-      innerHtml += aceRenderedObj.html
+      innerHtml += `<div class="font-sized">${aceRenderedObj.html}</div>`
 
       if (onePagePerFile === false) { //continuous text --> add new line after file
         innerHtml += `<br />`
@@ -538,19 +538,23 @@ class MultiFileAceEditor extends React.Component<Props, any> {
     // tslint:disable-next-line
     fontSize = Math.min(fontSize, 17) //everything above 17 will not work properly (lines intersect, tested)
     // tslint:disable-next-line
-    fontSize = Math.max(fontSize, 10) //8 would work too but 12 is normal
+    fontSize = Math.max(fontSize, 8) //8 would work too but 12 is normal...
+
+
+    const editorStyleFontSize = document.createElement("style") as HTMLStyleElement
+    editorStyleFontSize.appendChild(document.createTextNode(`
+    #${tempPrintDivId} .font-sized .ace_static_highlight {
+      font-size: ${fontSize}px;
+    }
+    `))
+    document.head.appendChild(editorStyleFontSize)
 
     PrintHelper.printContent(innerHtml,
                              () => {
-                               const div = document.querySelector(
-                                 `#${tempPrintDivId} .ace_static_highlight`) as HTMLDivElement | null
-
-                               //static renderer has hard coded fontsize...
-                               if (!div) return
-                               div.style.fontSize = `${fontSize}px`
                              },
                              () => {
                                document.head.removeChild(editorStyle)
+                               document.head.removeChild(editorStyleFontSize)
                              }
     )
 
diff --git a/src/constants.ts b/src/constants.ts
index fd0dd9d1..5be2f39c 100644
--- a/src/constants.ts
+++ b/src/constants.ts
@@ -13,7 +13,7 @@ import Logger from './helpers/logger'
  * y - breaking changes / new features
  * z - fixes, small changes
  */
-export const versionString = '2.5.7'
+export const versionString = '2.5.8'
 
 
 export const supportMail = 'yapex@informatik.uni-halle.de'
-- 
GitLab