mirror of
https://github.com/simonmichael/hledger.git
synced 2024-09-19 10:17:35 +03:00
fix: web: add form's typeahead now shows non-ascii text correctly (#1961)
(Fix contributed by Arsen Arsenović)
This commit is contained in:
parent
331b419c97
commit
ae87b1efd5
@ -190,7 +190,8 @@ toBloodhoundJson ts =
|
||||
"]"
|
||||
]
|
||||
where
|
||||
b64wrap = ("atob(\""<>) . (<>"\")") . encodeBase64
|
||||
-- decodeBase64EncodedText is defined in add-form.hamlet
|
||||
b64wrap = ("decodeBase64EncodedText(\""<>) . (<>"\")") . encodeBase64
|
||||
|
||||
zipDefault :: a -> [a] -> [a] -> [(a, a)]
|
||||
zipDefault def (b:bs) (c:cs) = (b, c):(zipDefault def bs cs)
|
||||
|
@ -19,6 +19,17 @@
|
||||
jQuery('input[name=description]').typeahead({ highlight: true }, { source: descriptionsSuggester.ttAdapter() });
|
||||
jQuery('input[name=account]').typeahead({ highlight: true }, { source: accountsSuggester.ttAdapter() });
|
||||
});
|
||||
|
||||
const utf8textdecoder = new TextDecoder();
|
||||
function decodeBase64EncodedText(b64) {
|
||||
const unb64 = window.atob(b64);
|
||||
const arr = new Uint8Array(unb64.length);
|
||||
for (let i = 0; i < arr.length; i++) {
|
||||
arr[i] = unb64.charCodeAt(i);
|
||||
}
|
||||
return utf8textdecoder.decode(arr);
|
||||
}
|
||||
|
||||
^{extra}
|
||||
|
||||
<div .row>
|
||||
|
Loading…
Reference in New Issue
Block a user