feat: migrate to react-markdown for robust markdown rendering
- Replace custom markdown parser with react-markdown + remark-gfm - Fix document link navigation (./ and ../ references) - Simplify doc viewing flow (direct markdown content instead of parsed structure) - Update electron main process to only use api folder for docs - Add blueprint loading from docs/blueprint.md dynamically - Fix sidebar file selection path matching - Update preload scripts for new API structure
This commit is contained in:
@@ -1,7 +1,31 @@
|
||||
import Scene3D from './Scene3D';
|
||||
import DetailPanel from './DetailPanel';
|
||||
import { useBlueprintStore } from '../../store/blueprintStore';
|
||||
import { useEffect, useCallback } from 'react';
|
||||
import { parseBlueprintFromMd } from '../../data/blueprintParser';
|
||||
|
||||
export default function BlueprintPage() {
|
||||
interface BlueprintPageProps {
|
||||
docsPath: string;
|
||||
}
|
||||
|
||||
export default function BlueprintPage({ docsPath }: BlueprintPageProps) {
|
||||
const setBlueprintData = useBlueprintStore(state => state.setBlueprintData);
|
||||
|
||||
const loadBlueprint = useCallback(async () => {
|
||||
if (!docsPath || !window.electronAPI) return;
|
||||
|
||||
const blueprintPath = docsPath.replace(/\\/g, '/') + '/blueprint.md';
|
||||
const content = await window.electronAPI.readDocFile(blueprintPath);
|
||||
if (content) {
|
||||
const data = parseBlueprintFromMd(content);
|
||||
setBlueprintData(data);
|
||||
}
|
||||
}, [docsPath, setBlueprintData]);
|
||||
|
||||
useEffect(() => {
|
||||
loadBlueprint();
|
||||
}, [loadBlueprint]);
|
||||
|
||||
return (
|
||||
<div className="flex h-full">
|
||||
<div className="flex-1">
|
||||
|
||||
Reference in New Issue
Block a user