MCPcopy
hub / github.com/remotely-save/remotely-save / onOpen

Method onOpen

src/settings.ts:305–366  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

303 }
304
305 onOpen() {
306 const { contentEl } = this;
307
308 const t = (x: TransItemType, vars?: any) => {
309 return this.plugin.i18n.t(x, vars);
310 };
311
312 contentEl.createEl("h2", { text: t("modal_remoteprefix_s3_title") });
313 t("modal_remoteprefix_s3_shortdesc")
314 .split("\n")
315 .forEach((val, idx) => {
316 contentEl.createEl("p", {
317 text: val,
318 });
319 });
320
321 contentEl.createEl("p", {
322 text: t("modal_remoteprefix_s3_tosave", { prefix: this.newRemotePrefix }),
323 });
324
325 if (
326 this.newRemotePrefix === "" ||
327 this.newRemotePrefix === this.app.vault.getName()
328 ) {
329 new Setting(contentEl)
330 .addButton((button) => {
331 button.setButtonText(t("modal_remoteprefix_s3_secondconfirm_empty"));
332 button.onClick(async () => {
333 // in the settings, the value is reset to the special case ""
334 this.plugin.settings.s3.remotePrefix = "";
335 await this.plugin.saveSettings();
336 new Notice(t("modal_remoteprefix_s3_notice"));
337 this.close();
338 });
339 button.setClass("remoteprefix-second-confirm");
340 })
341 .addButton((button) => {
342 button.setButtonText(t("goback"));
343 button.onClick(() => {
344 this.close();
345 });
346 });
347 } else {
348 new Setting(contentEl)
349 .addButton((button) => {
350 button.setButtonText(t("modal_remoteprefix_s3_secondconfirm_change"));
351 button.onClick(async () => {
352 this.plugin.settings.s3.remotePrefix = this.newRemotePrefix;
353 await this.plugin.saveSettings();
354 new Notice(t("modal_remoteprefix_s3_notice"));
355 this.close();
356 });
357 button.setClass("remoteprefix-s3-second-confirm");
358 })
359 .addButton((button) => {
360 button.setButtonText(t("goback"));
361 button.onClick(() => {
362 this.close();

Callers

nothing calls this directly

Calls 1

saveSettingsMethod · 0.80

Tested by

no test coverage detected