@myissue/vue-website-page-builder 3.3.64 → 3.3.67
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 +216 -129
- 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 +16345 -13089
- package/dist/vue-website-page-builder.umd.cjs +78 -54
- package/package.json +3 -2
- package/src/Components/DemoUnsplash.vue +1 -4
- package/src/Components/PageBuilder/EditorMenu/Editables/BackgroundColorEditor.vue +4 -3
- package/src/Components/PageBuilder/EditorMenu/Editables/BorderRadius.vue +32 -13
- package/src/Components/PageBuilder/EditorMenu/Editables/Borders.vue +12 -8
- package/src/Components/PageBuilder/EditorMenu/Editables/ClassEditor.vue +10 -8
- package/src/Components/PageBuilder/EditorMenu/Editables/EditGetElement.vue +5 -5
- package/src/Components/PageBuilder/EditorMenu/Editables/ManageBackgroundOpacity.vue +12 -9
- package/src/Components/PageBuilder/EditorMenu/Editables/ManageOpacity.vue +6 -4
- package/src/Components/PageBuilder/EditorMenu/Editables/Margin.vue +11 -5
- package/src/Components/PageBuilder/EditorMenu/Editables/OpacityEditor.vue +1 -1
- package/src/Components/PageBuilder/EditorMenu/Editables/Padding.vue +11 -5
- package/src/Components/PageBuilder/EditorMenu/Editables/StyleEditor.vue +116 -0
- package/src/Components/PageBuilder/EditorMenu/Editables/TextColorEditor.vue +2 -1
- package/src/Components/PageBuilder/EditorMenu/Editables/Typography.vue +32 -9
- package/src/Components/PageBuilder/EditorMenu/RightSidebarEditor.vue +63 -74
- package/src/Components/PageBuilder/Settings/PageBuilderSettings.vue +3 -3
- package/src/Components/PageBuilder/ToolbarOption/ToolbarOption.vue +14 -11
- package/src/PageBuilder/PageBuilder.vue +169 -65
- package/src/PageBuilder/Preview.vue +25 -9
- package/src/composables/builderInstance.ts +3 -2
- package/src/composables/extractCleanHTMLFromPageBuilder.ts +4 -3
- package/src/css/app.css +10 -70
- package/src/i18n.ts +28 -0
- package/src/locales/ar.json +136 -0
- package/src/locales/de.json +136 -0
- package/src/locales/en.json +136 -0
- package/src/locales/es.json +136 -0
- package/src/locales/fr.json +136 -0
- package/src/locales/hi.json +136 -0
- package/src/locales/ja.json +136 -0
- package/src/locales/pt.json +136 -0
- package/src/locales/ru.json +136 -0
- package/src/locales/zh-Hans.json +136 -0
- package/src/main.ts +10 -5
- package/src/services/LocalStorageManager.ts +1 -162
- package/src/services/PageBuilderService.ts +730 -290
- package/src/stores/page-builder-state.ts +8 -0
- package/src/tests/PageBuilderTest.vue +41 -70
- package/src/tests/componentsArray.test.json +3 -3
- package/src/tests/pageBuilderService.test.ts +7 -1
- package/src/types/index.ts +17 -3
- package/src/utils/html-elements/component.ts +10 -10
package/README.md
CHANGED
|
@@ -11,10 +11,11 @@
|
|
|
11
11
|
- [Installation](#installation)
|
|
12
12
|
- [About](#about)
|
|
13
13
|
- [Features](#features)
|
|
14
|
-
|
|
14
|
+
- [Trusted by Freelancers and Leading Brands](#trusted-by-freelancers-and-leading-brands)
|
|
15
|
+
- [Technical Details](#technical-details)
|
|
15
16
|
- [Documentation](#documentation)
|
|
16
17
|
- [Requirements](#requirements)
|
|
17
|
-
- [Getting
|
|
18
|
+
- [Getting Started \& Installation](#getting-started--installation)
|
|
18
19
|
- [Quick Start](#quick-start)
|
|
19
20
|
- [Initializing the Page Builder](#initializing-the-page-builder)
|
|
20
21
|
- [Why Use the Shared Instance?](#why-use-the-shared-instance)
|
|
@@ -22,14 +23,18 @@
|
|
|
22
23
|
- [Important: CSS Prefixing (`pbx-`)](#important-css-prefixing-pbx-)
|
|
23
24
|
- [Rendering HTML Output in Other Frameworks (React, Nuxt, etc.)](#rendering-html-output-in-other-frameworks-react-nuxt-etc)
|
|
24
25
|
- [Providing Configuration to the Page Builder](#providing-configuration-to-the-page-builder)
|
|
26
|
+
- [Comprehensive Language Support in the Page Builder](#comprehensive-language-support-in-the-page-builder)
|
|
27
|
+
- [Disabling the Language Dropdown](#disabling-the-language-dropdown)
|
|
25
28
|
- [Local Storage \& Auto-Save](#local-storage--auto-save)
|
|
26
29
|
- [Retrieving the Latest HTML Content for Form Submission](#retrieving-the-latest-html-content-for-form-submission)
|
|
27
30
|
- [Resetting the Builder After Successful Resource Creation or Update](#resetting-the-builder-after-successful-resource-creation-or-update)
|
|
28
|
-
- [Loading
|
|
31
|
+
- [Loading Existing Content or Components into the Page Builder](#loading-existing-content-or-components-into-the-page-builder)
|
|
32
|
+
- [Restoring Full Page Content (Global Styles \& Components)](#restoring-full-page-content-global-styles--components)
|
|
29
33
|
- [Automatic Draft Recovery](#automatic-draft-recovery)
|
|
30
34
|
- [Embedding Page Builder in a Modal or Dialog](#embedding-page-builder-in-a-modal-or-dialog)
|
|
35
|
+
- [Publish Button](#publish-button)
|
|
31
36
|
- [Styling the Main Page Builder Container](#styling-the-main-page-builder-container)
|
|
32
|
-
- [Download HTML
|
|
37
|
+
- [Download HTML File](#download-html-file)
|
|
33
38
|
- [Custom Components](#custom-components)
|
|
34
39
|
- [Custom Media Library Component](#custom-media-library-component)
|
|
35
40
|
- [Integrate Unsplash Library](#integrate-unsplash-library)
|
|
@@ -40,35 +45,35 @@
|
|
|
40
45
|
- [How the Page Builder Works](#how-the-page-builder-works)
|
|
41
46
|
- [Contributing](#contributing)
|
|
42
47
|
- [Security Vulnerabilities](#security-vulnerabilities)
|
|
43
|
-
- [Get in
|
|
48
|
+
- [Get in Touch for Customization or Any Questions](#get-in-touch-for-customization-or-any-questions)
|
|
44
49
|
- [Feedback](#feedback)
|
|
45
50
|
- [Support the Project](#support-the-project)
|
|
46
51
|
- [License](#license)
|
|
47
52
|
|
|
48
53
|
## Demo
|
|
49
54
|
|
|
50
|
-
A Vue 3 page builder component with drag
|
|
55
|
+
A Vue 3 page builder component with drag-and-drop functionality for creating dynamic web pages.
|
|
51
56
|
|
|
52
57
|
Create and enhance digital experiences with Vue on any backend.
|
|
53
58
|
|
|
54
59
|
Experience the power and simplicity of the Vue Website Page Builder in action.
|
|
55
|
-
Try the live demo to explore real-time visual updates
|
|
60
|
+
Try the live demo to explore real-time visual updates and smooth content management.
|
|
56
61
|
|
|
57
|
-
[Play around with the Page Builder](https://
|
|
62
|
+
[Play around with the Page Builder](https://mybuilder.dev)
|
|
58
63
|
|
|
59
64
|
## Overview
|
|
60
65
|
|
|
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.
|
|
66
|
+
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
67
|
|
|
63
|
-
|
|
68
|
+
A lightweight and minimalist Page Builder with an elegant and intuitive design, focused on simplicity and speed.
|
|
64
69
|
|
|
65
|
-
Build responsive pages like listings, jobs or blog posts and manage content easily.
|
|
70
|
+
Build responsive pages like listings, jobs, or blog posts and manage content easily.
|
|
66
71
|
|
|
67
72
|
<img style="max-width: 100%;" src="./public/home/editor.jpg" alt="Vue Website Page Builder - the editor" />
|
|
68
73
|
|
|
69
74
|
## Get Started in Minutes
|
|
70
75
|
|
|
71
|
-
Easy setup and instant productivity.
|
|
76
|
+
Easy setup and instant productivity.
|
|
72
77
|
Follow the [Quick Start](#quick-start) guide to begin building with just a few simple steps.
|
|
73
78
|
|
|
74
79
|
---
|
|
@@ -85,7 +90,7 @@ npm install @myissue/vue-website-page-builder
|
|
|
85
90
|
|
|
86
91
|
## About
|
|
87
92
|
|
|
88
|
-
A Page Builder designed for growth. Build your website pages with ready-made components that are fully customizable and always responsive, designed to fit every need. A powerful Page Builder for growing merchants, brands, and agencies.
|
|
93
|
+
A Page Builder designed for growth. Build your website pages with ready-made components that are fully customizable and always responsive, designed to fit every need. A powerful Page Builder for growing merchants, brands, and agencies. And it is totally free.
|
|
89
94
|
|
|
90
95
|
<img style="max-width: 100%;" src="./public/home/media_library.jpg" alt="Vue Website Page Builder - the editor" />
|
|
91
96
|
|
|
@@ -93,33 +98,34 @@ A Page Builder designed for growth. Build your website pages with ready-made com
|
|
|
93
98
|
|
|
94
99
|
Includes:
|
|
95
100
|
|
|
96
|
-
- **Page Builder**: Click & Drop Page Builder.
|
|
97
|
-
- **Customizable Design**:
|
|
101
|
+
- **Page Builder**: A Click & Drop Page Builder.
|
|
102
|
+
- **Customizable Design**: Customize the look to match your brand.
|
|
98
103
|
|
|
99
104
|
The Page Builder is packed with features:
|
|
100
105
|
|
|
101
106
|
- **Click & Drop**: Easily rearrange elements on your page.
|
|
107
|
+
- **Multilingual Page Builder**: : The Page Builder now offers comprehensive language support, empowering users around the world to build pages in their native language. Supported languages include English, Simplified Chinese, French, Japanese, Russian, Spanish, Portuguese, German, Arabic, and Hindi — making content creation truly global.
|
|
102
108
|
- **Reordering**: Change the order of your content without hassle.
|
|
103
109
|
- **True Visual Editing**: See your changes in real-time as you make them.
|
|
104
110
|
- **Media Library**: Easily inject your own custom media library component.
|
|
105
|
-
- **Local Storage & Auto-Save**: Never lose your work
|
|
106
|
-
- **Unsplash**: Unsplash
|
|
111
|
+
- **Local Storage & Auto-Save**: Never lose your work—changes are saved as you go.
|
|
112
|
+
- **Unsplash**: Unsplash integration.
|
|
107
113
|
- **Responsive Editing**: Ensure your site looks great on all devices.
|
|
108
114
|
- **Text Editing**: Edit text content live and in real-time.
|
|
109
115
|
- **Font Customization**: Choose the perfect fonts to match your style.
|
|
110
116
|
- **Undo & Redo**: Experiment confidently with the ability to revert changes.
|
|
111
|
-
- **Global Styles**: Global
|
|
117
|
+
- **Global Styles**: Global styles for fonts, designs, and colors.
|
|
112
118
|
- **YouTube Videos**: Integrate video content smoothly.
|
|
113
119
|
- **Download HTML**: Export the entire page as a standalone HTML file.
|
|
114
120
|
- **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
121
|
- **Tailwind Support**: Fully compatible with Tailwind CSS (with automatic class prefixing to avoid conflicts).
|
|
116
|
-
- **Styles
|
|
122
|
+
- **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
123
|
|
|
118
|
-
|
|
124
|
+
### Trusted by Freelancers and Leading Brands
|
|
119
125
|
|
|
120
|
-
|
|
126
|
+
From solo freelancers to fast-growing startups and established enterprises, the Page Builder is trusted by teams everywhere. With its intuitive click-and-drop editor, real-time visual editing, and a rich library of reusable components, you can turn ideas into polished pages in minutes. Built for merchants, brands, and agencies, it empowers anyone to create high-impact content.
|
|
121
127
|
|
|
122
|
-
## Technical
|
|
128
|
+
## Technical Details
|
|
123
129
|
|
|
124
130
|
- **Technologies**: This Page Builder is developed using TypeScript, Vue 3, the Composition API, Pinia, CSS, Tailwind CSS, and HTML.
|
|
125
131
|
- **Features**: Click & Drop Page Builder.
|
|
@@ -137,7 +143,7 @@ Please note that these instructions assume you have Node.js installed.
|
|
|
137
143
|
- Vue.js ≥ 3.0.0
|
|
138
144
|
- Modern browser with ES6+ support
|
|
139
145
|
|
|
140
|
-
## Getting
|
|
146
|
+
## Getting Started & Installation
|
|
141
147
|
|
|
142
148
|
Make sure to install the dependencies:
|
|
143
149
|
|
|
@@ -182,10 +188,10 @@ const app = createApp(App)
|
|
|
182
188
|
app.mount('#app')
|
|
183
189
|
```
|
|
184
190
|
|
|
185
|
-
> **Note:**
|
|
191
|
+
> **Note:**
|
|
186
192
|
> 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
193
|
|
|
188
|
-
> **Note**
|
|
194
|
+
> **Note**
|
|
189
195
|
> 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
196
|
|
|
191
197
|
### Why Use the Shared Instance?
|
|
@@ -196,10 +202,10 @@ By always accessing the shared instance, you avoid creating multiple, isolated c
|
|
|
196
202
|
|
|
197
203
|
Ensure the following configuration options are set:
|
|
198
204
|
|
|
199
|
-
- **`formType` (required):**
|
|
205
|
+
- **`formType` (required):**
|
|
200
206
|
Indicates whether you are creating or updating a resource. This is used to retrieve the correct content from local storage.
|
|
201
207
|
|
|
202
|
-
- **`formName` (required):**
|
|
208
|
+
- **`formName` (required):**
|
|
203
209
|
Specifies the resource type (for example, `article`, `jobPost`, `store`, etc.).
|
|
204
210
|
|
|
205
211
|
```vue
|
|
@@ -232,10 +238,10 @@ This prevents global styles from leaking into the builder and vice versa, which
|
|
|
232
238
|
|
|
233
239
|
**How does this affect you?**
|
|
234
240
|
|
|
235
|
-
When a user adds a component into the page builder, all classes from that component are automatically prefixed with pbx
|
|
241
|
+
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
242
|
|
|
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
|
|
243
|
+
> **Note:**
|
|
244
|
+
> 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
245
|
|
|
240
246
|
## Rendering HTML Output in Other Frameworks (React, Nuxt, etc.)
|
|
241
247
|
|
|
@@ -270,7 +276,7 @@ import '@myissue/vue-website-page-builder/style.css'
|
|
|
270
276
|
|
|
271
277
|
Then use `v-html` to render the HTML.
|
|
272
278
|
|
|
273
|
-
> **Note:**
|
|
279
|
+
> **Note:**
|
|
274
280
|
> You do not need to import any Vue components if you only want to render the HTML. Just import the CSS file.
|
|
275
281
|
|
|
276
282
|
## Providing Configuration to the Page Builder
|
|
@@ -279,19 +285,19 @@ The example below demonstrates the setup to start building pages, with additiona
|
|
|
279
285
|
|
|
280
286
|
Your `configPageBuilder` object can include:
|
|
281
287
|
|
|
282
|
-
- **`formType` (required):**
|
|
288
|
+
- **`formType` (required):**
|
|
283
289
|
Used to retrieve the correct content from local storage. Specify whether you are creating or updating a resource.
|
|
284
|
-
- **`formName` (required):**
|
|
290
|
+
- **`formName` (required):**
|
|
285
291
|
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):**
|
|
292
|
+
- **`resourceData` (optional):**
|
|
287
293
|
Prefill the builder with initial resource data (e.g., `title`, `id`).
|
|
288
|
-
- **`userForPageBuilder` (optional):**
|
|
294
|
+
- **`userForPageBuilder` (optional):**
|
|
289
295
|
Pass user information (such as `name` and `image`) to display the logged-in user’s details in the builder.
|
|
290
|
-
- **`pageBuilderLogo` (optional):**
|
|
296
|
+
- **`pageBuilderLogo` (optional):**
|
|
291
297
|
Display your company logo in the builder toolbar.
|
|
292
|
-
- **`userSettings` (optional):**
|
|
298
|
+
- **`userSettings` (optional):**
|
|
293
299
|
Set user preferences such as theme, language, or auto-save.
|
|
294
|
-
- **`brandColor` (optional):**
|
|
300
|
+
- **`brandColor` (optional):**
|
|
295
301
|
Set your brand’s primary color for key UI elements (inside the `settings` config).
|
|
296
302
|
|
|
297
303
|
```vue
|
|
@@ -314,7 +320,10 @@ const configPageBuilder = {
|
|
|
314
320
|
},
|
|
315
321
|
userSettings: {
|
|
316
322
|
theme: 'light',
|
|
317
|
-
language:
|
|
323
|
+
language: {
|
|
324
|
+
default: 'en',
|
|
325
|
+
enable: ['en', 'zh-Hans', 'fr'],
|
|
326
|
+
},
|
|
318
327
|
autoSave: true,
|
|
319
328
|
},
|
|
320
329
|
settings: {
|
|
@@ -334,6 +343,65 @@ console.info('You may inspect this result for message, status, or error:', resul
|
|
|
334
343
|
</template>
|
|
335
344
|
```
|
|
336
345
|
|
|
346
|
+
## Comprehensive Language Support in the Page Builder
|
|
347
|
+
|
|
348
|
+
The Page Builder offers robust multilingual support, enabling you to reach a global audience with ease. By default, it supports the following languages, chosen for their widespread use and strong developer communities:
|
|
349
|
+
|
|
350
|
+
| Language | Code |
|
|
351
|
+
| -------------------- | ------- |
|
|
352
|
+
| English | en |
|
|
353
|
+
| Chinese (Simplified) | zh-Hans |
|
|
354
|
+
| French | fr |
|
|
355
|
+
| Japanese | ja |
|
|
356
|
+
| Russian | ru |
|
|
357
|
+
| Spanish | es |
|
|
358
|
+
| Portuguese (Brazil) | pt |
|
|
359
|
+
| German | de |
|
|
360
|
+
| Arabic | ar |
|
|
361
|
+
| Hindi | hi |
|
|
362
|
+
|
|
363
|
+
You can set a default language for your project:
|
|
364
|
+
|
|
365
|
+
```js
|
|
366
|
+
userSettings: {
|
|
367
|
+
language: {
|
|
368
|
+
default: 'en',
|
|
369
|
+
enable: ['en', 'zh-Hans', 'fr'],
|
|
370
|
+
},
|
|
371
|
+
},
|
|
372
|
+
```
|
|
373
|
+
|
|
374
|
+
If you prefer to offer only a subset of these languages for users to switch between, specify them using the `enable` option.
|
|
375
|
+
|
|
376
|
+
If you do not provide the `enable` array, the Page Builder will default to showing all supported languages by default.
|
|
377
|
+
|
|
378
|
+
```js
|
|
379
|
+
userSettings: {
|
|
380
|
+
language: {
|
|
381
|
+
default: 'en',
|
|
382
|
+
enable: ['en', 'zh-Hans', 'fr'],
|
|
383
|
+
},
|
|
384
|
+
},
|
|
385
|
+
```
|
|
386
|
+
|
|
387
|
+
#### Disabling the Language Dropdown
|
|
388
|
+
|
|
389
|
+
If you want to completely hide the language selector from the UI (e.g., when only one language is available or you want a fixed language), simply set `disableLanguageDropdown` to `true`.
|
|
390
|
+
|
|
391
|
+
Even when the dropdown is disabled, the default language will still be applied automatically. This gives you full control over localization while keeping the interface simple for your users.
|
|
392
|
+
|
|
393
|
+
```js
|
|
394
|
+
userSettings: {
|
|
395
|
+
theme: 'light',
|
|
396
|
+
language: {
|
|
397
|
+
default: 'en',
|
|
398
|
+
disableLanguageDropdown: true,
|
|
399
|
+
},
|
|
400
|
+
},
|
|
401
|
+
```
|
|
402
|
+
|
|
403
|
+
This flexibility allows you to tailor the language experience to your audience’s needs.
|
|
404
|
+
|
|
337
405
|
## Local Storage & Auto-Save
|
|
338
406
|
|
|
339
407
|
The Page Builder automatically saves all changes to the browser’s local storage. Every time you add, edit, or delete a component, your progress is preserved—even if you close the browser or navigate away.
|
|
@@ -375,101 +443,90 @@ const configPageBuilder = {
|
|
|
375
443
|
const pageBuilderService = getPageBuilder()
|
|
376
444
|
await pageBuilderService.startBuilder(configPageBuilder)
|
|
377
445
|
|
|
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
|
-
}
|
|
446
|
+
const storedComponents = pageBuilderService.getSavedPageHtml()
|
|
447
|
+
yourForm.content = storedComponents
|
|
393
448
|
</script>
|
|
394
449
|
```
|
|
395
450
|
|
|
396
451
|
### Resetting the Builder After Successful Resource Creation or Update
|
|
397
452
|
|
|
398
|
-
After
|
|
453
|
+
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
454
|
|
|
400
|
-
You can reset the builder state and clear the draft with:
|
|
455
|
+
You can reset the Page Builder’s live DOM, builder state, and clear the draft with:
|
|
401
456
|
|
|
402
457
|
```js
|
|
403
|
-
|
|
404
|
-
pageBuilderService.deleteAllComponentsFromDOM()
|
|
405
|
-
// Clear Local Storage for the created or updated resource
|
|
406
|
-
await pageBuilderService.removeCurrentComponentsFromLocalStorage()
|
|
458
|
+
await pageBuilderService.handleFormSubmission()
|
|
407
459
|
```
|
|
408
460
|
|
|
409
|
-
Always call
|
|
461
|
+
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
462
|
|
|
411
|
-
## Loading
|
|
463
|
+
## Loading Existing Content or Components into the Page Builder
|
|
412
464
|
|
|
413
|
-
The Page Builder makes it simple to load previously published content from any backend source, such as your database or API.
|
|
465
|
+
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
466
|
|
|
415
|
-
|
|
467
|
+
### Restoring Full Page Content (Global Styles & Components)
|
|
416
468
|
|
|
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.
|
|
469
|
+
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
470
|
|
|
422
|
-
**
|
|
471
|
+
**Recommended Workflow:**
|
|
423
472
|
|
|
424
|
-
|
|
425
|
-
This tells the builder to expect and load your provided components array as the initial content.
|
|
473
|
+
1. **Parse your saved HTML** using the builder’s helper method to extract both the components and the global page settings:
|
|
426
474
|
|
|
427
|
-
```
|
|
428
|
-
|
|
429
|
-
|
|
475
|
+
```js
|
|
476
|
+
// yourPageHTML: the full HTML string previously saved from the builder
|
|
477
|
+
const { components, pageSettings } = pageBuilderService.parsePageBuilderHTML(yourPageHTML)
|
|
478
|
+
```
|
|
430
479
|
|
|
431
|
-
|
|
432
|
-
updateOrCreate: {
|
|
433
|
-
formType: 'update',
|
|
434
|
-
formName: 'article',
|
|
435
|
-
},
|
|
436
|
-
}
|
|
480
|
+
2. **Pass `pageSettings` directly** in your config object, and pass the `components` array as the second argument to `startBuilder`:
|
|
437
481
|
|
|
438
|
-
|
|
439
|
-
|
|
482
|
+
```vue
|
|
483
|
+
<script setup>
|
|
484
|
+
import { getPageBuilder } from '@myissue/vue-website-page-builder'
|
|
440
485
|
|
|
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
|
-
]
|
|
486
|
+
// Retrieve the Page Builder service instance
|
|
487
|
+
const pageBuilderService = getPageBuilder()
|
|
447
488
|
|
|
448
|
-
|
|
489
|
+
// Parse your saved HTML to extract both components and global page settings
|
|
490
|
+
const { components, pageSettings } = pageBuilderService.parsePageBuilderHTML(yourPageHTML)
|
|
449
491
|
|
|
450
|
-
|
|
451
|
-
|
|
492
|
+
// Prepare the config, passing pageSettings directly
|
|
493
|
+
const configPageBuilder = {
|
|
494
|
+
updateOrCreate: {
|
|
495
|
+
formType: 'update', // important: set to update
|
|
496
|
+
formName: 'article',
|
|
497
|
+
},
|
|
498
|
+
// pass directly, not nested
|
|
499
|
+
pageSettings: pageSettings,
|
|
500
|
+
}
|
|
452
501
|
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
</template>
|
|
456
|
-
```
|
|
502
|
+
// Start the builder with both config and components
|
|
503
|
+
const result = await pageBuilderService.startBuilder(configPageBuilder, components)
|
|
457
504
|
|
|
458
|
-
|
|
459
|
-
>
|
|
460
|
-
|
|
505
|
+
console.info('You may inspect this result for message, status, or error:', result)
|
|
506
|
+
</script>
|
|
507
|
+
|
|
508
|
+
<template>
|
|
509
|
+
<PageBuilder />
|
|
510
|
+
</template>
|
|
511
|
+
```
|
|
512
|
+
|
|
513
|
+
> **Note:**
|
|
514
|
+
>
|
|
515
|
+
> - Each component’s `html_code` must be wrapped in a `<section>...</section>` tag. This is how the Page Builder defines and separates individual components.
|
|
516
|
+
> - Always pass `pageSettings` directly in the config object (not as `{ pageSettings: { pageSettings } }`).
|
|
517
|
+
> - Set `formType: 'update'` to ensure the builder loads your provided content for editing.
|
|
461
518
|
|
|
462
|
-
This approach ensures your users can seamlessly
|
|
519
|
+
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
520
|
|
|
464
521
|
## Automatic Draft Recovery
|
|
465
522
|
|
|
466
|
-
The Page Builder automatically checks for unsaved drafts in local storage for the current resource.
|
|
523
|
+
The Page Builder automatically checks for unsaved drafts in local storage for the current resource.
|
|
467
524
|
If a draft is found, users are prompted to either continue where they left off or use the version loaded from your backend.
|
|
468
525
|
|
|
469
|
-
- **`formType` (required):**
|
|
526
|
+
- **`formType` (required):**
|
|
470
527
|
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
|
|
528
|
+
- **`formName` (required):**
|
|
529
|
+
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
530
|
|
|
474
531
|
```vue
|
|
475
532
|
<script setup>
|
|
@@ -494,7 +551,7 @@ console.info('You may inspect this result for message, status, or error:', resul
|
|
|
494
551
|
|
|
495
552
|
## Embedding Page Builder in a Modal or Dialog
|
|
496
553
|
|
|
497
|
-
You can easily use the Page Builder inside a modal or dialog.
|
|
554
|
+
You can easily use the Page Builder inside a modal or dialog.
|
|
498
555
|
To allow users to close the modal from inside the builder, use the `showCloseButton` prop and listen for the `@handleClosePageBuilder` event:
|
|
499
556
|
|
|
500
557
|
```vue
|
|
@@ -515,20 +572,52 @@ function closePageBuilder() {
|
|
|
515
572
|
</template>
|
|
516
573
|
```
|
|
517
574
|
|
|
518
|
-
|
|
519
|
-
|
|
575
|
+
## Publish Button
|
|
576
|
+
|
|
577
|
+
To allow users to use the Publish button from inside the builder, use the `showPublishButton` prop and listen for the `@handlePublishPageBuilder` event.
|
|
578
|
+
|
|
579
|
+
> **Note:**
|
|
580
|
+
> 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.
|
|
581
|
+
|
|
582
|
+
```vue
|
|
583
|
+
<script setup>
|
|
584
|
+
import { getPageBuilder, PageBuilder } from '@myissue/vue-website-page-builder'
|
|
585
|
+
|
|
586
|
+
const pageBuilderService = getPageBuilder()
|
|
587
|
+
|
|
588
|
+
const handlePublish = () => {
|
|
589
|
+
// Retrieve the latest HTML content (saved by the builder)
|
|
590
|
+
const latestHtml = pageBuilderService.getSavedPageHtml()
|
|
591
|
+
// Submit, publish, or process the content as needed
|
|
592
|
+
// e.g., send latestHtml to your API or update your form
|
|
593
|
+
}
|
|
594
|
+
</script>
|
|
595
|
+
|
|
596
|
+
<template>
|
|
597
|
+
<PageBuilder :showPublishButton="true" @handlePublishPageBuilder="handlePublish" />
|
|
598
|
+
</template>
|
|
599
|
+
```
|
|
600
|
+
|
|
601
|
+
- `:showPublishButton="true"` — shows a publish button in the Page Builder toolbar.
|
|
602
|
+
- `@handlePublishPageBuilder="handlePublish"` — emits after the builder auto-saves, so you always get the latest content.
|
|
520
603
|
|
|
521
604
|
> **Tip:**
|
|
522
|
-
> You can name your handler function anything you like.
|
|
605
|
+
> 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.
|
|
606
|
+
|
|
607
|
+
- `:showPublishButton="true"` — shows a publish button in the Page Builder toolbar.
|
|
608
|
+
- `@handlePublishPageBuilder="yourMethod"` — emits when the close button is clicked, so you can close your modal.
|
|
609
|
+
|
|
610
|
+
> **Tip:**
|
|
611
|
+
> You can name your handler function anything you like.
|
|
523
612
|
> This pattern makes it easy to embed the builder in modals, dialogs, or overlays in any Vue app.
|
|
524
613
|
|
|
525
614
|
## Styling the Main Page Builder Container
|
|
526
615
|
|
|
527
|
-
The Page Builder allows you to define and update global styles for the main wrapper (
|
|
616
|
+
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
617
|
|
|
529
618
|
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
|
|
619
|
+
The Page Builder renders all components wrapped inside a single parent container, `<div id="pagebuilder">`.
|
|
620
|
+
You can pass global CSS `classes` and `style` to this wrapper by adding a `pageSettings` object in your config:
|
|
532
621
|
|
|
533
622
|
```ts
|
|
534
623
|
const configPageBuilder = {
|
|
@@ -544,9 +633,9 @@ const configPageBuilder = {
|
|
|
544
633
|
} as const
|
|
545
634
|
```
|
|
546
635
|
|
|
547
|
-
You have full control over the page’s appearance at any time
|
|
636
|
+
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
637
|
|
|
549
|
-
## Download HTML
|
|
638
|
+
## Download HTML File
|
|
550
639
|
|
|
551
640
|
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
641
|
|
|
@@ -556,9 +645,7 @@ To ensure images render properly after export, you must specify a URL prefix in
|
|
|
556
645
|
|
|
557
646
|
```ts
|
|
558
647
|
const configPageBuilder = {
|
|
559
|
-
|
|
560
|
-
imageUrlPrefix: 'https://your-domain.com/uploads/',
|
|
561
|
-
},
|
|
648
|
+
imageUrlPrefix: 'https://your-domain.com/uploads/',
|
|
562
649
|
// other config options...
|
|
563
650
|
} as const
|
|
564
651
|
```
|
|
@@ -582,7 +669,7 @@ Learn how to create and integrate your own components step by step.
|
|
|
582
669
|
### Integrate Unsplash Library
|
|
583
670
|
|
|
584
671
|
Easily add Unsplash image search to your media library modal—just like in the demo!
|
|
585
|
-
|
|
672
|
+
A code example is provided so you can copy-paste to get started.
|
|
586
673
|
|
|
587
674
|
See the full step-by-step guide and working demo code here:
|
|
588
675
|
📚 **[Unsplash Integration Guide](./UNSPLASH_INTEGRATION.md)**
|
|
@@ -600,7 +687,7 @@ Learn how to create and integrate your own components step by step.
|
|
|
600
687
|
|
|
601
688
|
If fonts or Material Icons are not displaying correctly, verify that:
|
|
602
689
|
|
|
603
|
-
**CSS Import**:
|
|
690
|
+
**CSS Import**: You are importing the CSS file:
|
|
604
691
|
|
|
605
692
|
```js
|
|
606
693
|
import '@myissue/vue-website-page-builder/style.css'
|
|
@@ -614,34 +701,34 @@ The Page Builder is designed as a modular, state-driven editor for dynamic page
|
|
|
614
701
|
|
|
615
702
|
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
703
|
|
|
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).
|
|
704
|
+
- **Configuration First:**
|
|
705
|
+
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
706
|
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
707
|
|
|
621
|
-
- **Loading Content:**
|
|
708
|
+
- **Loading Content:**
|
|
622
709
|
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
710
|
|
|
624
|
-
- **Editing Experience:**
|
|
711
|
+
- **Editing Experience:**
|
|
625
712
|
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
713
|
|
|
627
|
-
**In short:**
|
|
714
|
+
**In short:**
|
|
628
715
|
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
716
|
|
|
630
717
|
<img style="max-width: 100%;" src="./public/home/page_builder_architecture.png" alt="Vue Website Page Builder - the editor" />
|
|
631
718
|
|
|
632
719
|
## Contributing
|
|
633
720
|
|
|
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
|
|
721
|
+
1. Fork the repository.
|
|
722
|
+
2. Create your feature branch.
|
|
723
|
+
3. Make your changes.
|
|
724
|
+
4. Build and test locally.
|
|
725
|
+
5. Submit a pull request.
|
|
639
726
|
|
|
640
727
|
## Security Vulnerabilities
|
|
641
728
|
|
|
642
729
|
If you discover a security vulnerability, please send us a message.
|
|
643
730
|
|
|
644
|
-
## Get in
|
|
731
|
+
## Get in Touch for Customization or Any Questions
|
|
645
732
|
|
|
646
733
|
If you have any questions or if you're looking for customization, feel free to connect with our developer.
|
|
647
734
|
|
|
@@ -650,7 +737,7 @@ If you have any questions or if you're looking for customization, feel free to c
|
|
|
650
737
|
|
|
651
738
|
## Feedback
|
|
652
739
|
|
|
653
|
-
Suggestions
|
|
740
|
+
Suggestions or any issues you encounter while using this app. Feel free to reach out.
|
|
654
741
|
|
|
655
742
|
## Support the Project
|
|
656
743
|
|