Skip to content

Commit 9e37a9e

Browse files
committed
fix: doesn't set the region dropdown value based on settings
1 parent ae41e52 commit 9e37a9e

File tree

4 files changed

+26
-13
lines changed

4 files changed

+26
-13
lines changed

manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"id": "qiniu-image-uploader",
33
"name": "Qiniu Image Uploader",
4-
"version": "1.1.0",
4+
"version": "1.1.1",
55
"minAppVersion": "0.15.0",
66
"description": "Uploads images from your clipboard to qiniu.com and embeds uploaded image to your note.",
77
"author": "Jade Zheng",

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "obsidian-sample-plugin",
3-
"version": "1.0.0",
3+
"version": "1.1.1",
44
"description": "This is a sample plugin for Obsidian (https://obsidian.md)",
55
"main": "main.js",
66
"scripts": {

src/settings.ts

Lines changed: 23 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { App, PluginSettingTab, Setting } from "obsidian";
1+
import { App, PluginSettingTab, Setting, Notice } from "obsidian";
22
import QiniuImageUploader from "./main";
33
import { t } from "./lang/helpers";
44

@@ -68,21 +68,33 @@ export class SettingTab extends PluginSettingTab {
6868
await this.plugin.saveSettings();
6969
}));
7070

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+
7180
new Setting(containerEl)
7281
.setName(t("Region"))
7382
.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) => {
8292
this.plugin.settings.region = value;
8393
await this.plugin.saveSettings();
84-
});
85-
});
94+
const fiveSecondsMillis = 5_000
95+
new Notice("修改地区为 " + regionMapping[value], fiveSecondsMillis)
96+
})
97+
);
8698

8799
new Setting(containerEl)
88100
.setName(t("Domain"))

versions.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
{
2+
"1.1.1": "0.15.0",
23
"1.1.0": "0.15.0",
34
"1.0.0": "0.15.0"
45
}

0 commit comments

Comments
 (0)