Skip to content

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

:art: https://github.com/siyuan-note/siyuan/issues/17890

Daniela91c32fbcbf3
diff --git a/app/src/protyle/util/insertHTML.ts b/app/src/protyle/util/insertHTML.ts
index 21b93dd200..38bf5bee3b 100644
--- a/app/src/protyle/util/insertHTML.ts
+++ b/app/src/protyle/util/insertHTML.ts
@@ -460,8 +460,9 @@ export const insertHTML = (html: string, protyle: IProtyle, isBlock = false,
if (tempElement.content.firstChild.nodeType === 3 || (tempElement.content.firstChild.nodeType === 1 && tempElement.content.firstElementChild.tagName !== "DIV")) {
tempElement.innerHTML = protyle.lute.SpinBlockDOM(tempElement.innerHTML);
}
- // 列表项内不允许产生子列表 https://github.com/siyuan-note/siyuan/issues/17890
- if (cursorLiElement) {
+ // 列表项内紧挨标记的第一个段落块不允许产生子列表 https://github.com/siyuan-note/siyuan/issues/17890
+ if (cursorLiElement &&
+ blockElement.previousElementSibling?.classList.contains("protyle-action")) {
const firstBlock = tempElement.content.firstElementChild;
if (firstBlock?.getAttribute("data-type") === "NodeList" ||
firstBlock?.getAttribute("data-type") === "NodeListItem") {
diff --git a/app/src/protyle/wysiwyg/input.ts b/app/src/protyle/wysiwyg/input.ts
index 91b4eab12a..9d05beb140 100644
--- a/app/src/protyle/wysiwyg/input.ts
+++ b/app/src/protyle/wysiwyg/input.ts
@@ -184,8 +184,9 @@ export const input = async (protyle: IProtyle, blockElement: HTMLElement, range:
}
}
html = protyle.lute.SpinBlockDOM(html);
- // 列表项内不允许 SpinBlockDOM 产生新的列表结构 https://github.com/siyuan-note/siyuan/issues/17890
- if (blockElement.closest('[data-type="NodeListItem"]')) {
+ // 列表项内紧挨标记的第一个段落块不允许产生子列表 https://github.com/siyuan-note/siyuan/issues/17890
+ if (blockElement.closest('[data-type="NodeListItem"]') &&
+ blockElement.previousElementSibling?.classList.contains("protyle-action")) {
const tempDiv = document.createElement("div");
tempDiv.innerHTML = html;
const firstChild = tempDiv.firstElementChild;