text fixing

This commit is contained in:
Anthony Stirling
2025-12-03 10:48:13 +00:00
parent c5525d8676
commit 2b173a030e
@@ -2147,14 +2147,20 @@ const selectionToolbarPosition = useMemo(() => {
// Determine text wrapping behavior based on whether text has been changed
const hasChanges = changed;
const widthExtended = resolvedWidth - baseWidth > 0.5;
const enableWrap = isParagraphLayout || widthExtended || isEditing || hasChanges;
// Only enable wrapping if:
// 1. It's paragraph layout (multi-line groups should wrap)
// 2. Width was manually extended (user explicitly made space for wrapping)
// 3. Has changes AND was already wrapping (preserve existing wrap state)
// DO NOT enable wrapping just because isEditing - text should only wrap when it actually overflows
const wasWrapping = isParagraphLayout || widthExtended;
const enableWrap = wasWrapping || (hasChanges && wasWrapping);
const whiteSpace = enableWrap ? 'pre-wrap' : 'pre';
const wordBreak = enableWrap ? 'break-word' : 'normal';
const overflowWrap = enableWrap ? 'break-word' : 'normal';
// For paragraph mode, allow height to grow to accommodate lines without wrapping
// For single-line mode, maintain fixed height based on PDF bounds
const useFlexibleHeight = isEditing || enableWrap || (isParagraphLayout && lineCount > 1);
const useFlexibleHeight = enableWrap || (isParagraphLayout && lineCount > 1);
// The renderGroupContainer wrapper adds 4px horizontal padding (2px left + 2px right)
// We need to add this to the container width to compensate, so the inner content