Skip to content

Commit

Permalink
Bug fix for #67
Browse files Browse the repository at this point in the history
  • Loading branch information
jon-dez committed Nov 13, 2024
1 parent f66d058 commit c55cf1e
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 6 deletions.
2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
23 changes: 18 additions & 5 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<FileDestinationsSettings>,
(() => {
// Do not migrate if the the old file destination settings were already migrated.
if (fileDestinations === undefined) return {};
// Migrate old settings
const migrated: Partial<FileDestinationsSettings> = {};

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;
Expand Down

0 comments on commit c55cf1e

Please sign in to comment.