Files
hstream/resources/js/user-blacklist.js
2025-09-18 15:31:27 +02:00

28 lines
874 B
JavaScript

import Tagify from '@yaireo/tagify';
import '@yaireo/tagify/dist/tagify.css';
const taginput = document.querySelector("#tags");
// Get Tags from API
window.axios.get('/user/blacklist').then(function (response) {
if (response.status != 200) {
return;
}
var tagify = new Tagify(taginput, {
whitelist: response.data.tags,
enforceWhitelist: true,
dropdown: {
classname: "color-blue",
enabled: 0, // show the dropdown immediately on focus
maxItems: 10,
position: "text", // place the dropdown near the typed text
closeOnSelect: false, // keep the dropdown open after selecting a suggestion
highlightFirst: true,
}
});
tagify.addTags(response.data.usertags);
}).catch(function (error) {
console.log(error);
});