Re-write suggestions

This commit is contained in:
Jon Staab
2025-02-04 19:00:48 -08:00
parent e53d2eb8da
commit d4df23545d
21 changed files with 941 additions and 9 deletions
+1 -2
View File
@@ -10,9 +10,8 @@
import WotScore from "@lib/components/WotScore.svelte"
import ProfileCircle from "@app/components/ProfileCircle.svelte"
const {value} = $props()
const {pubkey} = $props()
const pubkey = value
const profileDisplay = deriveProfileDisplay(pubkey)
const handle = deriveHandleForPubkey(pubkey)
const score = deriveUserWotScore(pubkey)
+11 -4
View File
@@ -1,11 +1,12 @@
import {asClassComponent} from "svelte/legacy"
import {mount} from "svelte"
import type {Writable} from "svelte/store"
import {derived} from "svelte/store"
import {get} from "svelte/store"
import {Editor, SvelteNodeViewRenderer} from "svelte-tiptap"
import {ctx} from "@welshman/lib"
import type {StampedEvent} from "@welshman/util"
import {signer, profileSearch} from "@welshman/app"
import {MentionSuggestion, WelshmanExtension} from "@welshman/editor"
import {MentionSuggestion, WelshmanExtension} from "@lib/editor"
import {getSetting, userSettingValues} from "@app/state"
import ProfileSuggestion from "./ProfileSuggestion.svelte"
import EditMention from "./EditMention.svelte"
@@ -82,9 +83,15 @@ export const makeEditor = ({
return [
MentionSuggestion({
editor: (this as any).editor,
search: derived(profileSearch, s => s.searchValues),
search: (term: string) => get(profileSearch).searchValues(term),
getRelays: (pubkey: string) => ctx.app.router.FromPubkeys([pubkey]).getUrls(),
component: asClassComponent(ProfileSuggestion),
createSuggestion: (pubkey: string) => {
const target = document.createElement("div")
mount(ProfileSuggestion, {target, props: {pubkey}})
return target
},
}),
]
},