Image support!
Some checks failed
Test / test (push) Failing after 5s
Build and Deploy Nuxt / build (push) Successful in 1m46s

This commit is contained in:
2026-11-20 19:10:28 +01:00
parent d61659cfdd
commit fe662bb351
11 changed files with 119 additions and 21 deletions

View File

@@ -1,5 +1,6 @@
// The rules behind the note editor's wiki-link autocomplete (type `[[` while editing a note and the
// campaign's notes, actors, items and maps are offered to link to). These helpers hold no state,
// campaign's notes, actors, items, maps and uploaded files are offered to link to). These helpers
// hold no state,
// touch no DOM and import nothing, so tests can load them straight from source. Marker.js renders
// `[[target]]` as a link, so the target written here is the entry's label.
@@ -30,10 +31,10 @@ function FindLinkTrigger(text, caret) {
return { start, query };
}
// One `{ id, label, type }` per linkable entry, from the campaign's four lists. Entries without a
// name are left out (they would show as an empty menu row), the rest are sorted by label so the menu
// One `{ id, label, type }` per linkable entry, from the campaign's lists. Entries without a name
// are left out (they would show as an empty menu row), the rest are sorted by label so the menu
// reads alphabetically whatever order the API answered with.
function BuildLinkSuggestions({ notes, actors, items, maps } = {}) {
function BuildLinkSuggestions({ notes, actors, items, maps, media } = {}) {
const suggestions = [];
const seen = new Set();
@@ -52,6 +53,7 @@ function BuildLinkSuggestions({ notes, actors, items, maps } = {}) {
push('actor', actors, (actor) => actor.name);
push('item', items, (item) => item.name);
push('map', maps, (map) => map.name);
push('media', media, (file) => file.name);
return suggestions.sort((a, b) => a.label.localeCompare(b.label));
}