Eltaurus-Lt / Anki-Card-Templates

Decks of templates + source code for Anki cards
39 stars 2 forks source link

Memrise Cards [Lt], space bar button #15

Open Gardengul opened 3 weeks ago

Gardengul commented 3 weeks ago

Anki 24.06.2 (33a92379) (ao) Python 3.9.18 Qt 6.6.2 PyQt 6.6.1 Platform: Windows-10-10.0.19045

When you turn on the addon Memrise Cards [Lt], the space bar does not work during the review.

Eltaurus-Lt commented 3 weeks ago

What would be the expected behaviour for the space bar in this case?

Gardengul commented 2 weeks ago

image

The space bar button shows the answer and if the answer is already shown, responds to the card as good.

Eltaurus-Lt commented 2 weeks ago

If you want the spacebar to act like the Enter key you can substitute the following expression on the front of a card

ev.key === 'Enter'

with this:

(ev.key === 'Enter' || ev.key === ' ')

I won't make this change in the general template, as I have a different use for a space button for the future versions in mind, and it is not a behaviour people would expect from a Memrise template anyway.

Gardengul commented 2 weeks ago

I meant that the space bar does not work with all note types, not just with Memrise (Long) Preset [...] v3.32

Eltaurus-Lt commented 2 weeks ago

Thats right. But any shortcut used by Anki itself becomes inaccessible from card scripts. So there are basically only two ways around it:

  1. Return the shortcuts back to Anki by commenting out the first line:
    from . import Clear_Shortcuts

    in the __init__.py file in the add-on folder. (this will also revert the functionality of pressing Enter on the memrise cards to the basic Anki behavior)

  2. Keep the add-on as is, and add the JS processing Enter and Space keys to all the Note Types that require it.
Gardengul commented 2 weeks ago

I thought it was a bug. But if this is not the case, then everything is fine. It would be good to access disabling/enabling this feature via config.