|
1 |
| -import { App, PluginSettingTab, Setting } from "obsidian"; |
| 1 | +import { App, PluginSettingTab, Setting, Notice } from "obsidian"; |
2 | 2 | import QiniuImageUploader from "./main";
|
3 | 3 | import { t } from "./lang/helpers";
|
4 | 4 |
|
@@ -68,21 +68,33 @@ export class SettingTab extends PluginSettingTab {
|
68 | 68 | await this.plugin.saveSettings();
|
69 | 69 | }));
|
70 | 70 |
|
| 71 | + const regionMapping: { [key: string]: string } = { |
| 72 | + "z1": t("North China - Hebei"), |
| 73 | + "z0": t("East China - Zhejiang"), |
| 74 | + "cn-east-2": t("East China - Zhejiang 2"), |
| 75 | + "z2": t("South China - Guangdong"), |
| 76 | + "na0": t("North America - Los Angeles"), |
| 77 | + "as0": t("Asia Pacific - Singapore (formerly Southeast Asia)"), |
| 78 | + }; |
| 79 | + |
71 | 80 | new Setting(containerEl)
|
72 | 81 | .setName(t("Region"))
|
73 | 82 | .setDesc(t("Region Desc"))
|
74 |
| - .addDropdown((dropDown) => { |
75 |
| - dropDown.addOption("z1", t("North China - Hebei")); |
76 |
| - dropDown.addOption("z0", t("East China - Zhejiang")); |
77 |
| - dropDown.addOption("cn-east-2", t("East China - Zhejiang 2")); |
78 |
| - dropDown.addOption("z2", t("South China - Guangdong")); |
79 |
| - dropDown.addOption("na0", t("North America - Los Angeles")); |
80 |
| - dropDown.addOption("as0", t("Asia Pacific - Singapore (formerly Southeast Asia)")); |
81 |
| - dropDown.onChange(async (value) => { |
| 83 | + .addDropdown(dropDown => dropDown |
| 84 | + .addOption("z1", t("North China - Hebei")) |
| 85 | + .addOption("z0", t("East China - Zhejiang")) |
| 86 | + .addOption("cn-east-2", t("East China - Zhejiang 2")) |
| 87 | + .addOption("z2", t("South China - Guangdong")) |
| 88 | + .addOption("na0", t("North America - Los Angeles")) |
| 89 | + .addOption("as0", t("Asia Pacific - Singapore (formerly Southeast Asia)")) |
| 90 | + .setValue(this.plugin.settings.region) |
| 91 | + .onChange(async (value) => { |
82 | 92 | this.plugin.settings.region = value;
|
83 | 93 | await this.plugin.saveSettings();
|
84 |
| - }); |
85 |
| - }); |
| 94 | + const fiveSecondsMillis = 5_000 |
| 95 | + new Notice("修改地区为 " + regionMapping[value], fiveSecondsMillis) |
| 96 | + }) |
| 97 | + ); |
86 | 98 |
|
87 | 99 | new Setting(containerEl)
|
88 | 100 | .setName(t("Domain"))
|
|
0 commit comments