Skip to content

Add empty card placeholder#135

Merged
tatsumoto-ren merged 11 commits intoAjatt-Tools:masterfrom
emiham:empty_card_placeholder
Mar 20, 2025
Merged

Add empty card placeholder#135
tatsumoto-ren merged 11 commits intoAjatt-Tools:masterfrom
emiham:empty_card_placeholder

Conversation

@emiham
Copy link
Copy Markdown
Contributor

@emiham emiham commented Mar 15, 2025

If you have vocab cards and your first field is the vocab or its translation, you aren't able to create cards, only modify existing ones.

After this PR you can add a placeholder text to the first field of a card, e.g. "TODO", that you can later search for and edit.

Sorry for the README edits, they snuck in without me noticing, but I figure there's no harm in including them.

emiham added 2 commits March 11, 2025 14:48
If you have vocab cards and your first field is the vocab or its
translation, you aren't able to create cards, only modify existing ones.

With this change you can add a placeholder text to the first field of a
card, e.g. "TODO", that you can later search for and edit.
@tatsumoto-ren
Copy link
Copy Markdown
Member

This is actually mentioned in the README.

Sentence field should be first in the note type settings. Otherwise, Anki won't allow mpvacious to add new notes.

So you just need to get a note type where the sentence field is set as the first field. Like this.

Most of the time it's a bad idea to have vocab cards. An example sentence should be placed on the front. If you're mining cards from anime, for example, it makes no sense to omit the sentence.

If you have a custom note type where for some reason you can't change the order of the fields then it is worth considering this PR, but it would be great if you provided more info about why that is the case.

@emiham
Copy link
Copy Markdown
Contributor Author

emiham commented Mar 16, 2025

Most of the time it's a bad idea to have vocab cards.

I don't disagree, but I don't think people shouldn't be allowed to create them.

If you have a custom note type where for some reason you can't change the order of the fields then it is worth considering this PR, but it would be great if you provided more info about why that is the case.

If you have the vocab field as your first field this lets you use Anki's built in duplicate detection to see if you have a card for that word already. At least in the past this was was Rikaitan or one of its predecessors used for duplicate detection, not sure if it has changed.

@emiham
Copy link
Copy Markdown
Contributor Author

emiham commented Mar 16, 2025

I removed the config option and updated the README. Feel free to change the wording.

Also let me know if you want me to squash the commits or anything.

@tatsumoto-ren
Copy link
Copy Markdown
Member

Since ankiconnect.get_first_field(config.model_name) is being called before every card creation, would it be better to get rid of the global variable first_field and instead move the function call where the result is used?

@emiham
Copy link
Copy Markdown
Contributor Author

emiham commented Mar 16, 2025

It won't be called if you haven't enabled reload_config_before_card_creation. So then you get one less API call, which probably doesn't matter, but overhead is overhead.

Honestly though I can see the argument for just calling it every time. I figured if you want to reload the config there is a greater chance that you've changed the order of the fields (not that this is something that happens often at all). In actuality there's no reason to assume those events are actually correlated though, so the safest thing would be to accept the tiny overhead and just check every time.

@tatsumoto-ren
Copy link
Copy Markdown
Member

If we somehow could get rid of the global variable first_field, that would be great. Maybe just putting it inside config is enough though.

@emiham
Copy link
Copy Markdown
Contributor Author

emiham commented Mar 17, 2025

A config option would work, but I think that adds unnecessary friction for new users. It's also strictly speaking not really a configuration option, it's just an chore to make sure the setting matches your note structure.

@tatsumoto-ren tatsumoto-ren merged commit aceb854 into Ajatt-Tools:master Mar 20, 2025
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