diff --git a/src/locales/de.json b/src/locales/de.json
index a78cd4da..db63a6a2 100644
--- a/src/locales/de.json
+++ b/src/locales/de.json
@@ -1769,6 +1769,10 @@
"Transfer In Amount": "Überweisungsbetrag (Eingang)",
"Transfer In Account Name": "Transfer In Account Name",
"Transfer In Currency": "Transfer In Currency",
+ "Paste Amount": "Paste Amount",
+ "Paste Destination Amount": "Paste Destination Amount",
+ "Cannot parse amount from clipboard": "Cannot parse amount from clipboard",
+ "Unable to read clipboard text": "Unable to read clipboard text",
"Show Amount": "Betrag anzeigen",
"Hide Amount": "Betrag verbergen",
"Swap Account": "Konto tauschen",
diff --git a/src/locales/en.json b/src/locales/en.json
index bdf62511..1a0e09b8 100644
--- a/src/locales/en.json
+++ b/src/locales/en.json
@@ -1769,6 +1769,10 @@
"Transfer In Amount": "Transfer In Amount",
"Transfer In Account Name": "Transfer In Account Name",
"Transfer In Currency": "Transfer In Currency",
+ "Paste Amount": "Paste Amount",
+ "Paste Destination Amount": "Paste Destination Amount",
+ "Cannot parse amount from clipboard": "Cannot parse amount from clipboard",
+ "Unable to read clipboard text": "Unable to read clipboard text",
"Show Amount": "Show Amount",
"Hide Amount": "Hide Amount",
"Swap Account": "Swap Account",
diff --git a/src/locales/es.json b/src/locales/es.json
index f9716258..fed84993 100644
--- a/src/locales/es.json
+++ b/src/locales/es.json
@@ -1769,6 +1769,10 @@
"Transfer In Amount": "Importe de transferencias recibidas",
"Transfer In Account Name": "Transfer In Account Name",
"Transfer In Currency": "Transfer In Currency",
+ "Paste Amount": "Paste Amount",
+ "Paste Destination Amount": "Paste Destination Amount",
+ "Cannot parse amount from clipboard": "Cannot parse amount from clipboard",
+ "Unable to read clipboard text": "Unable to read clipboard text",
"Show Amount": "Mostrar importe",
"Hide Amount": "Ocultar importe",
"Swap Account": "Intercambiar cuenta",
diff --git a/src/locales/fr.json b/src/locales/fr.json
index 7fda26da..ca29eee7 100644
--- a/src/locales/fr.json
+++ b/src/locales/fr.json
@@ -1769,6 +1769,10 @@
"Transfer In Amount": "Montant de virement entrant",
"Transfer In Account Name": "Nom du compte de virement entrant",
"Transfer In Currency": "Devise de virement entrant",
+ "Paste Amount": "Paste Amount",
+ "Paste Destination Amount": "Paste Destination Amount",
+ "Cannot parse amount from clipboard": "Cannot parse amount from clipboard",
+ "Unable to read clipboard text": "Unable to read clipboard text",
"Show Amount": "Afficher le montant",
"Hide Amount": "Masquer le montant",
"Swap Account": "Échanger le compte",
diff --git a/src/locales/it.json b/src/locales/it.json
index aae45662..4b00b4a3 100644
--- a/src/locales/it.json
+++ b/src/locales/it.json
@@ -1769,6 +1769,10 @@
"Transfer In Amount": "Importo trasferimento in entrata",
"Transfer In Account Name": "Nome account trasferimento in entrata",
"Transfer In Currency": "Valuta trasferimento in entrata",
+ "Paste Amount": "Paste Amount",
+ "Paste Destination Amount": "Paste Destination Amount",
+ "Cannot parse amount from clipboard": "Cannot parse amount from clipboard",
+ "Unable to read clipboard text": "Unable to read clipboard text",
"Show Amount": "Mostra importo",
"Hide Amount": "Nascondi importo",
"Swap Account": "Scambia account",
diff --git a/src/locales/ja.json b/src/locales/ja.json
index 95ba529e..900f8165 100644
--- a/src/locales/ja.json
+++ b/src/locales/ja.json
@@ -1769,6 +1769,10 @@
"Transfer In Amount": "振込金額",
"Transfer In Account Name": "振替口座名",
"Transfer In Currency": "振替通貨",
+ "Paste Amount": "Paste Amount",
+ "Paste Destination Amount": "Paste Destination Amount",
+ "Cannot parse amount from clipboard": "Cannot parse amount from clipboard",
+ "Unable to read clipboard text": "Unable to read clipboard text",
"Show Amount": "金額を表示",
"Hide Amount": "金額を非表示",
"Swap Account": "口座のスワップ",
diff --git a/src/locales/ko.json b/src/locales/ko.json
index 2c5ee34b..2e6e91f3 100644
--- a/src/locales/ko.json
+++ b/src/locales/ko.json
@@ -1769,6 +1769,10 @@
"Transfer In Amount": "이체 입금 금액",
"Transfer In Account Name": "이체 입금 계좌명",
"Transfer In Currency": "이체 입금 통화",
+ "Paste Amount": "Paste Amount",
+ "Paste Destination Amount": "Paste Destination Amount",
+ "Cannot parse amount from clipboard": "Cannot parse amount from clipboard",
+ "Unable to read clipboard text": "Unable to read clipboard text",
"Show Amount": "금액 표시",
"Hide Amount": "금액 숨기기",
"Swap Account": "계좌 교체",
diff --git a/src/locales/nl.json b/src/locales/nl.json
index 09e4bf10..c7c73173 100644
--- a/src/locales/nl.json
+++ b/src/locales/nl.json
@@ -1769,6 +1769,10 @@
"Transfer In Amount": "Inkomend bedrag",
"Transfer In Account Name": "Naam inkomende rekening",
"Transfer In Currency": "Valuta inkomende rekening",
+ "Paste Amount": "Paste Amount",
+ "Paste Destination Amount": "Paste Destination Amount",
+ "Cannot parse amount from clipboard": "Cannot parse amount from clipboard",
+ "Unable to read clipboard text": "Unable to read clipboard text",
"Show Amount": "Bedrag tonen",
"Hide Amount": "Bedrag verbergen",
"Swap Account": "Rekening omwisselen",
diff --git a/src/locales/pt_BR.json b/src/locales/pt_BR.json
index a4db388e..080a7a09 100644
--- a/src/locales/pt_BR.json
+++ b/src/locales/pt_BR.json
@@ -1769,6 +1769,10 @@
"Transfer In Amount": "Valor da Transferência Entrada",
"Transfer In Account Name": "Nome da Conta de Transferência Entrada",
"Transfer In Currency": "Moeda da Transferência Entrada",
+ "Paste Amount": "Paste Amount",
+ "Paste Destination Amount": "Paste Destination Amount",
+ "Cannot parse amount from clipboard": "Cannot parse amount from clipboard",
+ "Unable to read clipboard text": "Unable to read clipboard text",
"Show Amount": "Mostrar Valor",
"Hide Amount": "Ocultar Quantia",
"Swap Account": "Trocar Conta",
diff --git a/src/locales/ru.json b/src/locales/ru.json
index 9e07f677..bff38cff 100644
--- a/src/locales/ru.json
+++ b/src/locales/ru.json
@@ -1769,6 +1769,10 @@
"Transfer In Amount": "Сумма перевода (входящий)",
"Transfer In Account Name": "Transfer In Account Name",
"Transfer In Currency": "Transfer In Currency",
+ "Paste Amount": "Paste Amount",
+ "Paste Destination Amount": "Paste Destination Amount",
+ "Cannot parse amount from clipboard": "Cannot parse amount from clipboard",
+ "Unable to read clipboard text": "Unable to read clipboard text",
"Show Amount": "Показать сумму",
"Hide Amount": "Скрыть сумму",
"Swap Account": "Поменять счет",
diff --git a/src/locales/th.json b/src/locales/th.json
index 33aa4328..c011ae61 100644
--- a/src/locales/th.json
+++ b/src/locales/th.json
@@ -1769,6 +1769,10 @@
"Transfer In Amount": "จำนวนโอนเข้า",
"Transfer In Account Name": "ชื่อบัญชีรับโอน",
"Transfer In Currency": "สกุลเงินรับโอน",
+ "Paste Amount": "Paste Amount",
+ "Paste Destination Amount": "Paste Destination Amount",
+ "Cannot parse amount from clipboard": "Cannot parse amount from clipboard",
+ "Unable to read clipboard text": "Unable to read clipboard text",
"Show Amount": "แสดงจำนวน",
"Hide Amount": "ซ่อนจำนวน",
"Swap Account": "สลับบัญชี",
diff --git a/src/locales/uk.json b/src/locales/uk.json
index 3e852429..5e8c8312 100644
--- a/src/locales/uk.json
+++ b/src/locales/uk.json
@@ -1769,6 +1769,10 @@
"Transfer In Amount": "Сума переказу (вхідна)",
"Transfer In Account Name": "Назва рахунку для вхідного переказу",
"Transfer In Currency": "Валюта вхідного переказу",
+ "Paste Amount": "Paste Amount",
+ "Paste Destination Amount": "Paste Destination Amount",
+ "Cannot parse amount from clipboard": "Cannot parse amount from clipboard",
+ "Unable to read clipboard text": "Unable to read clipboard text",
"Show Amount": "Показати суму",
"Hide Amount": "Сховати суму",
"Swap Account": "Поміняти рахунки",
diff --git a/src/locales/vi.json b/src/locales/vi.json
index cc8e09f4..444b587b 100644
--- a/src/locales/vi.json
+++ b/src/locales/vi.json
@@ -1769,6 +1769,10 @@
"Transfer In Amount": "Số tiền chuyển vào",
"Transfer In Account Name": "Transfer In Account Name",
"Transfer In Currency": "Transfer In Currency",
+ "Paste Amount": "Paste Amount",
+ "Paste Destination Amount": "Paste Destination Amount",
+ "Cannot parse amount from clipboard": "Cannot parse amount from clipboard",
+ "Unable to read clipboard text": "Unable to read clipboard text",
"Show Amount": "Hiển thị số tiền",
"Hide Amount": "Ẩn số tiền",
"Swap Account": "Hoán đổi tài khoản",
diff --git a/src/locales/zh_Hans.json b/src/locales/zh_Hans.json
index efde4a35..9ff98c6f 100644
--- a/src/locales/zh_Hans.json
+++ b/src/locales/zh_Hans.json
@@ -1769,6 +1769,10 @@
"Transfer In Amount": "转入金额",
"Transfer In Account Name": "转入账户名",
"Transfer In Currency": "转入货币",
+ "Paste Amount": "粘贴金额",
+ "Paste Destination Amount": "粘贴目标金额",
+ "Cannot parse amount from clipboard": "无法从剪贴板解析金额",
+ "Unable to read clipboard text": "无法读取剪贴板文本",
"Show Amount": "显示金额",
"Hide Amount": "隐藏金额",
"Swap Account": "交换账户",
diff --git a/src/locales/zh_Hant.json b/src/locales/zh_Hant.json
index 58ddb014..3eeb3fdc 100644
--- a/src/locales/zh_Hant.json
+++ b/src/locales/zh_Hant.json
@@ -1769,6 +1769,10 @@
"Transfer In Amount": "轉入金額",
"Transfer In Account Name": "轉入帳戶名稱",
"Transfer In Currency": "轉入貨幣",
+ "Paste Amount": "貼上金額",
+ "Paste Destination Amount": "貼上目標金額",
+ "Cannot parse amount from clipboard": "無法從剪貼簿解析金額",
+ "Unable to read clipboard text": "無法讀取剪貼簿文字",
"Show Amount": "顯示金額",
"Hide Amount": "隱藏金額",
"Swap Account": "交換帳戶",
diff --git a/src/views/mobile/transactions/EditPage.vue b/src/views/mobile/transactions/EditPage.vue
index 7f29238a..d7efe5e0 100644
--- a/src/views/mobile/transactions/EditPage.vue
+++ b/src/views/mobile/transactions/EditPage.vue
@@ -447,6 +447,8 @@
{{ tt('Swap Account and Amount') }}
+ {{ tt('Paste Amount') }}
+ {{ tt('Paste Destination Amount') }}
{{ tt('Show Amount') }}
{{ tt('Hide Amount') }}
@@ -537,7 +539,8 @@ const {
getMultiWeekdayLongNames,
formatUnixTimeToLongDate,
formatUnixTimeToLongTime,
- formatGregorianTextualYearMonthDayToLongDate
+ formatGregorianTextualYearMonthDayToLongDate,
+ parseAmountFromLocalizedNumerals
} = useI18n();
const { showAlert, showConfirm, showToast, routeBackOnError } = useI18nUIComponents();
@@ -604,6 +607,8 @@ const transactionTemplatesStore = useTransactionTemplatesStore();
const pictureBrowser = useTemplateRef('pictureBrowser');
const pictureInput = useTemplateRef('pictureInput');
+const isSupportClipboard = !!navigator.clipboard;
+
const loadingError = ref(null);
const submitted = ref(false);
const removingPictureId = ref(null);
@@ -1095,6 +1100,39 @@ function save(): void {
}
}
+function pasteAmount(type: 'sourceAmount' | 'destinationAmount'): void {
+ if (mode.value === TransactionEditPageMode.View || !isSupportClipboard) {
+ return;
+ }
+
+ navigator.clipboard.readText().then(text => {
+ if (!text) {
+ return;
+ }
+
+ const parsedAmount = parseAmountFromLocalizedNumerals(text);
+
+ if (Number.isNaN(parsedAmount) || !Number.isFinite(parsedAmount)) {
+ showToast('Cannot parse amount from clipboard');
+ return;
+ }
+
+ if (parsedAmount < TRANSACTION_MIN_AMOUNT || parsedAmount > TRANSACTION_MAX_AMOUNT) {
+ showToast('Numeric Overflow');
+ return;
+ }
+
+ if (type === 'sourceAmount') {
+ transaction.value.sourceAmount = parsedAmount;
+ } else if (type === 'destinationAmount') {
+ transaction.value.destinationAmount = parsedAmount;
+ }
+ }).catch(error => {
+ logger.error('failed to read clipboard text', error);
+ showToast('Unable to read clipboard text');
+ });
+}
+
function updateGeoLocation(forceUpdate: boolean): void {
if (!isSupportGeoLocation) {
logger.warn('this browser does not support geo location');