a tool for shared writing and social publishing
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

properly open atmentions in editor and resolve pubs

+21 -28
+19 -23
components/Blocks/TextBlock/mountProsemirror.ts
··· 80 80 handlePaste, 81 81 handleClickOn: (_view, _pos, node, _nodePos, _event, direct) => { 82 82 if (!direct) return; 83 + 84 + // Check for didMention inline nodes 85 + if (node?.type === schema.nodes.didMention) { 86 + window.open( 87 + didToBlueskyUrl(node.attrs.did), 88 + "_blank", 89 + "noopener,noreferrer", 90 + ); 91 + return; 92 + } 93 + 94 + // Check for atMention inline nodes 95 + if (node?.type === schema.nodes.atMention) { 96 + const url = atUriToUrl(node.attrs.atURI); 97 + window.open(url, "_blank", "noopener,noreferrer"); 98 + return; 99 + } 83 100 if (node.nodeSize - 2 <= _pos) return; 84 101 85 102 // Check for marks at the clicked position ··· 87 104 const nodeAt2 = node.nodeAt(Math.max(_pos - 2, 0)); 88 105 89 106 // Check for link marks 90 - let linkMark = nodeAt1?.marks.find((f) => f.type === schema.marks.link) || 107 + let linkMark = 108 + nodeAt1?.marks.find((f) => f.type === schema.marks.link) || 91 109 nodeAt2?.marks.find((f) => f.type === schema.marks.link); 92 110 if (linkMark) { 93 111 window.open(linkMark.attrs.href, "_blank"); 94 - return; 95 - } 96 - 97 - // Check for didMention inline nodes 98 - if (nodeAt1?.type === schema.nodes.didMention) { 99 - window.open(didToBlueskyUrl(nodeAt1.attrs.did), "_blank", "noopener,noreferrer"); 100 - return; 101 - } 102 - if (nodeAt2?.type === schema.nodes.didMention) { 103 - window.open(didToBlueskyUrl(nodeAt2.attrs.did), "_blank", "noopener,noreferrer"); 104 - return; 105 - } 106 - 107 - // Check for atMention inline nodes 108 - if (nodeAt1?.type === schema.nodes.atMention) { 109 - const url = atUriToUrl(nodeAt1.attrs.atURI); 110 - window.open(url, "_blank", "noopener,noreferrer"); 111 - return; 112 - } 113 - if (nodeAt2?.type === schema.nodes.atMention) { 114 - const url = atUriToUrl(nodeAt2.attrs.atURI); 115 - window.open(url, "_blank", "noopener,noreferrer"); 116 112 return; 117 113 } 118 114 },
+2 -5
src/utils/mentionUtils.ts
··· 19 19 const uri = new AtUri(atUri); 20 20 21 21 if (isPublicationCollection(uri.collection)) { 22 - // Publication URL: /lish/{did}/{rkey} 23 - return `/lish/${uri.host}/${uri.rkey}`; 22 + return `/lish/uri/${encodeURIComponent(atUri)}`; 24 23 } else if (isDocumentCollection(uri.collection)) { 25 - // Document URL - we need to resolve this via the API 26 - // For now, create a redirect route that will handle it 27 24 return `/lish/uri/${encodeURIComponent(atUri)}`; 28 25 } 29 26 ··· 42 39 export function handleMentionClick( 43 40 e: MouseEvent | React.MouseEvent, 44 41 type: "did" | "at-uri", 45 - value: string 42 + value: string, 46 43 ) { 47 44 e.preventDefault(); 48 45 e.stopPropagation();