Skip to content

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

:bug: Fix callout click caret placement https://github.com/siyuan-note/siyuan/issues/16310

Daniel608c8feab285
diff --git a/app/src/protyle/wysiwyg/index.ts b/app/src/protyle/wysiwyg/index.ts
index 56365f707d..689227ceb4 100644
--- a/app/src/protyle/wysiwyg/index.ts
+++ b/app/src/protyle/wysiwyg/index.ts
@@ -4313,6 +4313,13 @@ export class WYSIWYG {
setTimeout(() => {
// 选中后,在选中的文字上点击需等待 range 更新
let newRange = getEditorRange(this.element);
+ const calloutElement = ["callout", "callout-info", "callout-content"].some(className =>
+ event.target.classList.contains(className)) ? hasClosestBlock(event.target) : false;
+ if (!protyle.disabled && !event.shiftKey && !ctrlIsPressed && calloutElement) {
+ // 提示块结构区域不可编辑,点击后将光标定位到首个可编辑子块
+ // https://github.com/siyuan-note/siyuan/issues/16310
+ newRange = focusBlock(calloutElement) || newRange;
+ }
// 表格中点击两侧或间隙导致光标跳转到开头 https://github.com/siyuan-note/siyuan/issues/16179
if (event.target.classList.contains("protyle-wysiwyg") || event.target.parentElement?.classList.contains("table")) {
const rect = this.element.getBoundingClientRect();