Closed ahlec closed 1 year ago
Awesome work ! I'll review that as soon as possible !
When I started working on this module, I also had to find a way to support users on newer version with breaking changes while handling users on older versions. These Anki deprecations are really a struggle to deal with.
2.54
but since there is some retro-compatibility checks with ANKI_SEMVER_AS_INT
I assume it should work on older versions. If someone reading this experience some issues, feel free to comment here.Thank you for your great work, I just released the change on the Anki package manager, feel free to check it out !
Hi!
Huge caveat that I'm not a Python developer, and this is my first time working with Anki, so please be welcome to suggest any changes, big or small!
Anki 2.1.50 released further refactors to the editor interface, which broke this plugin (and many others like it). In particular, it appears that
getCurrentField
was removed from the runtime, which mean that trying to find the HTML for the current field was producing an infinite loop (the JS was erroring, and the callback was then called withelements=None
, which would call the JS again).I spent a long time trying to figure out what the new best solution was, but wasn't able to really get a good sense from looking through the Anki PRs what would directly replace the removal of
getCurrentField
. In lieu of that, I opted to use thenote
andcurrentField
fields on theEditor
object. However, these has been around for a couple of years now, so I'm not sure if there's a particular reason not to use them. Any tips here would be appreciated!Additional Changes
Additionally, I made a couple of changes as I was working. If you'd prefer I separate them into other PRs for better tracking/visibility, I'm happy to do so!
Selection
class, I opted to moveSelection
into its own fileisWin
andisMac
were replaced byis_win
andis_mac
_(...)
function is deprecated by Anki and will be removed in a future version. Here too I spent some time trying to figure out how to migrate to their new system, but per Anki's translation documentation for add-ons, it looks like they want us to roll our own rather than use the same system Anki uses<ruby>
tags<b>
tags to produce the聳える[そびえる]
style, it broke down when needing to convert from that style into<ruby>
, meaning I was left with a mix of half-<ruby>
and half-brackets.ReadingNode
class objects, and at the end we join them together and format them into the appropriate string, so that there's no need to parse one style and convert to another.