Created
March 1, 2022 22:39
-
-
Save GitMurf/35f56b3c803581de593aea8dc68c3288 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<%* | |
//Specify your typical default location here so it is always top of the list to reset to | |
const myDefaultLocation = "new"; | |
//Specify the list of folders you would like to have an option to switch between | |
const changeToPaths = [myDefaultLocation, 'new/tasks', 'templater', '/']; | |
const folderTypeSetting = app.vault.getConfig('newFileLocation'); | |
if(folderTypeSetting !== "folder") { | |
new Notice(`It appears you currently are not using the setting to specify a folder to save new notes to.`, 10000); | |
} else { | |
const currentFolderSetting = app.vault.getConfig('newFileFolderPath'); | |
if(currentFolderSetting) { | |
const chosenFolder = await tp.system.suggester(changeToPaths, changeToPaths, false, `Change default folder location. Currently: "${currentFolderSetting}"`); | |
if(chosenFolder) { | |
app.vault.setConfig("newFileFolderPath", chosenFolder); | |
new Notice(`Changed new file location from "${currentFolderSetting}" to "${chosenFolder}"`, 10000); | |
} else { | |
new Notice(`Did not select an item. Keeping the new file location as "${currentFolderSetting}"`, 10000); | |
} | |
} | |
} | |
return; | |
%> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment