a tool for shared writing and social publishing
0
fork

Configure Feed

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

tooltip fixes and make list shortcut

+65 -7
+18
components/SelectionManager.tsx
··· 40 40 let removeListener = addShortcut([ 41 41 { 42 42 metaKey: true, 43 + altKey: true, 44 + key: ["l", "¬"], 45 + handler: async () => { 46 + let [sortedBlocks, siblings] = await getSortedSelection(); 47 + for (let block of sortedBlocks) { 48 + if (!block.listData) { 49 + console.log("yo?"); 50 + await rep?.mutate.assertFact({ 51 + entity: block.value, 52 + attribute: "block/is-list", 53 + data: { type: "boolean", value: true }, 54 + }); 55 + } 56 + } 57 + }, 58 + }, 59 + { 60 + metaKey: true, 43 61 shift: true, 44 62 key: ["ArrowDown"], 45 63 handler: async () => {
+45 -7
components/Toolbar/index.tsx
··· 119 119 Strikethrough 120 120 </div> 121 121 <div className="flex gap-1"> 122 - <ShortcutKey>{metaKey()}</ShortcutKey> +{" "} 123 - <ShortcutKey> Cmd </ShortcutKey> +{" "} 124 - <ShortcutKey> X </ShortcutKey> 122 + {isMac() ? ( 123 + <> 124 + <ShortcutKey>⌘</ShortcutKey> +{" "} 125 + <ShortcutKey> Ctrl </ShortcutKey> +{" "} 126 + <ShortcutKey> X </ShortcutKey> 127 + </> 128 + ) : ( 129 + <> 130 + <ShortcutKey> Ctrl </ShortcutKey> +{" "} 131 + <ShortcutKey> Meta </ShortcutKey> +{" "} 132 + <ShortcutKey> X </ShortcutKey> 133 + </> 134 + )} 125 135 </div> 126 136 </div> 127 137 } ··· 139 149 $ 140 150 {isMac() ? ( 141 151 <> 152 + <ShortcutKey>⌘</ShortcutKey> +{" "} 142 153 <ShortcutKey> Ctrl </ShortcutKey> +{" "} 143 - <ShortcutKey> Cmd </ShortcutKey> +{" "} 144 154 <ShortcutKey> H </ShortcutKey> 145 155 </> 146 156 ) : ( ··· 296 306 return ( 297 307 <div className="flex w-full justify-between items-center gap-4"> 298 308 <ToolbarButton 299 - tooltipContent={<div>Indent List Item</div>} 309 + tooltipContent={ 310 + <div className="flex flex-col gap-1 justify-center"> 311 + <div className="text-center font-normal">Make List</div> 312 + <div className="flex gap-1"> 313 + { 314 + <> 315 + <ShortcutKey> {metaKey()}</ShortcutKey> +{" "} 316 + <ShortcutKey> Alt </ShortcutKey> +{" "} 317 + <ShortcutKey> L </ShortcutKey> 318 + </> 319 + } 320 + </div> 321 + </div> 322 + } 300 323 onClick={() => { 301 324 if (!focusedBlock) return; 302 325 rep?.mutate.assertFact({ ··· 316 339 <div className="flex items-center gap-[6px]"> 317 340 <Separator classname="h-6" /> 318 341 <ToolbarButton 319 - tooltipContent={<div>Indent List Item</div>} 342 + tooltipContent={ 343 + <div className="flex flex-col gap-1 justify-center"> 344 + <div className="text-center">Indent Item</div> 345 + <div className="flex gap-1 justify-center"> 346 + <ShortcutKey>Tab</ShortcutKey> 347 + </div> 348 + </div> 349 + } 320 350 disabled={ 321 351 !previousBlock?.listData || 322 352 previousBlock.listData.depth !== block?.listData?.depth ··· 329 359 <ListIndentIncreaseSmall /> 330 360 </ToolbarButton> 331 361 <ToolbarButton 332 - tooltipContent={<div>Outdent List Item</div>} 362 + tooltipContent={ 363 + <div className="flex flex-col gap-1 justify-center"> 364 + <div className="text-center">Outdent Item</div> 365 + <div className="flex gap-1 justify-center"> 366 + <ShortcutKey>Shift</ShortcutKey> +{" "} 367 + <ShortcutKey>Tab</ShortcutKey> 368 + </div> 369 + </div> 370 + } 333 371 onClick={() => { 334 372 if (!rep || !block) return; 335 373 outdent(block, previousBlock, rep);
+2
src/shortcuts.ts
··· 5 5 6 6 type Shortcut = { 7 7 metaKey?: boolean; 8 + altKey?: boolean; 8 9 shift?: boolean; 9 10 key: string | string[]; 10 11 handler: () => void; ··· 13 14 let listener = (e: KeyboardEvent) => { 14 15 for (let shortcut of [shortcuts].flat()) { 15 16 if (e.shiftKey !== !!shortcut.shift) continue; 17 + if (e.altKey !== !!shortcut.altKey) continue; 16 18 if (!!shortcut.metaKey !== (isMac() ? e.metaKey : e.ctrlKey)) continue; 17 19 if (![shortcut.key].flat().includes(e.key)) continue; 18 20 e.preventDefault();