Change file limit from slider to number
This commit is contained in:
parent
383e2868c2
commit
22a13e0152
1 changed files with 21 additions and 8 deletions
|
|
@ -297,15 +297,28 @@ export class SyncSettingsTab extends PluginSettingTab {
|
||||||
.setDesc(
|
.setDesc(
|
||||||
"Set the maximum file size that can be uploaded to the server. Files larger than this size will be ignored."
|
"Set the maximum file size that can be uploaded to the server. Files larger than this size will be ignored."
|
||||||
)
|
)
|
||||||
.addSlider((slider) =>
|
.addText((input) =>
|
||||||
slider
|
input
|
||||||
.setLimits(1, 64, 1)
|
.setValue(
|
||||||
.setDynamicTooltip()
|
this.syncClient.getSettings().maxFileSizeMB.toString()
|
||||||
.setInstant(false)
|
|
||||||
.setValue(this.syncClient.getSettings().maxFileSizeMB)
|
|
||||||
.onChange(async (value) =>
|
|
||||||
this.syncClient.setSetting("maxFileSizeMB", value)
|
|
||||||
)
|
)
|
||||||
|
.onChange(async (value) => {
|
||||||
|
if (value === "") {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
let parsedValue = Number.parseFloat(value);
|
||||||
|
if (Number.isNaN(parsedValue) || parsedValue < 0) {
|
||||||
|
parsedValue =
|
||||||
|
this.syncClient.getSettings().maxFileSizeMB;
|
||||||
|
}
|
||||||
|
this.syncClient.setSetting(
|
||||||
|
"maxFileSizeMB",
|
||||||
|
parsedValue
|
||||||
|
);
|
||||||
|
if (value !== parsedValue.toString()) {
|
||||||
|
input.setValue(parsedValue.toString());
|
||||||
|
}
|
||||||
|
})
|
||||||
);
|
);
|
||||||
|
|
||||||
new Setting(containerEl)
|
new Setting(containerEl)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue