Skip to content

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

fix: 选中文本或块时,禁止添加空块 (#13975)

Jeffrey Chen95f1c08e96bb
diff --git a/app/src/protyle/ui/initUI.ts b/app/src/protyle/ui/initUI.ts
index 85fd82964e..c08f277e41 100644
--- a/app/src/protyle/ui/initUI.ts
+++ b/app/src/protyle/ui/initUI.ts
@@ -115,7 +115,8 @@ export const initUI = (protyle: IProtyle) => {
}, {passive: true});
protyle.contentElement.addEventListener("click", (event: MouseEvent & { target: HTMLElement }) => {
// wysiwyg 元素下方点击无效果 https://github.com/siyuan-note/siyuan/issues/12009
- if (protyle.disabled ||
+ // 选中文本或块时,禁止添加空块 https://github.com/siyuan-note/siyuan/issues/13905
+ if (protyle.disabled || window.getSelection().toString().length > 0 || event.target.querySelector(".protyle-wysiwyg--select") ||
(!event.target.classList.contains("protyle-content") && !event.target.classList.contains("protyle-wysiwyg"))) {
return;
}