From 4dac2126bf974eef51536c1954eed1312e2d3bfc Mon Sep 17 00:00:00 2001 From: 50h100a Date: Wed, 21 Jun 2023 23:59:52 -0400 Subject: [PATCH 1/3] Do not replace codeblock newlines with
tags. --- public/script.js | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/public/script.js b/public/script.js index 75111d324..a773d180d 100644 --- a/public/script.js +++ b/public/script.js @@ -1045,7 +1045,7 @@ function messageFormatting(mes, ch_name, isSystem, isUser) { if (power_user.auto_fix_generated_markdown) { mes = fixMarkdown(mes); } - + if (this_chid != undefined && !isSystem) mes = mes.replaceAll("<", "<").replaceAll(">", ">"); //for welcome message if ((this_chid === undefined || this_chid === "invalid-safety-id") && !selected_group) { @@ -1053,21 +1053,19 @@ function messageFormatting(mes, ch_name, isSystem, isUser) { .replace(/\*\*(.+?)\*\*/g, "$1") .replace(/\n/g, "
"); } else if (!isSystem) { - mes = mes.replace(/```[\s\S]*?```|``[\s\S]*?``|`[\s\S]*?`|(\".+?\")|(\u201C.+?\u201D)/gm, function (match, p1, p2) { - if (p1) { - return '"' + p1.replace(/\"/g, "") + '"'; - } else if (p2) { - return '“' + p2.replace(/\u201C|\u201D/g, "") + '”'; - } else { - return match; - } - }); + mes = mes.replace(/\".+?\"|\u201C.+?\u201D/gm, '$&') // Wrap quotes in + mes = mes.replaceAll('\\begin{align*}', '$$'); mes = mes.replaceAll('\\end{align*}', '$$'); mes = converter.makeHtml(mes); mes = mes.replace(/{{(\*?.*\*?)}}/g, ""); + mes = mes.replace(/[\s\S]*?<\/code>/g, function (match) { + // Firefox creates extra newlines from
s in code blocks, so we replace them before converting newlines to
s. + return match.replace(/\n/gm, '\u0000'); + }) mes = mes.replace(/\n/g, "
"); + mes = mes.replace(/\u0000/g, "\n"); // Restore converted newlines mes = mes.trim(); mes = mes.replace(/[\s\S]*?<\/code>/g, function (match) { From 85876e9377fb4aefc5110380d55dabe91effc5d5 Mon Sep 17 00:00:00 2001 From: Cohee Date: Thu, 22 Jun 2023 12:47:05 +0300 Subject: [PATCH 2/3] Revert old quote wrapping for code blocks --- public/script.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/public/script.js b/public/script.js index a773d180d..2f39ff3c6 100644 --- a/public/script.js +++ b/public/script.js @@ -1045,7 +1045,7 @@ function messageFormatting(mes, ch_name, isSystem, isUser) { if (power_user.auto_fix_generated_markdown) { mes = fixMarkdown(mes); } - + if (this_chid != undefined && !isSystem) mes = mes.replaceAll("<", "<").replaceAll(">", ">"); //for welcome message if ((this_chid === undefined || this_chid === "invalid-safety-id") && !selected_group) { @@ -1053,7 +1053,15 @@ function messageFormatting(mes, ch_name, isSystem, isUser) { .replace(/\*\*(.+?)\*\*/g, "$1") .replace(/\n/g, "
"); } else if (!isSystem) { - mes = mes.replace(/\".+?\"|\u201C.+?\u201D/gm, '$&') // Wrap quotes in + mes = mes.replace(/```[\s\S]*?```|``[\s\S]*?``|`[\s\S]*?`|(\".+?\")|(\u201C.+?\u201D)/gm, function (match, p1, p2) { + if (p1) { + return '"' + p1.replace(/\"/g, "") + '"'; + } else if (p2) { + return '“' + p2.replace(/\u201C|\u201D/g, "") + '”'; + } else { + return match; + } + }); mes = mes.replaceAll('\\begin{align*}', '$$'); mes = mes.replaceAll('\\end{align*}', '$$'); From bd34cab6e8fd13e23bf360c0f882736c4e85bcf1 Mon Sep 17 00:00:00 2001 From: Cohee Date: Thu, 22 Jun 2023 13:10:39 +0300 Subject: [PATCH 3/3] #547 Display 3 lines of description in big avatars mode --- public/style.css | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/public/style.css b/public/style.css index 533142fa7..c5306392d 100644 --- a/public/style.css +++ b/public/style.css @@ -1339,6 +1339,14 @@ input[type=search]:focus::-webkit-search-cancel-button { margin-top: -5px; } +body.big-avatars .ch_description { + display: -webkit-box; + -webkit-line-clamp: 3; + -webkit-box-orient: vertical; + white-space: normal; + text-overflow: unset; +} + .justifySpaceBetween { justify-content: space-between; }