plasmo
plasmo copied to clipboard
[How to fetch anchor innerText]
What is the example you wish to see?
export const getInlineAnchorList: PlasmoGetInlineAnchorList = async () => {
return document.querySelectorAll("div[id^='message-content']")
}
export const getShadowHostId = (anchor: PlasmoCSUIAnchor) =>
anchor.element.innerText + "plasmo-inline-example-unique-id"
const TranslateComponent = () => {
// how to fetch anchor innerText
const orgMsgText = anchor.element.innerText
const newMsgText = (orgMsgText) => {}
const [fontColor, _setColor] = useStorage("pickColor", "blue")
return (
<div style={{
color: fontColor
}}>
<span> {newMsgText} </span>
</div>
)
}
export default TranslateComponent
Is there any context that might help us understand?
I want to fetch anchor innerText in TranslateComponent , I didn't find the corresponding solution in the documents and examples, Is there any way to solve it?
Code of Conduct
- [X] I agree to follow this project's Code of Conduct
- [X] I checked the current issues for duplicate problems.
It's 2024, and I'm also looking for a solution to this
You can try this
...
const TranslateComponent = ({ anchor: { element } }) => {
...
You can try this
... const TranslateComponent = ({ anchor: { element } }) => { ...
Thank you, I discovered this usage after some time by reviewing some reference code, but it was not mentioned in the official documentation. In fact, I do not know how much more advanced usage I am unaware of.