SilentVoid13 / Templater

A template plugin for obsidian
https://silentvoid13.github.io/Templater
GNU Affero General Public License v3.0
2.99k stars 173 forks source link

[BUG & WORKAROUND] The default function tp.system.prompt() because when the enter key is pressed nothing happens. #1338

Open Void4m0n opened 4 months ago

Void4m0n commented 4 months ago

First of all thank you for your work and for this amazing plugin.

Plugin information:

Describe the bug The bug occurs in android, when waiting for user input using the default function it does not recognize the enter input so you cannot use the function from the phone.

Expected behavior When the enter key is pressed on the mobile keyboard the value should be assigned so that the code flow can continue.

Bug Example

<%*
let title = await tp.system.prompt("Select Title")
await tp.file.rename(title); 
%>`

IMG_20240308_151707 IMG_20240308_151617

Workaround To make it work, you can use the multiline mode to display a sumbit button

<%*
let title = await tp.system.prompt("Select Title", null, false, true)
await tp.file.rename(title); 
%>

IMG_20240308_152339

.

Zachatoo commented 4 months ago

I'm not able to reproduce, maybe try on a different keyboard? Some keyboards don't work well with Obsidian.

https://github.com/SilentVoid13/Templater/assets/6936914/b3ae747a-1053-4b3a-977e-1d34e8f53853

SYSTEM INFO: Operating system: android 14 (Google Pixel 7a) Obsidian version: 1.5.8 (126) API version: v1.5.8 Login status: not logged in Live preview: on Base theme: dark Community theme: none Snippets enabled: 17 Restricted mode: off Plugins installed: 20 Plugins enabled: 19 1: BRAT v0.8.4 2: Git v2.24.0 3: Iconize v2.7.3 4: Hotkey Helper v0.3.18 5: Advanced URI v1.40.0 6: Dataview v0.5.59 7: Linter v1.23.1 8: Grandfather v1.0.1 9: Window Collapse v1.0.2 10: Achievements v0.0.10 11: Inbox v3.0.0 12: Calendar v1.5.10 13: File Diff v1.1.0 14: CSS Editor v0.5.0 15: Canvas Send to Back v0.0.4 16: Attachment Management v0.9.6 17: CookLang Editor v0.3.0 18: Settings Search v1.3.10 19: Templater v2.2.3

Void4m0n commented 4 months ago

You're absolutely right, it's a problem with the stock GrapheneOS keyboard, with gboard there is no bug. Maybe it is a good idea to implement the sumbit button in default tp.system.prompt(), but with the workaround there is no problem at all, so it's totally up to you.

Again, thank you very much for your work and for the quick response.

Zachatoo commented 4 months ago

Thanks for checking!

I think adding the submit button always makes a lot of sense to be able to support all keyboards.