Mobile: Fixes #9175: Beta editor: Fix image timestamps not updated after editing (#9176)

pull/9173/head
Henry Heino 2023-10-30 15:17:49 -07:00 committed by GitHub
parent 2d71d01beb
commit 94cef15d9f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 10 additions and 5 deletions

View File

@ -51,6 +51,7 @@ import VoiceTypingDialog from '../voiceTyping/VoiceTypingDialog';
import { voskEnabled } from '../../services/voiceTyping/vosk';
import { isSupportedLanguage } from '../../services/voiceTyping/vosk.android';
import { ChangeEvent as EditorChangeEvent, UndoRedoDepthChangeEvent } from '@joplin/editor/events';
import { join } from 'path';
const urlUtils = require('@joplin/lib/urlUtils');
// import Vosk from 'react-native-vosk';
@ -829,13 +830,17 @@ class NoteScreenComponent extends BaseScreenComponent {
throw new Error('No resource is loaded in the editor');
}
const resourcePath = Resource.fullPath(resource);
logger.info('Saving drawing to resource', resource.id);
const filePath = resourcePath;
await shim.fsDriver().writeFile(filePath, svgData, 'utf8');
logger.info('Saved drawing to', filePath);
const tempFilePath = join(Setting.value('tempDir'), uuid.createNano());
await shim.fsDriver().writeFile(tempFilePath, svgData, 'utf8');
resource = await Resource.updateResourceBlobContent(
resource.id,
tempFilePath,
);
await shim.fsDriver().remove(tempFilePath);
resource = await Resource.save(resource, { isNew: false });
await this.refreshResource(resource);
}