mirror of
https://github.com/easydiffusion/easydiffusion.git
synced 2025-08-17 19:21:30 +02:00
Update image-modifiers.js
Reloading of image tags with ((weight modifiers)) doesn't reuse the modifier card even if it exists, which means images are not restored either. This change fixes that behavior by ensuring proper matching of the tags with existing modifiers.
This commit is contained in:
@ -167,12 +167,14 @@ function refreshModifiersState(newTags) {
|
||||
let found = false
|
||||
document.querySelector('#editor-modifiers').querySelectorAll('.modifier-card').forEach(modifierCard => {
|
||||
const modifierName = modifierCard.querySelector('.modifier-card-label').innerText
|
||||
if (tag == modifierName) {
|
||||
if (trimModifiers(tag) == trimModifiers(modifierName)) {
|
||||
// add modifier to active array
|
||||
if (!activeTags.map(x => x.name).includes(tag)) { // only add each tag once even if several custom modifier cards share the same tag
|
||||
const imageModifierCard = modifierCard.cloneNode(true)
|
||||
imageModifierCard.querySelector('.modifier-card-label p').innerText = tag
|
||||
activeTags.push({
|
||||
'name': modifierName,
|
||||
'element': modifierCard.cloneNode(true),
|
||||
'element': imageModifierCard,
|
||||
'originElement': modifierCard
|
||||
})
|
||||
}
|
||||
|
Reference in New Issue
Block a user