Collapsible Fields [Official support]

This is the official support thread for the add-on Collapsible Fields. If you have any questions, or suggestions, you can leave them here.

If you’re familiar with GitHub, you can also leave an issue in the official repository instead.

1 Like

I just installed Collapsible Fields add-on. I like the idea but there is a conflict with the Multi-column note Editor add-on. Some fields have the arrow icon and can collapse properly, but some have the icon and don’t collapse, some don’t have any icon.
Disabling the Multi-column note editor made it work correctly.

Luckily for you I will adopt the development for the Multi-Column Note very soon. Just give me after Easter :slight_smile:

Excellent add-on, but it has an annoying bug (nothing that obscures the brightness of its work): sometimes, when opening the card addition box, no file presents collapsed as placed in the field customizations. Would it be an addon problem?
Note: To return to the initial preset (collapse certain fields), it is necessary to restart Anki.

Edit: I found an error: every time you change the deck cards, the addon stops working, therefore it is necessary to restart the program

Error
An error occurred. Please start Anki while holding down the shift key, which will temporarily disable the add-ons you have installed.
If the issue only occurs when add-ons are enabled, please use the Tools > Add-ons menu item to disable some add-ons and restart Anki, repeating until you discover the add-on that is causing the problem.
When you’ve discovered the add-on that is causing the problem, please report the issue on the add-on support site.
Debug info:
Anki 2.1.35 (84dcaa86) Python 3.8.0 Qt 5.14.2 PyQt 5.14.2
Platform: Windows 10
Flags: frz=True ao=True sv=1
Add-ons, last update check: 2021-05-09 22:14:12

Caught exception:
Traceback (most recent call last):
File “aqt\webview.py”, line 37, in cmd
File “aqt\webview.py”, line 123, in _onCmd
File “aqt\webview.py”, line 541, in _onBridgeCmd
File “aqt\gui_hooks.py”, line 2959, in call
File “C:\Users\xxx\AppData\Roaming\Anki2\addons21\1896168623\src\webview.py”, line 30, in handle_collapsible_messages
model = context.note.model()
AttributeError: ‘NoneType’ object has no attribute ‘model’

I don’t understand what you mean by this:

no file presents collapsed as placed in the field customizations

Could you maybe upload a screenshot?

Hello - for some reason all are working but the ‘extra’ fields, even though I have selected the ‘extra’ field to be collapsed in all card types… Ideas? Attached screenshot of add ons since that seemed to be a problem for some.

You could try to disable the add-ons one by one to see which one triggers it. Otherwise it’s hard to tell for me. If I had to guess, I’d say the Amboss add-on, because I don’t really know what it does.

2.1.45 alpha 1 → add-on broken
image
https://www.reddit.com/r/Anki/comments/neoihx/anki_2145_alpha/ (changelogs)

The next alpha should fix this one by adding a legacy alias

Hi,

Thanks for your add-on, it’s useful. There’s just a little bug, when I edit HTML in editor (with CTRL + SHIFT + X), all fields collapse after editing the card.

1 Like

@hengiesel you probably know this already but its not working on 2.1.45alpha3, just FYI

1 Like

Is there any way to to get multiple fields to collapse under a single heading? I am creating a deck for verb conj and usage - each person (1st, 2nd, 3rd, singular, plural and formal) gets a field that is populated with the correct verb form for a specific tense, plus a sample sentence for translation in English and the target language. There are also fields for audio and a literal translation. So, in the following list every item past number 4 is related to a single tense. I’d like to have all the data points for all the tenses in one note. But it gets a bit unruly because there would be well over 100 fields in the note. If i could organize groups of fields under a tense heading I think it would make editing notes much easier. I could alos just create separate decks for each tense but something tells me it would be useful to all of this in one note and use cards and sub-decks to organize study by each tense (foe example). I’m a beginner, so I’m not really sure that this is a good strategy or if Anki would have trouble with notes of this size.

  1. Infinitivo
  2. English
  3. prsnt part
  4. -end (reg/irreg)
  5. io
  6. noi
  7. tu
  8. tu formale
  9. voi
  10. lei,lui
  11. loro
  12. Instruction
  13. PrsntSmpl-1s-Ital-1
  14. Lit-1s-Ital-1
  15. PrsntSmpl-1s-Eng-1
  16. PrsntSmpl-1s-aud-1
  17. PrsntSmpl-1p-Ital-1
  18. Lit-1p-Ital-1
  19. PrsntSmpl-1p-Eng-1
  20. PrsntSmpl-1p-aud-1
  21. PrsntSmpl-2s-Ital-1
  22. Lit-2s-Ital-1
  23. PrsntSmpl-2s-Eng-1
  24. PrsntSmpl-2s-aud-1
  25. PrsntSmpl-2sf-Ital-1
  26. Lit-2sf-Ital-1
  27. PrsntSmpl-2sf-Eng-1
  28. PrsntSmpl-2sf-aud-1
  29. PrsntSmpl-2p-Ital-1
  30. Lit-2p-Ital-1
  31. PrsntSmpl-2p-Eng-1
  32. PrsntSmpl-2p-aud-1
  33. PrsntSmpl-3s-Ital-1
  34. Lit-3s-Ital-1
  35. PrsntSmpl-3s-Eng-1
  36. PrsntSmpl-3s-aud-1
  37. PrsntSmpl-3p-Ital-1
  38. Lit-3p-Ital-1
  39. PrsntSmpl-3p-Eng-1
  40. PrsntSmpl-3p-aud-1
  41. Usage Note

