UI: Search and read NS API docs in editor tab and documentation tab (#2163)

This commit is contained in:
catloversg
2025-06-01 13:53:20 +07:00
committed by GitHub
parent 98f6cc9554
commit 6a23c85e12
41 changed files with 3602 additions and 130 deletions
+15 -3
View File
@@ -1,6 +1,18 @@
import Root from "./doc/index.md?raw";
import { AllPages } from "./pages";
import { EventEmitter } from "../utils/EventEmitter";
export type Document = typeof Root;
export const getPage = (title: string): string => {
const pageContent = AllPages[title];
if (pageContent == null) {
const errorMessage = `Cannot find ${title} page.`;
console.error(errorMessage);
return errorMessage;
}
return pageContent;
};
export const getPage = (title: string): Document => AllPages[title] ?? Root;
export const DocumentationPopUpEvents = new EventEmitter<[string | undefined]>();
export function openDocumentationPopUp(path: string): void {
DocumentationPopUpEvents.emit(path);
}