Advanced Mention Name Reminder

Shows the title of each advanced mention’s target entity in Summernote, next to the entity ID (or in a tooltip on hover).

As of 2022-05-23. See the latest version.

Author
Salvatos
Ratings
0 0 0
Version
1.1
Created
2022-05-16
Updated
2022-05-23
Size
3.03 KB
License
MIT
Applies to

This Kanka script adds a small reminder of the targeted entity’s name to all advanced mentions in Summernote’s visual editor. This way, you don’t have to go back and view the entity to figure out what each mention points to. This script runs only once when the editor is loaded, so changes will not be reflected and new mentions won’t get a tooltip immediately. If there is demand, I may add a toolbar button to regenerate the tooltips during an editing session.

Note that this feature does not "work" in the code view as that editor contains only plain text and a tooltip cannot be attached to an arbitrary part of the text; however, you will see a dfn tag around your mentions’s entity type and ID, like so:

[<dfn entity-id="494047" title="Ragnar Lokra">character:494047</dfn>|Alternate Text]

You can therefore refer to the title attribute to find the target entity’s name. (Since <dfn> is not whitelisted on Kanka, those tags will not be saved when the form is submitted and you don’t have to worry about it affecting your mentions.)

If you wish to style the mentions differently, you can use the following CSS selector:

.note-editable dfn {}

Alternatively, you can uncomment the last part of the CSS at the end of the script, where it says Uncomment this to show only a tooltip, and no superscript, to do exactly that :) By default, this replacement rule will underline the hoverable part of the mention instead to remind you that a tooltip is available.


If my scripts are making your life easier, feel free to tip me via Ko-fi (no account needed):

Support me on Ko-fi.com