mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-12 15:35:15 +00:00
Fix #4011
This commit is contained in:
2
public/v1/js/create_transaction.js
vendored
2
public/v1/js/create_transaction.js
vendored
File diff suppressed because one or more lines are too long
2
public/v1/js/edit_transaction.js
vendored
2
public/v1/js/edit_transaction.js
vendored
File diff suppressed because one or more lines are too long
@@ -53,7 +53,15 @@
|
|||||||
:target="target"
|
:target="target"
|
||||||
item-key="name_with_balance"
|
item-key="name_with_balance"
|
||||||
v-on:input="selectedItem"
|
v-on:input="selectedItem"
|
||||||
></typeahead>
|
>
|
||||||
|
<template slot="item" slot-scope="props">
|
||||||
|
<li v-for="(item, index) in props.items" :class="{active:props.activeIndex===index}">
|
||||||
|
<a role="button" @click="props.select(item)">
|
||||||
|
<span v-html="betterHighlight(item)"></span>
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
</template>
|
||||||
|
</typeahead>
|
||||||
<ul v-for="error in this.error" class="list-unstyled">
|
<ul v-for="error in this.error" class="list-unstyled">
|
||||||
<li class="text-danger">{{ error }}</li>
|
<li class="text-danger">{{ error }}</li>
|
||||||
</ul>
|
</ul>
|
||||||
@@ -131,22 +139,17 @@ export default {
|
|||||||
aSyncFunction: function (query, done) {
|
aSyncFunction: function (query, done) {
|
||||||
axios.get(this.accountAutoCompleteURI + query)
|
axios.get(this.accountAutoCompleteURI + query)
|
||||||
.then(res => {
|
.then(res => {
|
||||||
// loop over data
|
done(res.data);
|
||||||
let escapedData = [];
|
|
||||||
let current;
|
|
||||||
for (const key in res.data) {
|
|
||||||
if (res.data.hasOwnProperty(key) && /^0$|^[1-9]\d*$/.test(key) && key <= 4294967294) {
|
|
||||||
current = res.data[key];
|
|
||||||
current.name_with_balance = this.escapeHtml(res.data[key].name_with_balance)
|
|
||||||
escapedData.push(current);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
done(escapedData);
|
|
||||||
})
|
})
|
||||||
.catch(err => {
|
.catch(err => {
|
||||||
// any error handler
|
// any error handler
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
betterHighlight: function (item) {
|
||||||
|
var inputValue = this.$refs.input.value.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, '\\$&');
|
||||||
|
var escapedName = this.escapeHtml(item.name_with_balance);
|
||||||
|
return escapedName.replace(new RegExp(("" + inputValue), 'i'), '<b>$&</b>');
|
||||||
|
},
|
||||||
escapeHtml: function (string) {
|
escapeHtml: function (string) {
|
||||||
|
|
||||||
let entityMap = {
|
let entityMap = {
|
||||||
|
Reference in New Issue
Block a user