41 lines
888 B
TypeScript
41 lines
888 B
TypeScript
import type { PlasmoCSConfig, PlasmoGetInlineAnchor } from "plasmo"
|
|
import { sendToBackground } from "@plasmohq/messaging"
|
|
|
|
export const config: PlasmoCSConfig = {
|
|
matches: ["<all_urls>"]
|
|
}
|
|
|
|
export const getInlineAnchor: PlasmoGetInlineAnchor = () =>
|
|
// document.querySelector(`[href="/#pricing"]`)
|
|
document.querySelector(`.pgc-space-follow-page`);
|
|
|
|
// Use this to optimize unmount lookups
|
|
// export const getShadowHostId = () => "plasmo-inline-example-unique-id"
|
|
|
|
const PlasmoInline = () => {
|
|
const onClick = () => {
|
|
const resp = sendToBackground({
|
|
name: "test",
|
|
body: {
|
|
id: 123
|
|
}
|
|
}).then((res) => {
|
|
console.log(res);
|
|
})
|
|
}
|
|
|
|
return (
|
|
<div
|
|
style={{
|
|
borderRadius: 4,
|
|
padding: 4,
|
|
background: "pink"
|
|
}}
|
|
onClick={onClick}
|
|
>
|
|
CSUI INLINE
|
|
</div>
|
|
)
|
|
}
|
|
|
|
export default PlasmoInline |