Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions resources/js/components/fieldtypes/DictionaryFieldtype.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<template>
<Combobox
label-html
searchable
ignore-filter
:disabled="config.disabled"
Expand Down
11 changes: 10 additions & 1 deletion resources/js/components/ui/Combobox/Combobox.vue
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import Button from '../Button/Button.vue';
import Icon from '../Icon/Icon.vue';
import Badge from '../Badge.vue';
import fuzzysort from 'fuzzysort';
import DOMPurify from 'dompurify';
import { SortableList } from '@/components/sortable/Sortable.js';
import Scrollbar from "@ui/Combobox/Scrollbar.vue";

Expand Down Expand Up @@ -148,7 +149,15 @@ const selectedOption = computed(() => {
return selectedOptions.value[0];
});

const getOptionLabel = (option) => option?.[props.optionLabel];
const getOptionLabel = (option) => {
const label = option?.[props.optionLabel];
if (props.labelHtml) {
return DOMPurify.sanitize(label ?? '', {
USE_PROFILES: { html: true, svg: true },
});
}
return label;
};
const getOptionValue = (option) => option?.[props.optionValue];
const isSelected = (option) => selectedOptions.value.some((item) => getOptionValue(item) === getOptionValue(option));

Expand Down