Add an overlay that is invisible.

We will put a second copy of the input text in here invisibly, so we can create overlay spans.
This commit is contained in:
Tom Alexander 2024-01-12 22:30:55 -05:00
parent 636f2dabb8
commit 949e02af2f
Signed by: talexander
GPG Key ID: D3A179C9A53C0EDE
2 changed files with 12 additions and 1 deletions

View File

@ -8,6 +8,7 @@
.Editor-textwrapper { .Editor-textwrapper {
flex: 1; flex: 1;
flex-basis: 0; flex-basis: 0;
position: relative;
} }
.Editor-textarea { .Editor-textarea {
@ -19,3 +20,12 @@
flex: 1; flex: 1;
background: green; background: green;
} }
.Editor-overlay {
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
pointer-events: none;
}

View File

@ -8,7 +8,8 @@ function Editor() {
return ( return (
<div className="Editor"> <div className="Editor">
<div className="Editor-textwrapper"> <div className="Editor-textwrapper">
<textarea onChange={handleChange} className="Editor-textarea"></textarea> <div className="Editor-overlay"></div>
<textarea onChange={handleChange} className="Editor-textarea">I have text</textarea>
</div> </div>
<div className="Editor-ast"></div> <div className="Editor-ast"></div>
</div> </div>