@myissue/vue-website-page-builder 3.4.17 → 3.4.19
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/dist/style.css +1 -1
- package/dist/vue-website-page-builder.js +3698 -3565
- package/dist/vue-website-page-builder.umd.cjs +60 -60
- package/package.json +1 -1
- package/src/Components/PageBuilder/EditorMenu/Editables/BackgroundColorEditor.vue +1 -1
- package/src/Components/PageBuilder/EditorMenu/Editables/EditGetElement.vue +304 -114
- package/src/Components/PageBuilder/EditorMenu/Editables/HTMLEditor.vue +16 -13
- package/src/Components/PageBuilder/EditorMenu/Editables/TextColorEditor.vue +1 -1
- package/src/PageBuilder/PageBuilder.vue +1 -1
- package/src/css/dev-global.css +17 -0
- package/src/css/style.css +6 -3
- package/src/services/PageBuilderService.ts +57 -22
- package/src/stores/page-builder-state.ts +9 -0
|
@@ -804,18 +804,19 @@ export class PageBuilderService {
|
|
|
804
804
|
) {
|
|
805
805
|
const heading = element.children[0] as HTMLElement
|
|
806
806
|
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
})
|
|
807
|
+
// Only add default font size classes if none exist
|
|
808
|
+
const hasFontSizeClass = Array.from(element.classList).some((cls) =>
|
|
809
|
+
this.fontSizeRegex.test(cls),
|
|
810
|
+
)
|
|
812
811
|
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
812
|
+
if (!hasFontSizeClass) {
|
|
813
|
+
// Apply responsive font size classes based on heading type
|
|
814
|
+
if (heading.tagName === 'H2') {
|
|
815
|
+
element.classList.add('pbx-text-2xl', 'lg:pbx-text-4xl', 'pbx-font-medium')
|
|
816
|
+
}
|
|
817
|
+
if (heading.tagName === 'H3') {
|
|
818
|
+
element.classList.add('pbx-text-1xl', 'lg:pbx-text-3xl', 'pbx-font-medium')
|
|
819
|
+
}
|
|
819
820
|
}
|
|
820
821
|
}
|
|
821
822
|
}
|
|
@@ -1508,6 +1509,49 @@ export class PageBuilderService {
|
|
|
1508
1509
|
return !this.hasVisibleContent(section)
|
|
1509
1510
|
}
|
|
1510
1511
|
|
|
1512
|
+
/**
|
|
1513
|
+
* Duplicate the currently selected component from the DOM and the state.
|
|
1514
|
+
* @returns {Promise<void>}
|
|
1515
|
+
*/
|
|
1516
|
+
public async duplicateComponent() {
|
|
1517
|
+
// Sync latest DOM changes to the store
|
|
1518
|
+
this.syncDomToStoreOnly()
|
|
1519
|
+
await nextTick()
|
|
1520
|
+
|
|
1521
|
+
const components = this.pageBuilderStateStore.getComponents
|
|
1522
|
+
const selectedComponent = this.getComponent.value
|
|
1523
|
+
|
|
1524
|
+
if (!components || !selectedComponent) return
|
|
1525
|
+
|
|
1526
|
+
// Find the index of the selected component
|
|
1527
|
+
const index = components.findIndex(
|
|
1528
|
+
(component: ComponentObject) => component.id === selectedComponent.id,
|
|
1529
|
+
)
|
|
1530
|
+
if (index === -1) return
|
|
1531
|
+
|
|
1532
|
+
// Clone the component and generate a new id
|
|
1533
|
+
const clonedComponent = this.cloneCompObjForDOMInsertion(components[index])
|
|
1534
|
+
|
|
1535
|
+
// Insert the cloned component right after the selected one
|
|
1536
|
+
const newComponents = [
|
|
1537
|
+
...components.slice(0, index + 1),
|
|
1538
|
+
clonedComponent,
|
|
1539
|
+
...components.slice(index + 1),
|
|
1540
|
+
]
|
|
1541
|
+
|
|
1542
|
+
this.pageBuilderStateStore.setComponents(newComponents)
|
|
1543
|
+
|
|
1544
|
+
// Wait for DOM update and re-attach listeners
|
|
1545
|
+
await nextTick()
|
|
1546
|
+
await this.addListenersToEditableElements()
|
|
1547
|
+
|
|
1548
|
+
// Optionally, select the new duplicated component
|
|
1549
|
+
this.pageBuilderStateStore.setComponent(clonedComponent)
|
|
1550
|
+
this.pageBuilderStateStore.setElement(null)
|
|
1551
|
+
|
|
1552
|
+
// Auto-save after duplication
|
|
1553
|
+
await this.handleAutoSave()
|
|
1554
|
+
}
|
|
1511
1555
|
/**
|
|
1512
1556
|
* Deletes the currently selected component from the DOM and the state.
|
|
1513
1557
|
* @returns {Promise<void>}
|
|
@@ -1521,8 +1565,8 @@ export class PageBuilderService {
|
|
|
1521
1565
|
if (!components) return
|
|
1522
1566
|
|
|
1523
1567
|
// Find the index of the component to be deleted.
|
|
1524
|
-
const indexToDelete = components.findIndex(
|
|
1525
|
-
|
|
1568
|
+
const indexToDelete = components.findIndex((component: ComponentObject) =>
|
|
1569
|
+
this.getComponent.value ? component.id === this.getComponent.value.id : false,
|
|
1526
1570
|
)
|
|
1527
1571
|
|
|
1528
1572
|
if (indexToDelete === -1) {
|
|
@@ -1538,15 +1582,6 @@ export class PageBuilderService {
|
|
|
1538
1582
|
|
|
1539
1583
|
this.pageBuilderStateStore.setComponents(newComponents)
|
|
1540
1584
|
|
|
1541
|
-
// Remove the component's corresponding section from the DOM.
|
|
1542
|
-
const pagebuilder = document.querySelector('#pagebuilder')
|
|
1543
|
-
if (pagebuilder && this.getComponent.value?.id) {
|
|
1544
|
-
const section = pagebuilder.querySelector(
|
|
1545
|
-
`section[data-componentid="${this.getComponent.value.id}"]`,
|
|
1546
|
-
)
|
|
1547
|
-
if (section) section.remove()
|
|
1548
|
-
}
|
|
1549
|
-
|
|
1550
1585
|
// Wait for the DOM to update before re-attaching event listeners.
|
|
1551
1586
|
await nextTick()
|
|
1552
1587
|
await this.addListenersToEditableElements()
|
|
@@ -52,6 +52,7 @@ interface PageBuilderState {
|
|
|
52
52
|
components: ComponentObject[]
|
|
53
53
|
basePrimaryImage: string | null
|
|
54
54
|
configPageBuilder: PageBuilderConfig | null
|
|
55
|
+
showModalHTMLEditor: boolean
|
|
55
56
|
|
|
56
57
|
// Media Library State
|
|
57
58
|
applyImageToSelection: ImageObject
|
|
@@ -114,6 +115,7 @@ export const usePageBuilderStateStore = defineStore('pageBuilderState', {
|
|
|
114
115
|
components: [],
|
|
115
116
|
basePrimaryImage: null,
|
|
116
117
|
configPageBuilder: null,
|
|
118
|
+
showModalHTMLEditor: false,
|
|
117
119
|
|
|
118
120
|
// Media Library State
|
|
119
121
|
applyImageToSelection: { src: '' },
|
|
@@ -260,6 +262,9 @@ export const usePageBuilderStateStore = defineStore('pageBuilderState', {
|
|
|
260
262
|
getPageBuilderConfig(state: PageBuilderState): PageBuilderConfig | null {
|
|
261
263
|
return state.configPageBuilder
|
|
262
264
|
},
|
|
265
|
+
getShowModalHTMLEditor(state: PageBuilderState): boolean {
|
|
266
|
+
return state.showModalHTMLEditor
|
|
267
|
+
},
|
|
263
268
|
|
|
264
269
|
getApplyImageToSelection(state: PageBuilderState): ImageObject {
|
|
265
270
|
return state.applyImageToSelection
|
|
@@ -450,6 +455,10 @@ export const usePageBuilderStateStore = defineStore('pageBuilderState', {
|
|
|
450
455
|
this.configPageBuilder = payload
|
|
451
456
|
},
|
|
452
457
|
|
|
458
|
+
setShowModalHTMLEditor(payload: boolean): void {
|
|
459
|
+
this.showModalHTMLEditor = payload
|
|
460
|
+
},
|
|
461
|
+
|
|
453
462
|
setApplyImageToSelection(payload: ImageObject): void {
|
|
454
463
|
this.applyImageToSelection = payload
|
|
455
464
|
},
|