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
@@ -31,7 +31,7 @@ import { mountShapeTextEditor, ShapeTool } from '@blocksuite/affine-gfx-shape';
import { TextTool } from '@blocksuite/affine-gfx-text';
import {
ConnectorElementModel,
ConnectorMode,
type ConnectorMode,
EdgelessTextBlockModel,
GroupElementModel,
LayoutType,
@@ -93,10 +93,18 @@ export class EdgelessPageKeyboardManager extends PageKeyboardManager {
this._setEdgelessTool(TextTool);
},
c: () => {
const mode = ConnectorMode.Curve;
rootComponent.std.get(EditPropsStore).recordLastProps('connector', {
mode,
});
const editPropsStore = this.std.get(EditPropsStore);
let mode: ConnectorMode;
if (
this.gfx.tool.currentToolName$.peek() === ConnectorTool.toolName
) {
mode = this.gfx.tool.get(ConnectorTool).getNextMode();
editPropsStore.recordLastProps('connector', { mode });
} else {
mode = editPropsStore.lastProps$.peek().connector.mode;
}
this._setEdgelessTool(ConnectorTool, { mode });
},
h: () => {