Skip to content

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

:art: fix https://github.com/siyuan-note/siyuan/issues/10085

Vanessa6dd6d7401ae2
diff --git a/app/src/card/openCard.ts b/app/src/card/openCard.ts
index 183e698ca4..38097a507f 100644
--- a/app/src/card/openCard.ts
+++ b/app/src/card/openCard.ts
@@ -17,6 +17,7 @@ import {getDisplayName, movePathTo} from "../util/pathName";
import {App} from "../index";
import {resize} from "../protyle/util/resize";
import {setStorageVal} from "../protyle/util/compatibility";
+import {focusByRange} from "../protyle/util/selection";
const genCardCount = (unreviewedNewCardCount: number, unreviewedOldCardCount: number,) => {
return `<span class="ft__error">1</span>
@@ -493,7 +494,11 @@ export const openCardByData = (app: App, cardsData: {
dialog
});
dialog.editor = editor;
- (dialog.element.querySelector('.b3-button[data-type="-1"]') as HTMLButtonElement).focus();
+ const focusElement = dialog.element.querySelector('.b3-button[data-type="-1"]') as HTMLButtonElement
+ focusElement.focus();
+ const range = document.createRange()
+ range.selectNodeContents(focusElement)
+ focusByRange(range);
};
const nextCard = (options: {