wiki-viewer 1.8.1 → 1.8.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.next/standalone/.next/BUILD_ID +1 -1
- package/.next/standalone/.next/build-manifest.json +5 -5
- package/.next/standalone/.next/server/app/_global-error/page/build-manifest.json +2 -2
- package/.next/standalone/.next/server/app/_global-error.html +1 -1
- package/.next/standalone/.next/server/app/_global-error.rsc +1 -1
- package/.next/standalone/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/_not-found/page/build-manifest.json +2 -2
- package/.next/standalone/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/_not-found.html +1 -1
- package/.next/standalone/.next/server/app/_not-found.rsc +2 -2
- package/.next/standalone/.next/server/app/_not-found.segments/_full.segment.rsc +2 -2
- package/.next/standalone/.next/server/app/_not-found.segments/_head.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/_not-found.segments/_index.segment.rsc +2 -2
- package/.next/standalone/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/_not-found.segments/_tree.segment.rsc +2 -2
- package/.next/standalone/.next/server/app/api/app-proxy/[...path]/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/system/browse/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/wiki/app/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/wiki/upload/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/index.html +1 -1
- package/.next/standalone/.next/server/app/index.rsc +3 -3
- package/.next/standalone/.next/server/app/index.segments/__PAGE__.segment.rsc +2 -2
- package/.next/standalone/.next/server/app/index.segments/_full.segment.rsc +3 -3
- package/.next/standalone/.next/server/app/index.segments/_head.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/index.segments/_index.segment.rsc +2 -2
- package/.next/standalone/.next/server/app/index.segments/_tree.segment.rsc +2 -2
- package/.next/standalone/.next/server/app/page/build-manifest.json +2 -2
- package/.next/standalone/.next/server/app/page.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/signin/page/build-manifest.json +2 -2
- package/.next/standalone/.next/server/app/signin/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__0-inabx._.js +1 -1
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__00lep-u._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/{0~w0_katex_dist_katex_mjs_04mhawr._.js → 0~w0_katex_dist_katex_mjs_0hyln.b._.js} +1 -1
- package/.next/standalone/.next/server/chunks/ssr/{[root-of-the-server]__09~x2v~._.js → [root-of-the-server]__0du58sw._.js} +2 -2
- package/.next/standalone/.next/server/chunks/ssr/_0pqaawz._.js +19 -19
- package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_0shlang._.js → node_modules__pnpm_0.kyqfq._.js} +1 -1
- package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_04n0h6.._.js → node_modules__pnpm_0.~goq~._.js} +1 -1
- package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_011vy_q._.js → node_modules__pnpm_00y7foi._.js} +2 -2
- package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_0yiz.-t._.js → node_modules__pnpm_03.1jli._.js} +1 -1
- package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_093dp2q._.js → node_modules__pnpm_03z3na-._.js} +1 -1
- package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_01o_5qt._.js → node_modules__pnpm_05~w-ok._.js} +1 -1
- package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_0b8qx0g._.js → node_modules__pnpm_09d5yyu._.js} +1 -1
- package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_0wmx9kq._.js → node_modules__pnpm_09eo8jh._.js} +2 -2
- package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_0nw5ou2._.js → node_modules__pnpm_0adm8h6._.js} +1 -1
- package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_0bbc---._.js → node_modules__pnpm_0arbjru._.js} +1 -1
- package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_0t9jb7d._.js → node_modules__pnpm_0b5fla7._.js} +1 -1
- package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_124u4o2._.js → node_modules__pnpm_0beormu._.js} +2 -2
- package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_13tajgx._.js → node_modules__pnpm_0c7u76a._.js} +2 -2
- package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_09ej62_._.js → node_modules__pnpm_0dbr7c2._.js} +1 -1
- package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_0s0ur~d._.js → node_modules__pnpm_0d~ida~._.js} +1 -1
- package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_09ljbdz._.js → node_modules__pnpm_0elpfsb._.js} +2 -2
- package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_0hlzy8f._.js → node_modules__pnpm_0fh.6ir._.js} +1 -1
- package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_09~_ob2._.js → node_modules__pnpm_0fm6wcx._.js} +1 -1
- package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_0o.dn8o._.js → node_modules__pnpm_0iikbcy._.js} +1 -1
- package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_0hk6xys._.js → node_modules__pnpm_0mvih7b._.js} +2 -2
- package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_0a01ng7._.js → node_modules__pnpm_0qd2ovj._.js} +2 -2
- package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_0c.309.._.js → node_modules__pnpm_0s4yn43._.js} +1 -1
- package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_0sq3c2r._.js → node_modules__pnpm_0s8fvbn._.js} +1 -1
- package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_0xfx0sf._.js → node_modules__pnpm_0tq8zs6._.js} +1 -1
- package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_11sut1u._.js → node_modules__pnpm_0vyv.lz._.js} +1 -1
- package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_0c8aunj._.js → node_modules__pnpm_0xa.ko1._.js} +1 -1
- package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_0.96tmo._.js → node_modules__pnpm_12.ymhl._.js} +1 -1
- package/.next/standalone/.next/server/middleware-build-manifest.js +5 -5
- package/.next/standalone/.next/server/middleware-manifest.json +1 -1
- package/.next/standalone/.next/server/pages/404.html +1 -1
- package/.next/standalone/.next/server/pages/500.html +1 -1
- package/.next/standalone/.next/static/chunks/{0vp-ahhagxptc.js → 06iw_iy5e90d4.js} +1 -1
- package/.next/standalone/.next/static/chunks/0d~o0h0ssgra7.js +129 -0
- package/.next/standalone/.next/static/chunks/167ph4xws_-61.css +2 -0
- package/.next/standalone/.next/static/chunks/{turbopack-12~z-mr7b9b50.js → turbopack-0lf4~b-ofzbm6.js} +1 -1
- package/.next/standalone/AGENTS.md +104 -0
- package/.next/standalone/package.json +1 -1
- package/.next/standalone/packages/wiki-viewer-mcp/package-lock.json +2 -2
- package/.next/standalone/packages/wiki-viewer-mcp/package.json +1 -1
- package/.next/standalone/src/app/api/wiki/app/route.ts +7 -4
- package/.next/standalone/src/app/page.tsx +631 -193
- package/.next/standalone/src/components/editor/backlinks-panel.tsx +152 -0
- package/.next/standalone/src/components/editor/document-outline.tsx +221 -0
- package/.next/standalone/src/components/editor/editor.tsx +145 -48
- package/.next/standalone/src/components/editor/node-app-viewer.tsx +65 -7
- package/.next/standalone/src/components/editor/slash-commands.tsx +216 -41
- package/.next/standalone/src/components/editor/source-viewer.tsx +29 -2
- package/.next/standalone/src/components/search/search-command-dialog.tsx +183 -46
- package/.next/standalone/src/lib/app-runner.ts +57 -16
- package/.next/standalone/src/stores/pin-store.ts +55 -0
- package/.next/standalone/src/stores/recent-store.ts +50 -0
- package/.next/standalone/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/.next/standalone/.next/static/chunks/0c_~zevf2n0r4.css +0 -2
- package/.next/standalone/.next/static/chunks/0l4842ez-0_66.js +0 -129
- package/.next/standalone/src/components/wiki/markdown-preview.tsx +0 -120
- /package/.next/standalone/.next/static/{17VWCQ9_AhwJBT4yjkvWG → Pkj31aCfRVk0Zy2rKA1wf}/_buildManifest.js +0 -0
- /package/.next/standalone/.next/static/{17VWCQ9_AhwJBT4yjkvWG → Pkj31aCfRVk0Zy2rKA1wf}/_clientMiddlewareManifest.js +0 -0
- /package/.next/standalone/.next/static/{17VWCQ9_AhwJBT4yjkvWG → Pkj31aCfRVk0Zy2rKA1wf}/_ssgManifest.js +0 -0
|
@@ -1,120 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
|
|
3
|
-
import { useCallback, useEffect, useRef, useState } from "react";
|
|
4
|
-
import { markdownToHtml } from "@/lib/markdown/to-html";
|
|
5
|
-
import { useWikiSlugsStore } from "@/stores/wiki-slugs-store";
|
|
6
|
-
|
|
7
|
-
interface MarkdownPreviewProps {
|
|
8
|
-
markdown: string;
|
|
9
|
-
pagePath: string;
|
|
10
|
-
onNavigate: (targetPath: string, anchor: string | null) => void;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
export function MarkdownPreview({
|
|
14
|
-
markdown,
|
|
15
|
-
pagePath,
|
|
16
|
-
onNavigate,
|
|
17
|
-
}: MarkdownPreviewProps) {
|
|
18
|
-
const [html, setHtml] = useState<string>("");
|
|
19
|
-
const containerRef = useRef<HTMLDivElement>(null);
|
|
20
|
-
|
|
21
|
-
// Recompute HTML whenever markdown or pagePath changes.
|
|
22
|
-
useEffect(() => {
|
|
23
|
-
let cancelled = false;
|
|
24
|
-
markdownToHtml(markdown, { pagePath, sanitize: true }).then((result) => {
|
|
25
|
-
if (!cancelled) setHtml(result);
|
|
26
|
-
});
|
|
27
|
-
return () => {
|
|
28
|
-
cancelled = true;
|
|
29
|
-
};
|
|
30
|
-
}, [markdown, pagePath]);
|
|
31
|
-
|
|
32
|
-
// Delegated click handler: wiki-links navigate; external links get _blank.
|
|
33
|
-
const handleClick = useCallback(
|
|
34
|
-
(e: MouseEvent) => {
|
|
35
|
-
const link = (e.target as HTMLElement).closest(
|
|
36
|
-
"a",
|
|
37
|
-
) as HTMLAnchorElement | null;
|
|
38
|
-
if (!link) return;
|
|
39
|
-
|
|
40
|
-
if (link.dataset.wikiLink === "true") {
|
|
41
|
-
e.preventDefault();
|
|
42
|
-
const slug = link.dataset.slug ?? "";
|
|
43
|
-
if (!slug) return;
|
|
44
|
-
const dir = useWikiSlugsStore.getState().getDir(slug);
|
|
45
|
-
if (!dir) return; // broken link - no nav
|
|
46
|
-
const targetPath =
|
|
47
|
-
dir === "root" ? `${slug}.md` : `${dir}/${slug}.md`;
|
|
48
|
-
const anchor = link.dataset.anchor ?? null;
|
|
49
|
-
onNavigate(targetPath, anchor);
|
|
50
|
-
return;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
// External links: ensure _blank + noreferrer.
|
|
54
|
-
const href = link.getAttribute("href") ?? "";
|
|
55
|
-
if (/^https?:\/\//.test(href)) {
|
|
56
|
-
if (!link.target) {
|
|
57
|
-
link.setAttribute("target", "_blank");
|
|
58
|
-
link.setAttribute("rel", "noreferrer");
|
|
59
|
-
}
|
|
60
|
-
return;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
// Anchor-only hrefs: let browser scroll natively.
|
|
64
|
-
},
|
|
65
|
-
[onNavigate],
|
|
66
|
-
);
|
|
67
|
-
|
|
68
|
-
// Attach and detach click handler whenever html or handler changes.
|
|
69
|
-
useEffect(() => {
|
|
70
|
-
const el = containerRef.current;
|
|
71
|
-
if (!el) return;
|
|
72
|
-
// Set _blank on external links at bind time so they work without JS.
|
|
73
|
-
el.querySelectorAll<HTMLAnchorElement>("a[href^='http']").forEach((a) => {
|
|
74
|
-
if (!a.target) {
|
|
75
|
-
a.setAttribute("target", "_blank");
|
|
76
|
-
a.setAttribute("rel", "noreferrer");
|
|
77
|
-
}
|
|
78
|
-
});
|
|
79
|
-
el.addEventListener("click", handleClick);
|
|
80
|
-
return () => el.removeEventListener("click", handleClick);
|
|
81
|
-
}, [html, handleClick]);
|
|
82
|
-
|
|
83
|
-
// Apply broken-link styling after render and whenever slug store updates.
|
|
84
|
-
const slugsLoadedAt = useWikiSlugsStore((s) => s.loadedAt);
|
|
85
|
-
useEffect(() => {
|
|
86
|
-
const el = containerRef.current;
|
|
87
|
-
if (!el) return;
|
|
88
|
-
const store = useWikiSlugsStore.getState();
|
|
89
|
-
el.querySelectorAll<HTMLAnchorElement>(
|
|
90
|
-
'a[data-wiki-link="true"]',
|
|
91
|
-
).forEach((link) => {
|
|
92
|
-
const slug = link.dataset.slug ?? "";
|
|
93
|
-
if (slug && !store.has(slug)) {
|
|
94
|
-
link.dataset.broken = "true";
|
|
95
|
-
} else {
|
|
96
|
-
delete link.dataset.broken;
|
|
97
|
-
}
|
|
98
|
-
});
|
|
99
|
-
}, [html, slugsLoadedAt]);
|
|
100
|
-
|
|
101
|
-
// Disable task-list checkboxes in read-only viewer.
|
|
102
|
-
useEffect(() => {
|
|
103
|
-
const el = containerRef.current;
|
|
104
|
-
if (!el) return;
|
|
105
|
-
el.querySelectorAll<HTMLInputElement>(
|
|
106
|
-
'input[type="checkbox"]',
|
|
107
|
-
).forEach((input) => {
|
|
108
|
-
input.disabled = true;
|
|
109
|
-
});
|
|
110
|
-
}, [html]);
|
|
111
|
-
|
|
112
|
-
return (
|
|
113
|
-
<div
|
|
114
|
-
ref={containerRef}
|
|
115
|
-
className="tiptap md-preview"
|
|
116
|
-
// biome-ignore lint/security/noDangerouslySetInnerHtml: HTML is sanitized by rehype-sanitize
|
|
117
|
-
dangerouslySetInnerHTML={{ __html: html }}
|
|
118
|
-
/>
|
|
119
|
-
);
|
|
120
|
-
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|