mirror of
https://github.com/amitwh/markdown-converter.git
synced 2026-08-02 18:10:18 +05:30
fix: add missing rendererReady call and fix temporal dead zone crash
- App.tsx: call electronAPI.file.rendererReady() on mount so main process opens pendingFile (files passed via CLI or file associations) - FindReplaceBar: move updateMatchCount declaration before executeCommand to fix 'Cannot access d before initialization' crash in minified build (executeCommand referenced updateMatchCount via closure before its const declaration in the same scope)
This commit is contained in:
@@ -25,18 +25,6 @@ export function FindReplaceBar() {
|
||||
const [useRegex, setUseRegex] = useState(false);
|
||||
const [matchInfo, setMatchInfo] = useState<{ current: number; total: number } | null>(null);
|
||||
|
||||
const executeCommand = useCallback(
|
||||
(fn: (view: EditorView) => boolean | void) => {
|
||||
const view = getActiveView();
|
||||
if (!view) return false;
|
||||
const result = fn(view);
|
||||
updateMatchCount();
|
||||
view.focus();
|
||||
return result;
|
||||
},
|
||||
[updateMatchCount]
|
||||
);
|
||||
|
||||
const updateMatchCount = useCallback(() => {
|
||||
const view = getActiveView();
|
||||
if (!view) {
|
||||
@@ -77,6 +65,18 @@ export function FindReplaceBar() {
|
||||
}
|
||||
}, []);
|
||||
|
||||
const executeCommand = useCallback(
|
||||
(fn: (view: EditorView) => boolean | void) => {
|
||||
const view = getActiveView();
|
||||
if (!view) return false;
|
||||
const result = fn(view);
|
||||
updateMatchCount();
|
||||
view.focus();
|
||||
return result;
|
||||
},
|
||||
[updateMatchCount]
|
||||
);
|
||||
|
||||
const handleFindNext = useCallback(() => {
|
||||
executeCommand(findNext);
|
||||
}, [executeCommand]);
|
||||
|
||||
Reference in New Issue
Block a user