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/13343

Vanessa04806ea4b98b
diff --git a/app/src/history/history.ts b/app/src/history/history.ts
index 07acd9d3a3..9a0605108b 100644
--- a/app/src/history/history.ts
+++ b/app/src/history/history.ts
@@ -695,14 +695,14 @@ const bindEvent = (app: App, element: Element, dialog?: Dialog) => {
} else if (type === "doc") {
fetchPost("/api/history/getDocHistoryContent", {
historyPath: dataPath,
- highlight: CSS && CSS.highlights,
+ highlight: CSS && CSS.highlights ? true : false,
k: (firstPanelElement.querySelector(".b3-text-field") as HTMLInputElement).value
}, (response) => {
if (response.data.isLargeDoc) {
mdElement.value = response.data.content;
mdElement.classList.remove("fn__none");
docElement.classList.add("fn__none");
- searchTextMarkRender(mdElement, []);
+ searchTextMarkRender(mdElement, []);
} else {
mdElement.classList.add("fn__none");
docElement.classList.remove("fn__none");
@@ -712,7 +712,7 @@ const bindEvent = (app: App, element: Element, dialog?: Dialog) => {
protyle: historyEditor.protyle,
action: [Constants.CB_GET_HISTORY, Constants.CB_GET_HTML],
});
- searchMarkRender(historyEditor.protyle, historyEditor.protyle.wysiwyg.element.querySelectorAll('span[data-type~="search-mark"]'));
+ searchMarkRender(historyEditor.protyle, historyEditor.protyle.wysiwyg.element.querySelectorAll('span[data-type~="search-mark"]'));
}
});
}
diff --git a/app/src/layout/dock/Backlink.ts b/app/src/layout/dock/Backlink.ts
index 536e85f60f..6ca2288ca5 100644
--- a/app/src/layout/dock/Backlink.ts
+++ b/app/src/layout/dock/Backlink.ts
@@ -437,7 +437,7 @@ export class Backlink extends Model {
fetchPost(isMention ? "/api/ref/getBackmentionDoc" : "/api/ref/getBacklinkDoc", {
defID: this.blockId,
refTreeID: docId,
- highlight: CSS && CSS.highlights,
+ highlight: CSS && CSS.highlights ? true : false,
keyword: isMention ? this.inputsElement[1].value : this.inputsElement[0].value,
}, (response) => {
svgElement.removeAttribute("disabled");
diff --git a/app/src/protyle/render/searchMarkRender.ts b/app/src/protyle/render/searchMarkRender.ts
index ad966278a9..c9c527da27 100644
--- a/app/src/protyle/render/searchMarkRender.ts
+++ b/app/src/protyle/render/searchMarkRender.ts
@@ -30,5 +30,7 @@ export const searchMarkRender = (protyle: IProtyle, matchElements: NodeListOf<El
export const searchTextMarkRender = (element: HTMLElement, k: string[]) => {
-
+ if (!CSS || !CSS.highlights) {
+ return;
+ }
}
diff --git a/app/src/protyle/scroll/saveScroll.ts b/app/src/protyle/scroll/saveScroll.ts
index ac1c1177c6..f06761c699 100644
--- a/app/src/protyle/scroll/saveScroll.ts
+++ b/app/src/protyle/scroll/saveScroll.ts
@@ -73,7 +73,7 @@ export const getDocByScroll = (options: {
query: options.protyle.query?.key,
queryMethod: options.protyle.query?.method,
queryTypes: options.protyle.query?.types,
- highlight: CSS && CSS.highlights,
+ highlight: CSS && CSS.highlights ? true : false,
}, response => {
if (response.code === 1) {
fetchPost("/api/filetree/getDoc", {
@@ -81,7 +81,7 @@ export const getDocByScroll = (options: {
query: options.protyle.query?.key,
queryMethod: options.protyle.query?.method,
queryTypes: options.protyle.query?.types,
- highlight: CSS && CSS.highlights,
+ highlight: CSS && CSS.highlights ? true : false,
}, response => {
onGet({
data: response,
@@ -113,7 +113,7 @@ export const getDocByScroll = (options: {
query: options.protyle.query?.key,
queryMethod: options.protyle.query?.method,
queryTypes: options.protyle.query?.types,
- highlight: CSS && CSS.highlights,
+ highlight: CSS && CSS.highlights ? true : false,
}, response => {
onGet({
data: response,
diff --git a/app/src/protyle/util/reload.ts b/app/src/protyle/util/reload.ts
index 852601a383..1e0ecdf736 100644
--- a/app/src/protyle/util/reload.ts
+++ b/app/src/protyle/util/reload.ts
@@ -40,7 +40,7 @@ export const reloadProtyle = (protyle: IProtyle, focus: boolean, updateReadonly?
fetchPost(isMention ? "/api/ref/getBackmentionDoc" : "/api/ref/getBacklinkDoc", {
defID: protyle.element.getAttribute("data-defid"),
refTreeID: protyle.block.rootID,
- highlight: CSS && CSS.highlights,
+ highlight: CSS && CSS.highlights ? true : false,
keyword: isMention ? inputsElement[1].value : inputsElement[0].value,
}, response => {
protyle.options.backlinkData = isMention ? response.data.backmentions : response.data.backlinks;
diff --git a/app/src/search/util.ts b/app/src/search/util.ts
index e23ce29093..e64d0beaff 100644
--- a/app/src/search/util.ts
+++ b/app/src/search/util.ts
@@ -1221,7 +1221,7 @@ export const getArticle = (options: {
mode: zoomIn ? 0 : 3,
size: zoomIn ? Constants.SIZE_GET_MAX : window.siyuan.config.editor.dynamicLoadBlocks,
zoom: zoomIn,
- highlight: CSS && CSS.highlights,
+ highlight:CSS && CSS.highlights ? true : false,
}, getResponse => {
options.edit.protyle.query = {
key: options.value || null,