Skip to content

TagSpaces is an offline, open source, document manager with tagging support

chore: added fall back for getting content from the editors, fixing #2413

Ilian Sapundshievc8e4d4a9f3ac
diff --git a/src/renderer/components/EntryContainer.tsx b/src/renderer/components/EntryContainer.tsx
index 637bd7934..5a3425a0c 100644
--- a/src/renderer/components/EntryContainer.tsx
+++ b/src/renderer/components/EntryContainer.tsx
@@ -450,11 +450,8 @@ function EntryContainer() {
const savingFile = (force = false) => {
try {
if (
- fileViewer &&
- fileViewer.current &&
- fileViewer.current.contentWindow &&
// @ts-ignore
- fileViewer.current.contentWindow.getContent
+ fileViewer?.current?.contentWindow?.getContent
) {
//check if file is changed
if (fileChanged || force) {
@@ -464,12 +461,16 @@ function EntryContainer() {
}
} else {
//console.log('saving crepe file');
- fileViewer.current.contentWindow.postMessage(
+ fileViewer?.current?.contentWindow.postMessage(
{ action: 'savingFile' },
'*',
);
}
} catch (e) {
+ fileViewer?.current?.contentWindow.postMessage(
+ { action: 'savingFile' },
+ '*',
+ );
isSavingInProgress.current = false;
console.debug('function getContent not exist for file:', e);
}