06254fd4 by Jonille Arreglo

Merge branch '29047_export_pdf' into 'master'

29047_export_pdf

See merge request !91
2 parents 4ab6686e 2c517740
...@@ -6,9 +6,26 @@ export default function ExportButton({ ...@@ -6,9 +6,26 @@ export default function ExportButton({
6 }) { 6 }) {
7 const responseToExport = () => { 7 const responseToExport = () => {
8 const response_to_export = document.querySelector(".response-to-export"); 8 const response_to_export = document.querySelector(".response-to-export");
9 if (!response_to_export) return; 9
10 return response_to_export?.innerHTML ?? ""; 10 if (response_to_export) {
11 }; 11
12 let response = '';
13 for(var i = 0; i < response_to_export.children.length; i++) {
14 if(!response_to_export.children[i].querySelector(".message")) continue;
15 let img_url = window.location.origin + "/assets/images/";
16 if(response_to_export.children[i].classList.contains("chatgpt")) {
17 let msg = "<div style='float: left; margin-left: 10px; padding-top: 5px;'>"+response_to_export.children[i].querySelector(".message").innerHTML+"</div>";
18 let profile = "<div style='width: 36px; height: 36px; background: #4c66ef; border-radius: 5px; float: left;'><img style='width: 24px; height: 24px; margin-top: 6px; margin-left: 6px;' src='" + img_url + "bot.png'></div>";
19 response = response + "<div style='background: #ddf1f9; padding: 5px'>"+ profile + msg +"</div>";
20 } else {
21 let msg = "<div style='float: left; margin-left: 10px;'>"+response_to_export.children[i].querySelector(".message").innerHTML+"</div>";
22 let profile = "<div style='width: 36px; height: 36px; background: #6BA447; border-radius: 5px; float: left;'><img style='width: 24px; height: 24px; margin-top: 6px; margin-left: 6px;' src='" + img_url + "user.png'></div>";
23 response = response + "<div style='padding: 5px'>"+ profile + msg +"</div>";
24 }
25 }
26 return response;
27 }
28 }
12 const generatePDF = window.generatePDF; 29 const generatePDF = window.generatePDF;
13 30
14 const onClickExportToPDF = () => { 31 const onClickExportToPDF = () => {
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!