Tippy Tooltips [Official Support]

Thanks guys, I didn’t get around to it yet, but an update will be coming soon.

2 Likes

What do I need to change to prevent a newly added entry’s text color from changing to black if it already has a different color applied? This is very frustrating. I use color for key concepts, and this addon keeps deleting them when I add the tooltip function, where needed, on my notes.

Furthermore, as a bug report:
Sometimes when canceling (aka, removing) a Tippy tooltip from a word, the text “&-nbsp;” appears after the word, and it’s unregistered as an official action, and thus is unaffected by the undo command. This forces the user to have to manually select and delete it himself.

1 Like

This is one of my most used add-ons, and having the keyboard shortcut functional is very significant for me. For some strange reason, about 4 or so of the addons I utilize make use of Control+T (very, very irritating, and they don’t allow you to change it). I’m combing over editor.js, which is where the shortcut mapping lies. Can you be so kind as to direct me to the snippet of code that allows me to change this, at least until you push an update?

Thanks!

Pop up not working in newer versions

Problem

The pop up isn’t appearing in newer Anki versions.
The latest version where the pop up works is 2.1.54.
(2.1.55 and 2.1.56 aren’t working)

Notes

The HTML tag still gets added. So only opening the pop up isn’t working.

Images in Tippy Tooltip for mobile

General

Generally it is possible to add images into the tippy tooltip:
I can just paste it into the tippy tooltip.

Generated HTML

<a data-tippy-content="<img src=&quot;image_name.png&quot;>" aria-expanded="false">
    Tippy Tooltip Text
</a>

Problem

The image isn’t shown on mobile. (Desktop and Web works fine)

Solution

When replacing the &quot; with an ', the image is shown an desktop, web and mobile.

Suggestion

When pasting an image into a tippy tooltip, use the ' symbol.

Hey guys, I’m sorry to keep you waiting this long for an update.

I know how frustrating it is when an add-on your workflow depends upon is holding you back from moving to a newer Anki version.

The reason I can’t simply push a quick fix is that I started a major rework of the repository and build scripts right before work on Anki 2.1.55 and university took all my time. I need at least a day to sort everything out and I’m unable to spend that time on anything other than my studies currently.

Next week the semester is over. Then I’ll start processing all the backlog that’s accumulated in various areas of my life. I need to go by priority, and there are several duties that take precedence over my add-on work (and Anki in general).

1 Like

Tippy tooltip is the most important addon.
So we should rather thank you.

Just take your time, being on the newest anki version isn’t important.
Until then, Anki 2.1.54 works perfectly.

1 Like

Thanks for your patience, guys!

I’ve just updated the add-on. The main branch is now compatible with Anki 2.1.50 to 2.1.57+ and will likely remain stable for the next year or so. Most changes happened under the hood, so you won’t notice much of a difference to former versions.

@Secret_Squirrel_44 I added a config to set a custom shortcut. Let me know if you run into any issues.

I’ll open-source the repository in a few days, so hopefully it can serve as a prototype for simple editor add-ons.

1 Like

I noticed that the 1.2.0 version you just updated seems to automatically ignore all strings pasted in from the clipboard.Please check the code in html format. I hope there is a quick fix for this.

The source code is now publicly available: GitHub - kleinerpirat/anki-tooltips: Add tooltips to your Anki cards with Tippy.js

I pushed version 2.0. to AnkiWeb and renamed the add-on to “Anki Tooltips”. The update from last week was a tiny bugfix compared to this one. I moved the tooltip editing entirely to Svelte and added lots of new features. I will properly explain them in the coming days. Let me know if you run into any issues.

The tooltip editor is now located inside <anki-editable>. This means you should be able to use almost any formatting feature you want, including pasted content such as images or formatted text.

Then I get a error information like follow when I click the Browser:

Anki 2.1.57 (6b7d372c) Python 3.9.15 Qt 6.4.2 PyQt 6.4.0
Platform: Windows-10-10.0.22621
Flags: frz=True ao=True sv=2
Add-ons, last update check: 2023-02-17 10:49:53

Caught exception:
Traceback (most recent call last):
  File "aqt.webview", line 43, in cmd
  File "aqt.webview", line 150, in _onCmd
  File "aqt.webview", line 620, in _onBridgeCmd
  File "aqt.toolbar", line 411, in _linkHandler
  File "aqt.toolbar", line 429, in _browseLinkHandler
  File "aqt.main", line 1202, in onBrowse
  File "aqt", line 131, in open
  File "aqt.browser.browser", line 139, in __init__
  File "aqt.browser.browser", line 523, in setupEditor
  File "aqt.editor", line 131, in __init__
  File "_aqt.hooks", line 2075, in __call__
  File "C:\Users\zyd19\AppData\Roaming\Anki2\addons21\1840818335\qt\editor.py", line 27, in on_editor_did_init
    QShortcut(  # type: ignore
NameError: name 'QShortcut' is not defined

I have to delete :

def on_editor_did_init(editor: Editor) -> str:
    """
    Override default editor shortcut
    """

    QShortcut(  # type: ignore
        QKeySequence(tooltip_shortcut.value),
        self.widget,
        activated=suppress,
    )

and

editor_did_init.append(on_editor_did_init)

in the file "addons21/1840818335/qt/editor.py", then it is normal now. (I hardly ever use shortcuts

And there is currently a bug that will not appear before, I click the tip text the editor box will not pop when I in anki’s editor:
<a data-tippy-content="test content"><font color="#ff00ff">tip text</font></a>
I have to delete the <font> tag into:
<a data-tippy-content="test content">tip text</a>
But it was always okay before this version

Thanks for notifying me. The error you mentioned above caused the add-on to stop completely. So the hotfix I just pushed should fix the second issue too. Let me know if you still have trouble after updating.

This bug is disappear indeed. But as my testing, this bug is still. It doesn’t seem to have that pop-up edit box still

Which Anki version are you on?

Version ⁨2.1.57 (6b7d372c)⁩

Except the configuration menu, there is no interface element in Anki Tooltips 2.0.2 (Anki 2.1.58) that is shown or can be triggered to be shown. Should there be an icon? Should there be a contextual menu entry when acting on selected text?

1 Like

Is this icon missing on your end?

image

Yes, it is missing.

Curious. I am on the most recent dev branch on Linux and it shows up for me. Maybe a difference between operating systems causes this. Interference with other add-ons is ruled out, I suppose?

I reckon tooltip insertion via shortcut doesn’t work either? It’s handled by the button component.