~ knotless Search/
↑↓ move↵ open⇧↵ all results

chadtmiller.com/knotless

git that lives in your Atmosphere account

knotless.dev
1 collaborator

knotless 0.13.0 Latest 2 packages, 1 image

1
10

Mention suggestions match handles from their start

Merged chadtmiller.com asked to merge into main from chadtmiller.com/knotless:web/mention-prefix
web/src/lib/molecules/MarkdownField.svelte+9−4
@@ -20,7 +20,7 @@
* A picture pasted or dropped in, with a `repo`, is uploaded and linked
* where it went, and its blob added to `images`, to attach. Typing `@`
* suggests whom to mention: those in the thread, then whom the viewer
* follows, then the owners whose handles match.
* follows, then the owners, each whose handle starts with what follows it.
*/
let {
value = $bindable(''),
@@ -124,11 +124,16 @@
: null
]);
if (signal.aborted) return;
const near = [...people, ...followed].filter((a) => a.handle.toLowerCase().includes(q));
const all = [...near, ...(owners?.owners ?? []).map((o) => o.owner)];
const all = [...people, ...followed, ...(owners?.owners ?? []).map((o) => o.owner)];
const seen = new Set<string>(me ? [me] : []);
found = all
.filter((a) => !a.handle.startsWith('did:') && !seen.has(a.did) && !!seen.add(a.did))
.filter(
(a) =>
a.handle.toLowerCase().startsWith(q) &&
!a.handle.startsWith('did:') &&
!seen.has(a.did) &&
!!seen.add(a.did)
)
.slice(0, SUGGESTED);
at = 0;
}, 120);