Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding setting option for renaming new files on creation. #1494

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

ChloBearDesigns
Copy link

This will allow users to disable the auto rename on file creation. It's annoying if you design your templates to already do the renaming. This will allow users to disable it.

This will allow users to disable the auto rename on file creation. It's annoying if you design your templates to already do the renaming. This will allow users to disable it.
@ChloBearDesigns
Copy link
Author

ChloBearDesigns commented Oct 31, 2024

Hey, just adding this quick setting to toggle on the auto file rename when creating new files. It was slightly annoying bc I already do this in my templates and it's not needed twice. I suspect others might like this too, if not.. no worries.

@Zachatoo
Copy link
Collaborator

I think this is a great idea, thank you for putting this together! I have a few thoughts:

  1. Is there any way to have tp.file.title populated with the user entered file name? Otherwise you wouldn't be able to use tp.file.title in the template and have it be accurate.
  2. I'd like this setting to be defaulted to off, to avoid the support headache that will come from users seeing duplicate prompts for users who already have a prompt.
  3. We should rename the setting name to "Prompt to rename on create new note from template" and update the description to "Templater will prompt you to rename the file when creating a new note from a template."
  4. Can we remove the changes to the package-lock.json file, since it isn't related to this feature?

Copy link
Collaborator

@Zachatoo Zachatoo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See other comment for requested changes.

@ChloBearDesigns
Copy link
Author

hey Zachatoo, sure I can make those changes. Sorry for not getting back to you sooner, Github didn't tell me I had any messages until I went to look!

@ChloBearDesigns
Copy link
Author

ChloBearDesigns commented Dec 13, 2024

I made the changes to update the setting name and I defaulted it to off, but I had a question about your first point:

"Is there any way to have tp.file.title populated with the user entered file name? Otherwise you wouldn't be able to use tp.file.title in the template and have it be accurate."

I'm not sure what you mean by this. All my change does is bypass the active_leaf.setEphemeralState() call after the file is created. my use case is that I manually renamed the filename from inside the templater script. Either way, tp.file.title wouldn't be correct since the new file name is already created and the rename happened after all templater scripts were finished.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants