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
28
pulls
pipelines
fix sorts
awarm.space
3 months ago
94a96af9
5ee7a1ae
+11
-3
1 changed file
expand all
collapse all
unified
split
app
api
rpc
[command]
getFactsFromHomeLeaflets.ts
+11
-3
app/api/rpc/[command]/getFactsFromHomeLeaflets.ts
···
46
return a.data.position.x - b.data.position.x;
47
return a.data.position.y - b.data.position.y;
48
})
49
-
: scan.eav(rootEntity, "card/block").sort((a, b) => a.data.position - b.data.position);
0
0
0
0
50
51
// Map to get type and filter for text/heading
52
let blocks = rawBlocks
53
.map((b) => {
54
let type = scan.eav(b.data.value, "block/type")[0];
55
-
if (!type || (type.data.value !== "text" && type.data.value !== "heading")) return null;
0
0
0
0
56
return b.data;
57
})
58
-
.filter((b) => b !== null);
59
60
let title = blocks[0];
61
···
46
return a.data.position.x - b.data.position.x;
47
return a.data.position.y - b.data.position.y;
48
})
49
+
: scan.eav(rootEntity, "card/block").sort((a, b) => {
50
+
if (a.data.position === b.data.position)
51
+
return a.id > b.id ? 1 : -1;
52
+
return a.data.position > b.data.position ? 1 : -1;
53
+
});
54
55
// Map to get type and filter for text/heading
56
let blocks = rawBlocks
57
.map((b) => {
58
let type = scan.eav(b.data.value, "block/type")[0];
59
+
if (
60
+
!type ||
61
+
(type.data.value !== "text" && type.data.value !== "heading")
62
+
)
63
+
return null;
64
return b.data;
65
})
66
+
.filter((b): b is NonNullable<typeof b> => b !== null);
67
68
let title = blocks[0];
69