mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-26 02:35:58 +08:00
chore: merge blocksuite source code (#9213)
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
import type { Command } from '@blocksuite/block-std';
|
||||
|
||||
export const deleteSelectedModelsCommand: Command<'selectedModels'> = (
|
||||
ctx,
|
||||
next
|
||||
) => {
|
||||
const models = ctx.selectedModels;
|
||||
|
||||
if (!models) {
|
||||
console.error(
|
||||
'`selectedModels` is required, you need to use `getSelectedModels` command before adding this command to the pipeline.'
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
models.forEach(model => {
|
||||
ctx.std.doc.deleteBlock(model);
|
||||
});
|
||||
|
||||
return next();
|
||||
};
|
||||
|
||||
declare global {
|
||||
namespace BlockSuite {
|
||||
interface Commands {
|
||||
deleteSelectedModels: typeof deleteSelectedModelsCommand;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user