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 (