Image handling issues

I’ve built an addon to fix the image handling. As in being able to cut/paste images and delete them with keys. However, the image handlers won’t go away without "blur"ring the container. Which makes sense when I look at the Svelte. Could you please expose the method “function resetHandle()”? The reason I’m asking is because blur() removes the undo/redo stack.

(Either that or that you add proper image handling :stuck_out_tongue: hahaha)

Could you describe these problems in more detail? Cutting/pasting/deleting images with the keyboard seems to work for me.

CleanShot 2022-11-29 at 21.45.37

Issues this addon solves what imo should be standard in Anki:

  • When clicking on the image while the field isn’t focused (since there is no active caret in that case)
    • Ctrl-A will highlight all of the field’s content and not all of Anki
    • Pressing the arrow keys will place the caret left or right of the image!
  • General fixes
    • Pressing Del or Backspace will delete the image (with undo intact)
    • Ctrl-C and Ctrl-A work without selecting the image with the cursor. So as soon as the image is “active”/shows the handles, it can be cut/copied. This will copy the Image but also HTML. It’s thus not going to insert clones of the same image in the media files (when using the webP addon for instance).

I’m very surprised that this hasn’t been a much bigger concern from the start. Because literally everyone I’ve introduced Anki to, hates the image handling (or will eventually come to hate it). For me in particular, the worst is when I had an image that filled the entire field. There was no way of clearing the field besides double-clicking on the image and clicking next to it + backspace. Or to carefully place the cursor between the margin and the picture. Both of which are tedious when making 250+ cards per day. Hence why it invoked many swear words… However, this is sad, because the image handles/scaling and such are all very nice. It’s literally just what I’ve listed above that ruins it for me.

As I’ve asked for in my previous post, it would be nice for addon devs if you’d expose the svelte way more. And also add more classes and ids to elements in the DOM. It’s truly way more of a pain to develop add-ons than it has to be right now, or so I feel. And the reason I’m asking and not simply doing pull requests here is that I have very little time on my hands right now. But, this summer I’d gladly chip in.

Off topic:

I would also plea once more for the Edit/Cards buttons to be removed from the “Add” window and to only be shown in Browse as I’ve opted for. As with the image editing tweaks, everyone I’ve asked about this prefers the cleaner more editing-centric feeling without that clutter. Instead, I’ve added a pragmatic Browse button below. This way you can very quickly get to Edit/Cards and the current deck in general.

1 Like

As long as we’re missing our high-calibre web developer Henrik, this needs to wait sadly. Or maybe someone else can fill the void - not me, that’s for sure.

I’m a med student with UI/UX interests and sadly my time for working on Anki is sparse during the semester (as you can see on the current beta phase dragging on forever due to my exams getting in the way).


Don’t we all! Those fixes sound good, so I look forward to your future PRs.

I’m afraid that’s more controversial. Some people use the Cards… button to preview things like audio or LaTeX, and removing the buttons adds an extra step for any user who is adding cards or editing the current one and who wants to make a tweak to their notetype.

All your contributions are much appreciated Matthias, and of course your studies should take priority.