Skip to content

Commit ebd4f7e

Browse files
committed
#211 - allow smaller values of initial delay, including zero
- also increased the precision to one decimal place (tenths of a second)
1 parent 743e1b7 commit ebd4f7e

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

src/settings.ts

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ export interface CustomSortPluginSettings {
1717
}
1818

1919
const MILIS = 1000
20-
const DEFAULT_DELAY_SECONDS = 1
20+
const DEFAULT_DELAY_SECONDS = 0
2121
const DELAY_MIN_SECONDS = 1
2222
const DELAY_MAX_SECONDS = 30
2323
const DEFAULT_DELAY = DEFAULT_DELAY_SECONDS * MILIS
@@ -60,10 +60,14 @@ export class CustomSortSettingTab extends PluginSettingTab {
6060
containerEl.empty();
6161

6262
const delayDescr: DocumentFragment = sanitizeHTMLToDom(
63-
'Seconds to wait before applying custom ordering on plugin / app start.'
63+
'Number of seconds to wait before applying custom ordering on plugin / app start.'
6464
+ '<br>'
65-
+ 'For large vaults or on mobile the value might need to be increased if plugin constantly fails to auto-apply'
66-
+ ' custom ordering on start.'
65+
+ 'For large vaults, multi-plugin vaults or on mobile the value might need to be increased if you encounter issues with auto-applying'
66+
+ ' of custom ordering on start. The delay gives Obsidian additional time to sync notes from cloud storages, to populate notes metadata caches,'
67+
+ ' etc.'
68+
+ '<br>'
69+
+ 'At the same time if your vault is relatively small or only used on desktop, or not synced with other copies,'
70+
+ ' decreasing the delay to 0 could be a safe option.'
6771
+ '<br>'
6872
+ `Min: ${DELAY_MIN_SECONDS} sec., max. ${DELAY_MAX_SECONDS} sec.`
6973
)
@@ -76,7 +80,7 @@ export class CustomSortSettingTab extends PluginSettingTab {
7680
.onChange(async (value) => {
7781
let delayS = parseInt(value, 10)
7882
delayS = Number.isNaN(delayS) ? DEFAULT_DELAY_SECONDS : (delayS < DELAY_MIN_SECONDS ? DELAY_MIN_SECONDS :(delayS > DELAY_MAX_SECONDS ? DELAY_MAX_SECONDS : delayS))
79-
delayS = Math.round(delayS)
83+
delayS = Math.round(delayS*10) / 10 // allow values like 0.2
8084
this.plugin.settings.delayForInitialApplication = delayS * MILIS
8185
await this.plugin.saveSettings()
8286
}))
@@ -110,7 +114,7 @@ export class CustomSortSettingTab extends PluginSettingTab {
110114
+ ' The `.md` filename suffix is optional.'
111115
+ '<br>'
112116
+ 'This will tell the plugin to read sorting specs and also folders metadata from these files.'
113-
+ '<br></br>'
117+
+ '<br>'
114118
+ 'The <i>Inside Folder, with Same Name Recommended</i> mode of Folder Notes is handled automatically, no additional configuration needed.'
115119
+ '</p>'
116120
+ '<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'

0 commit comments

Comments
 (0)