mirror of
https://github.com/jackyzha0/quartz.git
synced 2026-03-24 15:05:42 -05:00
fix: parse bool to string first
Signed-off-by: Aaron Pham <contact@aarnphm.xyz>
This commit is contained in:
parent
077e79c48f
commit
a572e9336e
@ -17,6 +17,10 @@ type Options = {
|
||||
}
|
||||
}
|
||||
|
||||
function boolToStringBool(b: boolean): string {
|
||||
return b ? "1" : "0"
|
||||
}
|
||||
|
||||
export default ((opts: Options) => {
|
||||
const Comments: QuartzComponent = ({ displayClass, cfg }: QuartzComponentProps) => {
|
||||
return (
|
||||
@ -27,8 +31,8 @@ export default ((opts: Options) => {
|
||||
data-category={opts.options.category}
|
||||
data-category-id={opts.options.categoryId}
|
||||
data-mapping={opts.options.mapping ?? "url"}
|
||||
data-strict={opts.options.strict ?? true}
|
||||
data-reactions-enabled={opts.options.reactionsEnabled ?? true}
|
||||
data-strict={boolToStringBool(opts.options.strict ?? true)}
|
||||
data-reactions-enabled={boolToStringBool(opts.options.reactionsEnabled ?? true)}
|
||||
data-input-position={opts.options.inputPosition ?? "bottom"}
|
||||
></div>
|
||||
)
|
||||
|
||||
@ -32,8 +32,8 @@ type GiscusElement = Omit<HTMLElement, "dataset"> & {
|
||||
category: string
|
||||
categoryId: string
|
||||
mapping: "url" | "title" | "og:title" | "specific" | "number" | "pathname"
|
||||
strict: boolean
|
||||
reactionsEnabled: boolean
|
||||
strict: string
|
||||
reactionsEnabled: string
|
||||
inputPosition: "top" | "bottom"
|
||||
}
|
||||
}
|
||||
@ -55,11 +55,8 @@ document.addEventListener("nav", () => {
|
||||
giscusScript.setAttribute("data-category", giscusContainer.dataset.category)
|
||||
giscusScript.setAttribute("data-category-id", giscusContainer.dataset.categoryId)
|
||||
giscusScript.setAttribute("data-mapping", giscusContainer.dataset.mapping)
|
||||
giscusScript.setAttribute("data-strict", boolToStringBool(giscusContainer.dataset.strict))
|
||||
giscusScript.setAttribute(
|
||||
"data-reactions-enabled",
|
||||
boolToStringBool(giscusContainer.dataset.reactionsEnabled),
|
||||
)
|
||||
giscusScript.setAttribute("data-strict", giscusContainer.dataset.strict)
|
||||
giscusScript.setAttribute("data-reactions-enabled", giscusContainer.dataset.reactionsEnabled)
|
||||
giscusScript.setAttribute("data-input-position", giscusContainer.dataset.inputPosition)
|
||||
|
||||
const theme = document.documentElement.getAttribute("saved-theme")
|
||||
|
||||
Loading…
Reference in New Issue
Block a user