a tool for shared writing and social publishing
0
fork

Configure Feed

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

make it work on windows too

+30 -23
+30 -23
components/Blocks/TextBlock/keymap.ts
··· 33 33 "Ctrl-Meta-h": toggleMark(schema.marks.highlight, { 34 34 color: useUIState.getState().lastUsedHighlight, 35 35 }), 36 - "Meta-a": (state, _dispatch, view) => { 37 - const { from, to } = state.selection; 38 - // Check if the entire content of the blockk is selected 39 - const isFullySelected = from === 0 && to === state.doc.content.size; 40 - 41 - if (!isFullySelected) { 42 - // If the entire block is selected, we don't need to do anything 43 - return false 44 - } else { 45 - // Remove the selection 46 - view?.dispatch(state.tr.setSelection(TextSelection.create(state.doc, from))); 47 - view?.dom.blur() 48 - repRef.current?.query(async tx=>{ 49 - let allBlocks = await getBlocksWithType(tx, propsRef.current.parent) ||[] 50 - console.log("allBlocks", allBlocks) 51 - useUIState.setState({ 52 - selectedBlock: allBlocks.map(b=>({value: b.value, parent: propsRef.current.parent})) 53 - }) 54 - }) 55 - return true 56 - } 57 - 58 - }, 36 + "Ctrl-a": metaA(propsRef, repRef), 37 + "Meta-a": metaA(propsRef, repRef), 59 38 Tab: () => { 60 39 if (useUIState.getState().selectedBlock.length > 1) return false; 61 40 if (!repRef.current || !propsRef.current.previousBlock) return false; ··· 454 433 }); 455 434 return true; 456 435 }; 436 + 437 + 438 + const metaA = ( 439 + propsRef: MutableRefObject<BlockProps & { entity_set: { set: string } }>, 440 + repRef: MutableRefObject<Replicache<ReplicacheMutators> | null>, 441 + )=> (state: EditorState, dispatch: ((tr: Transaction) => void) | undefined, view: EditorView | undefined) => { 442 + const { from, to } = state.selection; 443 + // Check if the entire content of the blockk is selected 444 + const isFullySelected = from === 0 && to === state.doc.content.size; 445 + 446 + if (!isFullySelected) { 447 + // If the entire block is selected, we don't need to do anything 448 + return false 449 + } else { 450 + // Remove the selection 451 + view?.dispatch(state.tr.setSelection(TextSelection.create(state.doc, from))); 452 + view?.dom.blur() 453 + repRef.current?.query(async tx=>{ 454 + let allBlocks = await getBlocksWithType(tx, propsRef.current.parent) ||[] 455 + console.log("allBlocks", allBlocks) 456 + useUIState.setState({ 457 + selectedBlock: allBlocks.map(b=>({value: b.value, parent: propsRef.current.parent})) 458 + }) 459 + }) 460 + return true 461 + } 462 + 463 + }