fix(editor): edgeless selected block is missing in the return of getSelectedBlockCommand (#11813)

This commit is contained in:
L-Sun
2025-04-18 13:52:43 +00:00
parent 5fcf34d848
commit f16bcdbe2b
7 changed files with 46 additions and 11 deletions
@@ -0,0 +1,10 @@
import { SurfaceSelection } from '@blocksuite/std';
import type { GetSelectionCommand } from './types';
export const getSurfaceSelectionCommand: GetSelectionCommand = (ctx, next) => {
const currentSurfaceSelection = ctx.std.selection.filter(SurfaceSelection)[0];
if (!currentSurfaceSelection) return;
next({ currentSurfaceSelection });
};
@@ -7,5 +7,6 @@ export {
getSelectionRectsCommand,
type SelectionRect,
} from './get-selection-rects';
export { getSurfaceSelectionCommand } from './get-surface-selection';
export { getTextSelectionCommand } from './get-text-selection.js';
export { isNothingSelectedCommand } from './is-nothing-selected.js';
@@ -1,4 +1,9 @@
import type { BlockSelection, Command, TextSelection } from '@blocksuite/std';
import type {
BlockSelection,
Command,
SurfaceSelection,
TextSelection,
} from '@blocksuite/std';
import type { ImageSelection } from '../../selection/image';
@@ -8,5 +13,6 @@ export type GetSelectionCommand = Command<
currentTextSelection?: TextSelection;
currentBlockSelections?: BlockSelection[];
currentImageSelections?: ImageSelection[];
currentSurfaceSelection?: SurfaceSelection;
}
>;