fix: connector issues (#12308)

Fixes [BS-3161](https://linear.app/affine-design/issue/BS-3161/发现已连接的connector会响应对齐线)
Fixes [BS-3337](https://linear.app/affine-design/issue/BS-3337/connector你肿么了)
Fixes [BS-3334](https://linear.app/affine-design/issue/BS-3334/connector-不应该能够被拖拽)

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

## Summary by CodeRabbit

- **Bug Fixes**
	- Corrected typos related to label editing state, ensuring more reliable label editing and display for connectors.
	- Fixed logic in the auto-complete overlay, improving when overlays appear during hover actions.

- **New Features**
	- Improved connector label handling by ensuring label state is preserved and restored during editing.
	- Enhanced connector movement behavior, allowing connectors to be moved only when appropriate elements are selected.

- **Tests**
	- Added end-to-end tests to verify connector movement and selection behaviors for improved reliability.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
This commit is contained in:
doouding
2025-05-16 09:49:22 +00:00
parent 8ed4f14380
commit 5eca722edf
6 changed files with 80 additions and 5 deletions

View File

@@ -36,6 +36,8 @@ export class ConnectorFilter extends InteractivityExtension {
elements.sort((a, _) => (a instanceof ConnectorElementModel ? -1 : 1));
}
context.elements = elements;
return {};
});
}

View File

@@ -188,6 +188,8 @@ export class EdgelessConnectorLabelEditor extends WithDisposable(
});
this._resizeObserver.observe(this.richText);
this.connector.stash('labelXYWH');
this.updateComplete
.then(() => {
if (!this.inlineEditor) return;
@@ -257,7 +259,8 @@ export class EdgelessConnectorLabelEditor extends WithDisposable(
}
}
connector.lableEditing = false;
connector.labelEditing = false;
connector.pop('labelXYWH');
selection.set({
elements: [],
@@ -293,7 +296,7 @@ export class EdgelessConnectorLabelEditor extends WithDisposable(
}
);
connector.lableEditing = true;
connector.labelEditing = true;
})
.catch(console.error);
}