mirror of
https://github.com/ershisan99/md-preview-desktop.git
synced 2025-12-16 20:59:24 +00:00
Compare commits
2 Commits
feat/watch
...
v1.0.0
| Author | SHA1 | Date | |
|---|---|---|---|
| 5fd5d68411 | |||
| fb5383775b |
9
package-lock.json
generated
9
package-lock.json
generated
@@ -13,7 +13,7 @@
|
||||
"@electron-toolkit/utils": "^2.0.1",
|
||||
"@fontsource/roboto": "^5.0.8",
|
||||
"@it-incubator/md-bundler": "0.0.10",
|
||||
"@it-incubator/mdx-components": "0.0.8",
|
||||
"@it-incubator/mdx-components": "0.0.11",
|
||||
"@it-incubator/ui-kit": "0.2.20",
|
||||
"builtin-modules": "^3.3.0",
|
||||
"chokidar": "^3.5.3",
|
||||
@@ -1724,9 +1724,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@it-incubator/mdx-components": {
|
||||
"version": "0.0.8",
|
||||
"resolved": "https://registry.npmjs.org/@it-incubator/mdx-components/-/mdx-components-0.0.8.tgz",
|
||||
"integrity": "sha512-L/yxluL90gSCQfnr2RzqTM89gJ8bd5upwM9/VrpPG4CGxoSMfsWkWBoybzLr98ClVH01Qd0+gzBe2Wz+fxaYoQ==",
|
||||
"version": "0.0.11",
|
||||
"resolved": "https://registry.npmjs.org/@it-incubator/mdx-components/-/mdx-components-0.0.11.tgz",
|
||||
"integrity": "sha512-U2JOVdnImiApCNfayX08j7A/9tD+eiCRkoUF4p9gvABS+aHRyFaiFttDuamU0rN2NqEE26Pxq51vriNXdsl9wg==",
|
||||
"dependencies": {
|
||||
"@radix-ui/react-checkbox": "1.0.4",
|
||||
"@radix-ui/react-scroll-area": "1.0.4",
|
||||
@@ -1735,6 +1735,7 @@
|
||||
"mdx-bundler": "^9.2.1"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@fontsource/roboto": "5.0.8",
|
||||
"react": ">=18.0.2",
|
||||
"react-dom": ">=18.0.2"
|
||||
}
|
||||
|
||||
@@ -15,16 +15,16 @@
|
||||
"dev": "electron-vite dev",
|
||||
"build": "npm run typecheck && electron-vite build",
|
||||
"postinstall": "electron-builder install-app-deps",
|
||||
"build:win": "npm run build && electron-builder --win --config",
|
||||
"build:mac": "electron-vite build && electron-builder --mac --config",
|
||||
"build:linux": "electron-vite build && electron-builder --linux --config"
|
||||
"build:win": "npm run build && electron-builder --win --config --x64",
|
||||
"build:mac": "electron-vite build && electron-builder --mac --config --universal",
|
||||
"build:linux": "electron-vite build && electron-builder --linux --config --x64"
|
||||
},
|
||||
"dependencies": {
|
||||
"@electron-toolkit/preload": "^2.0.0",
|
||||
"@electron-toolkit/utils": "^2.0.1",
|
||||
"@fontsource/roboto": "^5.0.8",
|
||||
"@it-incubator/md-bundler": "0.0.10",
|
||||
"@it-incubator/mdx-components": "0.0.8",
|
||||
"@it-incubator/mdx-components": "0.0.11",
|
||||
"@it-incubator/ui-kit": "0.2.20",
|
||||
"builtin-modules": "^3.3.0",
|
||||
"chokidar": "^3.5.3",
|
||||
|
||||
@@ -38,7 +38,7 @@ export const TableOfContents = ({ tocMap }: Props) => {
|
||||
const headingsObserver = headingsObserverRef.current
|
||||
|
||||
setTimeout(() => {
|
||||
document.querySelectorAll('article :is(h1,h2,h3)').forEach(h => headingsObserver.observe(h))
|
||||
document.querySelectorAll('article :is(h2,h3,h4)').forEach(h => headingsObserver.observe(h))
|
||||
}, 100)
|
||||
|
||||
return () => {
|
||||
@@ -53,13 +53,22 @@ export const TableOfContents = ({ tocMap }: Props) => {
|
||||
// Disconnect and reconnect the observer to refresh it
|
||||
headingsObserver.disconnect()
|
||||
setTimeout(() => {
|
||||
document.querySelectorAll('article :is(h1,h2,h3)').forEach(h => headingsObserver.observe(h))
|
||||
document.querySelectorAll('article :is(h2,h3,h4)').forEach(h => headingsObserver.observe(h))
|
||||
}, 100)
|
||||
}
|
||||
}, [tocMap])
|
||||
|
||||
const onLinkClick = (e: MouseEvent<HTMLAnchorElement>) => {
|
||||
setCurrentHeading(e.currentTarget.getAttribute('href')!.replace('#', ''))
|
||||
if (headingsObserverRef.current) {
|
||||
const headingsObserver = headingsObserverRef.current
|
||||
|
||||
// Disconnect and reconnect the observer to refresh it
|
||||
headingsObserver.disconnect()
|
||||
setTimeout(() => {
|
||||
document.querySelectorAll('article :is(h2,h3,h4)').forEach(h => headingsObserver.observe(h))
|
||||
}, 100)
|
||||
}
|
||||
}
|
||||
|
||||
return (
|
||||
|
||||
Reference in New Issue
Block a user