Update facet-renderer.ts
This commit is contained in:
@@ -1,9 +1,6 @@
|
|||||||
import * as facetDefs from '../lexicons/app/bsky/richtext/facet.defs'
|
import * as app from '../lexicons/app'
|
||||||
|
|
||||||
type Facet = facetDefs.Main
|
type Facet = app.bsky.richtext.facet.Main
|
||||||
type Link = facetDefs.Link
|
|
||||||
type Mention = facetDefs.Mention
|
|
||||||
type Tag = facetDefs.Tag
|
|
||||||
|
|
||||||
const encoder = new TextEncoder()
|
const encoder = new TextEncoder()
|
||||||
const decoder = new TextDecoder()
|
const decoder = new TextDecoder()
|
||||||
@@ -14,22 +11,16 @@ export class FacetSegment {
|
|||||||
public facet?: Facet,
|
public facet?: Facet,
|
||||||
) {}
|
) {}
|
||||||
|
|
||||||
get link(): Link | undefined {
|
get link() {
|
||||||
return this.facet?.features.find(
|
return this.facet?.features.find(app.bsky.richtext.facet.link.$isTypeOf)
|
||||||
f => f.$type === 'app.bsky.richtext.facet#link',
|
|
||||||
) as Link | undefined
|
|
||||||
}
|
}
|
||||||
|
|
||||||
get mention(): Mention | undefined {
|
get mention() {
|
||||||
return this.facet?.features.find(
|
return this.facet?.features.find(app.bsky.richtext.facet.mention.$isTypeOf)
|
||||||
f => f.$type === 'app.bsky.richtext.facet#mention',
|
|
||||||
) as Mention | undefined
|
|
||||||
}
|
}
|
||||||
|
|
||||||
get tag(): Tag | undefined {
|
get tag() {
|
||||||
return this.facet?.features.find(
|
return this.facet?.features.find(app.bsky.richtext.facet.tag.$isTypeOf)
|
||||||
f => f.$type === 'app.bsky.richtext.facet#tag',
|
|
||||||
) as Tag | undefined
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user