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/16051 11

Vanessaad1bce5fe15d
diff --git a/app/src/assets/scss/component/_typography.scss b/app/src/assets/scss/component/_typography.scss
index e045b19741..4f9149c854 100644
--- a/app/src/assets/scss/component/_typography.scss
+++ b/app/src/assets/scss/component/_typography.scss
@@ -229,7 +229,7 @@
}
&-title {
- margin-left: 8px;
+ margin-left: 4px;
font-weight: 500;
font-size: 114%;
opacity: .86;
diff --git a/app/src/boot/globalEvent/mousemove.ts b/app/src/boot/globalEvent/mousemove.ts
index a4932a1b52..f0498813c5 100644
--- a/app/src/boot/globalEvent/mousemove.ts
+++ b/app/src/boot/globalEvent/mousemove.ts
@@ -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;
}
});
diff --git a/app/src/protyle/gutter/index.ts b/app/src/protyle/gutter/index.ts
index 72eb69f406..38ad5b284a 100644
--- a/app/src/protyle/gutter/index.ts
+++ b/app/src/protyle/gutter/index.ts
@@ -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") {
diff --git a/app/src/protyle/ui/initUI.ts b/app/src/protyle/ui/initUI.ts
index f2ae6f938d..9a816b367b 100644
--- a/app/src/protyle/ui/initUI.ts
+++ b/app/src/protyle/ui/initUI.ts
@@ -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;
}