@@ -18,7 +18,7 @@ export interface CustomSortPluginSettings {
1818
1919const MILIS = 1000
2020const DEFAULT_DELAY_SECONDS = 1
21- const DELAY_MIN_SECONDS = 1
21+ const DELAY_MIN_SECONDS = 0
2222const DELAY_MAX_SECONDS = 30
2323const DEFAULT_DELAY = DEFAULT_DELAY_SECONDS * MILIS
2424
@@ -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 )
@@ -74,9 +78,9 @@ export class CustomSortSettingTab extends PluginSettingTab {
7478 . addText ( text => text
7579 . setValue ( `${ this . plugin . settings . delayForInitialApplication / MILIS } ` )
7680 . onChange ( async ( value ) => {
77- let delayS = parseInt ( value , 10 )
78- 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 )
81+ let delayS = parseFloat ( value )
82+ delayS = ( Number . isNaN ( delayS ) || ! Number . isFinite ( ( delayS ) ) ) ? DEFAULT_DELAY_SECONDS : ( delayS < DELAY_MIN_SECONDS ? DELAY_MIN_SECONDS :( delayS > DELAY_MAX_SECONDS ? DELAY_MAX_SECONDS : 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