@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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@djangocfg/ui-tools",
3
- "version": "2.1.92",
3
+ "version": "2.1.94",
4
4
  "description": "Heavy React tools with lazy loading - for Electron, Vite, CRA, Next.js apps",
5
5
  "keywords": [
6
6
  "ui-tools",
@@ -55,7 +55,7 @@
55
55
  "consola": "^3.4.2"
56
56
  },
57
57
  "dependencies": {
58
- "@djangocfg/ui-core": "^2.1.92",
58
+ "@djangocfg/ui-core": "^2.1.94",
59
59
  "@rjsf/core": "^6.1.2",
60
60
  "@rjsf/utils": "^6.1.2",
61
61
  "@rjsf/validator-ajv8": "^6.1.2",
@@ -73,7 +73,7 @@
73
73
  "wavesurfer.js": "^7.12.1"
74
74
  },
75
75
  "devDependencies": {
76
- "@djangocfg/typescript-config": "^2.1.92",
76
+ "@djangocfg/typescript-config": "^2.1.94",
77
77
  "@types/node": "^24.7.2",
78
78
  "@types/react": "^19.1.0",
79
79
  "@types/react-dom": "^19.1.0",
@@ -282,8 +282,13 @@ const createMarkdownComponents = (isUser: boolean = false, isCompact: boolean =
282
282
  ),
283
283
  };};
284
284
 
285
- // Check if content contains markdown syntax
285
+ // Check if content contains markdown syntax or line breaks
286
286
  const hasMarkdownSyntax = (text: string): boolean => {
287
+ // If there are line breaks (after trim), treat as markdown for proper paragraph rendering
288
+ if (text.trim().includes('\n')) {
289
+ return true;
290
+ }
291
+
287
292
  // Common markdown patterns
288
293
  const markdownPatterns = [
289
294
  /^#{1,6}\s/m, // Headers
@@ -331,18 +336,21 @@ export const MarkdownMessage: React.FC<MarkdownMessageProps> = ({
331
336
  isUser = false,
332
337
  isCompact = false,
333
338
  }) => {
339
+ // Trim content to remove leading/trailing whitespace and empty lines
340
+ const trimmedContent = content.trim();
341
+
334
342
  const components = React.useMemo(() => createMarkdownComponents(isUser, isCompact), [isUser, isCompact]);
335
343
 
336
344
  const textSizeClass = isCompact ? 'text-xs' : 'text-sm';
337
345
  const proseClass = isCompact ? 'prose-xs' : 'prose-sm';
338
346
 
339
347
  // For plain text without markdown, render directly without ReactMarkdown
340
- const isPlainText = !hasMarkdownSyntax(content);
348
+ const isPlainText = !hasMarkdownSyntax(trimmedContent);
341
349
 
342
350
  if (isPlainText) {
343
351
  return (
344
352
  <span className={`${textSizeClass} leading-relaxed break-words ${className}`}>
345
- {content}
353
+ {trimmedContent}
346
354
  </span>
347
355
  );
348
356
  }
@@ -367,7 +375,7 @@ export const MarkdownMessage: React.FC<MarkdownMessageProps> = ({
367
375
  remarkPlugins={[remarkGfm]}
368
376
  components={components}
369
377
  >
370
- {content}
378
+ {trimmedContent}
371
379
  </ReactMarkdown>
372
380
  </div>
373
381
  );