Fix optional chaining for electronAPI in note synchronization

This commit is contained in:
troyeguo committed 2026-08-08 16:04:25 +08:00
1 parent 473f6f3305
commit 5f3fd700fa
3 files changed
+10 -4

No files matched your search

@@ -171,8 +171,8 @@ class PopupNote extends React.Component<PopupNoteProps, PopupNoteState> {
let noteSyncManager = new NoteSyncManager(
DatabaseService,
ConfigService,
window.electronAPI.fs,
window.electronAPI.path
window.electronAPI?.fs,
window.electronAPI?.path
);
noteSyncManager.syncNote(note, bookKey);
});
@@ -143,6 +143,8 @@ class NavList extends React.Component<NavListProps, NavListState> {
handleCompositionStart = () => {
this.setState({ isComposing: true });
ConfigService.setReaderConfig("isTempLocked", "yes");
ConfigService.setReaderConfig("isNavLocked", "yes");
};
handleCompositionEnd = (event: React.CompositionEvent<HTMLInputElement>) => {
@@ -150,6 +152,10 @@ class NavList extends React.Component<NavListProps, NavListState> {
this.setState({ isComposing: false, searchKeyword: keyword }, () => {
this.handleSearch(keyword);
});
if (ConfigService.getReaderConfig("isTempLocked") === "yes") {
ConfigService.setReaderConfig("isNavLocked", "");
ConfigService.setReaderConfig("isTempLocked", "");
}
};
async handleJump(cfi: string) {
+2 -2
View File
@@ -85,8 +85,8 @@ export async function createHighlight(params: DigestParams): Promise<void> {
let noteSyncManager = new NoteSyncManager(
DatabaseService,
ConfigService,
window.electronAPI.fs,
window.electronAPI.path
window.electronAPI?.fs,
window.electronAPI?.path
);
noteSyncManager.syncNote(highlight, bookKey);
onSuccess?.();