🎨 焦点在关系图上时搜索快捷键报错

This commit is contained in:
Vanessa 2024-11-04 11:25:45 +08:00
parent 54a5d8b76a
commit 3a6ab971e2
3 changed files with 8 additions and 11 deletions

View file

@ -56,7 +56,8 @@
padding: 4px 8px;
color: var(--b3-theme-on-surface);
max-width: 10vw;
word-break: break-all;
white-space: break-spaces;
@include text-clamp(3);
}
}
}

View file

@ -510,10 +510,8 @@ export class Graph extends Model {
// 界面没有渲染时不能进行渲染
return;
}
this.network?.destroy();
if (!this.graphData || !this.graphData.nodes || this.graphData.nodes.length === 0) {
if (this.network) {
this.network.destroy();
}
return;
}
// 使用颜色
@ -567,10 +565,8 @@ export class Graph extends Model {
}
});
addScript(`${Constants.PROTYLE_CDN}/js/vis/vis-network.min.js?v=9.1.2`, "protyleVisScript").then(() => {
this.network?.destroy();
if (!this.graphData || !this.graphData.nodes || this.graphData.nodes.length === 0) {
if (this.network) {
this.network.destroy();
}
return;
}
const config = window.siyuan.config.graph[this.type === "global" ? "global" : "local"];

View file

@ -1,5 +1,5 @@
export const hasClosestByTag = (element: Node, nodeName: string) => {
if (!element) {
if (!element || element.nodeType === 9) {
return false;
}
if (element.nodeType === 3) {
@ -63,7 +63,7 @@ export const hasTopClosestByAttribute = (element: Node, attr: string, value: str
};
export const hasClosestByAttribute = (element: Node, attr: string, value: string | null, top = false) => {
if (!element) {
if (!element || element.nodeType === 9) {
return false;
}
if (element.nodeType === 3) {
@ -92,7 +92,7 @@ export const hasClosestBlock = (element: Node) => {
};
export const hasClosestByMatchTag = (element: Node, nodeName: string) => {
if (!element) {
if (!element || element.nodeType === 9) {
return false;
}
if (element.nodeType === 3) {
@ -111,7 +111,7 @@ export const hasClosestByMatchTag = (element: Node, nodeName: string) => {
};
export const hasClosestByClassName = (element: Node, className: string, top = false) => {
if (!element) {
if (!element || element.nodeType === 9) {
return false;
}
if (element.nodeType === 3) {