all of a sudden image occlusion stopped working in my anki. right now have the most up to date version, mac OS. I used to be able to drag and drop images into a card to make image occlusion cards which no longer works. If I copy and image and paste from clipboard, a picture of a JPEG/PNG file shows up and not there actual image. I’ve tried resetting all setting to default, trying the new beta version, downgrading and running the program with clicking shift all to no avail. If anyone could help I would appreciate you greatly!!
Could you provide your debug info, that can be found in About Anki > Copy debug info
Are you use Anki’s built-in Image Occlusion? Or the “Image Occlusion Enhanced” add-on?
built-in occlusion
Are you sure you used to be able to drag-and-drop images into the IO editor? It’s possible my memory is just failing me, but I don’t remember other options besides paste-from-clipboard and select. Or perhaps it was MacOS only, because I am on Windows?
By that do you mean a small icon, like a broken image?
[In Windows it looks like .]
yes 100%, I was able to drag whatever photo I had click image occlusion card and make the card. Even then, without draggingt the image I am still unable to paste from my clipboard
Anki 24.11 (87ccd24e) (ao)
Python 3.9.18 Qt 6.6.2 PyQt 6.6.1
Platform: macOS-15.2-arm64-arm-64bit
===Add-ons (active)===
(add-on provided name [Add-on folder, installed at, version, is config changed])
Anki Remote - Customize [‘693153301’, 2024-11-03T14:22, ‘None’, ‘’]
Automatic Basic to Cloze Updated [‘800723229’, 2022-11-15T07:37, ‘None’, ‘’]
Button Colours Good Again [‘2494384865’, 2022-09-27T05:18, ‘None’, ‘’]
Colorful Tags Hierarchical Tags [‘594329229’, 2022-09-15T10:06, ‘None’, ‘’]
Image Occlusion Enhanced [‘1374772155’, 2022-04-09T02:15, ‘None’, ‘’]
Mnemonic Generator [‘194234494’, 2024-09-13T15:31, ‘None’, ‘’]
Suspend Cards by Tags [‘342205704’, 2024-05-24T20:15, ‘None’, ‘’]
===IDs of active AnkiWeb add-ons===
1374772155 194234494 2494384865 342205704 594329229 693153301 800723229
===Add-ons (inactive)===
(add-on provided name [Add-on folder, installed at, version, is config changed])
Not sure how you were able to drag and drop on MacOS (15.2), tried Using 24.11, 24.06, 24.04.1, 23.12, 23.10.1 Qt 6
Could be an upgrade that broke drag and drop on macos side, in macos 15, showed one change regarding drag and drop
Fixed: Drag now supports file promises. Dragged items can be successfully dropped on a Finder window. (98710028) (FB11275037)
macOS Sequoia 15 Release Notes | Apple Developer Documentation
I see, thank you for that information. I still don’t know how to fix the issue with pasting from clipboard not working as well as the image showing up as a jpeg icon rather than the actual pIcture icon if you have any suggestions about this
Try restoring the media files from an backup and putting on the media folder
There is this issue about drag and drop, but its caused by the new iOS update on AnkiMobile, could be that macos implemented the same code as well?
Media files are not included in automatic backups.
A few more things to try –
- Have you restarted in safe mode to make sure none of your other add-ons are interfering? [see #2 in the Troubleshooting Checklist above]
- Have you run Check Database?
- Have you run Check Media? [Because you are having media issues, if you “delete unused media” – don’t delete it further than the media trash until you are confident those files aren’t needed.]
- Are you sure that what you’re pasting is an actual image from your copy-buffer, as opposed to the file representation of an image? What about a screenshot (which is the easiest way to get an actual image into your copy-buffer)? When you paste a screenshot what happens?
- Have you tried refreshing your note type? You can create a new version of the default IO note type – Manage Note Types > Add > “Add: Image Occlusion” – and see if that reacts like you expect.
- Are you sure that other apps on your system aren’t interfering – like a clipboard manager that may have changed settings?
I don’t know if it’s related to the OP’s problem, but recently I haven’t been able to add any content to any field by dragging and dropping onto it; when I try to do that the following message is printed in the terminal: JS error /_anki/js/editor.js:668 Uncaught TypeError: Cannot read properties of undefined (reading 'shadowRoot')
. I’ve just tried and the same message appears when I try to drag and drop onto a new Image Occlusion note in the Add note window.
@dae In the sources tab of the DevTools, I can see that line 668 is included in this function:
function Wt(je, dt) {
let Jt = document.elementsFromPoint(je, dt)[0];
return Jt.shadowRoot ? (Jt.shadowRoot.lastElementChild.focus(), !0) : !1
}
so the culprit seems to be anki/ts/editor/NoteEditor.svelte at 64ca90934bc26ddf7125913abc9dd9de8cb30c2b · ankitects/anki · GitHub, where first
is (at least sometimes) undefined
.
I’m on Ubuntu 24.10, and this behaviour occurs both in Anki 24.11 and in the 25.01beta1
Can you clarify what you mean by “any field”? Drag/dropping and copy/pasting both work for me on 24.11 and 25.01beta1, even with the misc. IO fields (header etc.)
Adding IO note images via dragging/dropping isn’t supported, for now at least. Trying it nets you the message you got
The error message appears whenever I try to drag and drop onto any field of a note of any note type. I’ve already ruled out add-ons.
I’m on debian linux (oldstable) with 24.11 and cannot reproduce this issue. I can drag and drop images into any field and there’s no error, warning, ect. if I do so ( and the picture gets included into the field just fine).
Thanks, I’ve logged this on Drag & drop broken on Linux · Issue #3767 · ankitects/anki · GitHub
@dae The problem apparently originates from the call to mapFromGlobal at line 1555: https://github.com/ankitects/anki/blob/main/qt/aqt/editor.py#L1555. Changing that to something like:
evt_pos = evt.position()
cursor_pos = QPoint(int(evt_pos.x()), int(evt_pos.y()))
seems to fix the problem
I can confirm evt.position() returns the same coordinates on Windows, so should be safe to use.
Maybe the issue with QCursor.pos() is related to multiple screens? QCursor Class | Qt GUI 6.8.1
The doc you posted says:
Returns the position of the cursor (hot spot) of the primary screen
I have two monitors and cannot reproduce the issue on any of them.
Here’s what I did:
- Drag and drop a local picture from
eog
,nautilus
,firefox
into the field of one of my cards.
I cannot reproduce this with .jpg
, .jpeg
, .png
, .mp3
, .webp
, .avif
.
Am I doing something different here or is the architecture actually relevant here? E.g. dae said this on github:
Was able to reproduce this on Qt 6.8 on an ARM Linux system;
I’m on debian oldstable, amd64.
I don’t think the architecture is relevant, as I have this problem on an amd64 machine.