Skip to content

An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作

:sparkles: https://github.com/siyuan-note/siyuan/issues/8665

Vanessa79842fc79326
diff --git a/app/src/protyle/hint/index.ts b/app/src/protyle/hint/index.ts
index 2595e8c9b3..2a9546120b 100644
--- a/app/src/protyle/hint/index.ts
+++ b/app/src/protyle/hint/index.ts
@@ -278,8 +278,16 @@ ${unicode2Emoji(emoji.unicode)}</button>`;
this.element.classList.remove("hint--menu");
}
this.element.style.width = Math.max(protyle.element.clientWidth / 2, 320) + "px";
- const textareaPosition = getSelectionPosition(protyle.wysiwyg.element);
- setPosition(this.element, textareaPosition.left, textareaPosition.top + 26, 30);
+ if (this.source === "av") {
+ const blockElement = hasClosestBlock(protyle.toolbar.range.startContainer)
+ if (blockElement) {
+ const rowAddRect = blockElement.querySelector(".av__row--add").getBoundingClientRect();
+ setPosition(this.element, rowAddRect.left, rowAddRect.bottom, rowAddRect.height);
+ }
+ } else {
+ const textareaPosition = getSelectionPosition(protyle.wysiwyg.element);
+ setPosition(this.element, textareaPosition.left, textareaPosition.top + 26, 30);
+ }
this.element.scrollTop = 0;
this.bindUploadEvent(protyle, this.element);
if (this.source !== "hint") {
diff --git a/app/src/protyle/render/av/action.ts b/app/src/protyle/render/av/action.ts
index e91e1b5e6f..c9a960a45e 100644
--- a/app/src/protyle/render/av/action.ts
+++ b/app/src/protyle/render/av/action.ts
@@ -131,7 +131,8 @@ export const avClick = (protyle: IProtyle, event: MouseEvent & { target: HTMLEle
const addRowElement = hasClosestByClassName(event.target, "av__row--add");
if (addRowElement) {
- (blockElement.querySelector(".av__title") as HTMLInputElement).focus()
+ protyle.toolbar.range = document.createRange()
+ protyle.toolbar.range.selectNodeContents(blockElement.querySelector(".av__title"));
hintRef("", protyle, "av");
event.preventDefault();
event.stopPropagation();