Merge branch 'jackyzha0:v4' into v4

This commit is contained in:
enneaa 2025-06-13 17:53:45 +08:00 committed by GitHub
commit f44c9045df
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 17 additions and 8 deletions

View File

@ -45,6 +45,8 @@ afterBody: [
category: 'Announcements', category: 'Announcements',
// from data-category-id // from data-category-id
categoryId: 'DIC_kwDOFxRnmM4B-Xg6', categoryId: 'DIC_kwDOFxRnmM4B-Xg6',
// from data-lang
lang: 'en'
} }
}), }),
], ],
@ -90,6 +92,10 @@ type Options = {
// where to put the comment input box relative to the comments // where to put the comment input box relative to the comments
// defaults to 'bottom' // defaults to 'bottom'
inputPosition?: "top" | "bottom" inputPosition?: "top" | "bottom"
// set your preference language here
// defaults to 'en'
lang?: string
} }
} }
``` ```

View File

@ -125,9 +125,10 @@ async function startWatching(
ctx, ctx,
mut, mut,
contentMap, contentMap,
ignored: (path) => { ignored: (fp) => {
if (gitIgnoredMatcher(path)) return true const pathStr = toPosixPath(fp.toString())
const pathStr = path.toString() if (pathStr.startsWith(".git/")) return true
if (gitIgnoredMatcher(pathStr)) return true
for (const pattern of cfg.configuration.ignorePatterns) { for (const pattern of cfg.configuration.ignorePatterns) {
if (minimatch(pathStr, pattern)) { if (minimatch(pathStr, pattern)) {
return true return true

View File

@ -17,6 +17,7 @@ type Options = {
strict?: boolean strict?: boolean
reactionsEnabled?: boolean reactionsEnabled?: boolean
inputPosition?: "top" | "bottom" inputPosition?: "top" | "bottom"
lang?: string
} }
} }
@ -50,6 +51,7 @@ export default ((opts: Options) => {
data-theme-url={ data-theme-url={
opts.options.themeUrl ?? `https://${cfg.baseUrl ?? "example.com"}/static/giscus` opts.options.themeUrl ?? `https://${cfg.baseUrl ?? "example.com"}/static/giscus`
} }
data-lang={opts.options.lang ?? "en"}
></div> ></div>
) )
} }

View File

@ -55,6 +55,7 @@ type GiscusElement = Omit<HTMLElement, "dataset"> & {
strict: string strict: string
reactionsEnabled: string reactionsEnabled: string
inputPosition: "top" | "bottom" inputPosition: "top" | "bottom"
lang: string
} }
} }
@ -78,7 +79,7 @@ document.addEventListener("nav", () => {
giscusScript.setAttribute("data-strict", giscusContainer.dataset.strict) giscusScript.setAttribute("data-strict", giscusContainer.dataset.strict)
giscusScript.setAttribute("data-reactions-enabled", giscusContainer.dataset.reactionsEnabled) giscusScript.setAttribute("data-reactions-enabled", giscusContainer.dataset.reactionsEnabled)
giscusScript.setAttribute("data-input-position", giscusContainer.dataset.inputPosition) giscusScript.setAttribute("data-input-position", giscusContainer.dataset.inputPosition)
giscusScript.setAttribute("data-lang", giscusContainer.dataset.lang)
const theme = document.documentElement.getAttribute("saved-theme") const theme = document.documentElement.getAttribute("saved-theme")
if (theme) { if (theme) {
giscusScript.setAttribute("data-theme", getThemeUrl(getThemeName(theme))) giscusScript.setAttribute("data-theme", getThemeUrl(getThemeName(theme)))

View File

@ -239,7 +239,7 @@ li:has(> .folder-outer:not(.open)) > .folder-container > svg {
margin-top: 0; margin-top: 0;
background-color: var(--light); background-color: var(--light);
max-width: 100vw; max-width: 100vw;
width: 100%; width: 100vw;
transform: translateX(-100vw); transform: translateX(-100vw);
transition: transition:
transform 200ms ease, transform 200ms ease,
@ -265,6 +265,6 @@ li:has(> .folder-outer:not(.open)) > .folder-container > svg {
.mobile-no-scroll { .mobile-no-scroll {
@media all and ($mobile) { @media all and ($mobile) {
overflow: hidden; overscroll-behavior: none;
} }
} }

View File

@ -11,8 +11,7 @@ html {
width: 100vw; width: 100vw;
} }
body, body {
section {
margin: 0; margin: 0;
box-sizing: border-box; box-sizing: border-box;
background-color: var(--light); background-color: var(--light);