Closed musse closed 2 years ago
Thanks for the report. The plugin doesn't work for Anki 2.1.44 and later due to changes made to the editor. I haven't worked out the necessary changes to fix this. Sorry but for now you'll have to edit the ((c1::blah))
-like markup manually until I fix it, or use an earlier version of Anki.
Sure, no problem. I have investigated a bit on my side, let me add the information here in case it's useful.
AFAIU, a good chunk of the cloze editing logic was moved to the Svelte side of Anki.
The Editor._onCloze()
method that the add-on monkey-patches is now deprecated and doesn't seem to be called anymore.
Maybe adding a new button using the setupEditorButtons
hook and using a different keyboard shortcut would be easier than overriding Anki's cloze button. I've given it a try and the onCloze
method from this add-on still seems to be working.
addHook("setupEditorButtons", addMyButton)
def addMyButton(buttons, editor: Editor):
editor._links['clozeAnything'] = onCloze
return buttons + [editor._addButton(
"iconname", # "/full/path/to/icon.png",
"clozeAnything", # link name
"tooltip")]
Thanks for your investigation! I was also thinking it would probably be easier to just add a new button and keyboard shortcut considering the changes that were made to Anki. I'll try this out and hopefully get the plugin updated soon.
I got it working! I've released the new version, so you can update the plugin and try it. Please let me know if this is working for you now. I had to change the shortcut to Ctrl+Shift+W unfortunately.
Here's how I fixed it: https://github.com/matthayes/anki_cloze_anything/commit/8ea67d7f033242795ba42706b9006a8a6c70f669
This fix ended up being a bit involved. There were some tricky issues to work out, which I've explained in the code comments.
Note that I tested on the Anki beta for 2.1.50 and the plugin is only partially working. I opened an issue to track it: https://github.com/matthayes/anki_cloze_anything/issues/23
FYI there's a PR to fix the issue in 2.1.50.
I'm running Anki
2.1.49
on MacOS. I've downloaded the shared deck and it is working fine. However, the add-on doesn't seem to be working. I don't see the[...]
button when creating a note (see screenshot below). The keyboard shortcut (cmd+shift+c on MacOS) that works for Anki's native Cloze note doesn't work for Cloze Anything notes either. The shared deck is useful, but without the add-on, it is a bit hard to add new notes.