tangled
alpha
login
or
join now
leaflet.pub
/
leaflet
289
fork
atom
a tool for shared writing and social publishing
289
fork
atom
overview
issues
29
pulls
pipelines
wip add at-mention
awarm.space
4 months ago
00baa4f3
731d8249
+55
6 changed files
expand all
collapse all
unified
split
actions
publishToPublication.ts
components
Blocks
TextBlock
RenderYJSFragment.tsx
lexicons
api
lexicons.ts
types
pub
leaflet
richtext
facet.ts
pub
leaflet
richtext
facet.json
src
facet.ts
+5
actions/publishToPublication.ts
···
549
549
$type: "pub.leaflet.richtext.facet#didMention",
550
550
did: d.attributes.didMention.did,
551
551
});
552
552
+
if (d.attributes?.atMention)
553
553
+
facet.features.push({
554
554
+
$type: "pub.leaflet.richtext.facet#atMention",
555
555
+
atURI: d.attributes.atMention.atURI,
556
556
+
});
552
557
if (d.attributes?.code)
553
558
facet.features.push({ $type: "pub.leaflet.richtext.facet#code" });
554
559
if (d.attributes?.highlight)
+1
components/Blocks/TextBlock/RenderYJSFragment.tsx
···
104
104
code?: {};
105
105
em?: {};
106
106
didMention?: { did: string };
107
107
+
atMention?: { atURI: string };
107
108
underline?: {};
108
109
strikethrough?: {};
109
110
highlight?: { color: string };
+12
lexicons/api/lexicons.ts
···
1862
1862
refs: [
1863
1863
'lex:pub.leaflet.richtext.facet#link',
1864
1864
'lex:pub.leaflet.richtext.facet#didMention',
1865
1865
+
'lex:pub.leaflet.richtext.facet#atMention',
1865
1866
'lex:pub.leaflet.richtext.facet#code',
1866
1867
'lex:pub.leaflet.richtext.facet#highlight',
1867
1868
'lex:pub.leaflet.richtext.facet#underline',
···
1909
1910
did: {
1910
1911
type: 'string',
1911
1912
format: 'did',
1913
1913
+
},
1914
1914
+
},
1915
1915
+
},
1916
1916
+
atMention: {
1917
1917
+
type: 'object',
1918
1918
+
description: 'Facet feature for mentioning an AT URI.',
1919
1919
+
required: ['atURI'],
1920
1920
+
properties: {
1921
1921
+
atURI: {
1922
1922
+
type: 'string',
1923
1923
+
format: 'uri',
1912
1924
},
1913
1925
},
1914
1926
},
+17
lexicons/api/types/pub/leaflet/richtext/facet.ts
···
21
21
features: (
22
22
| $Typed<Link>
23
23
| $Typed<DidMention>
24
24
+
| $Typed<AtMention>
24
25
| $Typed<Code>
25
26
| $Typed<Highlight>
26
27
| $Typed<Underline>
···
89
90
90
91
export function validateDidMention<V>(v: V) {
91
92
return validate<DidMention & V>(v, id, hashDidMention)
93
93
+
}
94
94
+
95
95
+
/** Facet feature for mentioning an AT URI. */
96
96
+
export interface AtMention {
97
97
+
$type?: 'pub.leaflet.richtext.facet#atMention'
98
98
+
atURI: string
99
99
+
}
100
100
+
101
101
+
const hashAtMention = 'atMention'
102
102
+
103
103
+
export function isAtMention<V>(v: V) {
104
104
+
return is$typed(v, id, hashAtMention)
105
105
+
}
106
106
+
107
107
+
export function validateAtMention<V>(v: V) {
108
108
+
return validate<AtMention & V>(v, id, hashAtMention)
92
109
}
93
110
94
111
/** Facet feature for inline code. */
+14
lexicons/pub/leaflet/richtext/facet.json
···
21
21
"refs": [
22
22
"#link",
23
23
"#didMention",
24
24
+
"#atMention",
24
25
"#code",
25
26
"#highlight",
26
27
"#underline",
···
73
74
"did": {
74
75
"type": "string",
75
76
"format": "did"
77
77
+
}
78
78
+
}
79
79
+
},
80
80
+
"atMention": {
81
81
+
"type": "object",
82
82
+
"description": "Facet feature for mentioning an AT URI.",
83
83
+
"required": [
84
84
+
"atURI"
85
85
+
],
86
86
+
"properties": {
87
87
+
"atURI": {
88
88
+
"type": "string",
89
89
+
"format": "uri"
76
90
}
77
91
}
78
92
},
+6
lexicons/src/facet.ts
···
15
15
required: ["did"],
16
16
properties: { did: { type: "string", format: "did" } },
17
17
},
18
18
+
atMention: {
19
19
+
type: "object",
20
20
+
description: "Facet feature for mentioning an AT URI.",
21
21
+
required: ["atURI"],
22
22
+
properties: { atURI: { type: "string", format: "uri" } },
23
23
+
},
18
24
code: {
19
25
type: "object",
20
26
description: "Facet feature for inline code.",