vault backup: 2026-05-28 10:08:57
This commit is contained in:
@@ -5706,6 +5706,7 @@ var DEFAULT_SETTINGS = {
|
||||
todoPageName: "todo",
|
||||
showChecked: false,
|
||||
showAllTodos: false,
|
||||
showOnlyActiveFile: false,
|
||||
autoRefresh: true,
|
||||
subGroups: false,
|
||||
groupBy: "page",
|
||||
@@ -5748,6 +5749,12 @@ var TodoSettingTab = class extends import_obsidian.PluginSettingTab {
|
||||
yield this.plugin.updateSettings({ showAllTodos: value });
|
||||
}));
|
||||
});
|
||||
new import_obsidian.Setting(this.containerEl).setName("Show only in currently active file?").setDesc("Show only todos present in currently active file?").addToggle((toggle) => {
|
||||
toggle.setValue(this.plugin.getSettingValue("showOnlyActiveFile"));
|
||||
toggle.onChange((value) => __async(this, null, function* () {
|
||||
yield this.plugin.updateSettings({ showOnlyActiveFile: value });
|
||||
}));
|
||||
});
|
||||
new import_obsidian.Setting(this.containerEl).setName("Grouping & Sorting");
|
||||
new import_obsidian.Setting(this.containerEl).setName("Group By").addDropdown((dropdown) => {
|
||||
dropdown.addOption("page", "Page");
|
||||
@@ -6293,7 +6300,7 @@ var getFileFromPath = (vault, path) => {
|
||||
let file = vault.getAbstractFileByPath(path);
|
||||
if (file instanceof import_obsidian2.TFile)
|
||||
return file;
|
||||
const files = vault.getFiles();
|
||||
const files = vault.getMarkdownFiles();
|
||||
file = files.find((e) => e.name === path);
|
||||
if (file instanceof import_obsidian2.TFile)
|
||||
return file;
|
||||
@@ -8124,6 +8131,11 @@ var TodoListView = class extends import_obsidian4.ItemView {
|
||||
return;
|
||||
yield this.refresh();
|
||||
})));
|
||||
this.registerEvent(this.app.workspace.on("active-leaf-change", () => __async(this, null, function* () {
|
||||
if (!this.plugin.getSettingValue("showOnlyActiveFile"))
|
||||
return;
|
||||
yield this.refresh();
|
||||
})));
|
||||
this.registerEvent(this.app.vault.on("delete", (file) => this.deleteFile(file.path)));
|
||||
this.refresh();
|
||||
});
|
||||
@@ -8166,7 +8178,7 @@ var TodoListView = class extends import_obsidian4.ItemView {
|
||||
}
|
||||
calculateAllItems() {
|
||||
return __async(this, null, function* () {
|
||||
const todosForUpdatedFiles = yield parseTodos(this.app.vault.getFiles(), this.todoTagArray.length === 0 ? ["*"] : this.visibleTodoTagArray, this.app.metadataCache, this.app.vault, this.plugin.getSettingValue("includeFiles"), this.plugin.getSettingValue("showChecked"), this.plugin.getSettingValue("showAllTodos"), this.lastRerender);
|
||||
const todosForUpdatedFiles = yield parseTodos(this.app.vault.getMarkdownFiles(), this.todoTagArray.length === 0 ? ["*"] : this.visibleTodoTagArray, this.app.metadataCache, this.app.vault, this.plugin.getSettingValue("includeFiles"), this.plugin.getSettingValue("showChecked"), this.plugin.getSettingValue("showAllTodos"), this.lastRerender);
|
||||
for (const [file, todos] of todosForUpdatedFiles) {
|
||||
this.itemsByFile.set(file.path, todos);
|
||||
}
|
||||
@@ -8174,7 +8186,10 @@ var TodoListView = class extends import_obsidian4.ItemView {
|
||||
}
|
||||
groupItems() {
|
||||
const flattenedItems = Array.from(this.itemsByFile.values()).flat();
|
||||
const searchedItems = flattenedItems.filter((e) => e.originalText.toLowerCase().includes(this.searchTerm.toLowerCase()));
|
||||
const viewOnlyOpen = this.plugin.getSettingValue("showOnlyActiveFile");
|
||||
const openFile = this.app.workspace.getActiveFile();
|
||||
const filteredItems = viewOnlyOpen ? flattenedItems.filter((i) => i.filePath === openFile.path) : flattenedItems;
|
||||
const searchedItems = filteredItems.filter((e) => e.originalText.toLowerCase().includes(this.searchTerm.toLowerCase()));
|
||||
this.groupedItems = groupTodos(searchedItems, this.plugin.getSettingValue("groupBy"), this.plugin.getSettingValue("sortDirectionGroups"), this.plugin.getSettingValue("sortDirectionItems"), this.plugin.getSettingValue("subGroups"), this.plugin.getSettingValue("sortDirectionSubGroups"));
|
||||
}
|
||||
renderView() {
|
||||
@@ -8280,3 +8295,5 @@ var TodoPlugin = class extends import_obsidian5.Plugin {
|
||||
return this.settings[setting];
|
||||
}
|
||||
};
|
||||
|
||||
/* nosourcemap */
|
||||
Reference in New Issue
Block a user