From cb2dc47567a3480d86dac8826a6b1455d5b20307 Mon Sep 17 00:00:00 2001 From: Vanessa Date: Sat, 16 Jul 2022 17:07:50 +0800 Subject: [PATCH] :art: fix https://github.com/siyuan-note/siyuan/issues/5434 --- app/src/menus/protyle.ts | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/app/src/menus/protyle.ts b/app/src/menus/protyle.ts index 1297616fb..49aacee88 100644 --- a/app/src/menus/protyle.ts +++ b/app/src/menus/protyle.ts @@ -612,6 +612,10 @@ export const linkMenu = (protyle: IProtyle, linkElement: HTMLElement, focusText focusByRange(protyle.toolbar.range); } window.siyuan.menus.menu.remove(); + } else if (event.key === "Tab" && !event.isComposing) { + event.preventDefault(); + event.stopPropagation(); + element.nextElementSibling.querySelector("input").focus(); } }); } @@ -649,6 +653,14 @@ export const linkMenu = (protyle: IProtyle, linkElement: HTMLElement, focusText focusByRange(protyle.toolbar.range); } window.siyuan.menus.menu.remove(); + } else if (event.key === "Tab" && !event.isComposing) { + event.preventDefault(); + event.stopPropagation(); + if (event.shiftKey) { + element.previousElementSibling.querySelector("input").focus(); + } else { + element.nextElementSibling.querySelector("input").focus(); + } } }); } @@ -679,6 +691,10 @@ export const linkMenu = (protyle: IProtyle, linkElement: HTMLElement, focusText focusByRange(protyle.toolbar.range); } window.siyuan.menus.menu.remove(); + } else if (event.key === "Tab" && event.shiftKey && !event.isComposing) { + event.preventDefault(); + event.stopPropagation(); + element.previousElementSibling.querySelector("input").focus(); } }); } @@ -690,7 +706,7 @@ export const linkMenu = (protyle: IProtyle, linkElement: HTMLElement, focusText protyle.toolbar.setInlineMark(protyle, "link", "remove"); } }).element); - if (linkAddress.startsWith("assets/")) { + if (linkAddress?.startsWith("assets/")) { window.siyuan.menus.menu.append(new MenuItem({ label: window.siyuan.languages.rename, click() {