Simplify line measurement logic in App.tsx
This commit is contained in:
@@ -459,9 +459,7 @@ export default function App() {
|
|||||||
useLayoutEffect(() => {
|
useLayoutEffect(() => {
|
||||||
if (!showLineNumbersActive) return;
|
if (!showLineNumbersActive) return;
|
||||||
const textarea = textareaRef.current;
|
const textarea = textareaRef.current;
|
||||||
const measure = measureRef.current;
|
if (!textarea) return;
|
||||||
if (!textarea || !measure) return;
|
|
||||||
measure.style.width = `${textarea.clientWidth}px`;
|
|
||||||
const computed = window.getComputedStyle(textarea);
|
const computed = window.getComputedStyle(textarea);
|
||||||
const lineHeight = parseFloat(computed.lineHeight);
|
const lineHeight = parseFloat(computed.lineHeight);
|
||||||
if (Number.isFinite(lineHeight) && lineHeight > 0 && lineHeight !== defaultLineHeight) {
|
if (Number.isFinite(lineHeight) && lineHeight > 0 && lineHeight !== defaultLineHeight) {
|
||||||
|
|||||||
Reference in New Issue
Block a user