mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-13 21:05:19 +00:00
Closes: [BS-2217](https://linear.app/affine-design/issue/BS-2217/remove-global-types-in-selection)
24 lines
570 B
TypeScript
24 lines
570 B
TypeScript
import { BlockSelection, type Command } from '@blocksuite/block-std';
|
|
|
|
export const getBlockSelectionsCommand: Command<
|
|
never,
|
|
'currentBlockSelections'
|
|
> = (ctx, next) => {
|
|
const currentBlockSelections = ctx.std.selection.filter(BlockSelection);
|
|
if (currentBlockSelections.length === 0) return;
|
|
|
|
next({ currentBlockSelections });
|
|
};
|
|
|
|
declare global {
|
|
namespace BlockSuite {
|
|
interface CommandContext {
|
|
currentBlockSelections?: BlockSelection[];
|
|
}
|
|
|
|
interface Commands {
|
|
getBlockSelections: typeof getBlockSelectionsCommand;
|
|
}
|
|
}
|
|
}
|