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

Option to highlight note's title on creation #15

Closed
alltiagocom opened this issue Dec 3, 2023 · 12 comments
Closed

Option to highlight note's title on creation #15

alltiagocom opened this issue Dec 3, 2023 · 12 comments
Assignees
Labels
bug Something isn't working

Comments

@alltiagocom
Copy link

alltiagocom commented Dec 3, 2023

Thank you for the great plugin!
I started using it yesterday, but one thing I believe will make a big difference is an option (so each user uses it or not based on their preferred workflow) to highlight the title instead of just adding "Untitled" and going straight to the body of the note.
In my case I always like to add a title right away.

Hope you can implement this :)

@Mara-Li
Copy link
Owner

Mara-Li commented Dec 3, 2023

Litterally the last update do it. Duplicate of #13

@Mara-Li Mara-Li closed this as completed Dec 3, 2023
@alltiagocom
Copy link
Author

alltiagocom commented Dec 3, 2023

Litterally the last update do it. Duplicate of #13

I'm sorry, I'm a bit confused. You mean that the latest update (1.7.0) highlights the title?
If so, I'm not experiencing that. The cursor still goes to the body of the note. I even restarted Obsidian, just in case, but it's not working.

Can you clarify what you mean?
I saw that other issue you shared (#13) and it seems you can't change this behavior, but now you said "the last update do it" so I'm confused about this.
Kapture 2023-12-03 at 17 18 36

I don't know if this is relevant or not:
Obsidian version 1.4.16
macOS 10.15.7

Thanks

@Mara-Li
Copy link
Owner

Mara-Li commented Dec 4, 2023

Hm, seems it is not working on your side.
Can I have the settings you use for the folder?

As there isn't a API to do it, I use an hacky way but it worked on my side :(

@Mara-Li Mara-Li added the bug Something isn't working label Dec 4, 2023
@Mara-Li Mara-Li reopened this Dec 4, 2023
@Mara-Li
Copy link
Owner

Mara-Li commented Dec 4, 2023

Tested on my test vault & normal vault and the note title is hightlighted. Maybed the methods i used doesn't work on MacOS ?

@alltiagocom
Copy link
Author

alltiagocom commented Dec 4, 2023

Hm, seems it is not working on your side. Can I have the settings you use for the folder?

As there isn't a API to do it, I use an hacky way but it worked on my side :(

Hope this is what you need
image

If it doesn't indeed work on macOS, what if the plugin includes an option to show a modal to add the Title? Then when we hit Enter, it will grab that info from the modal and creates the new note using that info, then goes to the body of the note.
That way, as an optional feature, those with a Mac can enable it, and those with Windows can disable it.

@Mara-Li
Copy link
Owner

Mara-Li commented Dec 4, 2023

Not, it's not the settings I need : I need the "edit" (on the pencil) parameters.

It's very strange that i didn't work on MacOS without reason.

Can you try a command without the {{current}}, ie in a specific folder ?
Did you have something in the console (CMD+MAJ+I) when you use the command/enable the plugin ?

Your plugin is in 1.8.0 ?

@Mara-Li
Copy link
Owner

Mara-Li commented Dec 4, 2023

It even works on my ipad :

RPReplay_Final1701694073.MP4

@alltiagocom
Copy link
Author

Not, it's not the settings I need : I need the "edit" (on the pencil) parameters.
This?
image

It's very strange that i didn't work on MacOS without reason
I just noticed that 2 of the options work as expected, 1 doesn't.
Green: work, meaning they highlight the title. Red: doesn't, meaning it goes to the body.
image

Can you try a command without the {{current}}, ie in a specific folder ?
Yes, removing {{current}} and adding a specific folder, makes it work, so it seems that the issue is with {{current}}
We are getting closer now ;)

Did you have something in the console (CMD+MAJ+I) when you use the command/enable the plugin ?
What you mean by "MAJ"?

Your plugin is in 1.8.0 ?
Yes, I just updated it, but as mentioned, 1 of them doesn't work.

@Mara-Li
Copy link
Owner

Mara-Li commented Dec 4, 2023

So the bug seems to be around the {{current}}

The methods used for current is a little bit more hacky than the other methods. I set a timeout of 50, but maybe we need more ?
I will add an option to set the timeout, so we can try editing this option to see if it works

@Mara-Li
Copy link
Owner

Mara-Li commented Dec 4, 2023

Okay, I published the 1.18.1, adding a new setting timeOutForInlineTitle.

After updating to this version, try if a bigger value work for you :

  • open the file data.json file in .obsidian/plugins/create-note-in-folder (any text editor works)
  • Edit the value timeOutForInlineTitle with a bigger number, like 3000 for example (3000 = 3seconde)
  • Save the file
  • Reload the plugin
  • Try to create a file in current

@alltiagocom
Copy link
Author

Updated it.
So 99% of the time, the timeout set to 50 would not work. I don't know why sometimes it did, but it's definitely not that reliable.
I found that 100 is more constant and it always works.
I will leave it like that and if by any chance it doesn't work sometimes, I will change it to a higher value and will report it so you can be updated on this as well.

Thank you so much for your help on this.

@Mara-Li
Copy link
Owner

Mara-Li commented Dec 4, 2023

Thank you too for this quick reply and help me debug the issue !
I will improve the settings to allow differents timeout by platform (mobile / desktop), make a little update in the README and close the issue after that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants