Extended html editor for fields and card templates (with some versioning) [Official Support Thread]

If you have a problem with the add-on extended html editor for fields and card templates (with some versioning) post in this thread. This way I get notified. If you make a new thread I will likely miss it.

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, repeat 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-ons section of our support site.
Debug info:
Anki 2.1.54 (b6a7760c) Python 3.9.7 Qt 6.3.1 PyQt 6.3.1
Platform: Mac 12.5.1
Flags: frz=True ao=True sv=2
Add-ons, last update check: 2022-09-04 21:04:35
Add-ons possibly involved: ⁨extended html editor for fields and card templates with some versioning⁩

Caught exception:
Traceback (most recent call last):
File “aqt.webview”, line 568, in handler
File “aqt.editor”, line 561, in
File “/Users/jerylsik/Library/Application Support/Anki2/addons21/1043915942/editor.py”, line 94, in
self.saveNow(lambda s=self: cm_start_dialog_helper(s))
File “/Users/jerylsik/Library/Application Support/Anki2/addons21/1043915942/editor.py”, line 87, in cm_start_dialog_helper
self.original_cm_text = self.note.fields[self.original_current_field]
TypeError: list indices must be integers or slices, not NoneType

Hope you can help me out, so far this add on is really useful! Thank you ijgnd!

thanks for your post.

This error occurred when you tried to start my external editor without having a field focused. I’ve just uploaded a new version that should fix this problem. If you still get errors let me know.

It works beautifully. Thank you again. I am still a student now, but I hope once I start having a job, hope to donate to you!

Do let me know if you have any patreon account or something!

Please update!.

I just updated. let me know if it works

Hi, you wrote in the description: “Note: Anki 2.1.45 (from summer 2021) or later already have the extended html editor “codemirror” built-in.”

By this, are you referring to the HTML editor that is toggled when pressing the <> button?

I need a solution that allows me to add tabs to code snippets that I use for typing practice - but this built-in editor doesn’t provide inputting tabs - was wondering if you were referring to something different.

Also, your add-on has been working fine for me except that typing certain characters leads to warnings and undesirable behavior - I notice this esp. with angle brackets. Then, the auto-indentation and syntax highlighting goes wonky

Was wondering if there is any solution to this problem - Thanks!

yes

instead of looking at addons: if you have a clipboard manager couldn’t you copy a tab into it and then paste it into the built-in anki html editor?

typing certain characters leads to warnings and undesirable behavior - I notice this esp. with angle brackets.

I don’t remember if this is built-in or if i enabled an option for this. you could have a look at the codemirror.html file in my addon folder and see if you can add an option around line 50 (the part that deals with setting up the codemirror instance in my window).

Awesome, thanks for the pointer - that fixed it.