Greasy Fork is available in English.

[Deprecated] 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).

Autor
Salvatos
Instalações hoje
0
Total de instalações
6
Avaliações
0 0 0
Versão
1.1
Criado
16/05/2022
Atualizado
28/06/2023
Licença
MIT
Aplicável a

This script is no longer maintained since a similar feature has now been implemented directly in Kanka. I recommend removing it from your active scripts.

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 also 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:

Known Issues

If you copy-paste an entry from Summernote’s visual editor while this script is active, and some of the mentions have replacement text that includes spaces (e.g. [character:12345|this could be problematic]), those mentions in the new entry will sometimes be broken and will show the mention code instead of a link. That happens because Summernote introduces line breaks in long lines of text when pasted in (only visible in code view), and considers the spaces in mention replacement text to be valid places to do so—however that prevents the mentions from being properly interpreted by Kanka.

This can be solved simply by switching to code view before saving if you also use my Summernote HTML Beautifier plugin; otherwise, you will need to look for those mentions in the code editor and manually remove the line breaks. Example:

[character:12345|this
is problematic]
[character:12345|this is okay]


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