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
27
pulls
pipelines
properly handle text-align-justify in publications
awarm.space
4 months ago
9cbfce8d
524bab27
+22
-2
6 changed files
expand all
collapse all
unified
split
actions
publishToPublication.ts
lexicons
api
index.ts
lexicons.ts
types
pub
leaflet
pages
linearDocument.ts
pub
leaflet
pages
linearDocument.json
src
pages
LinearDocument.ts
+12
-2
actions/publishToPublication.ts
···
195
let alignmentValue =
196
scan.eav(blockOrList.block.value, "block/text-alignment")[0]?.data
197
.value || "left";
198
-
let alignment =
0
0
199
alignmentValue === "center"
200
? "lex:pub.leaflet.pages.linearDocument#textAlignCenter"
201
: alignmentValue === "right"
202
? "lex:pub.leaflet.pages.linearDocument#textAlignRight"
203
-
: undefined;
0
0
204
let b = await blockToRecord(blockOrList.block, did);
205
if (!b) return [];
206
let block: PubLeafletPagesLinearDocument.Block = {
···
547
}
548
return [];
549
}
0
0
0
0
0
0
···
195
let alignmentValue =
196
scan.eav(blockOrList.block.value, "block/text-alignment")[0]?.data
197
.value || "left";
198
+
let alignment: ExcludeString<
199
+
PubLeafletPagesLinearDocument.Block["alignment"]
200
+
> =
201
alignmentValue === "center"
202
? "lex:pub.leaflet.pages.linearDocument#textAlignCenter"
203
: alignmentValue === "right"
204
? "lex:pub.leaflet.pages.linearDocument#textAlignRight"
205
+
: alignmentValue === "justify"
206
+
? "lex:pub.leaflet.pages.linearDocument#textAlignJustify"
207
+
: undefined;
208
let b = await blockToRecord(blockOrList.block, did);
209
if (!b) return [];
210
let block: PubLeafletPagesLinearDocument.Block = {
···
551
}
552
return [];
553
}
554
+
555
+
type ExcludeString<T> = T extends string
556
+
? string extends T
557
+
? never
558
+
: T /* maybe literal, not the whole `string` */
559
+
: T; /* not a string */
+2
lexicons/api/index.ts
···
96
'pub.leaflet.pages.linearDocument#textAlignCenter',
97
LinearDocumentTextAlignRight:
98
'pub.leaflet.pages.linearDocument#textAlignRight',
0
0
99
}
100
101
export class AtpBaseClient extends XrpcClient {
···
96
'pub.leaflet.pages.linearDocument#textAlignCenter',
97
LinearDocumentTextAlignRight:
98
'pub.leaflet.pages.linearDocument#textAlignRight',
99
+
LinearDocumentTextAlignJustify:
100
+
'pub.leaflet.pages.linearDocument#textAlignJustify',
101
}
102
103
export class AtpBaseClient extends XrpcClient {
+3
lexicons/api/lexicons.ts
···
1615
textAlignRight: {
1616
type: 'token',
1617
},
0
0
0
1618
quote: {
1619
type: 'object',
1620
required: ['start', 'end'],
···
1615
textAlignRight: {
1616
type: 'token',
1617
},
1618
+
textAlignJustify: {
1619
+
type: 'token',
1620
+
},
1621
quote: {
1622
type: 'object',
1623
required: ['start', 'end'],
+1
lexicons/api/types/pub/leaflet/pages/linearDocument.ts
···
81
export const TEXTALIGNLEFT = `${id}#textAlignLeft`
82
export const TEXTALIGNCENTER = `${id}#textAlignCenter`
83
export const TEXTALIGNRIGHT = `${id}#textAlignRight`
0
84
85
export interface Quote {
86
$type?: 'pub.leaflet.pages.linearDocument#quote'
···
81
export const TEXTALIGNLEFT = `${id}#textAlignLeft`
82
export const TEXTALIGNCENTER = `${id}#textAlignCenter`
83
export const TEXTALIGNRIGHT = `${id}#textAlignRight`
84
+
export const TEXTALIGNJUSTIFY = `${id}#textAlignJustify`
85
86
export interface Quote {
87
$type?: 'pub.leaflet.pages.linearDocument#quote'
+3
lexicons/pub/leaflet/pages/linearDocument.json
···
64
"textAlignRight": {
65
"type": "token"
66
},
0
0
0
67
"quote": {
68
"type": "object",
69
"required": [
···
64
"textAlignRight": {
65
"type": "token"
66
},
67
+
"textAlignJustify": {
68
+
"type": "token"
69
+
},
70
"quote": {
71
"type": "object",
72
"required": [
+1
lexicons/src/pages/LinearDocument.ts
···
32
textAlignLeft: { type: "token" },
33
textAlignCenter: { type: "token" },
34
textAlignRight: { type: "token" },
0
35
quote: {
36
type: "object",
37
required: ["start", "end"],
···
32
textAlignLeft: { type: "token" },
33
textAlignCenter: { type: "token" },
34
textAlignRight: { type: "token" },
35
+
textAlignJustify: { type: "token" },
36
quote: {
37
type: "object",
38
required: ["start", "end"],