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
style the actual mention
cozylittle.house
3 months ago
48b20232
8da4f186
+9
-10
3 changed files
expand all
collapse all
unified
split
app
[leaflet_id]
publish
BskyPostEditorProsemirror.tsx
components
Blocks
TextBlock
schema.ts
Mention.tsx
+7
-7
app/[leaflet_id]/publish/BskyPostEditorProsemirror.tsx
···
382
382
if (!view) return;
383
383
const { from, to } = range;
384
384
const tr = view.state.tr;
385
385
-
// Delete the query text (keep the @)
386
386
-
tr.delete(from + 1, to);
387
385
388
386
if (mention.type == "did") {
387
387
+
// Delete the query text (keep the @)
388
388
+
tr.delete(from + 1, to);
389
389
tr.insertText(mention.handle, from + 1);
390
390
tr.addMark(
391
391
from,
···
395
395
tr.insertText(" ", from + 1 + mention.handle.length);
396
396
}
397
397
if (mention.type === "publication" || mention.type === "post") {
398
398
+
// Delete the @ and any query text
399
399
+
tr.delete(from, to);
398
400
let name = mention.type == "post" ? mention.title : mention.name;
399
399
-
tr.insertText(name, from + 1);
401
401
+
tr.insertText(name, from);
400
402
tr.addMark(
401
403
from,
402
402
-
from + 1 + name.length,
404
404
+
from + name.length,
403
405
schema.marks.atMention.create({ atURI: mention.uri }),
404
406
);
405
405
-
tr.insertText(" ", from + 1 + name.length);
407
407
+
tr.insertText(" ", from + name.length);
406
408
}
407
407
-
408
408
-
// Insert the mention text after the @
409
409
410
410
view.dispatch(tr);
411
411
view.focus();
+1
-2
components/Blocks/TextBlock/schema.ts
···
144
144
"img",
145
145
{
146
146
src: `/api/pub_icon?at_uri=${encodeURIComponent(node.attrs.atURI)}`,
147
147
-
class:
148
148
-
"inline-block w-4 h-4 rounded-full ml-1 align-text-bottom",
147
147
+
class: "inline-block w-5 h-5 rounded-full mr-1 align-text-top",
149
148
alt: "",
150
149
width: "16",
151
150
height: "16",
+1
-1
components/Mention.tsx
···
336
336
}) => {
337
337
return (
338
338
<span
339
339
-
className="flex flex-row shrink-0 text-xs font-normal text-tertiary hover:text-accent-contrast cursor-pointer"
339
339
+
className="flex flex-row items-center h-full shrink-0 text-xs font-normal text-tertiary hover:text-accent-contrast cursor-pointer"
340
340
onClick={(e) => {
341
341
e.preventDefault();
342
342
e.stopPropagation();