From e241ff36932920adda7660d2c84700bb18a3ff0d Mon Sep 17 00:00:00 2001 From: lin onetwo Date: Sat, 29 Jun 2024 18:58:03 +0800 Subject: [PATCH] feat: make $:/core/save/all the default behavior (no lazy loading) and add tooltip for it fixes #569 --- localization/locales/en/translation.json | 5 +++++ localization/locales/zh_CN/translation.json | 5 +++++ src/constants/defaultTiddlerNames.ts | 2 +- src/pages/EditWorkspace/server.tsx | 1 + src/services/wiki/wikiWorker/startNodeJSWiki.ts | 2 +- 5 files changed, 13 insertions(+), 2 deletions(-) diff --git a/localization/locales/en/translation.json b/localization/locales/en/translation.json index f7909682..fb940e59 100644 --- a/localization/locales/en/translation.json +++ b/localization/locales/en/translation.json @@ -179,6 +179,11 @@ "BackupOnIntervalDescription": "When enabled, data will be automatically backed up with local Git at regular intervals (interval in global settings), so that even if no cloud git synchronization address is configured, it will be automatically backed up locally.", "WikiRootTiddler": "Wiki Root Tiddler", "WikiRootTiddlerDescription": "Wiki's root tiddler determines the core behavior of the system, please read the official documentation to understand before modifying", + "WikiRootTiddlerItems": { + "all": "Load all at once", + "lazy-images": "Load images on demand", + "lazy-all": "Load images and text on demand" + }, "ReadOnlyModeDescription": "Can be used with intranet penetration, allowing TidGi work as a server program to deploy blogs. After opening, wiki can only be modified by directly modifying the file on the disk (including using git synchronization). The content cannot be modified on the web page, but anyone can access it.", "ReadOnlyMode": "ReadOnly Mode", "TokenAuth": "Token Authenticate", diff --git a/localization/locales/zh_CN/translation.json b/localization/locales/zh_CN/translation.json index 82125267..86ea1b1c 100644 --- a/localization/locales/zh_CN/translation.json +++ b/localization/locales/zh_CN/translation.json @@ -213,6 +213,11 @@ "NameDescription": "工作区的名字,将显示在侧边栏上,可以与工作区Git仓库的实际文件夹名不同", "WikiRootTiddler": "知识库根条目", "WikiRootTiddlerDescription": "Wiki 的根条目(root-tiddler)决定了系统的核心行为,修改前请阅读官方文档来了解", + "WikiRootTiddlerItems": { + "all": "全量加载", + "lazy-images": "按需加载图片", + "lazy-all": "按需加载图片和文本" + }, "ReadOnlyMode": "只读模式", "ReadOnlyModeDescription": "可用于配合内网穿透,让太记作为服务器程序部署博客。打开后将只能通过直接改文件的方式修改知识库内容(包括git同步),网页上将不能修改内容,但任何人都可以访问。", "TokenAuth": "凭证鉴权", diff --git a/src/constants/defaultTiddlerNames.ts b/src/constants/defaultTiddlerNames.ts index 90f1ddb5..b1aa5678 100644 --- a/src/constants/defaultTiddlerNames.ts +++ b/src/constants/defaultTiddlerNames.ts @@ -1 +1 @@ -export const rootTiddlers = ['$:/core/save/lazy-images', '$:/core/save/all', '$:/core/save/lazy-all']; +export const rootTiddlers = ['$:/core/save/all', '$:/core/save/lazy-images', '$:/core/save/lazy-all']; diff --git a/src/pages/EditWorkspace/server.tsx b/src/pages/EditWorkspace/server.tsx index 45db58c4..57fbc18a 100644 --- a/src/pages/EditWorkspace/server.tsx +++ b/src/pages/EditWorkspace/server.tsx @@ -342,6 +342,7 @@ export function ServerOptions(props: IServerOptionsProps) { renderInput={(parameters: AutocompleteRenderInputParams) => ( )} + renderOption={(props, option) =>
  • {t(`EditWorkspace.WikiRootTiddlerItems.${option.replace('$:/core/save/', '')}`)} ({option})
  • } /> diff --git a/src/services/wiki/wikiWorker/startNodeJSWiki.ts b/src/services/wiki/wikiWorker/startNodeJSWiki.ts index ed496ab0..1e02825d 100644 --- a/src/services/wiki/wikiWorker/startNodeJSWiki.ts +++ b/src/services/wiki/wikiWorker/startNodeJSWiki.ts @@ -23,7 +23,7 @@ export function startNodeJSWiki({ isDev, openDebugger, readOnlyMode, - rootTiddler = '$:/core/save/lazy-images', + rootTiddler = '$:/core/save/all', tiddlyWikiHost = defaultServerIP, tiddlyWikiPort = 5112, tokenAuth,