An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作
TypeScript agentic-aiai-agentknowledge-baselocal-firstmarkdownmcpmindmapnote-takingself-hostedsiyuanworkspace
:art: Improve slash menu (#15906)
Jeffrey Chene259626ce51e
diff --git a/app/src/protyle/hint/index.ts b/app/src/protyle/hint/index.tsindex 697e5c8a3c..0d77970c09 100644--- a/app/src/protyle/hint/index.ts+++ b/app/src/protyle/hint/index.ts@@ -10,7 +10,7 @@ import {} from "../util/selection";import {genHintItemHTML, hintEmbed, hintRef, hintSlash} from "./extend";import {getSavePath, newFile} from "../../util/newFile";-import {upDownHint} from "../../util/upDownHint";+import {isAbnormalItem, upDownHint} from "../../util/upDownHint";import {setPosition} from "../../util/setPosition";import {getContenteditableElement, hasNextSibling, hasPreviousSibling} from "../wysiwyg/getBlock";import {transaction, updateTransaction} from "../wysiwyg/transaction";@@ -290,6 +290,14 @@ ${unicode2Emoji(emoji.unicode)}</button>`;/// #endif}this.element.scrollTop = 0;+ let currentHintElement = this.element.querySelector(".b3-list-item--focus") as HTMLElement;+ if (isAbnormalItem(currentHintElement, "b3-list-item")) {+ currentHintElement.classList.remove("b3-list-item--focus");+ do {+ currentHintElement = currentHintElement.nextElementSibling as HTMLElement;+ } while (isAbnormalItem(currentHintElement, "b3-list-item"));+ currentHintElement?.classList.add("b3-list-item--focus");+ }this.bindUploadEvent(protyle, this.element);if (this.source !== "hint") {const searchElement = this.element.querySelector("input.b3-text-field") as HTMLInputElement;diff --git a/app/src/util/upDownHint.ts b/app/src/util/upDownHint.tsindex 1b32684a2f..78299072ad 100644--- a/app/src/util/upDownHint.ts+++ b/app/src/util/upDownHint.ts@@ -1,5 +1,5 @@export const isAbnormalItem = (currentHintElement: HTMLElement, className: string) => {- return !currentHintElement || !currentHintElement.classList.contains(className) || currentHintElement.getBoundingClientRect().height === 0;+ return currentHintElement && (!currentHintElement.classList.contains(className) || currentHintElement.getBoundingClientRect().height === 0);};export const upDownHint = (listElement: Element, event: KeyboardEvent, classActiveName = "b3-list-item--focus", defaultElement?: Element) => {