@myissue/vue-website-page-builder 3.3.64 → 3.3.65
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/README.md +147 -126
- package/dist/logo/mybuilder_new_lowercase.svg +17558 -0
- package/dist/vue-website-page-builder.css +1 -1
- package/dist/vue-website-page-builder.js +7326 -6943
- package/dist/vue-website-page-builder.umd.cjs +54 -51
- package/package.json +2 -2
- package/src/Components/DemoUnsplash.vue +1 -4
- package/src/Components/PageBuilder/EditorMenu/Editables/BackgroundColorEditor.vue +2 -1
- package/src/Components/PageBuilder/EditorMenu/Editables/BorderRadius.vue +18 -5
- package/src/Components/PageBuilder/EditorMenu/Editables/Borders.vue +6 -4
- package/src/Components/PageBuilder/EditorMenu/Editables/ClassEditor.vue +2 -1
- package/src/Components/PageBuilder/EditorMenu/Editables/EditGetElement.vue +5 -5
- package/src/Components/PageBuilder/EditorMenu/Editables/ManageBackgroundOpacity.vue +7 -8
- package/src/Components/PageBuilder/EditorMenu/Editables/ManageOpacity.vue +2 -2
- package/src/Components/PageBuilder/EditorMenu/Editables/Margin.vue +4 -2
- package/src/Components/PageBuilder/EditorMenu/Editables/Padding.vue +4 -2
- package/src/Components/PageBuilder/EditorMenu/Editables/StyleEditor.vue +115 -0
- package/src/Components/PageBuilder/EditorMenu/Editables/TextColorEditor.vue +2 -1
- package/src/Components/PageBuilder/EditorMenu/Editables/Typography.vue +14 -7
- package/src/Components/PageBuilder/EditorMenu/RightSidebarEditor.vue +56 -64
- package/src/Components/PageBuilder/ToolbarOption/ToolbarOption.vue +10 -7
- package/src/PageBuilder/PageBuilder.vue +89 -63
- package/src/PageBuilder/Preview.vue +25 -9
- package/src/composables/extractCleanHTMLFromPageBuilder.ts +4 -3
- package/src/css/app.css +10 -70
- package/src/services/LocalStorageManager.ts +1 -162
- package/src/services/PageBuilderService.ts +584 -265
- package/src/stores/page-builder-state.ts +8 -0
- package/src/tests/PageBuilderTest.vue +20 -19
- package/src/tests/componentsArray.test.json +3 -3
- package/src/types/index.ts +10 -2
- package/src/utils/html-elements/component.ts +10 -10
package/README.md
CHANGED
|
@@ -11,10 +11,10 @@
|
|
|
11
11
|
- [Installation](#installation)
|
|
12
12
|
- [About](#about)
|
|
13
13
|
- [Features](#features)
|
|
14
|
-
- [Technical
|
|
14
|
+
- [Technical Details](#technical-details)
|
|
15
15
|
- [Documentation](#documentation)
|
|
16
16
|
- [Requirements](#requirements)
|
|
17
|
-
- [Getting
|
|
17
|
+
- [Getting Started \& Installation](#getting-started--installation)
|
|
18
18
|
- [Quick Start](#quick-start)
|
|
19
19
|
- [Initializing the Page Builder](#initializing-the-page-builder)
|
|
20
20
|
- [Why Use the Shared Instance?](#why-use-the-shared-instance)
|
|
@@ -25,11 +25,13 @@
|
|
|
25
25
|
- [Local Storage \& Auto-Save](#local-storage--auto-save)
|
|
26
26
|
- [Retrieving the Latest HTML Content for Form Submission](#retrieving-the-latest-html-content-for-form-submission)
|
|
27
27
|
- [Resetting the Builder After Successful Resource Creation or Update](#resetting-the-builder-after-successful-resource-creation-or-update)
|
|
28
|
-
- [Loading
|
|
28
|
+
- [Loading Existing Content or Components into the Page Builder](#loading-existing-content-or-components-into-the-page-builder)
|
|
29
|
+
- [Restoring Full Page Content (Global Styles \& Components)](#restoring-full-page-content-global-styles--components)
|
|
29
30
|
- [Automatic Draft Recovery](#automatic-draft-recovery)
|
|
30
31
|
- [Embedding Page Builder in a Modal or Dialog](#embedding-page-builder-in-a-modal-or-dialog)
|
|
32
|
+
- [Publish Button](#publish-button)
|
|
31
33
|
- [Styling the Main Page Builder Container](#styling-the-main-page-builder-container)
|
|
32
|
-
- [Download HTML
|
|
34
|
+
- [Download HTML File](#download-html-file)
|
|
33
35
|
- [Custom Components](#custom-components)
|
|
34
36
|
- [Custom Media Library Component](#custom-media-library-component)
|
|
35
37
|
- [Integrate Unsplash Library](#integrate-unsplash-library)
|
|
@@ -40,35 +42,35 @@
|
|
|
40
42
|
- [How the Page Builder Works](#how-the-page-builder-works)
|
|
41
43
|
- [Contributing](#contributing)
|
|
42
44
|
- [Security Vulnerabilities](#security-vulnerabilities)
|
|
43
|
-
- [Get in
|
|
45
|
+
- [Get in Touch for Customization or Any Questions](#get-in-touch-for-customization-or-any-questions)
|
|
44
46
|
- [Feedback](#feedback)
|
|
45
47
|
- [Support the Project](#support-the-project)
|
|
46
48
|
- [License](#license)
|
|
47
49
|
|
|
48
50
|
## Demo
|
|
49
51
|
|
|
50
|
-
A Vue 3 page builder component with drag
|
|
52
|
+
A Vue 3 page builder component with drag-and-drop functionality for creating dynamic web pages.
|
|
51
53
|
|
|
52
54
|
Create and enhance digital experiences with Vue on any backend.
|
|
53
55
|
|
|
54
56
|
Experience the power and simplicity of the Vue Website Page Builder in action.
|
|
55
|
-
Try the live demo to explore real-time visual updates
|
|
57
|
+
Try the live demo to explore real-time visual updates and smooth content management.
|
|
56
58
|
|
|
57
|
-
[Play around with the Page Builder](https://
|
|
59
|
+
[Play around with the Page Builder](https://mybuilder.dev)
|
|
58
60
|
|
|
59
61
|
## Overview
|
|
60
62
|
|
|
61
|
-
If you're a Vue 3 developer, this builder feels right at home. It installs quickly via npm and supports full customization through props and configuration objects. You can even set specific user settings like image, name, theme, language, company logo and autosave preferences, making it a personalized experience for every user.
|
|
63
|
+
If you're a Vue 3 developer, this builder feels right at home. It installs quickly via npm and supports full customization through props and configuration objects. You can even set specific user settings like image, name, theme, language, company logo, and autosave preferences, making it a personalized experience for every user.
|
|
62
64
|
|
|
63
|
-
|
|
65
|
+
A lightweight and minimalist Page Builder with an elegant and intuitive design, focused on simplicity and speed.
|
|
64
66
|
|
|
65
|
-
Build responsive pages like listings, jobs or blog posts and manage content easily.
|
|
67
|
+
Build responsive pages like listings, jobs, or blog posts and manage content easily.
|
|
66
68
|
|
|
67
69
|
<img style="max-width: 100%;" src="./public/home/editor.jpg" alt="Vue Website Page Builder - the editor" />
|
|
68
70
|
|
|
69
71
|
## Get Started in Minutes
|
|
70
72
|
|
|
71
|
-
Easy setup and instant productivity.
|
|
73
|
+
Easy setup and instant productivity.
|
|
72
74
|
Follow the [Quick Start](#quick-start) guide to begin building with just a few simple steps.
|
|
73
75
|
|
|
74
76
|
---
|
|
@@ -93,8 +95,8 @@ A Page Builder designed for growth. Build your website pages with ready-made com
|
|
|
93
95
|
|
|
94
96
|
Includes:
|
|
95
97
|
|
|
96
|
-
- **Page Builder**: Click & Drop Page Builder.
|
|
97
|
-
- **Customizable Design**:
|
|
98
|
+
- **Page Builder**: A Click & Drop Page Builder.
|
|
99
|
+
- **Customizable Design**: Customize the look to match your brand.
|
|
98
100
|
|
|
99
101
|
The Page Builder is packed with features:
|
|
100
102
|
|
|
@@ -102,24 +104,24 @@ The Page Builder is packed with features:
|
|
|
102
104
|
- **Reordering**: Change the order of your content without hassle.
|
|
103
105
|
- **True Visual Editing**: See your changes in real-time as you make them.
|
|
104
106
|
- **Media Library**: Easily inject your own custom media library component.
|
|
105
|
-
- **Local Storage & Auto-Save**: Never lose your work
|
|
106
|
-
- **Unsplash**: Unsplash
|
|
107
|
+
- **Local Storage & Auto-Save**: Never lose your work—changes are saved as you go.
|
|
108
|
+
- **Unsplash**: Unsplash integration.
|
|
107
109
|
- **Responsive Editing**: Ensure your site looks great on all devices.
|
|
108
110
|
- **Text Editing**: Edit text content live and in real-time.
|
|
109
111
|
- **Font Customization**: Choose the perfect fonts to match your style.
|
|
110
112
|
- **Undo & Redo**: Experiment confidently with the ability to revert changes.
|
|
111
|
-
- **Global Styles**: Global
|
|
113
|
+
- **Global Styles**: Global styles for fonts, designs, and colors.
|
|
112
114
|
- **YouTube Videos**: Integrate video content smoothly.
|
|
113
115
|
- **Download HTML**: Export the entire page as a standalone HTML file.
|
|
114
116
|
- **Global Page Styling**: Instantly define, update, or clear global styles for the main page wrapper at initialization or dynamically at runtime. Gain full control over fonts, colors, backgrounds, and more for a dynamic user experience.
|
|
115
117
|
- **Tailwind Support**: Fully compatible with Tailwind CSS (with automatic class prefixing to avoid conflicts).
|
|
116
|
-
- **Styles
|
|
118
|
+
- **Scoped Styles**: To ensure clean and predictable styling, the builder uses scoped style isolation. There is no risk of style conflicts between the builder and your app.
|
|
117
119
|
|
|
118
|
-
|
|
120
|
+
A powerful Page Builder for any growing merchants, brands, and agencies. Empower users to create the perfect content with the Page Builder.
|
|
119
121
|
|
|
120
122
|
<img style="max-width: 100%;" src="./public/home/text_editor.jpg" alt="Vue Website Page Builder - the media library" />
|
|
121
123
|
|
|
122
|
-
## Technical
|
|
124
|
+
## Technical Details
|
|
123
125
|
|
|
124
126
|
- **Technologies**: This Page Builder is developed using TypeScript, Vue 3, the Composition API, Pinia, CSS, Tailwind CSS, and HTML.
|
|
125
127
|
- **Features**: Click & Drop Page Builder.
|
|
@@ -137,7 +139,7 @@ Please note that these instructions assume you have Node.js installed.
|
|
|
137
139
|
- Vue.js ≥ 3.0.0
|
|
138
140
|
- Modern browser with ES6+ support
|
|
139
141
|
|
|
140
|
-
## Getting
|
|
142
|
+
## Getting Started & Installation
|
|
141
143
|
|
|
142
144
|
Make sure to install the dependencies:
|
|
143
145
|
|
|
@@ -182,10 +184,10 @@ const app = createApp(App)
|
|
|
182
184
|
app.mount('#app')
|
|
183
185
|
```
|
|
184
186
|
|
|
185
|
-
> **Note:**
|
|
187
|
+
> **Note:**
|
|
186
188
|
> You only need to import the CSS file once. If you have already imported it in your app entry, you do not need to import it again in individual components.
|
|
187
189
|
|
|
188
|
-
> **Note**
|
|
190
|
+
> **Note**
|
|
189
191
|
> The Page Builder is implemented as a singleton service. This ensures that all page-building logic and state are managed by a single, shared instance throughout your application.
|
|
190
192
|
|
|
191
193
|
### Why Use the Shared Instance?
|
|
@@ -196,10 +198,10 @@ By always accessing the shared instance, you avoid creating multiple, isolated c
|
|
|
196
198
|
|
|
197
199
|
Ensure the following configuration options are set:
|
|
198
200
|
|
|
199
|
-
- **`formType` (required):**
|
|
201
|
+
- **`formType` (required):**
|
|
200
202
|
Indicates whether you are creating or updating a resource. This is used to retrieve the correct content from local storage.
|
|
201
203
|
|
|
202
|
-
- **`formName` (required):**
|
|
204
|
+
- **`formName` (required):**
|
|
203
205
|
Specifies the resource type (for example, `article`, `jobPost`, `store`, etc.).
|
|
204
206
|
|
|
205
207
|
```vue
|
|
@@ -232,10 +234,10 @@ This prevents global styles from leaking into the builder and vice versa, which
|
|
|
232
234
|
|
|
233
235
|
**How does this affect you?**
|
|
234
236
|
|
|
235
|
-
When a user adds a component into the page builder, all classes from that component are automatically prefixed with pbx
|
|
237
|
+
When a user adds a component into the page builder, all classes from that component are automatically prefixed with `pbx-` (e.g., `pbx-button`, `pbx-container`) to ensure style isolation and avoid conflicts.
|
|
236
238
|
|
|
237
|
-
> **Note:**
|
|
238
|
-
> Simply import the builder’s CSS file once in your project. All builder styles are namespaced, so there is no risk of style conflicts
|
|
239
|
+
> **Note:**
|
|
240
|
+
> Simply import the builder’s CSS file once in your project. All builder styles are namespaced, so there is no risk of style conflicts.
|
|
239
241
|
|
|
240
242
|
## Rendering HTML Output in Other Frameworks (React, Nuxt, etc.)
|
|
241
243
|
|
|
@@ -270,7 +272,7 @@ import '@myissue/vue-website-page-builder/style.css'
|
|
|
270
272
|
|
|
271
273
|
Then use `v-html` to render the HTML.
|
|
272
274
|
|
|
273
|
-
> **Note:**
|
|
275
|
+
> **Note:**
|
|
274
276
|
> You do not need to import any Vue components if you only want to render the HTML. Just import the CSS file.
|
|
275
277
|
|
|
276
278
|
## Providing Configuration to the Page Builder
|
|
@@ -279,19 +281,19 @@ The example below demonstrates the setup to start building pages, with additiona
|
|
|
279
281
|
|
|
280
282
|
Your `configPageBuilder` object can include:
|
|
281
283
|
|
|
282
|
-
- **`formType` (required):**
|
|
284
|
+
- **`formType` (required):**
|
|
283
285
|
Used to retrieve the correct content from local storage. Specify whether you are creating or updating a resource.
|
|
284
|
-
- **`formName` (required):**
|
|
286
|
+
- **`formName` (required):**
|
|
285
287
|
The resource type (e.g., `article`, `jobPost`, `store`, etc.). This is especially useful for platforms supporting multiple resource types, allowing the builder to manage layouts and storage for each resource uniquely.
|
|
286
|
-
- **`resourceData` (optional):**
|
|
288
|
+
- **`resourceData` (optional):**
|
|
287
289
|
Prefill the builder with initial resource data (e.g., `title`, `id`).
|
|
288
|
-
- **`userForPageBuilder` (optional):**
|
|
290
|
+
- **`userForPageBuilder` (optional):**
|
|
289
291
|
Pass user information (such as `name` and `image`) to display the logged-in user’s details in the builder.
|
|
290
|
-
- **`pageBuilderLogo` (optional):**
|
|
292
|
+
- **`pageBuilderLogo` (optional):**
|
|
291
293
|
Display your company logo in the builder toolbar.
|
|
292
|
-
- **`userSettings` (optional):**
|
|
294
|
+
- **`userSettings` (optional):**
|
|
293
295
|
Set user preferences such as theme, language, or auto-save.
|
|
294
|
-
- **`brandColor` (optional):**
|
|
296
|
+
- **`brandColor` (optional):**
|
|
295
297
|
Set your brand’s primary color for key UI elements (inside the `settings` config).
|
|
296
298
|
|
|
297
299
|
```vue
|
|
@@ -375,101 +377,90 @@ const configPageBuilder = {
|
|
|
375
377
|
const pageBuilderService = getPageBuilder()
|
|
376
378
|
await pageBuilderService.startBuilder(configPageBuilder)
|
|
377
379
|
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
try {
|
|
382
|
-
storedComponents = JSON.parse(storedComponents)
|
|
383
|
-
contentFromPageBuilder =
|
|
384
|
-
storedComponents && Array.isArray(storedComponents.components)
|
|
385
|
-
? storedComponents.components.map((component) => component.html_code).join('')
|
|
386
|
-
: ''
|
|
387
|
-
} catch (e) {
|
|
388
|
-
console.error('Unable to parse storedComponents from localStorage:', e)
|
|
389
|
-
contentFromPageBuilder = ''
|
|
390
|
-
} finally {
|
|
391
|
-
yourForm.content = contentFromPageBuilder
|
|
392
|
-
}
|
|
380
|
+
const storedComponents = pageBuilderService.getSavedPageHtml()
|
|
381
|
+
yourForm.content = storedComponents
|
|
393
382
|
</script>
|
|
394
383
|
```
|
|
395
384
|
|
|
396
385
|
### Resetting the Builder After Successful Resource Creation or Update
|
|
397
386
|
|
|
398
|
-
After
|
|
387
|
+
After successfully creating or updating a resource (such as a post, article, or listing) using the Page Builder, it is important to clear the DOM and the builder’s draft state, as well as remove the corresponding local storage entry. This ensures that old drafts do not appear the next time the builder is opened for a new or existing resource.
|
|
399
388
|
|
|
400
|
-
You can reset the builder state and clear the draft with:
|
|
389
|
+
You can reset the Page Builder’s live DOM, builder state, and clear the draft with:
|
|
401
390
|
|
|
402
391
|
```js
|
|
403
|
-
|
|
404
|
-
pageBuilderService.deleteAllComponentsFromDOM()
|
|
405
|
-
// Clear Local Storage for the created or updated resource
|
|
406
|
-
await pageBuilderService.removeCurrentComponentsFromLocalStorage()
|
|
392
|
+
await pageBuilderService.handleFormSubmission()
|
|
407
393
|
```
|
|
408
394
|
|
|
409
|
-
Always call
|
|
395
|
+
Always call this method after a successful post or resource update to ensure users start with a fresh builder the next time they create or edit a resource.
|
|
410
396
|
|
|
411
|
-
## Loading
|
|
397
|
+
## Loading Existing Content or Components into the Page Builder
|
|
412
398
|
|
|
413
|
-
The Page Builder makes it simple to load previously published content from any backend source, such as your database or API.
|
|
399
|
+
The Page Builder makes it simple to load previously published content—including both your page’s global styles and all components—from any backend source, such as your database or API.
|
|
414
400
|
|
|
415
|
-
|
|
401
|
+
### Restoring Full Page Content (Global Styles & Components)
|
|
416
402
|
|
|
417
|
-
|
|
418
|
-
The builder configuration object.
|
|
419
|
-
2. **Components Data** (optional):
|
|
420
|
-
An array of component objects. Each object must include a `html_code` string and may optionally include a title string. This is especially useful when loading previously published or saved content into the builder.
|
|
403
|
+
If you have previously saved or published HTML content (for example, from your database), you can easily restore both the global page styles (classes, inline styles) and all builder components for seamless editing.
|
|
421
404
|
|
|
422
|
-
**
|
|
405
|
+
**Recommended Workflow:**
|
|
423
406
|
|
|
424
|
-
|
|
425
|
-
This tells the builder to expect and load your provided components array as the initial content.
|
|
407
|
+
1. **Parse your saved HTML** using the builder’s helper method to extract both the components and the global page settings:
|
|
426
408
|
|
|
427
|
-
```
|
|
428
|
-
|
|
429
|
-
|
|
409
|
+
```js
|
|
410
|
+
// yourPageHTML: the full HTML string previously saved from the builder
|
|
411
|
+
const { components, pageSettings } = pageBuilderService.parsePageBuilderHTML(yourPageHTML)
|
|
412
|
+
```
|
|
430
413
|
|
|
431
|
-
|
|
432
|
-
updateOrCreate: {
|
|
433
|
-
formType: 'update',
|
|
434
|
-
formName: 'article',
|
|
435
|
-
},
|
|
436
|
-
}
|
|
414
|
+
2. **Pass `pageSettings` directly** in your config object, and pass the `components` array as the second argument to `startBuilder`:
|
|
437
415
|
|
|
438
|
-
|
|
439
|
-
|
|
416
|
+
```vue
|
|
417
|
+
<script setup>
|
|
418
|
+
import { getPageBuilder } from '@myissue/vue-website-page-builder'
|
|
440
419
|
|
|
441
|
-
//
|
|
442
|
-
const
|
|
443
|
-
{ html_code: '<section>...</section>', title: 'Header H2' },
|
|
444
|
-
{ html_code: '<section>...</section>', title: 'Text' },
|
|
445
|
-
{ html_code: '<section>...</section>', title: 'Image' },
|
|
446
|
-
]
|
|
420
|
+
// Retrieve the Page Builder service instance
|
|
421
|
+
const pageBuilderService = getPageBuilder()
|
|
447
422
|
|
|
448
|
-
|
|
423
|
+
// Parse your saved HTML to extract both components and global page settings
|
|
424
|
+
const { components, pageSettings } = pageBuilderService.parsePageBuilderHTML(yourPageHTML)
|
|
449
425
|
|
|
450
|
-
|
|
451
|
-
|
|
426
|
+
// Prepare the config, passing pageSettings directly
|
|
427
|
+
const configPageBuilder = {
|
|
428
|
+
updateOrCreate: {
|
|
429
|
+
formType: 'update', // important: set to update
|
|
430
|
+
formName: 'article',
|
|
431
|
+
},
|
|
432
|
+
// pass directly, not nested
|
|
433
|
+
pageSettings: pageSettings,
|
|
434
|
+
}
|
|
452
435
|
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
</template>
|
|
456
|
-
```
|
|
436
|
+
// Start the builder with both config and components
|
|
437
|
+
const result = await pageBuilderService.startBuilder(configPageBuilder, components)
|
|
457
438
|
|
|
458
|
-
|
|
459
|
-
>
|
|
460
|
-
|
|
439
|
+
console.info('You may inspect this result for message, status, or error:', result)
|
|
440
|
+
</script>
|
|
441
|
+
|
|
442
|
+
<template>
|
|
443
|
+
<PageBuilder />
|
|
444
|
+
</template>
|
|
445
|
+
```
|
|
461
446
|
|
|
462
|
-
|
|
447
|
+
> **Note:**
|
|
448
|
+
>
|
|
449
|
+
> - Each component’s `html_code` must be wrapped in a `<section>...</section>` tag. This is how the Page Builder defines and separates individual components.
|
|
450
|
+
> - Always pass `pageSettings` directly in the config object (not as `{ pageSettings: { pageSettings } }`).
|
|
451
|
+
> - Set `formType: 'update'` to ensure the builder loads your provided content for editing.
|
|
452
|
+
|
|
453
|
+
This approach ensures your users can seamlessly restore and edit previously published content—including all global styles and layout—providing a smooth and reliable editing experience for existing pages.
|
|
463
454
|
|
|
464
455
|
## Automatic Draft Recovery
|
|
465
456
|
|
|
466
|
-
The Page Builder automatically checks for unsaved drafts in local storage for the current resource.
|
|
457
|
+
The Page Builder automatically checks for unsaved drafts in local storage for the current resource.
|
|
467
458
|
If a draft is found, users are prompted to either continue where they left off or use the version loaded from your backend.
|
|
468
459
|
|
|
469
|
-
- **`formType` (required):**
|
|
460
|
+
- **`formType` (required):**
|
|
470
461
|
Determines which draft to load from local storage. Set this to either `create` or `update` in the `updateOrCreate` config, depending on your use case.
|
|
471
|
-
- **`formName` (required):**
|
|
472
|
-
Specifies the resource type (e.g., `article`, `jobPost`, `store`, etc.) in the `updateOrCreate` config. This is especially important if your platform supports multiple resource types. By providing a unique name, the Page Builder can correctly manage layouts and drafts for each resource, allowing users to pick up where they left
|
|
462
|
+
- **`formName` (required):**
|
|
463
|
+
Specifies the resource type (e.g., `article`, `jobPost`, `store`, etc.) in the `updateOrCreate` config. This is especially important if your platform supports multiple resource types. By providing a unique name, the Page Builder can correctly manage layouts and drafts for each resource, allowing users to pick up where they left off.
|
|
473
464
|
|
|
474
465
|
```vue
|
|
475
466
|
<script setup>
|
|
@@ -494,7 +485,7 @@ console.info('You may inspect this result for message, status, or error:', resul
|
|
|
494
485
|
|
|
495
486
|
## Embedding Page Builder in a Modal or Dialog
|
|
496
487
|
|
|
497
|
-
You can easily use the Page Builder inside a modal or dialog.
|
|
488
|
+
You can easily use the Page Builder inside a modal or dialog.
|
|
498
489
|
To allow users to close the modal from inside the builder, use the `showCloseButton` prop and listen for the `@handleClosePageBuilder` event:
|
|
499
490
|
|
|
500
491
|
```vue
|
|
@@ -515,20 +506,52 @@ function closePageBuilder() {
|
|
|
515
506
|
</template>
|
|
516
507
|
```
|
|
517
508
|
|
|
518
|
-
|
|
519
|
-
|
|
509
|
+
## Publish Button
|
|
510
|
+
|
|
511
|
+
To allow users to use the Publish button from inside the builder, use the `showPublishButton` prop and listen for the `@handlePublishPageBuilder` event.
|
|
512
|
+
|
|
513
|
+
> **Note:**
|
|
514
|
+
> When the Publish button is clicked, the Page Builder will automatically save the latest changes to local storage before emitting the `@handlePublishPageBuilder` event. This ensures you always receive the most up-to-date content.
|
|
515
|
+
|
|
516
|
+
```vue
|
|
517
|
+
<script setup>
|
|
518
|
+
import { getPageBuilder, PageBuilder } from '@myissue/vue-website-page-builder'
|
|
519
|
+
|
|
520
|
+
const pageBuilderService = getPageBuilder()
|
|
521
|
+
|
|
522
|
+
const handlePublish = () => {
|
|
523
|
+
// Retrieve the latest HTML content (saved by the builder)
|
|
524
|
+
const latestHtml = pageBuilderService.getSavedPageHtml()
|
|
525
|
+
// Submit, publish, or process the content as needed
|
|
526
|
+
// e.g., send latestHtml to your API or update your form
|
|
527
|
+
}
|
|
528
|
+
</script>
|
|
529
|
+
|
|
530
|
+
<template>
|
|
531
|
+
<PageBuilder :showPublishButton="true" @handlePublishPageBuilder="handlePublish" />
|
|
532
|
+
</template>
|
|
533
|
+
```
|
|
534
|
+
|
|
535
|
+
- `:showPublishButton="true"` — shows a publish button in the Page Builder toolbar.
|
|
536
|
+
- `@handlePublishPageBuilder="handlePublish"` — emits after the builder auto-saves, so you always get the latest content.
|
|
520
537
|
|
|
521
538
|
> **Tip:**
|
|
522
|
-
> You can name your handler function anything you like.
|
|
539
|
+
> You can name your handler function anything you like. This pattern makes it easy to embed the builder in modals, dialogs, or overlays in any Vue app.
|
|
540
|
+
|
|
541
|
+
- `:showPublishButton="true"` — shows a publish button in the Page Builder toolbar.
|
|
542
|
+
- `@handlePublishPageBuilder="yourMethod"` — emits when the close button is clicked, so you can close your modal.
|
|
543
|
+
|
|
544
|
+
> **Tip:**
|
|
545
|
+
> You can name your handler function anything you like.
|
|
523
546
|
> This pattern makes it easy to embed the builder in modals, dialogs, or overlays in any Vue app.
|
|
524
547
|
|
|
525
548
|
## Styling the Main Page Builder Container
|
|
526
549
|
|
|
527
|
-
The Page Builder allows you to define and update global styles for the main wrapper (
|
|
550
|
+
The Page Builder allows you to define and update global styles for the main wrapper (`#pagebuilder`) at any time. These settings control the overall appearance, including font family, text color, background color, and more. Whether you set them initially in your config or update them dynamically at runtime, your changes are instantly reflected across all sections.
|
|
528
551
|
|
|
529
552
|
Use the `pageSettings` config to apply custom CSS classes and inline styles to the Page Builder’s main wrapper.
|
|
530
|
-
The Page Builder renders all components wrapped inside a single parent container `<div id="pagebuilder">`.
|
|
531
|
-
You can pass global CSS
|
|
553
|
+
The Page Builder renders all components wrapped inside a single parent container, `<div id="pagebuilder">`.
|
|
554
|
+
You can pass global CSS `classes` and `style` to this wrapper by adding a `pageSettings` object in your config:
|
|
532
555
|
|
|
533
556
|
```ts
|
|
534
557
|
const configPageBuilder = {
|
|
@@ -544,9 +567,9 @@ const configPageBuilder = {
|
|
|
544
567
|
} as const
|
|
545
568
|
```
|
|
546
569
|
|
|
547
|
-
You have full control over the page’s appearance at any time
|
|
570
|
+
You have full control over the page’s appearance at any time—instantly override or clear global styles for the entire page, ensuring a seamless and dynamic user experience.
|
|
548
571
|
|
|
549
|
-
## Download HTML
|
|
572
|
+
## Download HTML File
|
|
550
573
|
|
|
551
574
|
Export the entire page as a standalone HTML file. This includes all sections, content, and applied styles, making the file ready for use or integration elsewhere.
|
|
552
575
|
|
|
@@ -556,9 +579,7 @@ To ensure images render properly after export, you must specify a URL prefix in
|
|
|
556
579
|
|
|
557
580
|
```ts
|
|
558
581
|
const configPageBuilder = {
|
|
559
|
-
|
|
560
|
-
imageUrlPrefix: 'https://your-domain.com/uploads/',
|
|
561
|
-
},
|
|
582
|
+
imageUrlPrefix: 'https://your-domain.com/uploads/',
|
|
562
583
|
// other config options...
|
|
563
584
|
} as const
|
|
564
585
|
```
|
|
@@ -582,7 +603,7 @@ Learn how to create and integrate your own components step by step.
|
|
|
582
603
|
### Integrate Unsplash Library
|
|
583
604
|
|
|
584
605
|
Easily add Unsplash image search to your media library modal—just like in the demo!
|
|
585
|
-
|
|
606
|
+
A code example is provided so you can copy-paste to get started.
|
|
586
607
|
|
|
587
608
|
See the full step-by-step guide and working demo code here:
|
|
588
609
|
📚 **[Unsplash Integration Guide](./UNSPLASH_INTEGRATION.md)**
|
|
@@ -600,7 +621,7 @@ Learn how to create and integrate your own components step by step.
|
|
|
600
621
|
|
|
601
622
|
If fonts or Material Icons are not displaying correctly, verify that:
|
|
602
623
|
|
|
603
|
-
**CSS Import**:
|
|
624
|
+
**CSS Import**: You are importing the CSS file:
|
|
604
625
|
|
|
605
626
|
```js
|
|
606
627
|
import '@myissue/vue-website-page-builder/style.css'
|
|
@@ -614,34 +635,34 @@ The Page Builder is designed as a modular, state-driven editor for dynamic page
|
|
|
614
635
|
|
|
615
636
|
The Page Builder is designed to be easy to use and flexible for any web project. Here’s how it works behind the scenes:
|
|
616
637
|
|
|
617
|
-
- **Configuration First:**
|
|
618
|
-
When you start the builder, you pass in your configuration (such as what type of page you’re building, user info, branding, and any existing content).
|
|
638
|
+
- **Configuration First:**
|
|
639
|
+
When you start the builder, you pass in your configuration (such as what type of page you’re building, user info, branding, and any existing content).
|
|
619
640
|
The builder saves this configuration immediately—even if the editing interface (DOM) isn’t loaded yet. This means you can safely set up the builder in advance, and it will be ready as soon as the editor appears on the page.
|
|
620
641
|
|
|
621
|
-
- **Loading Content:**
|
|
642
|
+
- **Loading Content:**
|
|
622
643
|
If you have existing content (like a published page), the builder loads it so you can keep editing. If not, you start with a blank page.
|
|
623
644
|
|
|
624
|
-
- **Editing Experience:**
|
|
645
|
+
- **Editing Experience:**
|
|
625
646
|
As you add, move, or edit components (like text, images, or sections), the builder keeps everything in sync—both in the app’s memory and in your browser’s local storage. This means your work is always saved, even if you close the browser.
|
|
626
647
|
|
|
627
|
-
**In short:**
|
|
648
|
+
**In short:**
|
|
628
649
|
The Page Builder handles all the technical details of editing, saving, and loading pages, so your users can focus on creating great content—without worrying about losing their work or dealing with complicated setup.
|
|
629
650
|
|
|
630
651
|
<img style="max-width: 100%;" src="./public/home/page_builder_architecture.png" alt="Vue Website Page Builder - the editor" />
|
|
631
652
|
|
|
632
653
|
## Contributing
|
|
633
654
|
|
|
634
|
-
1. Fork the repository
|
|
635
|
-
2. Create your feature branch
|
|
636
|
-
3. Make your changes
|
|
637
|
-
4. Build and test locally
|
|
638
|
-
5. Submit a pull request
|
|
655
|
+
1. Fork the repository.
|
|
656
|
+
2. Create your feature branch.
|
|
657
|
+
3. Make your changes.
|
|
658
|
+
4. Build and test locally.
|
|
659
|
+
5. Submit a pull request.
|
|
639
660
|
|
|
640
661
|
## Security Vulnerabilities
|
|
641
662
|
|
|
642
663
|
If you discover a security vulnerability, please send us a message.
|
|
643
664
|
|
|
644
|
-
## Get in
|
|
665
|
+
## Get in Touch for Customization or Any Questions
|
|
645
666
|
|
|
646
667
|
If you have any questions or if you're looking for customization, feel free to connect with our developer.
|
|
647
668
|
|
|
@@ -650,7 +671,7 @@ If you have any questions or if you're looking for customization, feel free to c
|
|
|
650
671
|
|
|
651
672
|
## Feedback
|
|
652
673
|
|
|
653
|
-
Suggestions
|
|
674
|
+
Suggestions or any issues you encounter while using this app. Feel free to reach out.
|
|
654
675
|
|
|
655
676
|
## Support the Project
|
|
656
677
|
|