fix: tsc -b 全绿(rootDir/include 项目引用、frontmatter 导入路径、TiptapEditor 重复 import、WebkitAppRegion 断言、dialog confirm 返回类型)
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
// FrontmatterCodec — 文件头 frontmatter 解析/序列化(FR-M1/M2)
|
||||
// 仅 4 个业务字段:title? / tags? / star? / links?;空数组与默认值不落盘
|
||||
import type { DocMeta } from './doc.js';
|
||||
import type { DocMeta } from '@hunter/shared';
|
||||
|
||||
const FENCE = '---';
|
||||
|
||||
|
||||
@@ -17,6 +17,6 @@ interface DialogState {
|
||||
export const useDialog = create<DialogState>((set, get) => ({
|
||||
open: false, mode: 'input', title: '', message: '', placeholder: '', resolve: null,
|
||||
showInput: (title, placeholder = '') => new Promise<string | null>((resolve) => { set({ open: true, mode: 'input', title, placeholder, resolve }); }),
|
||||
showConfirm: (title, message) => new Promise<string | null>((resolve) => { set({ open: true, mode: 'confirm', title, message, resolve }); }),
|
||||
showConfirm: (title, message) => new Promise<boolean>((resolve) => { set({ open: true, mode: 'confirm', title, message, resolve: ((v: string | null) => resolve(v === 'yes')) }); }),
|
||||
close: (value) => { const r = get().resolve; set({ open: false, resolve: null }); r?.(value); },
|
||||
}));
|
||||
|
||||
@@ -13,7 +13,6 @@ import Image from '@tiptap/extension-image';
|
||||
import Placeholder from '@tiptap/extension-placeholder';
|
||||
import { Markdown } from 'tiptap-markdown';
|
||||
import { createLowlight, common } from 'lowlight';
|
||||
import { useEffect, useRef } from 'react';
|
||||
import { useStore } from '../../store';
|
||||
import { EditorProvider } from './editor-context';
|
||||
import { EditorToolbar } from './EditorToolbar';
|
||||
@@ -42,7 +41,7 @@ export function TiptapEditor() {
|
||||
BlockOps,
|
||||
],
|
||||
content: body,
|
||||
onUpdate: ({ editor }) => { if (!skipUpdate.current) setBody(editor.storage.markdown.getMarkdown()); },
|
||||
onUpdate: ({ editor }) => { if (!skipUpdate.current) setBody((editor.storage as Record<string, any>).markdown.getMarkdown()); },
|
||||
});
|
||||
|
||||
// 切换文档时只同步内容,不重建 editor
|
||||
|
||||
@@ -2,13 +2,13 @@ import { send } from '../../ipc-client';
|
||||
import { IPC } from '@hunter/shared';
|
||||
import { useStore } from '../../store';
|
||||
|
||||
const drag: React.CSSProperties = { WebkitAppRegion: 'drag' as any, flex: 1, height: '100%' };
|
||||
const noDrag: React.CSSProperties = { WebkitAppRegion: 'no-drag' as any };
|
||||
const drag = { WebkitAppRegion: 'drag', flex: 1, height: '100%' } as React.CSSProperties;
|
||||
const noDrag = { WebkitAppRegion: 'no-drag' } as React.CSSProperties;
|
||||
|
||||
export function TitleBar({ onToggleView, view, onSettings, onAppearance, onToggleSidebar, onToggleMinimal, minimal }: { onToggleView: () => void; view: 'editor' | 'graph'; onSettings: () => void; onAppearance: () => void; onToggleSidebar: () => void; onToggleMinimal: () => void; minimal: boolean }) {
|
||||
const { loadTree } = useStore();
|
||||
return (
|
||||
<div style={{ height: 36, display: 'flex', alignItems: 'center', background: '#161620', borderBottom: '1px solid #2a2a3a', WebkitAppRegion: 'drag' as any, userSelect: 'none' }}>
|
||||
<div style={{ height: 36, display: 'flex', alignItems: 'center', background: '#161620', borderBottom: '1px solid #2a2a3a', WebkitAppRegion: 'drag', userSelect: 'none' } as React.CSSProperties}>
|
||||
<div style={{ padding: '0 12px', color: '#7ab8ff', fontWeight: 600, fontSize: 13 }}>狩夜人笔记</div>
|
||||
<div style={drag} />
|
||||
<button title="侧边栏开关" onClick={onToggleSidebar} style={{ ...btn, fontSize: 14 }}>▤</button>
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
"target": "ES2022",
|
||||
"module": "ESNext",
|
||||
"moduleResolution": "Bundler",
|
||||
"rootDir": "../..",
|
||||
"strict": true,
|
||||
"skipLibCheck": true,
|
||||
"esModuleInterop": true,
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
"target": "ES2022",
|
||||
"module": "ESNext",
|
||||
"moduleResolution": "Bundler",
|
||||
"rootDir": "../..",
|
||||
"strict": true,
|
||||
"skipLibCheck": true,
|
||||
"esModuleInterop": true,
|
||||
|
||||
Reference in New Issue
Block a user