Skip to content

Commit

Permalink
Merge branch 'main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
louisgv authored Nov 9, 2023
2 parents b3258c0 + 6017ec5 commit 1d38d10
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
12 changes: 10 additions & 2 deletions cli/plasmo/src/type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,19 @@ type Getter<T, P = any> = (props?: P) => Async<T>

type GetElement = Getter<Element>

export type PlasmoCSUIAnchor = {
type PlasmoCSUIOverlayAnchor = {
element: Element
type: "overlay" | "inline"
type: "overlay"
}

type PlasmoCSUIInlineAnchor = {
element: Element
type: "inline"
insertPosition?: "beforebegin" | "afterbegin" | "beforeend" | "afterend"
}

export type PlasmoCSUIAnchor = PlasmoCSUIOverlayAnchor | PlasmoCSUIInlineAnchor

export type PlasmoCSUIProps = {
anchor?: PlasmoCSUIAnchor
}
Expand Down
2 changes: 1 addition & 1 deletion cli/plasmo/templates/static/common/csui.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ async function injectAnchor<T>(
mountState
})
} else if (anchor.type === "inline") {
anchor.element.insertAdjacentElement("afterend", shadowHost)
anchor.element.insertAdjacentElement(anchor.insertPosition || "afterend", shadowHost)
} else {
document.documentElement.prepend(shadowHost)
}
Expand Down

0 comments on commit 1d38d10

Please sign in to comment.