Skip to content

Commit

Permalink
fix highlighting ig
Browse files Browse the repository at this point in the history
  • Loading branch information
targoninc-alex committed Jun 30, 2024
1 parent 51aaf78 commit d2a7f66
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
11 changes: 6 additions & 5 deletions ui/classes.css
Original file line number Diff line number Diff line change
Expand Up @@ -731,18 +731,19 @@

.attachment.text code {
width: 100%;
height: 300px;
height: 200px;
overflow: auto;
padding: 1em;
background: var(--bg-3);
border-radius: var(--input-border-radius);
box-sizing: border-box;
}

.attachment.text code {
font-family: monospace;
font-size: 0.8em;
white-space: pre-wrap;
white-space: preserve;
}

.attachment.text {
width: 100%;
}

.attachment-floating-buttons {
Expand Down
5 changes: 3 additions & 2 deletions ui/components/attachment.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,8 @@ export class AttachmentTemplates {
method: "GET",
credentials: "include"
}).then(async text => {
fileContent.value = await text.text();
fileContent.value = (await text.text())
.replaceAll(/\n/g, '<br/>');
hljs.highlightElement(document.getElementById(id));
});

Expand All @@ -129,7 +130,7 @@ export class AttachmentTemplates {
.children(
create("code")
.id(id)
.text(fileContent)
.html(fileContent)
.build()
).build(),
create("div")
Expand Down

0 comments on commit d2a7f66

Please sign in to comment.