mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-05-08 07:12:39 +02:00
feat: add confirmation modal for enabling attachment sync in SurfSense plugin
This commit is contained in:
parent
6eeaa2db4d
commit
23a52b6c63
2 changed files with 73 additions and 0 deletions
|
|
@ -7,6 +7,7 @@ import {
|
|||
setIcon,
|
||||
} from "obsidian";
|
||||
import { AuthError } from "./api-client";
|
||||
import { AttachmentsConfirmModal } from "./attachments-confirm-modal";
|
||||
import { normalizeFolder, parseExcludePatterns } from "./excludes";
|
||||
import { FolderSuggestModal } from "./folder-suggest-modal";
|
||||
import type SurfSensePlugin from "./main";
|
||||
|
|
@ -210,6 +211,17 @@ export class SurfSenseSettingTab extends PluginSettingTab {
|
|||
toggle
|
||||
.setValue(settings.includeAttachments)
|
||||
.onChange(async (value) => {
|
||||
const isEnabling =
|
||||
value && !this.plugin.settings.includeAttachments;
|
||||
if (isEnabling) {
|
||||
const confirmed = await new AttachmentsConfirmModal(
|
||||
this.app,
|
||||
).waitForConfirmation();
|
||||
if (!confirmed) {
|
||||
this.display();
|
||||
return;
|
||||
}
|
||||
}
|
||||
this.plugin.settings.includeAttachments = value;
|
||||
await this.plugin.saveSettings();
|
||||
}),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue