👁️
5
fork

Configure Feed

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

show bullets on same line as content, allow toggling

+26 -4
+22
src/components/richtext/Toolbar.tsx
··· 117 117 118 118 const toggleList = (listType: NodeType) => { 119 119 return () => { 120 + const otherListType = 121 + listType === schema.nodes.bullet_list 122 + ? schema.nodes.ordered_list 123 + : schema.nodes.bullet_list; 124 + 120 125 if (isBlockActive(listType)) { 126 + // Already in this list type - lift out 121 127 liftListItem(schema.nodes.list_item)(state, view.dispatch); 128 + } else if (isBlockActive(otherListType)) { 129 + // In the other list type - switch by changing the list node type 130 + const { $from } = state.selection; 131 + for (let d = $from.depth; d > 0; d--) { 132 + const node = $from.node(d); 133 + if ( 134 + node.type === schema.nodes.bullet_list || 135 + node.type === schema.nodes.ordered_list 136 + ) { 137 + const pos = $from.before(d); 138 + const tr = state.tr.setNodeMarkup(pos, listType, node.attrs); 139 + view.dispatch(tr); 140 + break; 141 + } 142 + } 122 143 } else { 144 + // Not in any list - wrap in new list 123 145 wrapInList(listType)(state, view.dispatch); 124 146 } 125 147 view.focus();
+4 -4
src/components/richtext/schema.ts
··· 131 131 return [ 132 132 "ol", 133 133 { 134 - class: "list-decimal list-inside my-2 space-y-1", 134 + class: "list-decimal pl-6 my-2 space-y-1", 135 135 start: node.attrs.order === 1 ? null : node.attrs.order, 136 136 "data-tight": node.attrs.tight ? "true" : null, 137 137 }, ··· 156 156 return [ 157 157 "ul", 158 158 { 159 - class: "list-disc list-inside my-2 space-y-1", 159 + class: "list-disc pl-6 my-2 space-y-1", 160 160 "data-tight": node.attrs.tight ? "true" : null, 161 161 }, 162 162 0, ··· 165 165 }, 166 166 167 167 list_item: { 168 - content: "block+", 168 + content: "paragraph block*", 169 169 defining: true, 170 170 parseDOM: [{ tag: "li" }], 171 171 toDOM() { 172 - return ["li", 0]; 172 + return ["li", { class: "[&>p]:inline" }, 0]; 173 173 }, 174 174 }, 175 175