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
handle pasting bluesky posts
awarm.space
1 month ago
ee0c9aab
27b89624
+30
-2
2 changed files
expand all
collapse all
unified
split
components
Blocks
TextBlock
useHandlePaste.ts
src
utils
getBlocksAsHTML.tsx
+20
-1
components/Blocks/TextBlock/useHandlePaste.ts
···
396
396
]);
397
397
}
398
398
399
399
+
if (child.tagName === "DIV" && child.getAttribute("data-bluesky-post")) {
400
400
+
let postData = child.getAttribute("data-bluesky-post");
401
401
+
if (postData) {
402
402
+
rep.mutate.assertFact([
403
403
+
{
404
404
+
entity: entityID,
405
405
+
attribute: "block/type",
406
406
+
data: { type: "block-type-union", value: "bluesky-post" },
407
407
+
},
408
408
+
{
409
409
+
entity: entityID,
410
410
+
attribute: "block/bluesky-post",
411
411
+
data: { type: "bluesky-post", value: JSON.parse(postData) },
412
412
+
},
413
413
+
]);
414
414
+
}
415
415
+
}
416
416
+
399
417
if (child.tagName === "DIV" && child.getAttribute("data-entityid")) {
400
418
let oldEntityID = child.getAttribute("data-entityid") as string;
401
419
let factsData = child.getAttribute("data-facts");
···
593
611
"HR",
594
612
].includes(elementNode.tagName) ||
595
613
elementNode.getAttribute("data-entityid") ||
596
596
-
elementNode.getAttribute("data-tex")
614
614
+
elementNode.getAttribute("data-tex") ||
615
615
+
elementNode.getAttribute("data-bluesky-post")
597
616
) {
598
617
htmlBlocks.push(elementNode);
599
618
} else {
+10
-1
src/utils/getBlocksAsHTML.tsx
···
79
79
mailbox: async () => null,
80
80
poll: async () => null,
81
81
embed: async () => null,
82
82
-
"bluesky-post": async () => null,
82
82
+
"bluesky-post": async (b, tx) => {
83
83
+
let [post] = await scanIndex(tx).eav(b.value, "block/bluesky-post");
84
84
+
if (!post) return null;
85
85
+
return (
86
86
+
<div
87
87
+
data-type="bluesky-post"
88
88
+
data-bluesky-post={JSON.stringify(post.data.value)}
89
89
+
/>
90
90
+
);
91
91
+
},
83
92
math: async (b, tx, a) => {
84
93
let [math] = await scanIndex(tx).eav(b.value, "block/math");
85
94
const html = Katex.renderToString(math?.data.value || "", {