-
-
Notifications
You must be signed in to change notification settings - Fork 23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Pressing the tab key on a readonly textarea causes a tab in the value #152
Comments
jaywcjlove
added a commit
that referenced
this issue
Jun 23, 2023
@SangJunBak Upgrade import React, { useEffect } from "react";
import CodeEditor, { SelectionText } from "@uiw/react-textarea-code-editor";
import "./styles.css";
export default function App() {
const textRef = React.useRef();
const [code, setCode] = React.useState(
`function add(a, b) {\n return a + b;\n}`
);
useEffect(() => {
if (textRef.current) {
const obj = new SelectionText(textRef.current);
console.log("obj:", obj);
}
}, []);
return (
<>
<div>
<h3>Auto</h3>
<CodeEditor
value={code}
ref={textRef}
language="js"
placeholder="Please enter JS code."
onChange={(evn) => setCode(evn.target.value)}
padding={15}
readOnly
style={{
fontFamily:
"ui-monospace,SFMono-Regular,SF Mono,Consolas,Liberation Mono,Menlo,monospace",
fontSize: 12
}}
/>
</div>
</>
);
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
No description provided.
The text was updated successfully, but these errors were encountered: