I’m having issues with copying and pasting in the editor. If I copy text from a field to translate it in another app, then copy the translated text to paste it in Anki, Anki always paste the first text. I have to paste another time to get the new text. However, if I inspect what’s in my clipboard or try to paste into another app, I always get the most recently copied text.
Steps to reproduce:
- Copy text (a) from field in Anki.
- Copy another text (b) from another app.
- Paste text in Anki (this renders text a)
- Paste text in Anki again (this renders text b).
I’m using Anki 23.10 on MacOS Sonoma.
I can’t seem to reproduce this, when I paste into the notes app then copy something else from it. Are you using any third-party tools like a clipboard manager?
I’m using Raycast, which can manage the contents of the clipboard. I don’t have this issue with any other applications, though. When I contacted them, they said they hadn’t gotten any other reports of similar problems.
If you turn Raycast off, does the problem go away?
Yes, that worked. Does that mean the problem is with Anki or with Raycast? I don’t face the same issue with any other combinations.
Do you have some other Anki addons? There are a few of them that write to the clipboard, like Quick Clipboard Copy.
For completeness, you should see if it still happens when you temporarily disable these add-ons with Tools → Add-ons → (click on an add-on line to select it) → Toggle Enabled
I think you have to restart Anki for the change to take effect.
It seems unlikely that the add-ons could be the cause of such problems, but it also seems unlikely that Anki itself could be the cause, so it’s worth testing this.
Disabling the addons and restaring didn’t help. Here’s a short recording for demonstration purposes:
I also noticed that if I close the edit window, open it up again, and then paste, the behavior is normal (it pastes the most recently copied content).
I can’t think of anything else, sorry. Does the author of Raycast have any insights?
Raycast seems great, which extension is the green one to test with anki?
The extensions have source code as well, so we can see what is causing the issue and fix here or in the extension itself
Would be possible to create anki extension in raycast?
Regrettably, nothing yet.
It’s the built-in Floating Notes. I only used it for demonstration purposes. It doesn’t matter where I copy from (Word, Chrome, Notes…), the issue remains.
What use case are you considering for an Anki extension in Raycast?
Can replicate the problem here
Using Obsidian and Notion extension as reference
*Because there is a toggle for Notes and Cards, we could use search to use whatever the current toggle is, if it is toggled Notes, it will search Notes, else, Cards
**Don’t seem like there is arguments support for commands, but didn’t read docs yet, the arguments work similarly to what discord does, example: Remind me
the input: remind me to buy groceries, 5d (the argument separator could be comma, dash -…)
This is just a brainstorm for commands
haha. It will be figured out somehow.
Yeah, it could maybe come in handy. Right now, I just want the copy-paste behavior to be normal, though
Anki relies on clipboard change events to detect when something has been copied outside of it, and it seems that the change event is not being fired in this case. I don’t know whether it’s an issue with Raycast, or the toolkit Anki is built on. Since this is the first report of such an issue, I’m afraid it will be hard to justify spending time on trying to find a workaround for this in the near future.
Thought had posted, sorry for the delay
Asked for help in raycast’s Slack
Using Pasteboard Viewer on the Mac App Store couldn’t see anything wrong in raycast
Could replicate in Qt5 and Qt6
May we add an issue in GitHub about it @dae ? In case others users find themselves in a similar situation, although the dev from raycast couldn’t replicate the issue in his mac
If you wish, though given nobody else has reported being affected by this yet, I’m not sure how much help it will be.
Issue created Raycast copy and paste problem · Issue #2843 · ankitects/anki · GitHub
@herrsilen Managed to find a workaround, thanks to the friendly folks in raycast’s Slack, which was to switch application before pasting to anki
- Copy text (a) from field in Anki.
- Copy another text (b) from floating notes.
- Switch to another app (browser, notes…*)
- Paste text in Anki (this renders text b)
*as long the name of the app switches from anki (top left)
in this context I’m not considering floating notes as an app because the top left still remains as Anki
Anki is not recognizing changes because it is not changing apps and remains Anki even after pressing in floating notes.
That indeed works!
Using floating notes was just a way for me to demonstrate the issue, though. What I’m actually doing is selecting text in Anki, pressing a shortcut to translate it into English, and then pasting the result in the next field. So switching applications is about as much of a bump in the workflow as pasting, removing, and pasting again.