Commit 41f10b56 authored by bensinober's avatar bensinober Committed by Benjamin
Browse files

DEICH-5736 deichman autocomplete. strip leading and trailing quote from title phrase search

parent 0f7158d6
......@@ -67,18 +67,19 @@ export default class Autocomplete extends React.Component {
onSelect(item, index) {
this.props.tracker.interaction();
let selected = item.label;
const label = item.label.replace(/"(.+)"/g, '$1');
let selected = label;
if (item.typeLabel === "emne") {
selected = `emne:"${item.label}"`;
selected = `emne:"${label}"`;
} else if (item.typeLabel === "serie") {
selected = `serie:"${item.label}"`;
selected = `serie:"${label}"`;
} else if (item.typeLabel === "tittel") {
selected = `tittel:"${item.label}"`;
selected = `tittel:"${label}"`;
} else if (
item.typeLabel === "person" ||
item.typeLabel === "korporasjon"
) {
selected = `aktør:"${item.label}"`;
selected = `aktør:"${label}"`;
}
this.props.tracker.click(selected, index, this.props.value);
this.setState({ items: [], hidden: true });
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment