From c2850fa879a3ee8b572a08475eb82793abb1ad5a Mon Sep 17 00:00:00 2001 From: Tom Alexander Date: Sun, 28 Jan 2024 00:39:01 -0500 Subject: [PATCH] Make sure the text box starts out in sync. --- src/Editor.tsx | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/Editor.tsx b/src/Editor.tsx index 7d8ec82..d617586 100644 --- a/src/Editor.tsx +++ b/src/Editor.tsx @@ -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 (