fixed typings errors

This commit is contained in:
NebulousNessie 2025-11-10 11:36:58 +00:00
parent 3e29be1ecd
commit d430bfb4e8
3 changed files with 10 additions and 4 deletions

View file

@ -71,7 +71,7 @@ export function addPinButton(
percentY,
async (newMarker) => {
await addMarkerToFile(app.vault, markerFilePath, newMarker);
await refreshMOCBlock(app, source, el, ctx);
await refreshMOCBlock(app, source, el, ctx, parentComponent);
app.workspace.trigger("markdown-code-block-processed");
},
cleanup // call cleanup on cancel
@ -223,7 +223,7 @@ export function addPolylineButton(
newMarker.type = "polyline";
newMarker.points = points; // normalized percentages, for scaling
await addMarkerToFile(app.vault, markerFilePath, newMarker);
await refreshMOCBlock(app, source, el, ctx);
await refreshMOCBlock(app, source, el, ctx, parentComponent);
app.workspace.trigger("markdown-code-block-processed");
},
cleanup // call cleanup on cancel

View file

@ -163,7 +163,7 @@ export async function deleteMarkerFromFile(
//console.log("🗑️ Marker deleted:", markerId);
}
export async function renameDataFolder(this: { app: App }, oldPath: string, newPath: string) {
export async function renameDataFolder(app: App, oldPath: string, newPath: string) {
const oldFolder = app.vault.getAbstractFileByPath(oldPath);
const newFolder = app.vault.getAbstractFileByPath(newPath);
if (oldFolder && oldPath !== newPath) {

View file

@ -33,6 +33,12 @@ export const DEFAULT_SETTINGS: MOCBlockSettings = {
export class MOCBlockSettingTab extends PluginSettingTab {
plugin: MOCBlockPlugin;
constructor(app: App, plugin: MOCBlockPlugin) {
super(app, plugin);
this.plugin = plugin;
}
display(): void {
const { containerEl } = this;
containerEl.empty();
@ -57,7 +63,7 @@ export class MOCBlockSettingTab extends PluginSettingTab {
const newPath = normalizePath(pendingValue || "MOCData");
this.plugin.settings.dataFolder = newPath;
await this.plugin.saveSettings();
await renameDataFolder(oldPath, newPath);
await renameDataFolder(this.app, oldPath, newPath);
// Create the folder if it doesn't exist
const folderExists = await this.app.vault.adapter.exists(newPath);