mirror of
https://github.com/amitwh/markdown-converter.git
synced 2026-08-03 02:11:07 +05:30
feat: complete master feature parity with interactive PDF editing, Reveal.js export dialog, Large File Mode, and scoped CSS
This commit is contained in:
@@ -23,6 +23,7 @@ export type ModalState =
|
||||
| { kind: 'export-docx'; props: { sourcePath: string } }
|
||||
| { kind: 'export-html'; props: { sourcePath: string } }
|
||||
| { kind: 'export-batch'; props: { sourcePaths: string[] } }
|
||||
| { kind: 'export-revealjs'; props: { sourcePath: string } }
|
||||
| { kind: 'settings' }
|
||||
| { kind: 'about' }
|
||||
| { kind: 'welcome' }
|
||||
|
||||
@@ -3,8 +3,11 @@ import { create } from 'zustand';
|
||||
interface PreviewState {
|
||||
source: string;
|
||||
scrollRatio: number;
|
||||
largeFileMode: boolean;
|
||||
setSource: (s: string) => void;
|
||||
setScrollRatio: (r: number) => void;
|
||||
setLargeFileMode: (v: boolean) => void;
|
||||
forceRender: (s: string) => void;
|
||||
}
|
||||
|
||||
const DEBOUNCE_MS = 300;
|
||||
@@ -14,7 +17,12 @@ let pending: string = '';
|
||||
export const usePreviewStore = create<PreviewState>((set) => ({
|
||||
source: '',
|
||||
scrollRatio: 0,
|
||||
largeFileMode: false,
|
||||
setSource: (s) => {
|
||||
// If in large file mode, do not auto-update preview source on user typing
|
||||
if (usePreviewStore.getState().largeFileMode) {
|
||||
return;
|
||||
}
|
||||
pending = s;
|
||||
if (timer) clearTimeout(timer);
|
||||
timer = setTimeout(() => {
|
||||
@@ -22,4 +30,9 @@ export const usePreviewStore = create<PreviewState>((set) => ({
|
||||
}, DEBOUNCE_MS);
|
||||
},
|
||||
setScrollRatio: (r) => set({ scrollRatio: r }),
|
||||
setLargeFileMode: (v) => set({ largeFileMode: v }),
|
||||
forceRender: (s) => {
|
||||
if (timer) clearTimeout(timer);
|
||||
set({ source: s });
|
||||
},
|
||||
}));
|
||||
|
||||
Reference in New Issue
Block a user