Fix type errors related to siyuan.config (#10724)

* 🎨 Improve the type definition of `siyuan.config`

* 🐛 Fix type errors related to `siyuan.config`

* 💄 `types/config.d.ts`

* 🐛 Fix type errors related to `siyuan.config`
This commit is contained in:
Yingyi / 颖逸 2024-03-25 09:33:22 +08:00 committed by GitHub
parent 433c0b6dde
commit 6b2ac5e630
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
18 changed files with 692 additions and 306 deletions

View file

@ -86,9 +86,9 @@ export const loadPlugin = async (app: App, item: IPluginData) => {
};
const updateDock = (dockItem: IDockTab[], index: number, plugin: Plugin, type: string) => {
const updateDock = (dockItem: Config.IUILayoutDockTab[], index: number, plugin: Plugin, type: string) => {
const dockKeys = Object.keys(plugin.docks);
dockItem.forEach((tabItem: IDockTab, tabIndex: number) => {
dockItem.forEach((tabItem: Config.IUILayoutDockTab, tabIndex: number) => {
if (dockKeys.includes(tabItem.type)) {
if (type === "Left") {
plugin.docks[tabItem.type].config.position = index === 0 ? "LeftTop" : "LeftBottom";
@ -214,13 +214,13 @@ export const afterLoadPlugin = (plugin: Plugin) => {
}
/// #if !MOBILE
window.siyuan.config.uiLayout.left.data.forEach((dockItem: IDockTab[], index: number) => {
window.siyuan.config.uiLayout.left.data.forEach((dockItem: Config.IUILayoutDockTab[], index: number) => {
updateDock(dockItem, index, plugin, "Left");
});
window.siyuan.config.uiLayout.right.data.forEach((dockItem: IDockTab[], index: number) => {
window.siyuan.config.uiLayout.right.data.forEach((dockItem: Config.IUILayoutDockTab[], index: number) => {
updateDock(dockItem, index, plugin, "Right");
});
window.siyuan.config.uiLayout.bottom.data.forEach((dockItem: IDockTab[], index: number) => {
window.siyuan.config.uiLayout.bottom.data.forEach((dockItem: Config.IUILayoutDockTab[], index: number) => {
updateDock(dockItem, index, plugin, "Bottom");
});
Object.keys(plugin.docks).forEach(key => {