1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-12-05 22:57:29 +02:00

Refactoring and handle conflicts from edit watcher

This commit is contained in:
Laurent Cozic
2020-05-31 17:43:51 +01:00
parent 36776cd615
commit bdbf2fe583
4 changed files with 65 additions and 41 deletions

View File

@@ -205,28 +205,6 @@ function shimInit() {
return Resource.save(resource, { isNew: true });
};
shim.duplicateResource = async function(resourceId) {
const resource = await Resource.load(resourceId);
const localState = await Resource.localState(resource);
let newResource = { ...resource };
delete newResource.id;
newResource = await Resource.save(newResource);
const newLocalState = { ...localState };
newLocalState.resource_id = newResource.id;
delete newLocalState.id;
await Resource.setLocalState(newResource, newLocalState);
const sourcePath = Resource.fullPath(resource);
if (await shim.fsDriver().exists(sourcePath)) {
await shim.fsDriver().copy(sourcePath, Resource.fullPath(newResource));
}
return newResource;
};
shim.attachFileToNoteBody = async function(noteBody, filePath, position = null, options = null) {
options = Object.assign({}, {
createFileURL: false,