If your note type’s size (amount of code in card templates) is reasonable, I wouldn’t worry too much about performance, but perhaps about the ergonomics of handling so many fields.

If there’s one thing that could cause issues, it’s not the amount of fields per se, but the amount of card templates. In the past, I have experienced syncing issues on AnkiDroid with a note type that had more than 50 card templates. But that was a very complex note type with a lot of JS, mind you.

2 Likes

I have been studying Italian for a long time (years) using Anki. But I must confess that a large portion of my time is spent tweeking my note types and card templates. Playing around with it has become a hobby. I didn’t know any HTML or CSS before, and this has become a fun place to learn. Also learned a bit of scripting along the way. Amazing what you can do with Anki.
My current set up I like a lot. The following might give you some ideas.
Basically three main note types. The basic one has five cards: English to Italian, Italian to English, Italian audio to Italian, Italian audio to English, Picture to Italian. Then for verbs two note types: one for infinitives but also contains present participle, past participle and gerundio. So that note type has several cards for English to Italian and Italian to English. That infinitive note type also has the main comments on the verb. Then I have a note type for conjugations. I used to have a note type that required typing out all six forms for a tense. But that feels like learning a rhyme and is too academic and not a natural way to learn a language. Individual cards are better. But to avoid a proliferation of cards I figured in a real life situation one might have to chose between using the singular or plural. So I combine those on one card for English to Italian. Opposite direction, you have to recognize when you hear a single Italian form so they have to be six separate cards. That means a total of nine cards. To see comments you can link a conjugation note to the main infinitive note (using Add-on “link Cards Notes and Preview them in extra window”). I also use the add-on “Cloze Hide All” for studying longer sentences. You can cloze lots of parts of the sentence and chose whether you want them to be hidden or viewed when answering other clozes.

Everyone has their own preferences, but I hope I gave you some ideas. Have fun studying both Italian and Anki development.

I should add that I use audio I got from downloaded decks, but also now use TTS on all my cards. The Add-on AwesomeTTS could help you set it up but study how TTS is done in the Anki manual and then you can delete AwesomeTTS. The voice {{tts it_IT voices=Apple_Luca:fieldname}} is very good Italian.

The addon is great. Is there a way to change the color of a non-empty collapsed field’s indicator?

Go into the addon’s files, there’ll be a file called collapsible.css in the folder ‘web’.
At the top there’ll be some variable definitions for :root, you’ll need to change these.

Use this to get the filters needed for whatever color you want.
You’ll need to Change the value of --green for the daymode color, and --lime for the nightmode.

1 Like

OK thanks…good to know. But there is no separate closed indicator for a non-empty field (same closed indicator whether field is empty or not).

OK, I figured it out. Here is my changes:

  --nonemptycollapsed: invert(29%) sepia(93%) saturate(6053%)
    hue-rotate(353deg) brightness(95%) contrast(128%);
  --nonemptycollapsednite: invert(33%) sepia(98%) saturate(5768%)
    hue-rotate(292deg) brightness(109%) contrast(135%);

/*--------------------------------------------------------------------------*/
.collapse-icon {
  filter: var(--green);
}
.nightMode .collapse-icon {
  filter: var(--lime);
}
/*--------------------------------------------------------------------------*/
.is-collapsed .collapse-icon {
  filter: var(--nonemptycollapsed);
}
.nightMode .is-collapsed .collapse-icon {
  filter: var(--nonemptycollapsednite);
}
/*--------------------------------------------------------------------------*/
.is-collapsed--empty .collapse-icon {
  filter: var(--black);
}
.nightMode .is-collapsed--empty .collapse-icon {
  filter: var(--white);
}
/*--------------------------------------------------------------------------*/

1 Like

Update 20220914: I realize that this addon will only work to 49. After staying with 49 for nearly 11 months I decided to try v54. Collapsible Fields is so important for me I have considered going back to 49 but I do not know how long I’d have to stay. I enabled the addon to see what errors are reported…I sincerely hope it can be updated to work on v54+ (or maybe I could figure out how to fix it…I don’t know python but looks like 3 fields need to be defined: forEditorField, getCurrentField, getEditorField):

JS error /_addons/1896168623/web/collapsible.js:108 Uncaught (in promise) ReferenceError: forEditorField is not defined
JS error /_addons/1896168623/web/collapsible.js:32 Uncaught ReferenceError: getEditorField is not defined
JS error /_addons/1896168623/web/collapsible.js:108 Uncaught (in promise) ReferenceError: forEditorField is not defined
JS error /_addons/1896168623/web/collapsible.js:32 Uncaught ReferenceError: getEditorField is not defined
JS error /_addons/1896168623/web/collapsible.js:32 Uncaught ReferenceError: getEditorField is not defined
JS error /_addons/1896168623/web/collapsible.js:32 Uncaught ReferenceError: getEditorField is not defined
JS error /_addons/1896168623/web/collapsible.js:32 Uncaught ReferenceError: getEditorField is not defined
JS error /_addons/1896168623/web/collapsible.js:32 Uncaught ReferenceError: getEditorField is not defined
JS error /_addons/1896168623/web/collapsible.js:32 Uncaught ReferenceError: getEditorField is not defined
JS error /_addons/1896168623/web/collapsible.js:57 Uncaught ReferenceError: getCurrentField is not defined
JS error /_addons/1896168623/web/collapsible.js:57 Uncaught ReferenceError: getCurrentField is not defined
JS error /_addons/1896168623/web/collapsible.js:57 Uncaught ReferenceError: getCurrentField is not defined
JS error /_addons/1896168623/web/collapsible.js:32 Uncaught ReferenceError: getEditorField is not defined