chore(editor): keep root slash menu open when pressing left arrow left (#10730)

Close [BS-2643](https://linear.app/affine-design/issue/BS-2643/slash-menu-左键不关闭根菜单)
This commit is contained in:
L-Sun
2025-03-10 13:36:37 +00:00
parent c45abb013a
commit 027d3a51dc
2 changed files with 43 additions and 7 deletions
@@ -216,7 +216,14 @@ export class SlashMenu extends WithDisposable(LitElement) {
return;
}
if (key === 'ArrowRight' || key === 'ArrowLeft' || key === 'Escape') {
if (key === 'Escape') {
this.abortController.abort();
event.preventDefault();
event.stopPropagation();
return;
}
if (key === 'ArrowRight' || key === 'ArrowLeft') {
return;
}
@@ -542,7 +549,14 @@ export class InnerSlashMenu extends WithDisposable(LitElement) {
event.stopPropagation();
}
if ((key === 'ArrowLeft' || key === 'Escape') && notControlShift) {
if (key === 'ArrowLeft' && notControlShift) {
if (this.depth != 0) this.abortController.abort();
event.preventDefault();
event.stopPropagation();
}
if (key === 'Escape' && notControlShift) {
this.abortController.abort();
event.preventDefault();