fix(editor): should record edgeless connector mode (#12426)

Close [BS-3355](https://linear.app/affine-design/issue/BS-3355/白板快捷键c没有记住上次用的connector形状)

<!-- This is an auto-generated comment: release notes by coderabbit.ai -->
## Summary by CodeRabbit

- **New Features**
  - Added the ability to cycle through connector modes (Curve, Orthogonal, Straight) using the 'c' keyboard shortcut when the connector tool is active.
- **Bug Fixes**
  - Improved the logic for remembering and restoring the last used connector mode when switching between tools.
- **Tests**
  - Introduced a new end-to-end test to verify correct cycling and restoration of connector modes.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
This commit is contained in:
L-Sun
2025-05-22 03:54:31 +00:00
parent dd816f3284
commit 9ac1da9fc1
3 changed files with 57 additions and 11 deletions

View File

@@ -3,12 +3,10 @@ import {
DefaultTool,
OverlayIdentifier,
} from '@blocksuite/affine-block-surface';
import type {
Connection,
ConnectorElementModel,
ConnectorMode,
} from '@blocksuite/affine-model';
import {
type Connection,
type ConnectorElementModel,
ConnectorMode,
GroupElementModel,
ShapeElementModel,
ShapeType,
@@ -223,4 +221,15 @@ export class ConnectorTool extends BaseTool<ConnectorToolOptions> {
this.findTargetByPoint(point);
}
getNextMode() {
switch (this.activatedOption.mode) {
case ConnectorMode.Curve:
return ConnectorMode.Orthogonal;
case ConnectorMode.Orthogonal:
return ConnectorMode.Straight;
case ConnectorMode.Straight:
return ConnectorMode.Curve;
}
}
}