|
6 | 6 | normalizePath, |
7 | 7 | Plugin, |
8 | 8 | PluginSettingTab, |
| 9 | + sanitizeHTMLToDom, |
9 | 10 | setIcon, |
10 | 11 | Setting, |
11 | 12 | TAbstractFile, |
@@ -86,12 +87,13 @@ export default class CustomSortPlugin extends Plugin { |
86 | 87 | // - the file(s) explicitly configured by user in plugin settings |
87 | 88 | // Be human-friendly and accept both .md and .md.md file extensions |
88 | 89 | // (the latter representing a typical confusion between note name vs underlying file name) |
89 | | - if (aFile.name === SORTSPEC_FILE_NAME || |
90 | | - aFile.name === `${SORTSPEC_FILE_NAME}.md` || |
91 | | - aFile.basename === parent.name || |
92 | | - aFile.basename === this.settings.additionalSortspecFile || |
93 | | - aFile.path === this.settings.additionalSortspecFile || |
94 | | - aFile.path === `${this.settings.additionalSortspecFile}.md` |
| 90 | + if (aFile.name === SORTSPEC_FILE_NAME || // file name == sortspec.md ? |
| 91 | + aFile.name === `${SORTSPEC_FILE_NAME}.md` || // file name == sortspec.md.md ? |
| 92 | + aFile.basename === parent.name || // Folder Note mode: inside folder, same name |
| 93 | + aFile.basename === this.settings.additionalSortspecFile || // when user configured _about_ |
| 94 | + aFile.name === this.settings.additionalSortspecFile || // when user configured _about_.md |
| 95 | + aFile.path === this.settings.additionalSortspecFile || // when user configured Inbox/sort.md |
| 96 | + aFile.path === `${this.settings.additionalSortspecFile}.md` // when user configured Inbox/sort |
95 | 97 | ) { |
96 | 98 | const sortingSpecTxt: string = mCache.getCache(aFile.path)?.frontmatter?.[SORTINGSPEC_YAML_KEY] |
97 | 99 | if (sortingSpecTxt) { |
@@ -390,11 +392,26 @@ class CustomSortSettingTab extends PluginSettingTab { |
390 | 392 |
|
391 | 393 | containerEl.createEl('h2', {text: 'Settings for Custom File Explorer Sorting Plugin'}); |
392 | 394 |
|
| 395 | + const additionalSortspecFileDescr: DocumentFragment = sanitizeHTMLToDom( |
| 396 | + 'A note name or note path to scan (YAML frontmatter) for sorting specification in addition to the `sortspec` notes and Folder Notes<sup><b>*</b></sup>.' |
| 397 | + + '<br>' |
| 398 | + + ' The `.md` filename suffix is optional.' |
| 399 | + + '<p><b>(*)</b> if you employ the <i>Index-File based</i> approach to folder notes (as documented in ' |
| 400 | + + '<a href="https://github.com/aidenlx/alx-folder-note/wiki/folder-note-pref"' |
| 401 | + + '>Aidenlx Folder Note preferences</a>' |
| 402 | + + ') you can enter here the index note name, e.g. <b>_about_</b>' |
| 403 | + + '<br>' |
| 404 | + + 'The <i>Inside Folder, with Same Name Recommended</i> mode of Folder Notes is handled automatically, no additional configuration needed.' |
| 405 | + + '</p>' |
| 406 | + + '<p>NOTE: After updating this setting remember to refresh the custom sorting via clicking on the ribbon icon or via the <b>sort-on</b> command' |
| 407 | + + ' or by restarting Obsidian or reloading the vault</p>' |
| 408 | + ) |
| 409 | + |
393 | 410 | new Setting(containerEl) |
394 | | - .setName('Path to the designated note containing sorting specification') |
395 | | - .setDesc('The YAML front matter of this note will be scanned for sorting specification, in addition to the `sortspec` notes and folder notes. The `.md` filename suffix is optional.') |
| 411 | + .setName('Path or name of additional note(s) containing sorting specification') |
| 412 | + .setDesc(additionalSortspecFileDescr) |
396 | 413 | .addText(text => text |
397 | | - .setPlaceholder('e.g. Inbox/sort') |
| 414 | + .setPlaceholder('e.g. _about_') |
398 | 415 | .setValue(this.plugin.settings.additionalSortspecFile) |
399 | 416 | .onChange(async (value) => { |
400 | 417 | this.plugin.settings.additionalSortspecFile = value.trim() ? normalizePath(value) : ''; |
|
0 commit comments