release v1.9.0: date picker and open-date command, recent files opened/changed with background dot and type icons, mobile layout
This commit is contained in:
1 parent
984a0ab44f
commit
ff15470a06
14 files changed
+626
-175
No files matched your search
+69
-27
@@ -2,6 +2,7 @@ import { Setting, PluginSettingTab, App, setIcon, AbstractInputSuggest, TFile }
|
||||
import type WaypointPlugin from 'src/main';
|
||||
import { WaypointSettings, DEFAULT_SETTINGS, DEFAULT_DATE_SYSTEM, PeriodNoteSettings } from 'src/settings';
|
||||
import { formatHasDateToken } from 'src/utils/date-systems';
|
||||
import { IconSuggestModal } from 'src/views/waypoint-view';
|
||||
|
||||
/**
|
||||
* Vault-wide Markdown-file suggester for template-path fields, matching
|
||||
@@ -381,7 +382,7 @@ export class WaypointSettingTab extends PluginSettingTab {
|
||||
private renderRecentTab(container: HTMLElement): void {
|
||||
new Setting(container)
|
||||
.setName('Max items')
|
||||
.setDesc('Maximum number of recent files to track.')
|
||||
.setDesc('How many recently opened files, and separately how many recently changed files, to keep. A burst of synced changes cannot push out the files you opened.')
|
||||
.addText((text) => {
|
||||
text.inputEl.setAttr('type', 'number');
|
||||
text.inputEl.setAttr('placeholder', '50');
|
||||
@@ -395,20 +396,6 @@ export class WaypointSettingTab extends PluginSettingTab {
|
||||
};
|
||||
});
|
||||
|
||||
new Setting(container)
|
||||
.setName('Update on')
|
||||
.setDesc('When to add a file to the recent list.')
|
||||
.addDropdown((dropdown) => {
|
||||
dropdown
|
||||
.addOption('file-open', 'File opened')
|
||||
.addOption('file-edit', 'File changed')
|
||||
.setValue(this.settings.recentFiles.updateOn)
|
||||
.onChange((value: 'file-open' | 'file-edit') => {
|
||||
this.settings.recentFiles.updateOn = value;
|
||||
this.saveAndRefresh();
|
||||
});
|
||||
});
|
||||
|
||||
const pathDesc = new DocumentFragment();
|
||||
pathDesc.appendText('Regex patterns for paths to exclude. One per line.');
|
||||
new Setting(container)
|
||||
@@ -439,19 +426,74 @@ export class WaypointSettingTab extends PluginSettingTab {
|
||||
};
|
||||
});
|
||||
|
||||
const filterDesc = new DocumentFragment();
|
||||
filterDesc.appendText('Tags to show as filter pills above the file list. One per line. Leave empty to auto-detect from frontmatter `type` property.');
|
||||
new Setting(container)
|
||||
.setName('Filter tags')
|
||||
.setDesc(filterDesc)
|
||||
.addTextArea((text) => {
|
||||
text.inputEl.setAttr('rows', 4);
|
||||
text.setPlaceholder('meeting\nperson\nproject');
|
||||
text.setValue(this.settings.recentFiles.filterTags.join('\n'));
|
||||
text.inputEl.onblur = () => {
|
||||
this.settings.recentFiles.filterTags = text.getValue().split('\n').filter(t => t.trim());
|
||||
this.saveAndRefresh();
|
||||
};
|
||||
.setName('Type filter')
|
||||
.setDesc('Show pills above the list to filter recent files by their frontmatter `type`.')
|
||||
.addToggle((toggle) => {
|
||||
toggle
|
||||
.setValue(this.settings.recentFiles.showTypeFilter)
|
||||
.onChange((value) => {
|
||||
this.settings.recentFiles.showTypeFilter = value;
|
||||
this.saveAndRefresh();
|
||||
});
|
||||
});
|
||||
|
||||
this.renderRecentTypes(container);
|
||||
}
|
||||
|
||||
/** Frontmatter types with an icon each; also the pill list when the type filter is on. */
|
||||
private renderRecentTypes(container: HTMLElement): void {
|
||||
const types = this.settings.recentFiles.types;
|
||||
|
||||
new Setting(container)
|
||||
.setHeading()
|
||||
.setName('File types')
|
||||
.setDesc('Frontmatter `type` values. A type\'s icon shows beside matching recent files. With the type filter on, these types are the pills, in this order; with no types listed, pills are detected automatically.');
|
||||
|
||||
types.forEach((entry, i) => {
|
||||
new Setting(container)
|
||||
.addText((text) => {
|
||||
text.setPlaceholder('meeting');
|
||||
text.setValue(entry.type);
|
||||
text.inputEl.onblur = () => {
|
||||
const value = text.getValue().trim();
|
||||
if (value === entry.type) return;
|
||||
entry.type = value;
|
||||
this.saveAndRefresh();
|
||||
};
|
||||
})
|
||||
.addExtraButton((btn) => {
|
||||
btn
|
||||
.setIcon(entry.icon || 'image-off')
|
||||
.setTooltip(entry.icon ? `Icon: ${entry.icon}` : 'Choose icon')
|
||||
.onClick(() => {
|
||||
new IconSuggestModal(this.app, entry.icon, (icon) => {
|
||||
entry.icon = icon;
|
||||
this.saveAndRefresh();
|
||||
this.display();
|
||||
}).open();
|
||||
});
|
||||
})
|
||||
.addExtraButton((btn) => {
|
||||
btn
|
||||
.setIcon('trash')
|
||||
.setTooltip('Remove this type')
|
||||
.onClick(() => {
|
||||
types.splice(i, 1);
|
||||
this.saveAndRefresh();
|
||||
this.display();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
new Setting(container)
|
||||
.addButton((btn) => {
|
||||
btn
|
||||
.setButtonText('Add type')
|
||||
.onClick(() => {
|
||||
types.push({ type: '', icon: '' });
|
||||
this.display();
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user