Skip to content

Commit 37302d3

Browse files
committed
Add Dataview and syntax format migration feature
1 parent a046ca2 commit 37302d3

2 files changed

Lines changed: 28 additions & 0 deletions

File tree

src/settings.ts

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import {App, Plugin, PluginSettingTab, Setting} from "obsidian";
22
import {TokenStyle} from "./metadata-utils";
3+
import {MigrationModal} from "./migration-modal";
34

45
export interface EmbedMetadataSettings {
56
tokenStyle: TokenStyle;
@@ -161,5 +162,25 @@ export class EmbedMetadataSettingTab extends PluginSettingTab {
161162
await this.plugin.saveSettings();
162163
});
163164
});
165+
166+
containerEl.createEl("h3", {text: "Migration"});
167+
168+
new Setting(containerEl)
169+
.setName("Migrate from Dataview")
170+
.setDesc("Convert backticked `=this.key` tokens to the selected format.")
171+
.addButton((button) => {
172+
button.setButtonText("Review").onClick(() => {
173+
new MigrationModal(this.app, this.plugin, "dataview").open();
174+
});
175+
});
176+
177+
new Setting(containerEl)
178+
.setName("Migrate to current syntax")
179+
.setDesc("Convert other supported token formats to the selected format.")
180+
.addButton((button) => {
181+
button.setButtonText("Review").onClick(() => {
182+
new MigrationModal(this.app, this.plugin, "otherSyntax").open();
183+
});
184+
});
164185
}
165186
}

styles.css

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,13 @@
1717
padding: 0 2px;
1818
}
1919

20+
.embed-metadata-migration-actions {
21+
display: flex;
22+
gap: 8px;
23+
align-items: center;
24+
margin-top: 12px;
25+
}
26+
2027
.embed-metadata-hoverable:hover {
2128
filter: brightness(1.15);
2229
}

0 commit comments

Comments
 (0)