mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-17 15:10:12 +01:00
This commit is contained in:
parent
5795992705
commit
ad1bce5fe1
4 changed files with 22 additions and 21 deletions
|
|
@ -229,7 +229,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
&-title {
|
&-title {
|
||||||
margin-left: 8px;
|
margin-left: 4px;
|
||||||
font-weight: 500;
|
font-weight: 500;
|
||||||
font-size: 114%;
|
font-size: 114%;
|
||||||
opacity: .86;
|
opacity: .86;
|
||||||
|
|
|
||||||
|
|
@ -104,15 +104,11 @@ export const windowMouseMove = (event: MouseEvent, mouseIsEnter: boolean) => {
|
||||||
if (!targetBlockElement) {
|
if (!targetBlockElement) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
let rowElement: Element;
|
|
||||||
if (targetBlockElement.classList.contains("av")) {
|
|
||||||
rowElement = hasClosestByClassName(mouseElement, "av__row") as HTMLElement;
|
|
||||||
}
|
|
||||||
const allModels = getAllModels();
|
const allModels = getAllModels();
|
||||||
let findNode = false;
|
let findNode = false;
|
||||||
allModels.editor.find(item => {
|
allModels.editor.find(item => {
|
||||||
if (item.editor.protyle.wysiwyg.element === eventPath0) {
|
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;
|
findNode = true;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
@ -121,7 +117,7 @@ export const windowMouseMove = (event: MouseEvent, mouseIsEnter: boolean) => {
|
||||||
window.siyuan.blockPanels.find(item => {
|
window.siyuan.blockPanels.find(item => {
|
||||||
item.editors.find(eItem => {
|
item.editors.find(eItem => {
|
||||||
if (eItem.protyle.wysiwyg.element.contains(eventPath0)) {
|
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;
|
findNode = true;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
@ -135,7 +131,7 @@ export const windowMouseMove = (event: MouseEvent, mouseIsEnter: boolean) => {
|
||||||
allModels.backlink.find(item => {
|
allModels.backlink.find(item => {
|
||||||
item.editors.find(eItem => {
|
item.editors.find(eItem => {
|
||||||
if (eItem.protyle.wysiwyg.element === eventPath0) {
|
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;
|
findNode = true;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
@ -162,7 +158,7 @@ export const windowMouseMove = (event: MouseEvent, mouseIsEnter: boolean) => {
|
||||||
let findNode = false;
|
let findNode = false;
|
||||||
allModels.editor.find(item => {
|
allModels.editor.find(item => {
|
||||||
if (item.editor.protyle.wysiwyg.element.contains(eventPath0)) {
|
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;
|
findNode = true;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
@ -171,7 +167,7 @@ export const windowMouseMove = (event: MouseEvent, mouseIsEnter: boolean) => {
|
||||||
window.siyuan.blockPanels.find(item => {
|
window.siyuan.blockPanels.find(item => {
|
||||||
item.editors.find(eItem => {
|
item.editors.find(eItem => {
|
||||||
if (eItem.protyle.wysiwyg.element.contains(eventPath0)) {
|
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;
|
findNode = true;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
@ -185,7 +181,7 @@ export const windowMouseMove = (event: MouseEvent, mouseIsEnter: boolean) => {
|
||||||
allModels.backlink.find(item => {
|
allModels.backlink.find(item => {
|
||||||
item.editors.find(eItem => {
|
item.editors.find(eItem => {
|
||||||
if (eItem.protyle.wysiwyg.element.contains(eventPath0)) {
|
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;
|
findNode = true;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
@ -205,7 +201,7 @@ export const windowMouseMove = (event: MouseEvent, mouseIsEnter: boolean) => {
|
||||||
if (rowElement && !rowElement.classList.contains("av__row--header")) {
|
if (rowElement && !rowElement.classList.contains("av__row--header")) {
|
||||||
getAllEditor().find(item => {
|
getAllEditor().find(item => {
|
||||||
if (item.protyle.wysiwyg.element.contains(eventPath0)) {
|
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;
|
return true;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -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
|
// https://github.com/siyuan-note/siyuan/issues/4659
|
||||||
if (protyle.title && protyle.title.element.getAttribute("data-render") !== "true") {
|
if (protyle.title && protyle.title.element.getAttribute("data-render") !== "true") {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// 防止划选时触碰图标导致 hl 无法移除
|
// 防止划选时触碰图标导致 hl 无法移除
|
||||||
const selectElement = wysiwyg.parentElement.parentElement.querySelector(".protyle-select");
|
const selectElement = protyle.element.querySelector(".protyle-select");
|
||||||
if (selectElement && !selectElement.classList.contains("fn__none")) {
|
if (selectElement && !selectElement.classList.contains("fn__none")) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -2512,8 +2512,12 @@ export class Gutter {
|
||||||
}
|
}
|
||||||
if (index === 0) {
|
if (index === 0) {
|
||||||
// 不单独显示,要不然在块的间隔中,gutter 会跳来跳去的
|
// 不单独显示,要不然在块的间隔中,gutter 会跳来跳去的
|
||||||
if (["NodeBlockquote", "NodeCallout", "NodeList", "NodeSuperBlock"].includes(type)) {
|
if (["NodeBlockquote", "NodeList", "NodeCallout", "NodeSuperBlock"].includes(type)) {
|
||||||
return;
|
if (target && type === "NodeCallout" && hasTopClosestByClassName(target, "callout-info")) {
|
||||||
|
// Callout 标题需显示
|
||||||
|
} else {
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
const topElement = getTopAloneElement(nodeElement);
|
const topElement = getTopAloneElement(nodeElement);
|
||||||
listItem = topElement.querySelector(".li") || topElement.querySelector(".list");
|
listItem = topElement.querySelector(".li") || topElement.querySelector(".list");
|
||||||
|
|
@ -2522,7 +2526,7 @@ export class Gutter {
|
||||||
listItem = undefined;
|
listItem = undefined;
|
||||||
}
|
}
|
||||||
// 标题必须显示
|
// 标题必须显示
|
||||||
if (topElement !== nodeElement && type !== "NodeHeading") {
|
if (topElement !== nodeElement && type !== "NodeHeading" && !topElement.classList.contains("callout")) {
|
||||||
nodeElement = topElement;
|
nodeElement = topElement;
|
||||||
parentElement = hasClosestBlock(nodeElement.parentElement);
|
parentElement = hasClosestBlock(nodeElement.parentElement);
|
||||||
type = nodeElement.getAttribute("data-type");
|
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)) {
|
if (["NodeBlockquote", "NodeCallout"].includes(type)) {
|
||||||
space += 8;
|
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;
|
hideParent = true;
|
||||||
// 由于折叠块的第二个子块在界面上不显示,因此移除块标 https://github.com/siyuan-note/siyuan/issues/14304
|
// 由于折叠块的第二个子块在界面上不显示,因此移除块标 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.innerHTML = html;
|
||||||
this.element.classList.remove("fn__none");
|
this.element.classList.remove("fn__none");
|
||||||
this.element.style.width = "";
|
this.element.style.width = "";
|
||||||
const contentTop = wysiwyg.parentElement.getBoundingClientRect().top;
|
const contentTop = protyle.contentElement.getBoundingClientRect().top;
|
||||||
let rect = element.getBoundingClientRect();
|
let rect = element.getBoundingClientRect();
|
||||||
let marginHeight = 0;
|
let marginHeight = 0;
|
||||||
if (listItem && !window.siyuan.config.editor.rtl && getComputedStyle(element).direction !== "rtl") {
|
if (listItem && !window.siyuan.config.editor.rtl && getComputedStyle(element).direction !== "rtl") {
|
||||||
|
|
|
||||||
|
|
@ -211,10 +211,10 @@ export const initUI = (protyle: IProtyle) => {
|
||||||
}
|
}
|
||||||
const embedElement = isInEmbedBlock(nodeElement);
|
const embedElement = isInEmbedBlock(nodeElement);
|
||||||
if (embedElement) {
|
if (embedElement) {
|
||||||
protyle.gutter.render(protyle, embedElement, protyle.wysiwyg.element);
|
protyle.gutter.render(protyle, embedElement);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
protyle.gutter.render(protyle, nodeElement, protyle.wysiwyg.element, event.target);
|
protyle.gutter.render(protyle, nodeElement, event.target);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue