-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: outi-font in easy-code and mediumzoom
- Loading branch information
Showing
11 changed files
with
73 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from './useMediumZoom' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import mediumZoom from 'medium-zoom' | ||
import { inject, nextTick, onMounted, watch } from 'vue' | ||
import type { Zoom } from 'medium-zoom' | ||
import type { App, InjectionKey } from 'vue' | ||
import type { Router } from 'vitepress' | ||
|
||
declare module 'medium-zoom' { | ||
interface Zoom { | ||
refresh: (selector?: string) => void | ||
} | ||
} | ||
|
||
export const mediumZoomSymbol: InjectionKey<Zoom> = Symbol('mediumZoom') | ||
|
||
export function useMediumZoom() { | ||
onMounted(() => inject(mediumZoomSymbol)?.refresh()) | ||
} | ||
|
||
export function useMediumZoomProvider(app: App, router: Router) { | ||
//@ts-ignore | ||
if (import.meta.env.SSR) return | ||
const zoom = mediumZoom() | ||
zoom.refresh = () => { | ||
zoom.detach() | ||
zoom.attach(':not(a) > img:not(.image-src)') | ||
} | ||
app.provide(mediumZoomSymbol, zoom) | ||
watch( | ||
() => router.route.path, | ||
() => nextTick(() => zoom.refresh()) | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters