mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-14 13:25:12 +00:00
Closes: [BS-2216](https://linear.app/affine-design/issue/BS-2216/remove-global-types-in-command)
23 lines
420 B
TypeScript
23 lines
420 B
TypeScript
import {
|
|
type BlockComponent,
|
|
BlockSelection,
|
|
type Command,
|
|
} from '@blocksuite/block-std';
|
|
|
|
export const selectBlock: Command<{
|
|
focusBlock?: BlockComponent;
|
|
}> = (ctx, next) => {
|
|
const { focusBlock, std } = ctx;
|
|
if (!focusBlock) {
|
|
return;
|
|
}
|
|
|
|
const { selection } = std;
|
|
|
|
selection.setGroup('note', [
|
|
selection.create(BlockSelection, { blockId: focusBlock.blockId }),
|
|
]);
|
|
|
|
return next();
|
|
};
|