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

[FR]: Focus filename after creating a note (like default Obsidian) #13

Closed
redactedscribe opened this issue Dec 2, 2023 · 12 comments
Closed
Assignees
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@redactedscribe
Copy link

Just after creating a note, the cursor is automatically positioned in the body of the note instead of its inline title / tab title bar. Ideally we could create a note and immediately type its title (filename), instead of having to click it first then type. This happens when a folder is using Templater template, or none at all.

Thanks.

@Mara-Li
Copy link
Owner

Mara-Li commented Dec 2, 2023

I will love to do that, but can't find anything in the API that could let me to do this. I leave this request as standby until I found a proper solution.

@Mara-Li Mara-Li added enhancement New feature or request help wanted Extra attention is needed labels Dec 2, 2023
@Mara-Li Mara-Li changed the title Focus filename after creating a note (like default Obsidian) [FR]: Focus filename after creating a note (like default Obsidian) Dec 2, 2023
@Mara-Li Mara-Li closed this as completed in 3e07c6a Dec 3, 2023
@redactedscribe
Copy link
Author

Hello @Lisandra-dev, is it possible for you to take a look at this issue? It seems to be a compatibility issue with another plugin known as Front Matter Title being able to focus the title when both plugins are enabled. Maybe you can make sense of the latest comment regarding your code. Thank you.

@Mara-Li
Copy link
Owner

Mara-Li commented Jan 5, 2024

(joking) Yeay, a way to fly my finals (joking)

I will take a look, thanks for the investigation !

@Mara-Li Mara-Li reopened this Jan 5, 2024
@Mara-Li Mara-Li closed this as completed in 56057b4 Jan 5, 2024
@redactedscribe
Copy link
Author

It seems to work. Thank you! The only other thing is that if the template is long in length, it's possible that the title cannot be seen because the page scrolls to the bottom for some reason. But, the title is highlighted and so I can start typing and it'll scroll up to see the inline title. It might be a side effect of another plugin so I don't think you need to try and fix that now. If I find out more, I'll let you know.

Thank you again!

@Mara-Li
Copy link
Owner

Mara-Li commented Jan 6, 2024

It should scroll now!

@redactedscribe
Copy link
Author

redactedscribe commented Jan 6, 2024

It should scroll now!

I didn't notice any change with the new version, but as I said, if I start typing, it scrolls up so I can see the inline title, so it's functional enough in this state. Could be something else.

It does work when I remove Templater's <% tp.file.cursor() %> from my template. That was probably the issue, the note is now always scrolled to the top. I think it might be a Templater bug.


Secondly, I think there's a bug when a Templater template includes <% tp.file.rename("New note") -%>: The inline title is focused after note creation, and can be typed into, but inserted text does not overwrite "New note" and is instead prepended to it ("New note" isn't pre-selected). Removing <% tp.file.rename("New note") -%> and creating the note now has "New note" selected and ready to be typed over.

The inline title is always pre-selected if Create Note in Folder's folder specific settings is also set to "New note" for its note name. Then it will match the Templater code <% tp.file.rename("New note") -%> and the inline title will be selected. If folder settings note name differs to <% tp.file.rename("...") -%> then this bug occurs.

@redactedscribe
Copy link
Author

@Mara-Li Hello again. Thanks for your continued development of this plugin, however it appears that the latest release re-introduced this issue again. After creating a note, the cursor is on line 1 instead of in the inline title / tab title bar.

@Mara-Li
Copy link
Owner

Mara-Li commented May 27, 2024

A simple refractor could do this?
Will fix this tomorrow, sorry for the inconvenience!

@redactedscribe
Copy link
Author

It appears so. Hopefully the solution will be simple.

@Mara-Li
Copy link
Owner

Mara-Li commented May 28, 2024

Yeah, no worry, I know what cause the error ^^

@Mara-Li Mara-Li reopened this May 28, 2024
@Mara-Li
Copy link
Owner

Mara-Li commented May 28, 2024

Should be fixed again

@redactedscribe
Copy link
Author

Yep, it's fixed. Thanks @Mara-Li!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants