Make sure the text box starts out in sync.

This commit is contained in:
Tom Alexander 2024-01-28 00:39:01 -05:00
parent d5020d3f24
commit c2850fa879
Signed by: talexander
GPG Key ID: D3A179C9A53C0EDE
1 changed files with 6 additions and 1 deletions

View File

@ -1,4 +1,4 @@
import React, { ReactNode, useMemo, useRef, useState } from "react";
import React, { ReactNode, useEffect, useMemo, useRef, useState } from "react";
import "./Editor.css";
import { Highlight } from "./highlight";
import { buildShadow } from "./shadow";
@ -72,6 +72,11 @@ function Editor({ defaultValue = default_org_source }) {
}
}
useEffect(() => {
// Make sure the text area and shadow div start out in sync.
onTextAreaScroll();
}, []);
return (
<div className="Editor">
<div className="Editor-textwrapper">