mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-08-10 21:48:48 +08:00
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:
@@ -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: () => {
|
||||
|
||||
Reference in New Issue
Block a user