[Feature] Homebrew Domains (#639)

* Split into tabs

* Finished homebrew settings

* .

* Improved domainremoval cleanup
This commit is contained in:
WBHarry 2025-08-06 13:58:17 +02:00 committed by GitHub
parent d186c62ee5
commit 02958f9574
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
24 changed files with 560 additions and 49 deletions

View file

@ -83,15 +83,16 @@ export const chunkify = (array, chunkSize, mappingFunc) => {
return chunkifiedArray;
};
export const tagifyElement = (element, options, onChange, tagifyOptions = {}) => {
export const tagifyElement = (element, baseOptions, onChange, tagifyOptions = {}) => {
const { maxTags } = tagifyOptions;
const options = typeof baseOptions === 'object' ? Object.values(baseOptions) : baseOptions;
const tagifyElement = new Tagify(element, {
tagTextProp: 'name',
enforceWhitelist: true,
whitelist: Object.keys(options).map(key => {
const option = options[key];
whitelist: options.map(option => {
return {
value: key,
value: option.id,
name: game.i18n.localize(option.label),
src: option.src,
description: option.description
@ -100,7 +101,7 @@ export const tagifyElement = (element, options, onChange, tagifyOptions = {}) =>
maxTags: typeof maxTags === 'function' ? maxTags() : maxTags,
dropdown: {
mapValueTo: 'name',
searchKeys: ['name'],
searchKeys: ['value'],
enabled: 0,
maxItems: 100,
closeOnSelect: true,
@ -369,3 +370,7 @@ export async function createEmbeddedItemWithEffects(actor, baseData, update) {
return doc;
}
export const slugify = name => {
return name.toLowerCase().replaceAll(' ', '-').replaceAll('.', '');
};