diff --git a/apps/client/src/translations/cn/translation.json b/apps/client/src/translations/cn/translation.json index 4f38b4fff..1d59b2171 100644 --- a/apps/client/src/translations/cn/translation.json +++ b/apps/client/src/translations/cn/translation.json @@ -244,7 +244,7 @@ "prompt": { "title": "提示", "close": "关闭", - "ok": "确定 回车", + "ok": "确定", "defaultTitle": "提示" }, "protected_session_password": { diff --git a/apps/client/src/translations/de/translation.json b/apps/client/src/translations/de/translation.json index c013b3eec..5a5f32649 100644 --- a/apps/client/src/translations/de/translation.json +++ b/apps/client/src/translations/de/translation.json @@ -244,7 +244,7 @@ "prompt": { "title": "Prompt", "close": "Schließen", - "ok": "OK Eingabe", + "ok": "OK", "defaultTitle": "Prompt" }, "protected_session_password": { diff --git a/apps/client/src/translations/en/translation.json b/apps/client/src/translations/en/translation.json index d6a745932..0af2b16a9 100644 --- a/apps/client/src/translations/en/translation.json +++ b/apps/client/src/translations/en/translation.json @@ -250,7 +250,7 @@ "prompt": { "title": "Prompt", "close": "Close", - "ok": "OK enter", + "ok": "OK", "defaultTitle": "Prompt" }, "protected_session_password": { diff --git a/apps/client/src/translations/es/translation.json b/apps/client/src/translations/es/translation.json index 21b9eed84..3f95e1886 100644 --- a/apps/client/src/translations/es/translation.json +++ b/apps/client/src/translations/es/translation.json @@ -247,7 +247,7 @@ "prompt": { "title": "Aviso", "close": "Cerrar", - "ok": "Aceptar enter", + "ok": "Aceptar", "defaultTitle": "Aviso" }, "protected_session_password": { diff --git a/apps/client/src/translations/fr/translation.json b/apps/client/src/translations/fr/translation.json index 306f98763..ec61a8acb 100644 --- a/apps/client/src/translations/fr/translation.json +++ b/apps/client/src/translations/fr/translation.json @@ -244,7 +244,7 @@ "prompt": { "title": "Prompt", "close": "Fermer", - "ok": "OK entrer", + "ok": "OK", "defaultTitle": "Prompt" }, "protected_session_password": { diff --git a/apps/client/src/translations/ro/translation.json b/apps/client/src/translations/ro/translation.json index 4752ed63c..ac6b6f10b 100644 --- a/apps/client/src/translations/ro/translation.json +++ b/apps/client/src/translations/ro/translation.json @@ -970,7 +970,7 @@ }, "prompt": { "defaultTitle": "Aviz", - "ok": "OK enter", + "ok": "OK", "title": "Aviz", "close": "Închide" }, diff --git a/apps/client/src/translations/tw/translation.json b/apps/client/src/translations/tw/translation.json index 9d2b79540..b258090d1 100644 --- a/apps/client/src/translations/tw/translation.json +++ b/apps/client/src/translations/tw/translation.json @@ -222,7 +222,7 @@ }, "prompt": { "title": "提示", - "ok": "確定 Enter", + "ok": "確定", "defaultTitle": "提示" }, "protected_session_password": { diff --git a/apps/client/src/widgets/dialogs/prompt.ts b/apps/client/src/widgets/dialogs/prompt.ts deleted file mode 100644 index f780fc4f5..000000000 --- a/apps/client/src/widgets/dialogs/prompt.ts +++ /dev/null @@ -1,115 +0,0 @@ -import { openDialog } from "../../services/dialog.js"; -import { t } from "../../services/i18n.js"; -import BasicWidget from "../basic_widget.js"; -import { Modal } from "bootstrap"; - -const TPL = /*html*/` -`; - -interface ShownCallbackData { - $dialog: JQuery; - $question: JQuery | null; - $answer: JQuery | null; - $form: JQuery; -} - -export interface PromptDialogOptions { - title?: string; - message?: string; - defaultValue?: string; - shown?: PromptShownDialogCallback; - callback?: (value: string | null) => void; -} - -export type PromptShownDialogCallback = ((callback: ShownCallbackData) => void) | null; - -export default class PromptDialog extends BasicWidget { - private resolve?: ((value: string | null) => void) | undefined | null; - private shownCb?: PromptShownDialogCallback | null; - - private modal!: Modal; - private $dialogBody!: JQuery; - private $question!: JQuery | null; - private $answer!: JQuery | null; - private $form!: JQuery; - - constructor() { - super(); - - this.resolve = null; - this.shownCb = null; - } - - doRender() { - this.$widget = $(TPL); - this.modal = Modal.getOrCreateInstance(this.$widget[0]); - this.$dialogBody = this.$widget.find(".modal-body"); - this.$form = this.$widget.find(".prompt-dialog-form"); - this.$question = null; - this.$answer = null; - - this.$widget.on("shown.bs.modal", () => { - if (this.shownCb) { - this.shownCb({ - $dialog: this.$widget, - $question: this.$question, - $answer: this.$answer, - $form: this.$form - }); - } - - this.$answer?.trigger("focus").select(); - }); - - this.$widget.on("hidden.bs.modal", () => { - if (this.resolve) { - this.resolve(null); - } - }); - - this.$form.on("submit", (e) => { - e.preventDefault(); - if (this.resolve) { - this.resolve(this.$answer?.val() as string); - } - - this.modal.hide(); - }); - } - - showPromptDialogEvent({ title, message, defaultValue, shown, callback }: PromptDialogOptions) { - this.shownCb = shown; - this.resolve = callback; - - this.$widget.find(".prompt-title").text(title || t("prompt.defaultTitle")); - - this.$question = $("