mirror of
https://github.com/loot/libloot.git
synced 2026-07-27 14:16:01 -07:00
Simplify plugin item data binding
This commit is contained in:
@@ -97,17 +97,14 @@
|
||||
priority: {
|
||||
type: String,
|
||||
value: '',
|
||||
reflectToAttribute: true,
|
||||
},
|
||||
isPriorityGlobal: {
|
||||
type: Boolean,
|
||||
value: false,
|
||||
reflectToAttribute: true,
|
||||
},
|
||||
hasUserEdits: {
|
||||
type: Boolean,
|
||||
value: false,
|
||||
reflectToAttribute: true,
|
||||
},
|
||||
},
|
||||
|
||||
@@ -120,6 +117,12 @@
|
||||
evt.dataTransfer.setData('text/plain', evt.currentTarget.getName());
|
||||
evt.dataTransfer.setDragImage(evt.currentTarget, 325, 175);
|
||||
},
|
||||
|
||||
updateStyling(pluginData) {
|
||||
this.priority = pluginData.priority;
|
||||
this.isPriorityGlobal = pluginData.isPriorityGlobal;
|
||||
this.hasUserEdits = pluginData.hasUserEdits;
|
||||
},
|
||||
});
|
||||
</script>
|
||||
</dom-module>
|
||||
|
||||
@@ -437,17 +437,7 @@
|
||||
static onItemContentChange(evt) {
|
||||
const item = document.getElementById('cardsNav').querySelector(`[data-id="${evt.detail.pluginId}"]`);
|
||||
if (item) {
|
||||
item.setAttribute('priority', evt.detail.priority);
|
||||
if (evt.detail.isPriorityGlobal) {
|
||||
item.setAttribute('is-priority-global', '');
|
||||
} else {
|
||||
item.removeAttribute('is-priority-global');
|
||||
}
|
||||
if (evt.detail.hasUserEdits) {
|
||||
item.setAttribute('has-user-edits', '');
|
||||
} else {
|
||||
item.removeAttribute('has-user-edits');
|
||||
}
|
||||
item.updateStyling(evt.detail);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user