mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-21 09:00:12 +01:00
This commit is contained in:
parent
e922c402c8
commit
1f607cf08a
9 changed files with 15 additions and 294 deletions
|
|
@ -244,7 +244,7 @@ export const appearance = {
|
|||
});
|
||||
});
|
||||
},
|
||||
onSetappearance(data: IAppearance) {
|
||||
onSetappearance(data: Config.IAppearance) {
|
||||
if (data.lang !== window.siyuan.config.appearance.lang) {
|
||||
exportLayout({
|
||||
cb() {
|
||||
|
|
|
|||
|
|
@ -349,7 +349,7 @@ export const editor = {
|
|||
});
|
||||
});
|
||||
},
|
||||
_onSetEditor: (editorData: IEditor) => {
|
||||
_onSetEditor: (editorData: Config.IEditor) => {
|
||||
const changeReadonly = editorData.readOnly !== window.siyuan.config.editor.readOnly;
|
||||
if (changeReadonly) {
|
||||
editor.setReadonly(editorData.readOnly);
|
||||
|
|
|
|||
|
|
@ -254,7 +254,7 @@ export const exportConfig = {
|
|||
});
|
||||
/// #endif
|
||||
},
|
||||
onSetexport: (data: IExport) => {
|
||||
onSetexport: (data: Config.IExport) => {
|
||||
window.siyuan.config.export = data;
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -121,7 +121,7 @@ export const fileTree = {
|
|||
});
|
||||
});
|
||||
},
|
||||
onSetfiletree: (fileTree: IFileTree) => {
|
||||
onSetfiletree: (fileTree: Config.IFileTree) => {
|
||||
window.siyuan.config.fileTree = fileTree;
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -185,7 +185,7 @@ export const keymap = {
|
|||
</div>`;
|
||||
},
|
||||
_setkeymap(app: App) {
|
||||
const data: IKeymap = JSON.parse(JSON.stringify(Constants.SIYUAN_KEYMAP));
|
||||
const data: Config.IKeymap = JSON.parse(JSON.stringify(Constants.SIYUAN_KEYMAP));
|
||||
keymap.element.querySelectorAll("label.b3-list-item input").forEach((item) => {
|
||||
const keys = item.getAttribute("data-key").split(Constants.ZWSP);
|
||||
const newHotkey = item.getAttribute("data-value");
|
||||
|
|
|
|||
|
|
@ -286,7 +286,7 @@ export abstract class Constants {
|
|||
// "⌘", "⇧", "⌥", "⌃"
|
||||
// "⌘A", "⌘X", "⌘C", "⌘V", "⌘-", "⌘=", "⌘0", "⇧⌘V", "⌘/", "⇧↑", "⇧↓", "⇧→", "⇧←", "⇧⇥", "⌃D", "⇧⌘→", "⇧⌘←",
|
||||
// "⌘Home", "⌘End", "⇧↩", "↩", "PageUp", "PageDown", "⌫", "⌦", "Escape" 不可自定义
|
||||
public static readonly SIYUAN_KEYMAP: IKeymap = {
|
||||
public static readonly SIYUAN_KEYMAP: Config.IKeymap = {
|
||||
general: {
|
||||
mainMenu: {default: "⌥\\", custom: "⌥\\"},
|
||||
commandPanel: {default: "⌥⇧P", custom: "⌥⇧P"},
|
||||
|
|
|
|||
6
app/src/types/config.d.ts
vendored
6
app/src/types/config.d.ts
vendored
|
|
@ -65,6 +65,7 @@ declare namespace Config {
|
|||
openHelp: boolean;
|
||||
/**
|
||||
* Whether it is running in read-only mode
|
||||
* 全局只读
|
||||
*/
|
||||
readonly: boolean;
|
||||
repo: IRepo;
|
||||
|
|
@ -133,6 +134,7 @@ declare namespace Config {
|
|||
apiModel: TOpenAIModel;
|
||||
/**
|
||||
* API Provider
|
||||
* OpenAI, Azure
|
||||
*/
|
||||
apiProvider: APIProvider;
|
||||
/**
|
||||
|
|
@ -1191,8 +1193,8 @@ declare namespace Config {
|
|||
/**
|
||||
* Cloud storage service provider
|
||||
* - `0`: SiYuan official cloud storage service
|
||||
* - `1`: Object storage service compatible with S3 protocol
|
||||
* - `2`: Network storage service using WebDAV protocol
|
||||
* - `2`: Object storage service compatible with S3 protocol
|
||||
* - `3`: Network storage service using WebDAV protocol
|
||||
*/
|
||||
provider: number;
|
||||
s3: ISyncS3;
|
||||
|
|
|
|||
281
app/src/types/index.d.ts
vendored
281
app/src/types/index.d.ts
vendored
|
|
@ -607,61 +607,6 @@ interface ITab {
|
|||
callback?: (tab: import("../layout/Tab").Tab) => void
|
||||
}
|
||||
|
||||
interface IExport {
|
||||
fileAnnotationRefMode: number
|
||||
blockRefMode: number
|
||||
blockEmbedMode: number
|
||||
blockRefTextLeft: string
|
||||
blockRefTextRight: string
|
||||
tagOpenMarker: string
|
||||
tagCloseMarker: string
|
||||
pandocBin: string
|
||||
paragraphBeginningSpace: boolean;
|
||||
addTitle: boolean;
|
||||
markdownYFM: boolean;
|
||||
pdfFooter: string;
|
||||
pdfWatermarkStr: string;
|
||||
pdfWatermarkDesc: string;
|
||||
imageWatermarkStr: string;
|
||||
imageWatermarkDesc: string;
|
||||
docxTemplate: string;
|
||||
}
|
||||
|
||||
interface IEditor {
|
||||
justify: boolean;
|
||||
fontSizeScrollZoom: boolean;
|
||||
rtl: boolean;
|
||||
readOnly: boolean;
|
||||
listLogicalOutdent: boolean;
|
||||
listItemDotNumberClickFocus: boolean;
|
||||
spellcheck: boolean;
|
||||
onlySearchForDoc: boolean;
|
||||
katexMacros: string;
|
||||
fullWidth: boolean;
|
||||
floatWindowMode: number;
|
||||
dynamicLoadBlocks: number;
|
||||
fontSize: number;
|
||||
generateHistoryInterval: number;
|
||||
historyRetentionDays: number;
|
||||
codeLineWrap: boolean;
|
||||
displayBookmarkIcon: boolean;
|
||||
displayNetImgMark: boolean;
|
||||
codeSyntaxHighlightLineNum: boolean;
|
||||
embedBlockBreadcrumb: boolean;
|
||||
plantUMLServePath: string;
|
||||
codeLigatures: boolean;
|
||||
codeTabSpaces: number;
|
||||
fontFamily: string;
|
||||
virtualBlockRef: boolean;
|
||||
virtualBlockRefExclude: string;
|
||||
virtualBlockRefInclude: string;
|
||||
blockRefDynamicAnchorTextMaxLen: number;
|
||||
backlinkExpandCount: number;
|
||||
backmentionExpandCount: number;
|
||||
|
||||
emoji: string[];
|
||||
}
|
||||
|
||||
interface IWebSocketData {
|
||||
cmd?: string
|
||||
callback?: string
|
||||
|
|
@ -671,194 +616,6 @@ interface IWebSocketData {
|
|||
sid?: string
|
||||
}
|
||||
|
||||
interface IAppearance {
|
||||
modeOS: boolean,
|
||||
hideStatusBar: boolean,
|
||||
themeJS: boolean,
|
||||
mode: number, // 1 暗黑;0 明亮
|
||||
icon: string,
|
||||
closeButtonBehavior: number // 0:退出,1:最小化到托盘
|
||||
codeBlockThemeDark: string
|
||||
codeBlockThemeLight: string
|
||||
themeDark: string
|
||||
themeLight: string
|
||||
icons: string[]
|
||||
lang: string
|
||||
iconVer: string
|
||||
themeVer: string
|
||||
lightThemes: string[]
|
||||
darkThemes: string[]
|
||||
}
|
||||
|
||||
interface IFileTree {
|
||||
closeTabsOnStart: boolean
|
||||
alwaysSelectOpenedFile: boolean
|
||||
openFilesUseCurrentTab: boolean
|
||||
removeDocWithoutConfirm: boolean
|
||||
useSingleLineSave: boolean
|
||||
allowCreateDeeper: boolean
|
||||
refCreateSavePath: string
|
||||
docCreateSavePath: string
|
||||
sort: number
|
||||
maxOpenTabCount: number
|
||||
maxListCount: number
|
||||
}
|
||||
|
||||
interface IAccount {
|
||||
displayTitle: boolean
|
||||
displayVIP: boolean
|
||||
}
|
||||
|
||||
interface IConfig {
|
||||
snippet: {
|
||||
enabledCSS: boolean
|
||||
enabledJS: boolean
|
||||
}
|
||||
cloudRegion: number
|
||||
bazaar: {
|
||||
trust: boolean
|
||||
petalDisabled: boolean
|
||||
}
|
||||
repo: {
|
||||
key: string
|
||||
},
|
||||
flashcard: {
|
||||
newCardLimit: number
|
||||
reviewCardLimit: number
|
||||
mark: boolean
|
||||
list: boolean
|
||||
superBlock: boolean
|
||||
heading: boolean
|
||||
deck: boolean
|
||||
reviewMode: number
|
||||
requestRetention: number
|
||||
maximumInterval: number
|
||||
weights: string
|
||||
}
|
||||
ai: {
|
||||
openAI: {
|
||||
apiProvider: string // OpenAI, Azure
|
||||
apiUserAgent: string
|
||||
apiBaseURL: string
|
||||
apiVersion: string
|
||||
apiKey: string
|
||||
apiModel: string
|
||||
apiMaxTokens: number
|
||||
apiTemperature: number
|
||||
apiMaxContexts: number
|
||||
apiProxy: string
|
||||
apiTimeout: number
|
||||
},
|
||||
}
|
||||
sync: {
|
||||
generateConflictDoc: boolean
|
||||
enabled: boolean
|
||||
perception: boolean
|
||||
mode: number
|
||||
synced: number
|
||||
stat: string
|
||||
interval: number
|
||||
cloudName: string
|
||||
provider: number // 0 官方同步, 2 S3, 3 WebDAV
|
||||
s3: {
|
||||
endpoint: string
|
||||
pathStyle: boolean
|
||||
accessKey: string
|
||||
secretKey: string
|
||||
bucket: string
|
||||
region: string
|
||||
skipTlsVerify: boolean
|
||||
timeout: number
|
||||
}
|
||||
webdav: {
|
||||
endpoint: string
|
||||
username: string
|
||||
password: string
|
||||
skipTlsVerify: boolean
|
||||
timeout: number
|
||||
}
|
||||
},
|
||||
lang: string
|
||||
api: {
|
||||
token: string
|
||||
}
|
||||
openHelp: boolean
|
||||
system: {
|
||||
lockScreenMode: number // 0:手动,1:手动+跟随系统
|
||||
networkProxy: {
|
||||
host: string
|
||||
port: string
|
||||
scheme: string
|
||||
}
|
||||
name: string
|
||||
kernelVersion: string
|
||||
isInsider: boolean
|
||||
appDir: string
|
||||
workspaceDir: string
|
||||
confDir: string
|
||||
dataDir: string
|
||||
container: "std" | "android" | "docker" | "ios"
|
||||
isMicrosoftStore: boolean
|
||||
os: "windows" | "linux" | "darwin"
|
||||
osPlatform: string
|
||||
homeDir: string
|
||||
xanadu: boolean
|
||||
udanax: boolean
|
||||
uploadErrLog: boolean
|
||||
disableGoogleAnalytics: boolean
|
||||
downloadInstallPkg: boolean
|
||||
networkServe: boolean
|
||||
fixedPort: boolean
|
||||
autoLaunch: boolean
|
||||
}
|
||||
localIPs: string[]
|
||||
readonly: boolean // 全局只读
|
||||
uiLayout: Record<string, any>
|
||||
langs: {
|
||||
label: string,
|
||||
name: string
|
||||
}[]
|
||||
appearance: IAppearance
|
||||
editor: IEditor,
|
||||
fileTree: IFileTree
|
||||
graph: IGraph
|
||||
keymap: IKeymap
|
||||
export: IExport
|
||||
accessAuthCode: string
|
||||
account: IAccount
|
||||
tag: {
|
||||
sort: number
|
||||
}
|
||||
search: ISearchType & {
|
||||
name: boolean
|
||||
alias: boolean
|
||||
memo: boolean
|
||||
indexAssetPath: boolean
|
||||
ial: boolean
|
||||
limit: number
|
||||
caseSensitive: boolean
|
||||
backlinkMentionName: boolean
|
||||
backlinkMentionAlias: boolean
|
||||
backlinkMentionAnchor: boolean
|
||||
backlinkMentionDoc: boolean
|
||||
backlinkMentionKeywordsLimit: boolean
|
||||
virtualRefName: boolean
|
||||
virtualRefAlias: boolean
|
||||
virtualRefAnchor: boolean
|
||||
virtualRefDoc: boolean
|
||||
},
|
||||
stat: {
|
||||
treeCount: number
|
||||
cTreeCount: number
|
||||
blockCount: number
|
||||
cBlockCount: number
|
||||
dataSize: number
|
||||
cDataSize: number
|
||||
assetsSize: number
|
||||
cAssetsSize: number
|
||||
}
|
||||
}
|
||||
|
||||
interface IGraphCommon {
|
||||
d3: {
|
||||
centerStrength: number
|
||||
|
|
@ -884,44 +641,6 @@ interface IGraphCommon {
|
|||
}
|
||||
}
|
||||
|
||||
interface IGraph {
|
||||
global: {
|
||||
minRefs: number
|
||||
dailyNote: boolean
|
||||
} & IGraphCommon
|
||||
local: {
|
||||
dailyNote: boolean
|
||||
} & IGraphCommon
|
||||
}
|
||||
|
||||
interface IKeymap {
|
||||
plugin: {
|
||||
[key: string]: {
|
||||
[key: string]: IKeymapItem
|
||||
}
|
||||
}
|
||||
general: {
|
||||
[key: string]: IKeymapItem
|
||||
}
|
||||
editor: {
|
||||
general: {
|
||||
[key: string]: IKeymapItem
|
||||
}
|
||||
insert: {
|
||||
[key: string]: IKeymapItem
|
||||
}
|
||||
heading: {
|
||||
[key: string]: IKeymapItem
|
||||
}
|
||||
list: {
|
||||
[key: string]: IKeymapItem
|
||||
}
|
||||
table: {
|
||||
[key: string]: IKeymapItem
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
interface IKeymapItem {
|
||||
default: string,
|
||||
custom: string
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ import {fetchPost} from "./fetch";
|
|||
import {appearance} from "../config/appearance";
|
||||
import {isInAndroid, isInIOS} from "../protyle/util/compatibility";
|
||||
|
||||
const loadThirdIcon = (iconURL: string, data: IAppearance) => {
|
||||
const loadThirdIcon = (iconURL: string, data: Config.IAppearance) => {
|
||||
addScript(iconURL, "iconDefaultScript").then(() => {
|
||||
if (!["ant", "material"].includes(data.icon)) {
|
||||
const iconScriptElement = document.getElementById("iconScript");
|
||||
|
|
@ -21,7 +21,7 @@ const loadThirdIcon = (iconURL: string, data: IAppearance) => {
|
|||
});
|
||||
};
|
||||
|
||||
export const loadAssets = (data: IAppearance) => {
|
||||
export const loadAssets = (data: Config.IAppearance) => {
|
||||
const htmlElement = document.getElementsByTagName("html")[0];
|
||||
htmlElement.setAttribute("lang", window.siyuan.config.appearance.lang);
|
||||
htmlElement.setAttribute("data-theme-mode", getThemeMode());
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue