aidam38 / roamsr

Spaced Repetition in Roam Research
https://roamresearch.com/#/app/roam-depot-developers/page/uQSCwVKx0
98 stars 18 forks source link

Hook customizable functions to showing card and showing answer #24

Open hungriesthippo opened 3 years ago

hungriesthippo commented 3 years ago

simple first pass for #17 see my comment there for an example custom function

aidam38 commented 3 years ago

Hey, looks good, though I'm considering a bigger refactor enabling multiple "layers" of button, which should be more agnostic to what the UI is actually trying to done. Like instead of a fixed "question-answer" paradigm, it would be "layer1->layer2->layer3->..."

Not sure if shouldn't just go through your suggestion right now instead, and keep this idea for a next big release (that would probably be called roam/loop because it'd more general).

Can you maybe give an example of something that an onShowAnswer would allow you?

hungriesthippo commented 3 years ago

I had a very hacky image occlusion (onShowCard: add rectangle at coords, onShowAnswer: remove it), but your version of that is better. Another example is playing a sound for a foreign language word.

hungriesthippo commented 3 years ago

My strongest argument for doing something like this is that it's a way to appease people who have "card type" ideas that may or may not be worth complicating the code. With this you can just say to go try it and wait to see whether it's worth putting in the core code. (Of course it doesn't cover a variety of uses that e.g. involve changing how history is used, but it seems like that philosophical argument needs to be broached.)