a tool for shared writing and social publishing

publish checklists properly

+67 -2
+6
actions/publishToPublication.ts
··· 542 542 let record: PubLeafletBlocksUnorderedList.ListItem = { 543 543 $type: "pub.leaflet.blocks.unorderedList#listItem", 544 544 content, 545 + ...(child.block.listData?.checklist && { 546 + checked: child.block.listData.checked ?? false, 547 + }), 545 548 }; 546 549 let sameStyle = child.children.filter( 547 550 (c) => c.block.listData?.listStyle !== "ordered", ··· 576 579 let record: PubLeafletBlocksOrderedList.ListItem = { 577 580 $type: "pub.leaflet.blocks.orderedList#listItem", 578 581 content, 582 + ...(child.block.listData?.checklist && { 583 + checked: child.block.listData.checked ?? false, 584 + }), 579 585 }; 580 586 let sameStyle = child.children.filter( 581 587 (c) => c.block.listData?.listStyle === "ordered",
+14
app/lish/[did]/[publication]/[rkey]/PostContent.tsx
··· 36 36 import { blockTextSize } from "src/utils/blockTextSize"; 37 37 import { slugify } from "src/utils/slugify"; 38 38 import { PostNotAvailable } from "components/Blocks/BlueskyPostBlock/BlueskyEmbed"; 39 + import { CheckboxChecked } from "components/Icons/CheckboxChecked"; 40 + import { CheckboxEmpty } from "components/Icons/CheckboxEmpty"; 39 41 40 42 export function PostContent({ 41 43 blocks, ··· 487 489 ))} 488 490 </ol> 489 491 ) : null; 492 + let isChecklist = props.item.checked !== undefined; 490 493 return ( 491 494 <li className={`pb-0! flex flex-row gap-2`}> 492 495 <div 493 496 className={`listMarker shrink-0 mx-2 z-1 mt-[14px] h-[5px] w-[5px] ${props.item.content?.$type !== "null" ? "rounded-full bg-secondary" : ""}`} 494 497 /> 498 + {isChecklist && ( 499 + <div className={`pr-2 ${props.item.checked ? "text-accent-contrast" : "text-border"}`}> 500 + {props.item.checked ? <CheckboxChecked /> : <CheckboxEmpty />} 501 + </div> 502 + )} 495 503 <div className="flex flex-col w-full"> 496 504 <Block 497 505 pollData={props.pollData} ··· 558 566 ))} 559 567 </ul> 560 568 ) : null; 569 + let isChecklist = props.item.checked !== undefined; 561 570 return ( 562 571 <li className={`pb-0! flex flex-row gap-2`}> 563 572 <div className="listMarker shrink-0 mx-2 z-1 mt-[4px]"> 564 573 {calculatedIndex}. 565 574 </div> 575 + {isChecklist && ( 576 + <div className={`pr-2 ${props.item.checked ? "text-accent-contrast" : "text-border"}`}> 577 + {props.item.checked ? <CheckboxChecked /> : <CheckboxEmpty />} 578 + </div> 579 + )} 566 580 <div className="flex flex-col w-full"> 567 581 <Block 568 582 pollData={props.pollData}
+8
app/lish/[did]/[publication]/[rkey]/StaticPostContent.tsx
··· 12 12 PubLeafletPagesLinearDocument, 13 13 } from "lexicons/api"; 14 14 import { blobRefToSrc } from "src/utils/blobRefToSrc"; 15 + import { CheckboxChecked } from "components/Icons/CheckboxChecked"; 16 + import { CheckboxEmpty } from "components/Icons/CheckboxEmpty"; 15 17 import { blockTextSize } from "src/utils/blockTextSize"; 16 18 import { TextBlockCore, TextBlockCoreProps } from "./Blocks/TextBlockCore"; 17 19 import { StaticMathBlock } from "./Blocks/StaticMathBlock"; ··· 165 167 did: string; 166 168 className?: string; 167 169 }) { 170 + let isChecklist = props.item.checked !== undefined; 168 171 return ( 169 172 <li className={`pb-0! flex flex-row gap-2`}> 170 173 <div 171 174 className={`listMarker shrink-0 mx-2 z-1 mt-[14px] h-[5px] w-[5px] rounded-full bg-secondary`} 172 175 /> 176 + {isChecklist && ( 177 + <div className={`pr-2 ${props.item.checked ? "text-accent-contrast" : "text-border"}`}> 178 + {props.item.checked ? <CheckboxChecked /> : <CheckboxEmpty />} 179 + </div> 180 + )} 173 181 <div className="flex flex-col"> 174 182 <Block block={{ block: props.item.content }} did={props.did} isList /> 175 183 {props.item.children?.length ? (
+1
components/Blocks/Block.tsx
··· 48 48 type: Fact<"block/type">["data"]["value"]; 49 49 listData?: { 50 50 checklist?: boolean; 51 + checked?: boolean; 51 52 listStyle?: "ordered" | "unordered"; 52 53 listStart?: number; 53 54 displayNumber?: number;
+11 -1
lexicons/api/lexicons.ts
··· 1233 1233 type: 'object', 1234 1234 required: ['content'], 1235 1235 properties: { 1236 + checked: { 1237 + type: 'boolean', 1238 + description: 1239 + 'If present, this item is a checklist item. true = checked, false = unchecked. If absent, this is a normal list item.', 1240 + }, 1236 1241 content: { 1237 1242 type: 'union', 1238 1243 refs: [ ··· 1338 1343 type: 'object', 1339 1344 required: ['content'], 1340 1345 properties: { 1346 + checked: { 1347 + type: 'boolean', 1348 + description: 1349 + 'If present, this item is a checklist item. true = checked, false = unchecked. If absent, this is a normal list item.', 1350 + }, 1341 1351 content: { 1342 1352 type: 'union', 1343 1353 refs: [ ··· 2152 2162 type: 'array', 2153 2163 items: { 2154 2164 type: 'ref', 2155 - ref: 'lex:pub.leaflet.richtext.facet', 2165 + ref: 'lex:pub.leaflet.richtext.facet#main', 2156 2166 }, 2157 2167 }, 2158 2168 },
+2
lexicons/api/types/pub/leaflet/blocks/orderedList.ts
··· 37 37 38 38 export interface ListItem { 39 39 $type?: 'pub.leaflet.blocks.orderedList#listItem' 40 + /** If present, this item is a checklist item. true = checked, false = unchecked. If absent, this is a normal list item. */ 41 + checked?: boolean 40 42 content: 41 43 | $Typed<PubLeafletBlocksText.Main> 42 44 | $Typed<PubLeafletBlocksHeader.Main>
+2
lexicons/api/types/pub/leaflet/blocks/unorderedList.ts
··· 35 35 36 36 export interface ListItem { 37 37 $type?: 'pub.leaflet.blocks.unorderedList#listItem' 38 + /** If present, this item is a checklist item. true = checked, false = unchecked. If absent, this is a normal list item. */ 39 + checked?: boolean 38 40 content: 39 41 | $Typed<PubLeafletBlocksText.Main> 40 42 | $Typed<PubLeafletBlocksHeader.Main>
+4
lexicons/pub/leaflet/blocks/orderedList.json
··· 27 27 "content" 28 28 ], 29 29 "properties": { 30 + "checked": { 31 + "type": "boolean", 32 + "description": "If present, this item is a checklist item. true = checked, false = unchecked. If absent, this is a normal list item." 33 + }, 30 34 "content": { 31 35 "type": "union", 32 36 "refs": [
+4
lexicons/pub/leaflet/blocks/unorderedList.json
··· 23 23 "content" 24 24 ], 25 25 "properties": { 26 + "checked": { 27 + "type": "boolean", 28 + "description": "If present, this item is a checklist item. true = checked, false = unchecked. If absent, this is a normal list item." 29 + }, 26 30 "content": { 27 31 "type": "union", 28 32 "refs": [
+4 -1
lexicons/pub/leaflet/richtext/facet.json
··· 140 140 "footnote": { 141 141 "type": "object", 142 142 "description": "Facet feature for a footnote reference", 143 - "required": ["footnoteId", "contentPlaintext"], 143 + "required": [ 144 + "footnoteId", 145 + "contentPlaintext" 146 + ], 144 147 "properties": { 145 148 "footnoteId": { 146 149 "type": "string"
+10
lexicons/src/blocks.ts
··· 212 212 type: "object", 213 213 required: ["content"], 214 214 properties: { 215 + checked: { 216 + type: "boolean", 217 + description: 218 + "If present, this item is a checklist item. true = checked, false = unchecked. If absent, this is a normal list item.", 219 + }, 215 220 content: { 216 221 type: "union", 217 222 refs: [ ··· 250 255 type: "object", 251 256 required: ["content"], 252 257 properties: { 258 + checked: { 259 + type: "boolean", 260 + description: 261 + "If present, this item is a checklist item. true = checked, false = unchecked. If absent, this is a normal list item.", 262 + }, 253 263 content: { 254 264 type: "union", 255 265 refs: [
+1
src/replicache/getBlocks.ts
··· 78 78 parent, 79 79 path: newPath, 80 80 checklist: !!checklist[0], 81 + checked: checklist[0]?.data.value, 81 82 listStyle: listStyle?.data.value, 82 83 listStart: listNumber?.data.value, 83 84 },