Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(edgeless): cmd a will select element inner frame #8517

Merged
merged 1 commit into from
Oct 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -259,15 +259,15 @@ export class EdgelessPageKeyboardManager extends PageKeyboardManager {
...service.blocks
.filter(
block =>
block.group === null &&
block.container === null &&
!(
matchFlavours(block, ['affine:note']) &&
block.displayMode === NoteDisplayMode.DocOnly
)
)
.map(block => block.id),
...service.elements
.filter(el => el.group === null)
.filter(el => el.container === null)
.map(el => el.id),
],
editing: false,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,10 @@ import {
} from '@blocksuite/affine-model';
import { EditPropsStore } from '@blocksuite/affine-shared/services';
import { clamp } from '@blocksuite/affine-shared/utils';
import { GfxControllerIdentifier } from '@blocksuite/block-std/gfx';
import {
GfxControllerIdentifier,
isGfxContainerElm,
} from '@blocksuite/block-std/gfx';
import { BlockSuiteError, ErrorCode } from '@blocksuite/global/exceptions';
import { Bound, getCommonBound, last } from '@blocksuite/global/utils';
import { type BlockModel, Slot } from '@blocksuite/store';
Expand Down Expand Up @@ -474,6 +477,12 @@ export class EdgelessRootService extends RootService implements SurfaceContext {
id = typeof id === 'string' ? id : id.id;

const el = this.getElementById(id);
if (isGfxContainerElm(el)) {
el.childIds.forEach(childId => {
this.removeElement(childId);
});
}

if (el instanceof GfxBlockModel) {
this.doc.deleteBlock(el);
return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,10 @@ export const conversionsGroup: MenuItemGroup<ElementToolbarMoreMenuContext> = {
elements,
title
);
// delete selected elements
doc.transact(() => {
deleteElements(edgeless, elements);
});
// insert linked doc card
const width = 364;
const height = 390;
Expand All @@ -335,6 +339,10 @@ export const conversionsGroup: MenuItemGroup<ElementToolbarMoreMenuContext> = {
},
surface.model.id
);
selection.set({
elements: [cardId],
editing: false,
});
std.getOptional(TelemetryProvider)?.track('CanvasElementAdded', {
control: 'context-menu',
page: 'whiteboard editor',
Expand All @@ -355,14 +363,6 @@ export const conversionsGroup: MenuItemGroup<ElementToolbarMoreMenuContext> = {
type: 'embed-linked-doc',
other: 'new doc',
});
// delete selected elements
doc.transact(() => {
deleteElements(edgeless, elements);
});
selection.set({
elements: [cardId],
editing: false,
});

notifyDocCreated(host, doc);
},
Expand Down
Loading
Loading