diff --git a/quartz/build.ts b/quartz/build.ts index 64c462b..81558f9 100644 --- a/quartz/build.ts +++ b/quartz/build.ts @@ -19,6 +19,7 @@ import { options } from "./util/sourcemap" import { Mutex } from "async-mutex" import DepGraph from "./depgraph" import { getStaticResourcesFromPlugins } from "./plugins" +import { randomIdNonSecure } from "./util/random" type Dependencies = Record | null> @@ -38,13 +39,9 @@ type BuildData = { type FileEvent = "add" | "change" | "delete" -function newBuildId() { - return Math.random().toString(36).substring(2, 8) -} - async function buildQuartz(argv: Argv, mut: Mutex, clientRefresh: () => void) { const ctx: BuildCtx = { - buildId: newBuildId(), + buildId: randomIdNonSecure(), argv, cfg, allSlugs: [], @@ -162,7 +159,7 @@ async function partialRebuildFromEntrypoint( return } - const buildId = newBuildId() + const buildId = randomIdNonSecure() ctx.buildId = buildId buildData.lastBuildMs = new Date().getTime() const release = await mut.acquire() @@ -359,7 +356,7 @@ async function rebuildFromEntrypoint( toRemove.add(filePath) } - const buildId = newBuildId() + const buildId = randomIdNonSecure() ctx.buildId = buildId buildData.lastBuildMs = new Date().getTime() const release = await mut.acquire() diff --git a/quartz/components/Backlinks.tsx b/quartz/components/Backlinks.tsx index 735afe7..0d34457 100644 --- a/quartz/components/Backlinks.tsx +++ b/quartz/components/Backlinks.tsx @@ -3,7 +3,7 @@ import style from "./styles/backlinks.scss" import { resolveRelative, simplifySlug } from "../util/path" import { i18n } from "../i18n" import { classNames } from "../util/lang" -import OverflowList from "./OverflowList" +import OverflowListFactory from "./OverflowList" interface BacklinksOptions { hideWhenEmpty: boolean @@ -15,6 +15,7 @@ const defaultOptions: BacklinksOptions = { export default ((opts?: Partial) => { const options: BacklinksOptions = { ...defaultOptions, ...opts } + const { OverflowList, overflowListAfterDOMLoaded } = OverflowListFactory() const Backlinks: QuartzComponent = ({ fileData, @@ -30,7 +31,7 @@ export default ((opts?: Partial) => { return (

{i18n(cfg.locale).components.backlinks.title}

- + {backlinkFiles.length > 0 ? ( backlinkFiles.map((f) => (
  • @@ -48,7 +49,7 @@ export default ((opts?: Partial) => { } Backlinks.css = style - Backlinks.afterDOMLoaded = OverflowList.afterDOMLoaded("backlinks-ul") + Backlinks.afterDOMLoaded = overflowListAfterDOMLoaded return Backlinks }) satisfies QuartzComponentConstructor diff --git a/quartz/components/Explorer.tsx b/quartz/components/Explorer.tsx index 9c6319a..56784f1 100644 --- a/quartz/components/Explorer.tsx +++ b/quartz/components/Explorer.tsx @@ -6,7 +6,8 @@ import script from "./scripts/explorer.inline" import { classNames } from "../util/lang" import { i18n } from "../i18n" import { FileTrieNode } from "../util/fileTrie" -import OverflowList from "./OverflowList" +import OverflowListFactory from "./OverflowList" +import { concatenateResources } from "../util/resources" type OrderEntries = "sort" | "filter" | "map" @@ -56,6 +57,7 @@ export type FolderState = { export default ((userOpts?: Partial) => { const opts: Options = { ...defaultOptions, ...userOpts } + const { OverflowList, overflowListAfterDOMLoaded } = OverflowListFactory() const Explorer: QuartzComponent = ({ cfg, displayClass }: QuartzComponentProps) => { return ( @@ -73,8 +75,7 @@ export default ((userOpts?: Partial) => { > -
    - +
    +