@myissue/vue-website-page-builder 3.4.16 → 3.4.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -1579,10 +1579,13 @@ export class PageBuilderService {
|
|
|
1579
1579
|
|
|
1580
1580
|
// If the element to be deleted is the section itself
|
|
1581
1581
|
if (element.tagName === 'SECTION') {
|
|
1582
|
-
this.deleteComponentFromDOM()
|
|
1582
|
+
await this.deleteComponentFromDOM()
|
|
1583
1583
|
} else {
|
|
1584
1584
|
// If the element is inside a section
|
|
1585
1585
|
element.remove()
|
|
1586
|
+
// --- Sync DOM to store after DOM mutation ---
|
|
1587
|
+
this.syncDomToStoreOnly()
|
|
1588
|
+
|
|
1586
1589
|
if (parentSection && this.isSectionEmpty(parentSection)) {
|
|
1587
1590
|
const componentId = parentSection.getAttribute('data-componentid')
|
|
1588
1591
|
if (componentId) {
|
|
@@ -1596,6 +1599,10 @@ export class PageBuilderService {
|
|
|
1596
1599
|
]
|
|
1597
1600
|
this.pageBuilderStateStore.setComponents(newComponents)
|
|
1598
1601
|
parentSection.remove() // Directly remove from DOM
|
|
1602
|
+
// --- Sync DOM to store again after removing section ---
|
|
1603
|
+
this.syncDomToStoreOnly()
|
|
1604
|
+
// Save after removing the section
|
|
1605
|
+
this.saveDomComponentsToLocalStorage()
|
|
1599
1606
|
}
|
|
1600
1607
|
}
|
|
1601
1608
|
}
|
|
@@ -1619,14 +1626,20 @@ export class PageBuilderService {
|
|
|
1619
1626
|
...components.slice(componentIndex + 1),
|
|
1620
1627
|
]
|
|
1621
1628
|
this.pageBuilderStateStore.setComponents(newComponents)
|
|
1629
|
+
// --- Sync DOM to store after updating section ---
|
|
1630
|
+
this.syncDomToStoreOnly()
|
|
1631
|
+
// Save after updating the section
|
|
1632
|
+
this.saveDomComponentsToLocalStorage()
|
|
1622
1633
|
}
|
|
1623
1634
|
}
|
|
1624
1635
|
}
|
|
1636
|
+
} else {
|
|
1637
|
+
// If no parentSection, still sync and save
|
|
1638
|
+
this.syncDomToStoreOnly()
|
|
1639
|
+
this.saveDomComponentsToLocalStorage()
|
|
1625
1640
|
}
|
|
1626
1641
|
}
|
|
1627
1642
|
|
|
1628
|
-
this.handleAutoSave()
|
|
1629
|
-
|
|
1630
1643
|
// Clear the selection state.
|
|
1631
1644
|
this.pageBuilderStateStore.setComponent(null)
|
|
1632
1645
|
this.pageBuilderStateStore.setElement(null)
|
|
@@ -2007,15 +2020,17 @@ export class PageBuilderService {
|
|
|
2007
2020
|
const currentComponents = currentData.components || []
|
|
2008
2021
|
const newComponents = dataToSave.components || []
|
|
2009
2022
|
|
|
2010
|
-
const hasChanges =
|
|
2011
|
-
|
|
2012
|
-
|
|
2013
|
-
|
|
2014
|
-
|
|
2015
|
-
|
|
2016
|
-
|
|
2017
|
-
|
|
2018
|
-
|
|
2023
|
+
const hasChanges =
|
|
2024
|
+
newComponents.length !== currentComponents.length ||
|
|
2025
|
+
newComponents.some((newComponent, index) => {
|
|
2026
|
+
const currentComponent = currentComponents[index]
|
|
2027
|
+
return (
|
|
2028
|
+
// New component added
|
|
2029
|
+
!currentComponent ||
|
|
2030
|
+
// Component HTML changed
|
|
2031
|
+
currentComponent.html_code !== newComponent.html_code
|
|
2032
|
+
)
|
|
2033
|
+
})
|
|
2019
2034
|
|
|
2020
2035
|
// Compare pageSettings
|
|
2021
2036
|
const hasPageSettingsChanges =
|