From 192db4f306c64ee62fcf644662eeaad0b779fc84 Mon Sep 17 00:00:00 2001 From: Vanessa Date: Sat, 20 Sep 2025 14:49:12 +0800 Subject: [PATCH 1/5] :art: https://github.com/siyuan-note/siyuan/issues/15864 --- app/src/protyle/wysiwyg/keydown.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/src/protyle/wysiwyg/keydown.ts b/app/src/protyle/wysiwyg/keydown.ts index 2492518b4..c0147de73 100644 --- a/app/src/protyle/wysiwyg/keydown.ts +++ b/app/src/protyle/wysiwyg/keydown.ts @@ -860,7 +860,8 @@ export const keydown = (protyle: IProtyle, editorElement: HTMLElement) => { const nextBlockElement = hasClosestBlock(nextRange.startContainer); if (nextBlockElement && (!nextBlockElement.classList.contains("code-block") || - (nextBlockElement.classList.contains("code-block") && getContenteditableElement(nextBlockElement).textContent == "\n")) + (nextBlockElement.classList.contains("code-block") && + (getContenteditableElement(nextBlockElement).textContent == "\n") || nextBlockElement.parentElement.classList.contains("li"))) ) { // 反向删除合并为一个块时,光标应保持在尾部 https://github.com/siyuan-note/siyuan/issues/14290#issuecomment-2849810529 cloneRange.insertNode(document.createElement("wbr")); From 690dcb5899aa6e13953aca771f786306073fb98d Mon Sep 17 00:00:00 2001 From: Vanessa Date: Sat, 20 Sep 2025 15:14:07 +0800 Subject: [PATCH 2/5] :art: https://github.com/siyuan-note/siyuan/issues/15797 --- app/src/protyle/gutter/index.ts | 10 ++++++++-- app/src/protyle/util/insertHTML.ts | 20 -------------------- 2 files changed, 8 insertions(+), 22 deletions(-) diff --git a/app/src/protyle/gutter/index.ts b/app/src/protyle/gutter/index.ts index 91d10ab3d..30f55fd2a 100644 --- a/app/src/protyle/gutter/index.ts +++ b/app/src/protyle/gutter/index.ts @@ -1682,7 +1682,10 @@ export class Gutter { icon: "iconCopy", label: `${window.siyuan.languages.copy} ${window.siyuan.languages.headings1}`, click() { - fetchPost("/api/block/getHeadingChildrenDOM", {id, removeFoldAttr: false}, (response) => { + fetchPost("/api/block/getHeadingChildrenDOM", { + id, + removeFoldAttr: nodeElement.getAttribute("fold") !== "1" + }, (response) => { if (isInAndroid()) { window.JSAndroid.writeHTMLClipboard(protyle.lute.BlockDOM2StdMd(response.data).trimEnd(), response.data + Constants.ZWSP); } else if (isInHarmony()) { @@ -1698,7 +1701,10 @@ export class Gutter { icon: "iconCut", label: `${window.siyuan.languages.cut} ${window.siyuan.languages.headings1}`, click() { - fetchPost("/api/block/getHeadingChildrenDOM", {id, removeFoldAttr: false}, (response) => { + fetchPost("/api/block/getHeadingChildrenDOM", { + id, + removeFoldAttr: nodeElement.getAttribute("fold") !== "1" + }, (response) => { if (isInAndroid()) { window.JSAndroid.writeHTMLClipboard(protyle.lute.BlockDOM2StdMd(response.data).trimEnd(), response.data + Constants.ZWSP); } else if (isInHarmony()) { diff --git a/app/src/protyle/util/insertHTML.ts b/app/src/protyle/util/insertHTML.ts index f907a1fbf..2b92d7360 100644 --- a/app/src/protyle/util/insertHTML.ts +++ b/app/src/protyle/util/insertHTML.ts @@ -450,26 +450,6 @@ 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); } - // let foldHeadingId = ""; - // let foldHTML = ""; - // 粘贴内容中包含折叠的子节点需后端插入到原节点中 - // Array.from(tempElement.content.children).forEach((item) => { - // if (!item.getAttribute("parent-heading") && foldHeadingId && foldHTML) { - // fetchPost("/api/block/appendHeadingChildren", {id: foldHeadingId, dom: foldHTML}); - // foldHeadingId = ""; - // foldHTML = ""; - // } - // if (item.getAttribute("data-type") === "NodeHeading" && item.getAttribute("fold") === "1") { - // foldHeadingId = item.getAttribute("data-node-id"); - // return true; - // } - // if (foldHeadingId && item.getAttribute("parent-heading")) { - // foldHTML += item.outerHTML; - // } - // }); - // if (foldHeadingId && foldHTML) { - // fetchPost("/api/block/appendHeadingChildren", {id: foldHeadingId, dom: foldHTML}); - // } (insertBefore ? Array.from(tempElement.content.children) : Array.from(tempElement.content.children).reverse()).find((item) => { let addId = item.getAttribute("data-node-id"); const hasParentHeading = item.getAttribute("parent-heading"); From f34d8022b85d27d4689b3de457d12d158f679fe6 Mon Sep 17 00:00:00 2001 From: Vanessa Date: Sat, 20 Sep 2025 15:55:33 +0800 Subject: [PATCH 3/5] :art: https://github.com/siyuan-note/siyuan/pull/15876 --- app/src/protyle/render/av/relation.ts | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/app/src/protyle/render/av/relation.ts b/app/src/protyle/render/av/relation.ts index a08082359..8fdd33ffd 100644 --- a/app/src/protyle/render/av/relation.ts +++ b/app/src/protyle/render/av/relation.ts @@ -252,13 +252,13 @@ export const toggleUpdateRelationBtn = (menuItemsElement: HTMLElement, avId: str }; const updateCopyRelatedItems = (menuElement: Element) => { - const inputElement = menuElement.querySelector(".b3-form__icona .b3-text-field"); + const inputElement = menuElement.querySelector(".b3-form__icona .b3-text-field") as HTMLInputElement; if (menuElement.querySelector(".b3-menu__icon.fn__grab")) { inputElement.nextElementSibling.classList.remove("fn__none"); - inputElement.classList.add("b3-form__icona-input"); + inputElement.style.paddingRight = "26px"; } else { inputElement.nextElementSibling.classList.add("fn__none"); - inputElement.classList.remove("b3-form__icona-input"); + inputElement.style.paddingRight = ""; } }; @@ -326,13 +326,14 @@ draggable="true">${genSelectItemHTML({ }); } }); + const refElement = menuElement.querySelector(".popover__block"); menuElement.querySelector(".b3-menu__items").innerHTML = `${selectHTML} ${html} ${keyword ? genSelectItemHTML({ type: "empty", newName: Lute.EscapeHTMLStr(keyword), - text: menuElement.querySelector(".popover__block").outerHTML + text: `${refElement.textContent}`, }) : (html ? "" : genSelectItemHTML({type: "empty"}))}`; menuElement.querySelector(".b3-menu__items .b3-menu__item:not(.fn__none)").classList.add("b3-menu__item--current"); updateCopyRelatedItems(menuElement); @@ -410,7 +411,7 @@ ${html || genSelectItemHTML({type: "empty"})}`; event.stopPropagation(); filterItem(options.menuElement, options.cellElements[0], inputElement.value); }); - updateCopyRelatedItems(options.menuElement) + updateCopyRelatedItems(options.menuElement); options.menuElement.querySelector('[data-type="copyRelatedItems"]').addEventListener("click", () => { let copyText = ""; const selectedElements = options.menuElement.querySelectorAll('.b3-menu__item[draggable="true"]'); @@ -444,9 +445,9 @@ export const getRelationHTML = (data: IAV, cellElements?: HTMLElement[]) => { if (colRelationData && colRelationData.avID) { return `
-
- - +
+ +
From c4aee4d601ecef7052fc1564ed0558d2af58287e Mon Sep 17 00:00:00 2001 From: Vanessa Date: Sat, 20 Sep 2025 16:46:50 +0800 Subject: [PATCH 4/5] :art: https://github.com/siyuan-note/siyuan/issues/15885 --- app/src/layout/util.ts | 2 +- app/src/protyle/scroll/saveScroll.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/src/layout/util.ts b/app/src/layout/util.ts index f2c1ca878..0229521a8 100644 --- a/app/src/layout/util.ts +++ b/app/src/layout/util.ts @@ -578,7 +578,7 @@ export const layoutToJSON = (layout: Layout | Wnd | Tab | Model, json: any, brea json.blockId = layout.editor.protyle.block.id; json.rootId = layout.editor.protyle.block.rootID; json.mode = layout.editor.protyle.preview.element.classList.contains("fn__none") ? "wysiwyg" : "preview"; - json.action = layout.editor.protyle.block.showAll ? Constants.CB_GET_ALL : Constants.CB_GET_SCROLL; + json.action = (layout.editor.protyle.block.showAll && layout.editor.protyle.block.id !== layout.editor.protyle.block.rootID) ? Constants.CB_GET_ALL : Constants.CB_GET_SCROLL; json.instance = "Editor"; } else if (layout instanceof Asset) { json.path = layout.path; diff --git a/app/src/protyle/scroll/saveScroll.ts b/app/src/protyle/scroll/saveScroll.ts index d85aaca14..f4a69cf05 100644 --- a/app/src/protyle/scroll/saveScroll.ts +++ b/app/src/protyle/scroll/saveScroll.ts @@ -67,7 +67,7 @@ export const getDocByScroll = (options: { actions = [Constants.CB_GET_UNUNDO]; } } - if (options.scrollAttr?.zoomInId) { + if (options.scrollAttr?.zoomInId && options.scrollAttr?.rootId && options.scrollAttr.zoomInId !== options.scrollAttr.rootId) { fetchPost("/api/filetree/getDoc", { id: options.scrollAttr.zoomInId, size: Constants.SIZE_GET_MAX, From 2f9d2afcd3971026aea4bb8f106552004654d7b6 Mon Sep 17 00:00:00 2001 From: Vanessa Date: Sat, 20 Sep 2025 17:02:11 +0800 Subject: [PATCH 5/5] :art: https://github.com/siyuan-note/siyuan/issues/15885 --- app/src/layout/util.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/app/src/layout/util.ts b/app/src/layout/util.ts index 0229521a8..85f1d0c5b 100644 --- a/app/src/layout/util.ts +++ b/app/src/layout/util.ts @@ -744,13 +744,20 @@ export const newModelByInitData = (app: App, tab: Tab, json: any) => { }); } } else if (json.instance === "Editor") { + if (json.rootId === json.blockId && json.action) { + if (typeof json.action === "string") { + json.action = json.action.replace(Constants.CB_GET_ALL, ""); + } else if (typeof json.action === "object" && Array.isArray(json.action)) { + json.action = json.action.filter((item: string) => item !== Constants.CB_GET_ALL); + } + } model = new Editor({ app, tab, rootId: json.rootId, blockId: json.blockId, mode: json.mode, - action: typeof json.action === "string" ? [json.action, Constants.CB_GET_FOCUS] : json.action.concat(Constants.CB_GET_FOCUS), + action: typeof json.action === "string" ? (json.action ? [json.action, Constants.CB_GET_FOCUS] : [Constants.CB_GET_FOCUS]) : json.action.concat(Constants.CB_GET_FOCUS), }); } return model;