Skip to content

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

:recycle: Remove unused frontend exports and duplicate defaults https://github.com/siyuan-note/siyuan/issues/20233

Daniel8997c393aef5
diff --git a/app/src/layout/dock/graph/core.ts b/app/src/layout/dock/graph/core.ts
index 6c86e6ae47..49139b6e7a 100644
--- a/app/src/layout/dock/graph/core.ts
+++ b/app/src/layout/dock/graph/core.ts
@@ -422,11 +422,6 @@ export const createInitialPositions = (
return positions;
};
-export const graphToScreen = (x: number, y: number, camera: IGraphCamera) => ({
- x: x * camera.scale + camera.x,
- y: y * camera.scale + camera.y,
-});
-
export const screenToGraph = (x: number, y: number, camera: IGraphCamera) => ({
x: (x - camera.x) / camera.scale,
y: (y - camera.y) / camera.scale,
diff --git a/app/src/mobile/agent/MobileAgentChat.ts b/app/src/mobile/agent/MobileAgentChat.ts
index 0bcf0ab543..4321c7e793 100644
--- a/app/src/mobile/agent/MobileAgentChat.ts
+++ b/app/src/mobile/agent/MobileAgentChat.ts
@@ -161,8 +161,6 @@ export const insertMobileAgentMentions = (currentApp: App, mentions: Array<{id:
agentChat?.insertBlockMentions(mentions);
};
-export const isMobileAgentVisible = () => isAgentSidebarVisible();
-
export const reopenMobileAgent = () => {
if (app) {
openMobileAgent(app);
diff --git a/app/src/mobile/util/MobileBackFoward.ts b/app/src/mobile/util/MobileBackFoward.ts
index ddd99d1ff0..703c0427ce 100644
--- a/app/src/mobile/util/MobileBackFoward.ts
+++ b/app/src/mobile/util/MobileBackFoward.ts
@@ -7,14 +7,6 @@ import {destroyAVRichTextEditor} from "../../protyle/render/av/richTextEditor";
import {isAbove} from "../../util/zIndex";
import {getMobileSelectMenuElement} from "./nativeSelect";
-export const clearMobileBackForward = (notebookId?: string) => {
- if (notebookId) {
- window.siyuan.mobile.tabs?.removeNotebook(notebookId);
- } else {
- window.siyuan.backStack = [];
- }
-};
-
export const pushBack = () => {
window.siyuan.mobile.tabs?.pushCurrent();
};
diff --git a/app/src/mobile/util/mobileBottomBarConfig.ts b/app/src/mobile/util/mobileBottomBarConfig.ts
index f067e87a00..5b85509be9 100644
--- a/app/src/mobile/util/mobileBottomBarConfig.ts
+++ b/app/src/mobile/util/mobileBottomBarConfig.ts
@@ -56,11 +56,6 @@ export const DEFAULT_MOBILE_BOTTOM_BAR_ACTIONS = [
const LEGACY_DEFAULT_MOBILE_BOTTOM_BAR_ACTIONS = ["documents", "search", "newDoc", "tabs"];
-export const DEFAULT_MOBILE_BOTTOM_BAR_CONFIG: IMobileBottomBarConfig = {
- version: MOBILE_BOTTOM_BAR_CONFIG_VERSION,
- actions: DEFAULT_MOBILE_BOTTOM_BAR_ACTIONS,
-};
-
const mobileBottomBarActionSet = new Set<string>(MOBILE_BOTTOM_BAR_ACTIONS);
export const isMobileBottomBarBuiltInAction = (value: unknown): value is MobileBottomBarBuiltInAction => {
diff --git a/app/src/mobile/util/mobileSidePanelConfig.ts b/app/src/mobile/util/mobileSidePanelConfig.ts
index 86a3444759..2d3a284501 100644
--- a/app/src/mobile/util/mobileSidePanelConfig.ts
+++ b/app/src/mobile/util/mobileSidePanelConfig.ts
@@ -60,14 +60,6 @@ export const DEFAULT_MOBILE_SIDE_PANEL_RIGHT: readonly MobileSidePanelBuiltInDoc
"agent",
];
-export const DEFAULT_MOBILE_SIDE_PANEL_CONFIG: Readonly<IMobileSidePanelConfig> = {
- version: MOBILE_SIDE_PANEL_CONFIG_VERSION,
- left: [...DEFAULT_MOBILE_SIDE_PANEL_LEFT],
- right: [...DEFAULT_MOBILE_SIDE_PANEL_RIGHT],
- pluginDockIds: [],
- hidden: [],
-};
-
const mobileSidePanelDockIdSet = new Set<string>(MOBILE_SIDE_PANEL_DOCK_IDS);
export const isMobileSidePanelBuiltInDockId = (value: unknown): value is MobileSidePanelBuiltInDockId => {
diff --git a/app/src/plugin/loader.ts b/app/src/plugin/loader.ts
index 371dbc21e8..4cd44d560f 100644
--- a/app/src/plugin/loader.ts
+++ b/app/src/plugin/loader.ts
@@ -429,12 +429,6 @@ export const unloadPlugin = async (app: App, name: string) => {
await manager.requestUnload(name);
};
-export const uninstallPlugin = async (app: App, name: string) => {
- const manager = getLifecycleManager(app);
- manager.start();
- await manager.requestUninstall(name);
-};
-
// 窗口销毁时同步撤销实例,异步钩子的迟到完成不能重新挂载界面。
export const disposePlugins = (app: App) => lifecycleManagers.get(app)?.dispose();
diff --git a/app/src/protyle/render/listMindmap/model.ts b/app/src/protyle/render/listMindmap/model.ts
index 4fe0589d71..a7675fd49f 100644
--- a/app/src/protyle/render/listMindmap/model.ts
+++ b/app/src/protyle/render/listMindmap/model.ts
@@ -750,20 +750,6 @@ export const deleteListMindmapNode = (list: HTMLElement, id: string): boolean =>
return true;
};
-// 只替换指定的直属正文块,并沿用块身份和属性,其余正文及嵌套列表保持原样。
-export const replaceListMindmapBlock = (list: HTMLElement, nodeId: string, blockId: string,
- replacement: HTMLElement): boolean => {
- const node = readListMindmap(list).nodes.get(nodeId);
- const block = node?.contentBlocks.find(item => item.getAttribute("data-node-id") === blockId);
- if (!block || replacement.getAttribute("data-type") !== block.getAttribute("data-type")) {
- return false;
- }
- const updated = replacement.cloneNode(true) as HTMLElement;
- Array.from(block.attributes).forEach(attribute => updated.setAttribute(attribute.name, attribute.value));
- block.replaceWith(updated);
- return true;
-};
-
// 按原正文槽位写入编辑结果,保留穿插在正文之间的子列表及未改写的持久属性。
export const replaceListMindmapContent = (list: HTMLElement, nodeId: string, blockHTML: string): boolean => {
const node = readListMindmap(list).nodes.get(nodeId);
diff --git a/app/src/protyle/toolbar/inlineStyle.ts b/app/src/protyle/toolbar/inlineStyle.ts
index 4b38e79790..4d06c421f4 100644
--- a/app/src/protyle/toolbar/inlineStyle.ts
+++ b/app/src/protyle/toolbar/inlineStyle.ts
@@ -641,9 +641,6 @@ export const getVisibleBuiltinColorIndexes = (type: Exclude<TBuiltinColorType, "
.filter(index => isBuiltinInlineStyleVisible(type, index, data));
};
-export const getVisibleBuiltinInlineStyleIDs = (data = getInlineStylesCache()) =>
- BUILTIN_INLINE_STYLE_IDS.filter(id => isBuiltinInlineStyleVisible("style1", id, data));
-
export const getOrderedStyleKeys = (type: TInlineStyleType, data = getInlineStylesCache()) =>
normalizeInlineStyles(data).order[type];
diff --git a/app/src/util/functions.ts b/app/src/util/functions.ts
index f2095829c4..bbbab7be53 100644
--- a/app/src/util/functions.ts
+++ b/app/src/util/functions.ts
@@ -1,5 +1,4 @@
import {getHostCapabilities} from "./hostCapabilities";
-import {getPdfAnnotationReference} from "../editor/pdfAssetLink";
const CONTAINER_BACKEND_SET = new Set(["docker", "ios", "android", "harmony"]);
@@ -85,10 +84,6 @@ export const isDynamicRef = (text: string) => {
return /^\(\(\d{14}-\w{7} '.*'\)\)$/.test(text);
};
-export const isFileAnnotation = (text: string) => {
- return typeof getPdfAnnotationReference(text) !== "undefined";
-};
-
export const isValidCustomAttrName = (name: string) => {
return /^[a-z][\-0-9a-z]*$/.test(name);
};