diff --git a/manifest.json b/manifest.json index 403356f..c2504b6 100644 --- a/manifest.json +++ b/manifest.json @@ -1,7 +1,7 @@ { "id": "tldraw", "name": "Tldraw", - "version": "1.14.0", + "version": "1.14.1", "minAppVersion": "0.15.0", "description": "Integrates Tldraw into Obsidian, allowing users to draw and edit content on a virtual whiteboard.", "author": "Sam Alhaqab", diff --git a/src/main.ts b/src/main.ts index 9be87e8..a6e7db5 100644 --- a/src/main.ts +++ b/src/main.ts @@ -546,11 +546,24 @@ export default class TldrawPlugin extends Plugin { const embedsMerged = Object.assign({}, embedsDefault, embeds) const fileDestinationsMerged = Object.assign({}, fileDestinationsDefault, - { // Migrate old settings - defaultFolder: rest.folder, - assetsFolder: rest.assetsFolder, - destinationMethod: !rest.useAttachmentsFolder ? undefined : 'attachments-folder', - } as Partial, + (() => { + // Do not migrate if the the old file destination settings were already migrated. + if (fileDestinations === undefined) return {}; + // Migrate old settings + const migrated: Partial = {}; + + if (rest.folder !== undefined) { + migrated.defaultFolder = rest.folder; + } + + if (rest.assetsFolder !== undefined) { + migrated.assetsFolder = rest.assetsFolder; + } + + if (rest.useAttachmentsFolder !== undefined && rest.useAttachmentsFolder) { + migrated.destinationMethod = 'attachments-folder'; + } + })(), fileDestinations, ); delete rest.folder;