mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-07-24 05:48:59 +08:00
17bf75e843
Closes: [BS-2216](https://linear.app/affine-design/issue/BS-2216/remove-global-types-in-command)
28 lines
552 B
TypeScript
28 lines
552 B
TypeScript
import {
|
|
type BlockComponent,
|
|
type Command,
|
|
TextSelection,
|
|
} from '@blocksuite/block-std';
|
|
|
|
export const focusBlockEnd: Command<{
|
|
focusBlock?: BlockComponent;
|
|
}> = (ctx, next) => {
|
|
const { focusBlock, std } = ctx;
|
|
if (!focusBlock || !focusBlock.model.text) return;
|
|
|
|
const { selection } = std;
|
|
|
|
selection.setGroup('note', [
|
|
selection.create(TextSelection, {
|
|
from: {
|
|
blockId: focusBlock.blockId,
|
|
index: focusBlock.model.text.length,
|
|
length: 0,
|
|
},
|
|
to: null,
|
|
}),
|
|
]);
|
|
|
|
return next();
|
|
};
|