Vanessa 2025-12-11 12:46:47 +08:00
parent 5795992705
commit ad1bce5fe1
4 changed files with 22 additions and 21 deletions

View file

@ -229,7 +229,7 @@
}
&-title {
margin-left: 8px;
margin-left: 4px;
font-weight: 500;
font-size: 114%;
opacity: .86;

View file

@ -104,15 +104,11 @@ export const windowMouseMove = (event: MouseEvent, mouseIsEnter: boolean) => {
if (!targetBlockElement) {
return;
}
let rowElement: Element;
if (targetBlockElement.classList.contains("av")) {
rowElement = hasClosestByClassName(mouseElement, "av__row") as HTMLElement;
}
const allModels = getAllModels();
let findNode = false;
allModels.editor.find(item => {
if (item.editor.protyle.wysiwyg.element === eventPath0) {
item.editor.protyle.gutter.render(item.editor.protyle, targetBlockElement, item.editor.protyle.wysiwyg.element, rowElement);
item.editor.protyle.gutter.render(item.editor.protyle, targetBlockElement, mouseElement);
findNode = true;
return true;
}
@ -121,7 +117,7 @@ export const windowMouseMove = (event: MouseEvent, mouseIsEnter: boolean) => {
window.siyuan.blockPanels.find(item => {
item.editors.find(eItem => {
if (eItem.protyle.wysiwyg.element.contains(eventPath0)) {
eItem.protyle.gutter.render(eItem.protyle, targetBlockElement, eItem.protyle.wysiwyg.element, rowElement);
eItem.protyle.gutter.render(eItem.protyle, targetBlockElement, mouseElement);
findNode = true;
return true;
}
@ -135,7 +131,7 @@ export const windowMouseMove = (event: MouseEvent, mouseIsEnter: boolean) => {
allModels.backlink.find(item => {
item.editors.find(eItem => {
if (eItem.protyle.wysiwyg.element === eventPath0) {
eItem.protyle.gutter.render(eItem.protyle, targetBlockElement, eItem.protyle.wysiwyg.element, rowElement);
eItem.protyle.gutter.render(eItem.protyle, targetBlockElement, mouseElement);
findNode = true;
return true;
}
@ -162,7 +158,7 @@ export const windowMouseMove = (event: MouseEvent, mouseIsEnter: boolean) => {
let findNode = false;
allModels.editor.find(item => {
if (item.editor.protyle.wysiwyg.element.contains(eventPath0)) {
item.editor.protyle.gutter.render(item.editor.protyle, targetBlockElement, item.editor.protyle.wysiwyg.element);
item.editor.protyle.gutter.render(item.editor.protyle, targetBlockElement);
findNode = true;
return true;
}
@ -171,7 +167,7 @@ export const windowMouseMove = (event: MouseEvent, mouseIsEnter: boolean) => {
window.siyuan.blockPanels.find(item => {
item.editors.find(eItem => {
if (eItem.protyle.wysiwyg.element.contains(eventPath0)) {
eItem.protyle.gutter.render(eItem.protyle, targetBlockElement, eItem.protyle.wysiwyg.element);
eItem.protyle.gutter.render(eItem.protyle, targetBlockElement);
findNode = true;
return true;
}
@ -185,7 +181,7 @@ export const windowMouseMove = (event: MouseEvent, mouseIsEnter: boolean) => {
allModels.backlink.find(item => {
item.editors.find(eItem => {
if (eItem.protyle.wysiwyg.element.contains(eventPath0)) {
eItem.protyle.gutter.render(eItem.protyle, targetBlockElement, eItem.protyle.wysiwyg.element);
eItem.protyle.gutter.render(eItem.protyle, targetBlockElement);
findNode = true;
return true;
}
@ -205,7 +201,7 @@ export const windowMouseMove = (event: MouseEvent, mouseIsEnter: boolean) => {
if (rowElement && !rowElement.classList.contains("av__row--header")) {
getAllEditor().find(item => {
if (item.protyle.wysiwyg.element.contains(eventPath0)) {
item.protyle.gutter.render(item.protyle, eventPath0, item.protyle.wysiwyg.element, rowElement);
item.protyle.gutter.render(item.protyle, eventPath0, rowElement);
return true;
}
});

View file

@ -2468,13 +2468,13 @@ export class Gutter {
};
}
public render(protyle: IProtyle, element: Element, wysiwyg: HTMLElement, target?: Element) {
public render(protyle: IProtyle, element: Element, target?: Element) {
// https://github.com/siyuan-note/siyuan/issues/4659
if (protyle.title && protyle.title.element.getAttribute("data-render") !== "true") {
return;
}
// 防止划选时触碰图标导致 hl 无法移除
const selectElement = wysiwyg.parentElement.parentElement.querySelector(".protyle-select");
const selectElement = protyle.element.querySelector(".protyle-select");
if (selectElement && !selectElement.classList.contains("fn__none")) {
return;
}
@ -2512,8 +2512,12 @@ export class Gutter {
}
if (index === 0) {
// 不单独显示要不然在块的间隔中gutter 会跳来跳去的
if (["NodeBlockquote", "NodeCallout", "NodeList", "NodeSuperBlock"].includes(type)) {
return;
if (["NodeBlockquote", "NodeList", "NodeCallout", "NodeSuperBlock"].includes(type)) {
if (target && type === "NodeCallout" && hasTopClosestByClassName(target, "callout-info")) {
// Callout 标题需显示
} else {
return;
}
}
const topElement = getTopAloneElement(nodeElement);
listItem = topElement.querySelector(".li") || topElement.querySelector(".list");
@ -2522,7 +2526,7 @@ export class Gutter {
listItem = undefined;
}
// 标题必须显示
if (topElement !== nodeElement && type !== "NodeHeading") {
if (topElement !== nodeElement && type !== "NodeHeading" && !topElement.classList.contains("callout")) {
nodeElement = topElement;
parentElement = hasClosestBlock(nodeElement.parentElement);
type = nodeElement.getAttribute("data-type");
@ -2569,7 +2573,8 @@ data-type="fold" style="cursor:inherit;"><svg style="width: 10px${fold && fold =
if (["NodeBlockquote", "NodeCallout"].includes(type)) {
space += 8;
}
if (nodeElement.previousElementSibling && nodeElement.previousElementSibling.getAttribute("data-node-id")) {
if ((nodeElement.previousElementSibling && nodeElement.previousElementSibling.getAttribute("data-node-id")) ||
nodeElement.parentElement.classList.contains("callout-content")) {
// 前一个块存在时,只显示到当前层级
hideParent = true;
// 由于折叠块的第二个子块在界面上不显示,因此移除块标 https://github.com/siyuan-note/siyuan/issues/14304
@ -2615,7 +2620,7 @@ data-type="fold" style="cursor:inherit;"><svg style="width: 10px${fold && fold =
this.element.innerHTML = html;
this.element.classList.remove("fn__none");
this.element.style.width = "";
const contentTop = wysiwyg.parentElement.getBoundingClientRect().top;
const contentTop = protyle.contentElement.getBoundingClientRect().top;
let rect = element.getBoundingClientRect();
let marginHeight = 0;
if (listItem && !window.siyuan.config.editor.rtl && getComputedStyle(element).direction !== "rtl") {

View file

@ -211,10 +211,10 @@ export const initUI = (protyle: IProtyle) => {
}
const embedElement = isInEmbedBlock(nodeElement);
if (embedElement) {
protyle.gutter.render(protyle, embedElement, protyle.wysiwyg.element);
protyle.gutter.render(protyle, embedElement);
return;
}
protyle.gutter.render(protyle, nodeElement, protyle.wysiwyg.element, event.target);
protyle.gutter.render(protyle, nodeElement, event.target);
return;
}