👁️
5
fork

Configure Feed

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

more work on tags

+22 -11
+1
src/components/richtext/ProseMirrorEditor.tsx
··· 185 185 getQueryOptions: getTagQueryOptions, 186 186 onSelect: handleTagSelect, 187 187 renderPopup: (props) => <TagPopupContent {...props} />, 188 + minQueryLength: 0, 188 189 }); 189 190 190 191 // Combined callbacks for the single autocomplete plugin
+3
src/components/richtext/RichtextSection.tsx
··· 33 33 readOnly?: boolean; 34 34 placeholder?: string; 35 35 emptyText?: string; 36 + availableTags?: string[]; 36 37 } 37 38 38 39 const COLLAPSED_LINES = 8; ··· 45 46 readOnly = false, 46 47 placeholder = "Write something...", 47 48 emptyText = "Add a description...", 49 + availableTags, 48 50 }: RichtextSectionProps) { 49 51 const [isEditing, setIsEditing] = useState(false); 50 52 const [isExpanded, setIsExpanded] = useState(false); ··· 89 91 defaultValue={doc} 90 92 onChange={onChange} 91 93 placeholder={placeholder} 94 + availableTags={availableTags} 92 95 /> 93 96 <div className="flex items-center justify-between"> 94 97 <div className="flex items-center gap-2 text-sm text-gray-500 dark:text-gray-400">
+4 -4
src/lib/__tests__/richtext-convert.test.ts
··· 1105 1105 content: [ 1106 1106 { 1107 1107 $type: "com.deckbelcher.richtext#paragraphBlock", 1108 - text: "tagged with #combo for deck", 1108 + text: "tagged with combo for deck", 1109 1109 facets: [ 1110 1110 { 1111 - index: { byteStart: 12, byteEnd: 18 }, 1111 + index: { byteStart: 12, byteEnd: 17 }, 1112 1112 features: [ 1113 1113 { 1114 1114 $type: "com.deckbelcher.richtext.facet#tag", ··· 1578 1578 expect(result.eq(original)).toBe(true); 1579 1579 }); 1580 1580 1581 - it("converts tags without tag value to plain text", () => { 1581 + it("converts tags without tag value to undefined text", () => { 1582 1582 const original = schema.node("doc", null, [ 1583 1583 schema.node("paragraph", null, [schema.nodes.tag.create({ tag: "" })]), 1584 1584 ]); ··· 1589 1589 facets?: unknown[]; 1590 1590 }; 1591 1591 1592 - expect(paragraph.text).toBe("#"); 1592 + expect(paragraph.text).toBeUndefined(); 1593 1593 expect(paragraph.facets).toBeUndefined(); 1594 1594 }); 1595 1595
+3 -7
src/lib/richtext-convert.ts
··· 285 285 byteOffset += textBytes.length; 286 286 } else if (child.type.name === "tag") { 287 287 const tag = (child.attrs.tag as string) || ""; 288 - const displayText = `#${tag}`; 289 - const textBytes = new TextEncoder().encode(displayText); 288 + const textBytes = new TextEncoder().encode(tag); 290 289 291 - textParts.push(displayText); 290 + textParts.push(tag); 292 291 293 292 if (tag) { 294 293 facets.push({ ··· 590 589 ) as { $type: string; tag?: string } | undefined; 591 590 592 591 if (tagFeature) { 593 - // Strip leading # from display text 594 - const tag = 595 - tagFeature.tag || 596 - (segment.text.startsWith("#") ? segment.text.slice(1) : segment.text); 592 + const tag = tagFeature.tag || segment.text; 597 593 nodes.push(schema.nodes.tag.create({ tag })); 598 594 continue; 599 595 }
+10
src/routes/pm-demo.tsx
··· 12 12 }), 13 13 }); 14 14 15 + const DEMO_TAGS = [ 16 + "combo", 17 + "budget", 18 + "competitive", 19 + "casual", 20 + "aggro", 21 + "control", 22 + ]; 23 + 15 24 const SAMPLE_DOC: Document = { 16 25 content: [ 17 26 { ··· 99 108 document={savedDoc} 100 109 onSave={handleSave} 101 110 readOnly={false} 111 + availableTags={DEMO_TAGS} 102 112 /> 103 113 </div> 104 114
+1
src/routes/profile/$did/deck/$rkey/index.tsx
··· 558 558 isSaving={isSaving} 559 559 readOnly={!isOwner} 560 560 placeholder="Write about your deck's strategy, key combos, card choices..." 561 + availableTags={allTags} 561 562 /> 562 563 </ErrorBoundary> 563 564 </div>