Ajatt-Tools / Japanese

🍚 Automatically generate furigana and other data on Anki cards.
https://ankiweb.net/shared/info/1344485230
GNU Affero General Public License v3.0
34 stars 7 forks source link

Undo button doesn't undo #7

Closed kanjieater closed 5 months ago

kanjieater commented 9 months ago

In the browser, if you use the 再 or 振 hotkeys it and then hit the undo it will not undo. This can result in lost data or manual corrections to long definitions of words.

The request would be to use the standard undo mechanism used in anki and other add-ons to put things back to the state before one of these buttons was pressed.

Don't forget to provide:

1) OS name win 2) OS version 11 3) Anki version image

4) Logs 5) Screenshots, if applicable

tatsumoto-ren commented 9 months ago

undo mechanism used in other add-ons

Would be helpful if you posted some code examples of that.

kanjieater commented 9 months ago

It's been a while since I had to update any of my add-ons so I may be out of date on the lastest and greatest ways (as I primarily write them without GUI's and have them rely on configuration files). But last I checked it seems like using the mw.checkpoint is what sets up the current state to be a recoverable snapshot, that is registered into the standard undo flow.

image

Here's one such example, and i'm sure there's more in this repo https://github.com/glutanimate/anki-addons-misc/blob/7b981836e0a6637a1853f3e8d73d022ab95fed31/src/browser_replace_tag/browser_replace_tag.py#L49

tatsumoto-ren commented 9 months ago

Thanks, I'm gonna study the example and come back.

tatsumoto-ren commented 5 months ago

I believe we fixed this back in march.