generators/webpack/app/assets/javascripts/sections/_manager.js in locomotivecms_wagon-3.0.0.rc0 vs generators/webpack/app/assets/javascripts/sections/_manager.js in locomotivecms_wagon-3.0.0
- old
+ new
@@ -9,11 +9,11 @@
this.sections[type] = actions;
}
start() {
this.eachType((type, actions) => {
- this.queryAll(`.locomotive-section[data-locomotive-section-type="${type}"]`).forEach((section, index) => {
+ this.queryAll(`[data-locomotive-section-type="${type}"]`).forEach((section, index) => {
this.runAction(actions, 'load', section);
});
});
this.registerEvents();
@@ -38,10 +38,11 @@
}
}
applyRuleToEvent(actionName, event) {
const { sectionId, blockId } = event.detail;
- const section = document.getElementById(`locomotive-section-${sectionId}`);
+ const section = document.getElementById(`locomotive-section-${sectionId}`) ||
+ this.queryOne(`[data-locomotive-section-id="${sectionId}"]`);
const type = section.getAttribute('data-locomotive-section-type');
const block = this.queryOne(`[data-locomotive-block="section-${sectionId}-block-${blockId}"]`, section);
this.runAction(this.sections[type], actionName, section, block)
}