Skip to content

An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作

:art: fix https://github.com/siyuan-note/siyuan/issues/7609

Vanessabbd1333f9372
diff --git a/app/src/ai/actions.ts b/app/src/ai/actions.ts
index c3c5116f7f..85b7c6a26d 100644
--- a/app/src/ai/actions.ts
+++ b/app/src/ai/actions.ts
@@ -6,10 +6,10 @@ import {Dialog} from "../dialog";
import {isMobile} from "../util/functions";
export const AIActions = (elements: Element[], protyle: IProtyle) => {
- const ids: string[] = []
+ const ids: string[] = [];
elements.forEach(item => {
- ids.push(item.getAttribute("data-node-id"))
- })
+ ids.push(item.getAttribute("data-node-id"));
+ });
window.siyuan.menus.menu.append(new MenuItem({
icon: "iconSparkles",
label: window.siyuan.languages.ai,
@@ -136,4 +136,4 @@ export const AIActions = (elements: Element[], protyle: IProtyle) => {
}
}]
}).element);
-}
+};
diff --git a/app/src/ai/chat.ts b/app/src/ai/chat.ts
index fa481dfacc..a68c5ab3b2 100644
--- a/app/src/ai/chat.ts
+++ b/app/src/ai/chat.ts
@@ -36,4 +36,4 @@ export const AIChat = (protyle:IProtyle) => {
insertHTML(`${inputElement.value}${respContent}`, protyle, true);
});
});
-}
+};
diff --git a/app/src/layout/Tab.ts b/app/src/layout/Tab.ts
index 885baa6c84..66b1baf6c2 100644
--- a/app/src/layout/Tab.ts
+++ b/app/src/layout/Tab.ts
@@ -4,7 +4,7 @@ import {Model} from "./Model";
import {Editor} from "../editor";
import {hasClosestByTag} from "../protyle/util/hasClosest";
import {Constants} from "../constants";
-import {escapeHtml} from "../util/escape";
+import {escapeGreat, escapeHtml} from "../util/escape";
import {unicode2Emoji} from "../emoji";
import {fetchPost} from "../util/fetch";
import {showTooltip} from "../dialog/tooltip";
@@ -63,9 +63,9 @@ export class Tab {
id
}, (response) => {
if (!this.headElement.getAttribute("aria-label")) {
- showTooltip(escapeHtml(response.data), this.headElement);
+ showTooltip(escapeGreat(response.data), this.headElement);
}
- this.headElement.setAttribute("aria-label", escapeHtml(response.data));
+ this.headElement.setAttribute("aria-label", escapeGreat(response.data));
});
}
});
@@ -79,7 +79,7 @@ export class Tab {
const tabElement = hasClosestByTag(event.target, "LI");
if (tabElement) {
event.dataTransfer.setData("text/html", tabElement.outerHTML);
- const modeJSON = {id:this.id};
+ const modeJSON = {id: this.id};
layoutToJSON(this, modeJSON);
event.dataTransfer.setData(Constants.SIYUAN_DROP_TAB, JSON.stringify(modeJSON));
event.dataTransfer.dropEffect = "move";
diff --git a/app/src/menus/protyle.ts b/app/src/menus/protyle.ts
index 6a66e2c89a..d906456a9b 100644
--- a/app/src/menus/protyle.ts
+++ b/app/src/menus/protyle.ts
@@ -969,9 +969,9 @@ const genImageWidthMenu = (label: string, assetElement: HTMLElement, imgElement:
assetElement.style.width = "";
assetElement.style.maxWidth = "";
} else {
- assetElement.removeAttribute("style")
+ assetElement.removeAttribute("style");
}
- imgElement.removeAttribute("style")
+ imgElement.removeAttribute("style");
} else {
assetElement.style.width = label;
assetElement.style.maxWidth = "";
diff --git a/app/src/mobile/util/MobileBackFoward.ts b/app/src/mobile/util/MobileBackFoward.ts
index 12aba4a047..4950916f8f 100644
--- a/app/src/mobile/util/MobileBackFoward.ts
+++ b/app/src/mobile/util/MobileBackFoward.ts
@@ -111,7 +111,7 @@ export const goForward = () => {
export const goBack = () => {
if (window.JSAndroid) {
if (window.siyuan.menus.menu.element.classList.contains("b3-menu--fullscreen") && !window.siyuan.menus.menu.element.classList.contains("fn__none")) {
- window.siyuan.menus.menu.element.dispatchEvent(new CustomEvent("click", {detail: "back"}))
+ window.siyuan.menus.menu.element.dispatchEvent(new CustomEvent("click", {detail: "back"}));
return;
} else if (window.siyuan.backStack.length < 1) {
window.JSAndroid.returnDesktop();
diff --git a/app/src/util/escape.ts b/app/src/util/escape.ts
index b1f15839b1..214377cda1 100644
--- a/app/src/util/escape.ts
+++ b/app/src/util/escape.ts
@@ -2,6 +2,10 @@ export const escapeHtml = (html: string) => {
return html.replace(/&/g, "&amp;").replace(/</g, "&lt;");
};
+export const escapeGreat = (html: string) => {
+ return html.replace(/</g, "&lt;");
+};
+
export const escapeAttr = (html: string) => {
return html.replace(/"/g, "&quot;").replace(/'/g, "&apos;");
};