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:
@@ -110,20 +110,7 @@ export default {
|
||||
aSyncFunction: function (query, done) {
|
||||
axios.get(this.categoryAutoCompleteURI + query)
|
||||
.then(res => {
|
||||
// loop over 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_html = res.data[key].name;
|
||||
//current.name = this.escapeHtml(res.data[key].name);
|
||||
|
||||
//current.name = res.data[key].name;
|
||||
escapedData.push(current);
|
||||
}
|
||||
}
|
||||
done(escapedData);
|
||||
done(res.data);
|
||||
})
|
||||
.catch(err => {
|
||||
// any error handler
|
||||
|
@@ -53,7 +53,15 @@
|
||||
:target="target"
|
||||
item-key="description"
|
||||
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">
|
||||
<li class="text-danger">{{ error }}</li>
|
||||
</ul>
|
||||
@@ -83,23 +91,17 @@ export default {
|
||||
aSyncFunction: function (query, done) {
|
||||
axios.get(this.descriptionAutoCompleteURI + query)
|
||||
.then(res => {
|
||||
|
||||
// loop over 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.description = this.escapeHtml(res.data[key].description)
|
||||
escapedData.push(current);
|
||||
}
|
||||
}
|
||||
done(escapedData);
|
||||
done(res.data);
|
||||
})
|
||||
.catch(err => {
|
||||
// any error handler
|
||||
})
|
||||
},
|
||||
betterHighlight: function (item) {
|
||||
var inputValue = this.$refs.descr.value.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, '\\$&');
|
||||
var escapedName = this.escapeHtml(item.description);
|
||||
return escapedName.replace(new RegExp(("" + inputValue), 'i'), '<b>$&</b>');
|
||||
},
|
||||
escapeHtml: function (string) {
|
||||
|
||||
let entityMap = {
|
||||
|
Reference in New Issue
Block a user