Skip to content

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

:rotating_light:

Vanessa0152459bb9cd
diff --git a/app/src/config/util/snippets.ts b/app/src/config/util/snippets.ts
index b40af7e19f..1fd66e0efc 100644
--- a/app/src/config/util/snippets.ts
+++ b/app/src/config/util/snippets.ts
@@ -111,9 +111,9 @@ export const openSnippets = () => {
});
fetchPost("/api/snippet/setSnippet", {snippets}, () => {
removeIds.forEach(item => {
- const rmElement = document.querySelector(item)
+ const rmElement = document.querySelector(item);
if (rmElement) {
- rmElement.remove()
+ rmElement.remove();
}
});
renderSnippet();
@@ -138,8 +138,8 @@ export const openSnippets = () => {
}
const removeElement = hasClosestByClassName(target, "b3-tooltips");
if (removeElement) {
- const itemElement = removeElement.parentElement.parentElement
- removeIds.push("#snippet" + (itemElement.getAttribute("data-type") === "css" ? "CSS" : "JS") + itemElement.getAttribute("data-id"))
+ const itemElement = removeElement.parentElement.parentElement;
+ removeIds.push("#snippet" + (itemElement.getAttribute("data-type") === "css" ? "CSS" : "JS") + itemElement.getAttribute("data-id"));
itemElement.nextElementSibling.remove();
itemElement.remove();
}
diff --git a/app/src/protyle/toolbar/index.ts b/app/src/protyle/toolbar/index.ts
index ca088b1551..41961fb4eb 100644
--- a/app/src/protyle/toolbar/index.ts
+++ b/app/src/protyle/toolbar/index.ts
@@ -27,7 +27,7 @@ import {blockRender} from "../markdown/blockRender";
import {openBy} from "../../editor/util";
/// #endif
import {fetchPost} from "../../util/fetch";
-import {isArrayEqual, isBrowser, isMobile} from "../../util/functions";
+import {isArrayEqual, isMobile} from "../../util/functions";
import * as dayjs from "dayjs";
import {insertEmptyBlock} from "../../block/util";
import {matchHotKey} from "../util/hotKey";
diff --git a/app/src/protyle/wysiwyg/move.ts b/app/src/protyle/wysiwyg/move.ts
index cfcb62f8f4..f6007393e2 100644
--- a/app/src/protyle/wysiwyg/move.ts
+++ b/app/src/protyle/wysiwyg/move.ts
@@ -33,7 +33,7 @@ export const moveToUp = (protyle: IProtyle, nodeElement: HTMLElement, range: Ran
if (!previousElement) {
const newId = Lute.NewNodeID();
sourceElements[0].parentElement.parentElement.previousElementSibling.lastElementChild.insertAdjacentHTML("beforebegin", `<div data-subtype="${sourceElements[0].getAttribute("data-subtype")}" data-node-id="${newId}" data-type="NodeList" class="list" updated="${newId.split("-")[0]}"><div id="moveTempLi"></div><div class="protyle-attr" contenteditable="false">&ZeroWidthSpace;</div></div>`);
- previousElement = sourceElements[0].parentElement.parentElement.previousElementSibling.querySelector(".list")
+ previousElement = sourceElements[0].parentElement.parentElement.previousElementSibling.querySelector(".list");
}
} else {
return;
@@ -48,7 +48,7 @@ export const moveToUp = (protyle: IProtyle, nodeElement: HTMLElement, range: Ran
if (!previousElement) {
const newId = Lute.NewNodeID();
sourceElements[0].parentElement.previousElementSibling.lastElementChild.insertAdjacentHTML("beforebegin", `<div data-subtype="${sourceElements[0].getAttribute("data-subtype")}" data-node-id="${newId}" data-type="NodeList" class="list" updated="${newId.split("-")[0]}"><div id="moveTempLi"></div><div class="protyle-attr" contenteditable="false">&ZeroWidthSpace;</div></div>`);
- previousElement = sourceElements[0].parentElement.previousElementSibling.querySelector(".list")
+ previousElement = sourceElements[0].parentElement.previousElementSibling.querySelector(".list");
}
} else {
return;
@@ -136,10 +136,10 @@ export const moveToDown = (protyle: IProtyle, nodeElement: HTMLElement, range: R
if (!nextElement) {
const newId = Lute.NewNodeID();
sourceElements[0].parentElement.parentElement.nextElementSibling.lastElementChild.insertAdjacentHTML("beforebegin", `<div data-subtype="${sourceElements[0].getAttribute("data-subtype")}" data-node-id="${newId}" data-type="NodeList" class="list" updated="${newId.split("-")[0]}"><div class="protyle-attr" contenteditable="false">&ZeroWidthSpace;</div></div>`);
- nextElement = sourceElements[0].parentElement.parentElement.nextElementSibling.querySelector(".list > div")
+ nextElement = sourceElements[0].parentElement.parentElement.nextElementSibling.querySelector(".list > div");
}
} else {
- return
+ return;
}
}
if (type === "NodeList" && sourceElements[sourceElements.length - 1].nextElementSibling.classList.contains("protyle-attr") &&
diff --git a/app/src/search/util.ts b/app/src/search/util.ts
index 78d80b0eb5..3757e3cdb7 100644
--- a/app/src/search/util.ts
+++ b/app/src/search/util.ts
@@ -731,7 +731,7 @@ const addConfigMoreMenu = async (config: ISearchOption, edit: Protyle, element:
}
return;
}
- const dialogElement = hasClosestByClassName(element, "b3-dialog--open")
+ const dialogElement = hasClosestByClassName(element, "b3-dialog--open");
if (dialogElement && dialogElement.getAttribute("data-key") === window.siyuan.config.keymap.general.search.custom) {
// https://github.com/siyuan-note/siyuan/issues/6828
item.hPath = config.hPath;
diff --git a/app/src/util/globalShortcut.ts b/app/src/util/globalShortcut.ts
index 6d5579f867..f8ad58f4d2 100644
--- a/app/src/util/globalShortcut.ts
+++ b/app/src/util/globalShortcut.ts
@@ -11,7 +11,7 @@ import {
import {newFile} from "./newFile";
import {Constants} from "../constants";
import {openSetting} from "../config";
-import {exportLayout, getDockByType, getInstanceById, setPanelFocus} from "../layout/util";
+import {exportLayout, getDockByType, getInstanceById} from "../layout/util";
import {Tab} from "../layout/Tab";
import {Editor} from "../editor";
import {setEditMode} from "../protyle/util/setEditMode";
@@ -453,7 +453,7 @@ export const globalShortcut = () => {
if (item.element.getAttribute("data-key") === window.siyuan.config.keymap.general.recentDocs.custom) {
return true;
}
- })
+ });
if (openRecentDocsDialog) {
event.preventDefault();
dialogArrow(openRecentDocsDialog.element, event);
@@ -465,7 +465,7 @@ export const globalShortcut = () => {
if (item.element.getAttribute("data-key") === window.siyuan.config.keymap.general.recentDocs.custom) {
return true;
}
- })
+ });
if (openRecentDocsDialog) {
hideElements(["dialog"]);
return;
@@ -793,20 +793,20 @@ const dialogArrow = (element: HTMLElement, event: KeyboardEvent) => {
if (currentType) {
getDockByType(currentType).toggleModel(currentType, true);
} else {
- let actionString = currentLiElement.getAttribute("data-action")
+ let actionString = currentLiElement.getAttribute("data-action");
if (actionString.indexOf(Constants.CB_GET_SCROLL) === -1) {
- actionString = actionString ? (actionString + "," + Constants.CB_GET_SCROLL) : Constants.CB_GET_SCROLL
+ actionString = actionString ? (actionString + "," + Constants.CB_GET_SCROLL) : Constants.CB_GET_SCROLL;
}
openFileById({
id: currentLiElement.getAttribute("data-block-id") || currentLiElement.getAttribute("data-node-id"),
mode: currentLiElement.getAttribute("data-mode") as TEditorMode,
action: actionString.split(",")
- })
+ });
}
- hideElements(["dialog"])
+ hideElements(["dialog"]);
return;
}
- currentLiElement = element.querySelector(".b3-list-item--focus")
+ currentLiElement = element.querySelector(".b3-list-item--focus");
const rootId = currentLiElement.getAttribute("data-node-id");
if (rootId) {
fetchPost("/api/filetree/getFullHPathByID", {
@@ -825,15 +825,15 @@ const dialogArrow = (element: HTMLElement, event: KeyboardEvent) => {
currentLiElement.scrollIntoView(false);
}
}
-}
+};
const openRecentDocs = () => {
fetchPost("/api/storage/getRecentDocs", {}, (response) => {
- let range: Range
+ let range: Range;
if (getSelection().rangeCount > 0) {
- range = getSelection().getRangeAt(0)
+ range = getSelection().getRangeAt(0);
}
- let tabHtml = ""
+ let tabHtml = "";
response.data.forEach((item: any, index: number) => {
tabHtml += `<li data-index="${index}" data-action="${item.action}" data-node-id="${item.rootID}" data-block-id="${item.id || ""}" data-mode="${item.mode}" class="b3-list-item${index === 0 ? " b3-list-item--focus" : ""}">
${unicode2Emoji(item.icon || Constants.SIYUAN_IMAGE_FILE, false, "b3-list-item__graphic", true)}
@@ -873,19 +873,19 @@ ${unicode2Emoji(item.icon || Constants.SIYUAN_IMAGE_FILE, false, "b3-list-item__
dialog.element.querySelector(".dialog__path").innerHTML = dialog.element.querySelector(".b3-list-item--focus").textContent;
}
dialog.element.querySelector("input").focus();
- dialog.element.setAttribute("data-key", window.siyuan.config.keymap.general.recentDocs.custom)
+ dialog.element.setAttribute("data-key", window.siyuan.config.keymap.general.recentDocs.custom);
dialog.element.addEventListener("click", (event) => {
const liElement = hasClosestByClassName(event.target as HTMLElement, "b3-list-item");
if (liElement) {
dialog.element.querySelector(".b3-list-item--focus").classList.remove("b3-list-item--focus");
liElement.classList.add("b3-list-item--focus");
- window.dispatchEvent(new KeyboardEvent("keydown", {key: "Enter"}))
+ window.dispatchEvent(new KeyboardEvent("keydown", {key: "Enter"}));
event.stopPropagation();
event.preventDefault();
}
});
- })
-}
+ });
+};
const editKeydown = (event: KeyboardEvent) => {
const activeTabElement = document.querySelector(".layout__wnd--active .item--focus");
diff --git a/app/src/util/upDownHint.ts b/app/src/util/upDownHint.ts
index 39adbb0328..7f4a68b5a7 100644
--- a/app/src/util/upDownHint.ts
+++ b/app/src/util/upDownHint.ts
@@ -16,7 +16,7 @@ export const upDownHint = (listElement: Element, event: KeyboardEvent) => {
currentHintElement = listElement.querySelector(".b3-list-item--focus");
if (listElement.scrollTop < currentHintElement.offsetTop - listElement.clientHeight + currentHintElement.clientHeight ||
listElement.scrollTop > currentHintElement.offsetTop) {
- currentHintElement.scrollIntoView(listElement.scrollTop > currentHintElement.offsetTop)
+ currentHintElement.scrollIntoView(listElement.scrollTop > currentHintElement.offsetTop);
}
return currentHintElement;
} else if (event.key === "ArrowUp") {
@@ -36,7 +36,7 @@ export const upDownHint = (listElement: Element, event: KeyboardEvent) => {
currentHintElement = listElement.querySelector(".b3-list-item--focus");
if (listElement.scrollTop < currentHintElement.offsetTop - listElement.clientHeight + currentHintElement.clientHeight ||
listElement.scrollTop > currentHintElement.offsetTop - currentHintElement.clientHeight * 2) {
- currentHintElement.scrollIntoView(listElement.scrollTop > currentHintElement.offsetTop - currentHintElement.clientHeight * 2)
+ currentHintElement.scrollIntoView(listElement.scrollTop > currentHintElement.offsetTop - currentHintElement.clientHeight * 2);
}
return currentHintElement;
}