How can I add a content script UI for different elements in the same page? #1124
Unanswered
michael-freling
asked this question in
Q&A
Replies: 1 comment
-
|
In my opinion, Plasmo expects import { InlineContentScript } from "@plasmohq/content-scripts"
export const getInlineAnchorList = async () => {
// Component 1 anchors
const contentAnchors = Array.from(document.querySelectorAll("#content"))
// Component 2 anchors
const otherAnchors = Array.from(document.querySelectorAll(".something-else"))
return [
...contentAnchors.map((el) => ({ el, component: "Component1" })),
...otherAnchors.map((el) => ({ el, component: "Component2" }))
]
}If you share your code, maybe I can assist you further. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Goal
I want to add inline components for 2 different types of HTML elements in a page.
Rough contents will be like next.
component.querySelectorAll("#content")for eachdocument.querySelectorAll("#contents")document.querySelectorAll(".something-else")Question
How to implement
InlineComponentandgetInlineAnchorListto handle different HTML elements?Beta Was this translation helpful? Give feedback.
All reactions