mirror of
https://github.com/groldsf/obsidian_check_plugin.git
synced 2026-07-22 05:37:48 +00:00
feat(filter): Integrate FileFilter into plugin lifecycle
This commit is contained in:
parent
683b358053
commit
e5f3318809
2 changed files with 16 additions and 0 deletions
|
|
@ -40,5 +40,15 @@ export class FileFilter {
|
|||
// Метод ignorer.ignores(filePath) вернет true, если файл должен быть ИГНОРИРОВАН.
|
||||
// Нам нужно инвертировать это, чтобы получить "разрешен ли файл".
|
||||
return !this.ignorer.ignores(filePath);
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates the filter المستقيمs with new plugin settings and re-initializes the ignorer.
|
||||
* @param newSettings The new plugin settings.
|
||||
*/
|
||||
public updateSettings(newSettings: Readonly<CheckboxSyncPluginSettings>): void {
|
||||
console.log("FileFilter: Settings updated. Re-initializing ignorer."); // Для отладки
|
||||
this.settings = newSettings; // Обновляем ссылку на настройки
|
||||
this.initIgnorer(); // Переинициализируем ignorer с новыми pathGlobs
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ import FileStateHolder from "./FileStateHolder";
|
|||
import { CheckboxSyncPluginSettingTab } from "./ui/CheckboxSyncPluginSettingTab";
|
||||
import SyncController from "./SyncController";
|
||||
import { CheckboxSyncPluginSettings, DEFAULT_SETTINGS } from "./types";
|
||||
import { FileFilter } from "./FileFilter";
|
||||
|
||||
const DEBUG_FLAG_NAME = 'CHECKBOX_SYNC_DEBUG';
|
||||
|
||||
|
|
@ -25,10 +26,12 @@ export default class CheckboxSyncPlugin extends Plugin {
|
|||
private fileStateHolder: FileStateHolder;
|
||||
private fileLoadEventHandler: FileLoadEventHandler;
|
||||
private fileChangeEventHandler: FileChangeEventHandler;
|
||||
private fileFilter: FileFilter;
|
||||
|
||||
async onload() {
|
||||
await this.loadSettings();
|
||||
|
||||
this.fileFilter = new FileFilter(this.settings);
|
||||
this.fileStateHolder = new FileStateHolder(this.app.vault);
|
||||
this.checkboxUtils = new CheckboxUtils(this.settings);
|
||||
this.syncController = new SyncController(this.app.vault, this.checkboxUtils, this.fileStateHolder);
|
||||
|
|
@ -52,8 +55,11 @@ export default class CheckboxSyncPlugin extends Plugin {
|
|||
async updateSettings(callback: (settings: CheckboxSyncPluginSettings) => void | Promise<void>) {
|
||||
await callback(this._settings);
|
||||
this.setDebugFlag(this.settings.consoleEnabled);
|
||||
this.fileFilter.updateSettings(this.settings);
|
||||
await this.saveData(this.settings);
|
||||
|
||||
|
||||
|
||||
if (this.settings.enableAutomaticFileSync) {
|
||||
//надо пересинхронизировать все файлы в кеше
|
||||
const allFile = this.fileStateHolder.getAllFiles();
|
||||
|
|
|
|||
Loading…
Reference in a new issue