Spaces:
Sleeping
Sleeping
Delete text_selector.js
Browse files- text_selector.js +0 -22
text_selector.js
DELETED
|
@@ -1,22 +0,0 @@
|
|
| 1 |
-
import { Streamlit, withStreamlitConnection } from "streamlit-component-lib";
|
| 2 |
-
import React, { useState } from 'react';
|
| 3 |
-
|
| 4 |
-
function TextSelector() {
|
| 5 |
-
const [selectedText, setSelectedText] = useState("");
|
| 6 |
-
|
| 7 |
-
const handleMouseUp = () => {
|
| 8 |
-
const text = window.getSelection().toString().trim();
|
| 9 |
-
if (text) {
|
| 10 |
-
setSelectedText(text);
|
| 11 |
-
Streamlit.setComponentValue(text);
|
| 12 |
-
}
|
| 13 |
-
};
|
| 14 |
-
|
| 15 |
-
return (
|
| 16 |
-
<div onMouseUp={handleMouseUp} style={{ padding: '10px', cursor: 'text' }}>
|
| 17 |
-
{props.text}
|
| 18 |
-
</div>
|
| 19 |
-
);
|
| 20 |
-
}
|
| 21 |
-
|
| 22 |
-
export default withStreamlitConnection(TextSelector);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|