Skip to content

Commit 03c1a61

Browse files
committed
MarkdownChat
1 parent 7c2e795 commit 03c1a61

File tree

2 files changed

+15
-23
lines changed

2 files changed

+15
-23
lines changed

services/static-webserver/client/source/class/osparc/conversation/MessageUI.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ qx.Class.define("osparc.conversation.MessageUI", {
115115
this.getChildControl("main-layout").addAt(control, 1);
116116
break;
117117
case "message-content":
118-
control = new osparc.ui.markdown.Markdown2();
118+
control = new osparc.ui.markdown.MarkdownChat();
119119
this.getChildControl("message-bubble").add(control);
120120
break;
121121
case "menu-button": {

services/static-webserver/client/source/class/osparc/ui/markdown/Markdown2.js renamed to services/static-webserver/client/source/class/osparc/ui/markdown/MarkdownChat.js

Lines changed: 14 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
/* global marked */
1515

16-
qx.Class.define("osparc.ui.markdown.Markdown2", {
16+
qx.Class.define("osparc.ui.markdown.MarkdownChat", {
1717
extend: qx.ui.embed.Html,
1818

1919
/**
@@ -111,29 +111,21 @@ qx.Class.define("osparc.ui.markdown.Markdown2", {
111111
const safeHtml = osparc.wrapper.DOMPurify.getInstance().sanitize(html);
112112

113113
// flow-root prevents margin collapsing; inline style avoids extra stylesheet juggling
114-
let mdRoot;
115114
const max = 220;
116-
if (max) {
117-
mdRoot = `
118-
<div class="${this.self().MD_ROOT}" style="display:flow-root;">
119-
<div class="${this.self().MD_MEASURE}"
120-
style="
121-
display:inline-block;
122-
width:max-content;
123-
max-width:${max}px;
124-
white-space:normal;
125-
overflow-wrap:anywhere; /* break long tokens */
126-
">
127-
${safeHtml}
128-
</div>
129-
</div>
130-
`;
131-
} else {
132-
mdRoot = `
133-
<div class="${this.self().MD_ROOT}" style="display:flow-root;">
115+
const mdRoot = `
116+
<div class="${this.self().MD_ROOT}" style="display:flow-root;">
117+
<div class="${this.self().MD_MEASURE}"
118+
style="
119+
display:inline-block;
120+
width:max-content;
121+
max-width:${max}px;
122+
white-space:normal;
123+
overflow-wrap:anywhere; /* break long tokens */
124+
">
134125
${safeHtml}
135-
</div>`;
136-
}
126+
</div>
127+
</div>
128+
`;
137129
this.setHtml(mdRoot);
138130

139131
// resize once DOM is updated/painted

0 commit comments

Comments
 (0)