# Drag’n’drop is not working within the HTML editor

I discover this issue since version 2.1.49.
I’m running Manjaro KDE LTS-Kernel and NVidia proprietary drivers. I tried OpenGL as well as Software driver, but no difference on my problem.

I was used to add my Kanji pictures from an online library, just by drag&drop the pic to the correct place within the HTML editor. It automatically replaced the pic with the https: / / path / to / pic.jpg .
Since the new HTML editor is in charge I’m no longer able to drag&drop ANYTHING to the HTML editor. I can’t even click into the editor window to set the cursor’s position - it always jumps to the end of the text.

Using the window switcher ([Alt] + [Tab]) keeps the cursor at least at it’s former set position. But for the pictures I’ve to copy the pic-address directly and then go to the HTML editor and use [Ctrl] + [V] to paste it.
Actually meaning: e.g. a word with two Kanji

• until now:
1. two times [Ctrl] + [V] to paste <img src="" /> two times
2. drag&drop pics from browser (Firefox) to the designated positions between “”
3. redo 2 until all files are done
4. done
• since new version:
1. two times [Ctrl] + [V] to paste <img src="" /> two times
2. right click pic to click “Copy picture address”
3. go to HTML editor
4. <if one forgets to use [Alt] + [Tab] and clicks…> move the cursor using the arrow keys (again, if not already was moved this step is needed anyway)
5. use [Ctrl] + [V] to paste pic’s address
6. repeat from 4 until all files are done
7. done

Maybe you can see: It’s more effort for what was already good… Can I solve this in any way? If not: Please allow drag&drop again!

1 Like

Why don’t you just drag the images directly into your fields, instead of the HTML area? Remote image links are not recommended, as they will break whenever the remote host makes changes to their website.

Thanks. You showed me, I missed the main point in my topic myself.
Should I open a new topic? I can’t change the header…?

I can’t use my mouse cursor to do anything at the HTML editor.

I cannot recreate the bug in 2.1.49. Have you made sure it’s not because of add-ons? Try this link: When problems occur - Frequently Asked Questions

1 Like

Yeah… I’m pretty sure. As long as Anki doesn’t bring any addons by default, I didn’t install any at all.

Could it be any missing library? Or any part of Qt/KDE?

If you’ve installed Anki with pamac, some libraries could indeed be missing or just outdated: Third party Linux packages and source builds are not supported / Anki Ecosystem / Knowledge Base - AnkiMobile/AnkiWeb Support

In that case, follow the instructions here Install & Upgrade - Anki Manual and see if the problem persists.

1 Like

I installed anki (AUR) and anki-official-binary-bundle (AUR), one after one. All the same issues.

