Vanessa 2026-01-15 19:06:18 +08:00
parent 669ccfc602
commit 53a22961dc
2 changed files with 13 additions and 10 deletions

View file

@ -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") {

View file

@ -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);
}
}
}
}