@djangocfg/ui-tools 2.1.92 → 2.1.94
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +7 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +7 -3
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -3
- package/src/components/markdown/MarkdownMessage.tsx +12 -4
package/dist/index.cjs
CHANGED
|
@@ -4910,6 +4910,9 @@ var createMarkdownComponents = /* @__PURE__ */ chunkUQ3XI5MY_cjs.__name((isUser
|
|
|
4910
4910
|
};
|
|
4911
4911
|
}, "createMarkdownComponents");
|
|
4912
4912
|
var hasMarkdownSyntax = /* @__PURE__ */ chunkUQ3XI5MY_cjs.__name((text) => {
|
|
4913
|
+
if (text.trim().includes("\n")) {
|
|
4914
|
+
return true;
|
|
4915
|
+
}
|
|
4913
4916
|
const markdownPatterns = [
|
|
4914
4917
|
/^#{1,6}\s/m,
|
|
4915
4918
|
// Headers
|
|
@@ -4950,12 +4953,13 @@ var MarkdownMessage = /* @__PURE__ */ chunkUQ3XI5MY_cjs.__name(({
|
|
|
4950
4953
|
isUser = false,
|
|
4951
4954
|
isCompact = false
|
|
4952
4955
|
}) => {
|
|
4956
|
+
const trimmedContent = content.trim();
|
|
4953
4957
|
const components = React17__default.default.useMemo(() => createMarkdownComponents(isUser, isCompact), [isUser, isCompact]);
|
|
4954
4958
|
const textSizeClass = isCompact ? "text-xs" : "text-sm";
|
|
4955
4959
|
const proseClass = isCompact ? "prose-xs" : "prose-sm";
|
|
4956
|
-
const isPlainText = !hasMarkdownSyntax(
|
|
4960
|
+
const isPlainText = !hasMarkdownSyntax(trimmedContent);
|
|
4957
4961
|
if (isPlainText) {
|
|
4958
|
-
return /* @__PURE__ */ jsxRuntime.jsx("span", { className: `${textSizeClass} leading-relaxed break-words ${className}`, children:
|
|
4962
|
+
return /* @__PURE__ */ jsxRuntime.jsx("span", { className: `${textSizeClass} leading-relaxed break-words ${className}`, children: trimmedContent });
|
|
4959
4963
|
}
|
|
4960
4964
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
4961
4965
|
"div",
|
|
@@ -4978,7 +4982,7 @@ var MarkdownMessage = /* @__PURE__ */ chunkUQ3XI5MY_cjs.__name(({
|
|
|
4978
4982
|
{
|
|
4979
4983
|
remarkPlugins: [remarkGfm__default.default],
|
|
4980
4984
|
components,
|
|
4981
|
-
children:
|
|
4985
|
+
children: trimmedContent
|
|
4982
4986
|
}
|
|
4983
4987
|
)
|
|
4984
4988
|
}
|