The anki package pulls much dependencies, the aobb doesn’t. But both work the very same way. (I didn’t see any difference, also not at my problem. Any further ideas?

https:// aur .archlinux .org/packages/anki
https:// aur .archlinux .org/packages/anki-official-binary-bundle/

I think I wasn’t clear enough: On Linux, you should never install Anki with a package manager. The only reliable way to get the fully working current version is to download Anki from https://apps.ankiweb.net/ and follow these instructions:

Trying the official downloads when you run into trouble is good advice, though by the looks of it PKGBUILD - aur.git - AUR Package Repositories is basically wrapping the official bundle, so one would hope it’d behave the same way. What does the about screen say when you run the bundle version?

1 Like

There are some package managers that keep up with Anki. Besides some that are distro-agnostic (last time I checked, both snap and flatpak had the latest version, or the one just before), NixOS and Arch (AUR) do have the latest version available, although both fetch binaries (it really seems no one around has achieved to package Anki properly…).

I have to admit, I’ve never installed a third-party packaged or binary build.

My warning about those stems from the fact that just over the last week at least three forum topics have emerged that could have been prevented by just installing the official package - and it’s a fairly regular cause for all kinds of issues that cannot be replicated on proper builds.

Yes, I saw that. Maybe it means it would be worth the effort to find out why is it so hard to package Anki, so that packagers could do their work and Linux users never have this kind of issue.

As far as I see the anki (not anki-official-binary-bundle) AUR package is built from source.
https:// aur. archlinux. org /cgit/aur.git/tree/PKGBUILD?h=anki

I think it is even doing better work than I could:
All I know about building packages by source is something like
./configure [options]
make
make install
And installing dependencies, which were complained, of course. But this PKGBUILD is running without any errors - I tried running the ./run script for bazel compiling, but it’s arguing, my bazel is to new. (4.2.2.1 < 4.0.0)
This seems to be “solved” by removing the the .bazelversion file through PKGBUILD. Maybe I will give it a try in a VM.

P.S.: @kleinerpirat: Yes, as far as I understood, is should NOT build it from source… Quite the opposite.

You don’t need to know anything about building if you just follow the installation instructions. It’s literally just unpacking the folder and running a single command. Have you tried that yet?

Sorry for being so annoying about this, but I’d be very interested to know if installing Anki the “canonical” way would have solved the issue.

Building from source yourself shouldn’t pose any issues. The problem are the packaged builds from third parties, which often contain dated libraries or old Anki versions.

Also, would you mind checking your Anki version on that AUR build?

That would be useful info too

The AUR package linked by @DomX builds Anki 2.1.49.

…you said…
I set up a fresh VM with Ubuntu, updated it. Yeah… No “literally unpacking and running” at all! Even if I got some things it complained about solved it kept complaining about any missing python modules or whatever…
Never the less I got it starting - no idea if all dependencies where satisfied properly, the remaining messages are:

dominik@anki-test:~\$ anki
Qt info: Warning: Ignoring XDG_SESSION_TYPE=wayland on Gnome. Use QT_QPA_PLATFORM=wayland to run on Wayland anyway.
mpv not found, reverting to mplayer

All in all: Differences are few: Now I can set the cursor by mouse and make selections by mouse within the HTML editor. But I still can’t drag’n’drop anything from or to the HTML editor. It’s slightly better, than on Manajro, but still no full mouse support for the HTML editor…?

Nice to know, but should be irrelevant regarding this issue.

Would you mind explaining what exactly you did and at which step you had to deviate from given instructions to get Anki working?

If I understood your initial post correctly, you used to drag and drop image URLs into the source of image tags. Is there any reason why you can’t just click in between the quotes and press Ctrl+V?

First run:

linux.tar.bz2
2. untared and sudo ./install.shed it
3. Tried to run and got thins
File "runanki.py", line 4, in <module>
File "aqt/__init__.py", line 437, in run
File "aqt/__init__.py", line 498, in _run
File "aqt/profiles.py", line 127, in setupMeta
File "aqt/profiles.py", line 403, in _loadMeta
resetting corrupt _global
Qt info: Warning: Ignoring XDG_SESSION_TYPE=wayland on Gnome. Use QT_QPA_PLATFORM=wayland to run on Wayland anyway.
Qt info: Could not load the Qt platform plugin "xcb" in "" even though it was found.
Qt fatal: This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.

Available platform plugins are: eglfs, linuxfb, minimal, minimalegl, offscreen, vnc, wayland-egl, wayland, wayland-xcomposite-egl, wayland-xcomposite-glx, webgl, xcb.

Aborted (core dumped)
1. Solved by
sudo apt install xcb libxcb-icccm4 libxcb-image0 libxcb-keysyms1 libxcb-randr0 libxcb-render-util0 python3 python3-pyqt5 libqt5core5a python3-distutils python3-bs4 python3-pyaudio python3-requests python3-send2trash python3-decorator python3-markdown python3-jsonschema python3-distro libjs-jquery libjs-jquery-ui libjs-jquery-flot libjs-mathjax
1. Started Anki
2. Tried to drag’n’drop any content
→ nothing happens when I try to add text via drag’n’drop
→ get following error, when I try to add a remote picture as I do since many years:
Qt warning: Unknown or unsupported skia image format

Addition: This message occurs only once and never again. (At least I was unable to reproduce it.)
But in the end: I can’t add any data (neither pic nor text) by drag’n’drop.

Second run:
https:// github .com/ankitects/anki/blob/main/docs/linux.md → built 2.1.50 (dev)
When I tried drag’n’drop a pic it threw following error, but didn’t add the pic:

JS error /_anki/js/browser_editor.js:75699 Uncaught TypeError: Cannot read property 'shadowRoot' of undefined

Additinally I noticed: Anki is poorly slow in this way of running, and furthermore the whole VM’s GUI became slow while Anki was running this way…

I tought it is relevant - isn’t Ubuntu/Debian Anki’s mainly supported Linux?

You’re right. But this is one of the rare moments, where a drag’n’drop is much faster than right click → copy graphic’ss address → Click into Anki → Ctrl+V
or replace “graphic’s address” with “show graphic” and click / combo to address bar.

Basically: “One click + hold + release” versus multiple clicks, menus and mouse movements.
For only some time work it makes no difference, but on regular work with an huge amount of repetition you will get every additional action very fast.

All in short: Adding sixty cards was regular for me to be done within 60 to 70 minutes. With so much clicks it is down to round about 15 to 20 cards in the SAME TIME of 60 to 70 minutes. And the only thing changed was the HTML editor which now needs much more clicks and keys on the pix.
My vocabulary is increasing, as my Japanese is getting better, especially for Japanese characters. Productivity drop makes it a pain to me.

1 Like

There shouldn’t be any mention of Bazel if you’re using the packaged version and install.sh. Maybe you had other files lying around? If you repeat those steps and get the same errors, what exactly do they say?

Sorry, @dae.
I wrote “First run” from my memory, and was quite far away from the actual issue.

I reworked the part “First run”. (But still having the issue.)