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/12139

Vanessa53a22961dcad
diff --git a/app/src/protyle/gutter/index.ts b/app/src/protyle/gutter/index.ts
index cef99bc92c..d2913ae291 100644
--- a/app/src/protyle/gutter/index.ts
+++ b/app/src/protyle/gutter/index.ts
@@ -2545,11 +2545,11 @@ export class Gutter {
}
listItem = topElement.querySelector(".li") || topElement.querySelector(".list");
// 嵌入块中有列表时块标显示位置错误 https://github.com/siyuan-note/siyuan/issues/6254
- if (isInEmbedBlock(listItem) || isInAVBlock(listItem)) {
+ if (isInEmbedBlock(listItem) || isInAVBlock(listItem) || hasClosestByClassName(nodeElement, "callout")) {
listItem = undefined;
}
- // 标题必须显示
- if (topElement !== nodeElement && type !== "NodeHeading" && !topElement.classList.contains("callout")) {
+ // 标题(除列表下的)、提示下的块必须显示
+ if (topElement !== nodeElement && type !== "NodeHeading" && !hasClosestByClassName(nodeElement, "callout")) {
nodeElement = topElement;
parentElement = hasClosestBlock(nodeElement.parentElement);
type = nodeElement.getAttribute("data-type");
@@ -2647,9 +2647,7 @@ data-type="fold" style="cursor:inherit;"><svg style="width: 10px${fold && fold =
const contentTop = protyle.contentElement.getBoundingClientRect().top;
let rect = element.getBoundingClientRect();
let marginHeight = 0;
- if (listItem && !window.siyuan.config.editor.rtl && getComputedStyle(element).direction !== "rtl" &&
- // 提示下有列表
- !element.classList.contains("callout")) {
+ if (listItem && !window.siyuan.config.editor.rtl && getComputedStyle(element).direction !== "rtl") {
rect = listItem.firstElementChild.getBoundingClientRect();
space = 0;
} else if (nodeElement.getAttribute("data-type") === "NodeBlockQueryEmbed") {
diff --git a/app/src/protyle/wysiwyg/remove.ts b/app/src/protyle/wysiwyg/remove.ts
index e0e2f31f91..a7018094b2 100644
--- a/app/src/protyle/wysiwyg/remove.ts
+++ b/app/src/protyle/wysiwyg/remove.ts
@@ -272,7 +272,8 @@ export const removeBlock = async (protyle: IProtyle, blockElement: Element, rang
}
const isCallout = blockElement.parentElement.classList.contains("callout-content");
- if (!blockElement.previousElementSibling && blockType !== "NodeHeading" &&
+ if (!blockElement.previousElementSibling &&
+ (blockType !== "NodeHeading" || (blockType === "NodeHeading" && type === "Delete")) &&
(blockElement.parentElement.getAttribute("data-type") === "NodeBlockquote" || isCallout)) {
if (type !== "Delete") {
range.insertNode(document.createElement("wbr"));
@@ -563,9 +564,13 @@ export const moveToPrevious = (blockElement: Element, range: Range, isDelete: bo
if (isDelete) {
const previousBlockElement = getPreviousBlock(blockElement);
if (previousBlockElement) {
- const previousEditElement = getContenteditableElement(getLastBlock(previousBlockElement));
- if (previousEditElement) {
- return setLastNodeRange(previousEditElement, range, false);
+ if (previousBlockElement.querySelector("wbr")) {
+ return focusByWbr(previousBlockElement, range);
+ } else {
+ const previousEditElement = getContenteditableElement(getLastBlock(previousBlockElement));
+ if (previousEditElement) {
+ return setLastNodeRange(previousEditElement, range, false);
+ }
}
}
}