mirror of
				https://github.com/ChatGPTNextWeb/ChatGPT-Next-Web.git
				synced 2025-11-04 16:23:41 +08:00 
			
		
		
		
	fix: #1359 empty line wrap count
This commit is contained in:
		@@ -160,13 +160,13 @@ export function autoGrowTextArea(dom: HTMLTextAreaElement) {
 | 
			
		||||
  measureDom.style.width = width + "px";
 | 
			
		||||
  measureDom.innerText = dom.value.trim().length > 0 ? dom.value : "1";
 | 
			
		||||
 | 
			
		||||
  const lineWrapCount = Math.max(0, dom.value.split("\n").length - 1);
 | 
			
		||||
  const emptyLineWrap = Math.max(0, dom.value.split("\n\n").length - 1);
 | 
			
		||||
  const height = parseFloat(window.getComputedStyle(measureDom).height);
 | 
			
		||||
  const singleLineHeight = parseFloat(
 | 
			
		||||
    window.getComputedStyle(singleLineDom).height,
 | 
			
		||||
  );
 | 
			
		||||
 | 
			
		||||
  const rows = Math.round(height / singleLineHeight) + lineWrapCount;
 | 
			
		||||
  const rows = Math.round(height / singleLineHeight) + emptyLineWrap;
 | 
			
		||||
 | 
			
		||||
  return rows;
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user