@myissue/vue-website-page-builder 3.1.30 → 3.1.33
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
CHANGED
|
@@ -38,7 +38,7 @@ This import automatically includes:
|
|
|
38
38
|
|
|
39
39
|
[Play around with the page builder](https://www.builder-demo.myissue.dk)
|
|
40
40
|
|
|
41
|
-
|
|
41
|
+
Born out of desire to create a minimalist page builder with an elegant and intuitive design.
|
|
42
42
|
|
|
43
43
|
The web builder for stunning pages. Enable users to design and publish modern pages at any scale. Build responsive pages like listings, jobs or blog posts and manage content easily using the free Click & Drop Page Builder.
|
|
44
44
|
|
|
@@ -46,7 +46,7 @@ To star the repository, simply click on the **Star** button located at the top-r
|
|
|
46
46
|
|
|
47
47
|
## Demo
|
|
48
48
|
|
|
49
|
-
Introducing the **
|
|
49
|
+
Introducing the **The LightweightFree Vue Click & Drop Page Builder**
|
|
50
50
|
create and enhance digital experiences with Vue on any backend.
|
|
51
51
|
|
|
52
52
|
[Play around with the page builder](https://www.builder-demo.myissue.dk)
|
|
@@ -136,14 +136,22 @@ Get up and running quickly by importing the PageBuilder component, setting up yo
|
|
|
136
136
|
- `pageBuilderLogo` to display your company logo in the builder toolbar
|
|
137
137
|
- `resourceData` to prefill the builder with initial data
|
|
138
138
|
- `userSettings` to set user preferences such as theme, language, or autoSave
|
|
139
|
+
- `createNewResourceFormName` (recommended): Specify the resource type (e.g., `"article"`, `"jobPost"`, `"store"`, etc.) in the `updateOrCreate` config. This is especially useful if your platform supports multiple resource types. By providing a unique name, the page builder can correctly manage layouts and local storage for each resource type, allowing users to continue where they left off for different resources.
|
|
139
140
|
|
|
140
141
|
```vue
|
|
141
142
|
<script setup>
|
|
142
|
-
import {
|
|
143
|
-
|
|
143
|
+
import {
|
|
144
|
+
PageBuilder,
|
|
145
|
+
PageBuilderClass,
|
|
146
|
+
sharedPageBuilderStore,
|
|
147
|
+
} from '@myissue/vue-website-page-builder'
|
|
144
148
|
import '@myissue/vue-website-page-builder/style.css'
|
|
145
149
|
|
|
146
150
|
const configPageBuilder = {
|
|
151
|
+
updateOrCreate: {
|
|
152
|
+
// Set the resource type for better local storage and multi-resource support
|
|
153
|
+
createNewResourceFormName: 'article',
|
|
154
|
+
},
|
|
147
155
|
pageBuilderLogo: {
|
|
148
156
|
src: '/logo/logo.svg',
|
|
149
157
|
},
|
|
@@ -159,12 +167,12 @@ const configPageBuilder = {
|
|
|
159
167
|
},
|
|
160
168
|
}
|
|
161
169
|
|
|
170
|
+
// Use sharedPageBuilderStore for shared state between PageBuilderClass and PageBuilder component
|
|
162
171
|
const pageBuilderStateStore = sharedPageBuilderStore
|
|
163
172
|
const pageBuilderClass = new PageBuilderClass(pageBuilderStateStore)
|
|
164
173
|
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
})
|
|
174
|
+
// Initializing page builder with essential configuration
|
|
175
|
+
pageBuilderClass.setConfigPageBuilder(configPageBuilder)
|
|
168
176
|
</script>
|
|
169
177
|
|
|
170
178
|
<template>
|
|
@@ -172,7 +180,53 @@ onMounted(() => {
|
|
|
172
180
|
</template>
|
|
173
181
|
```
|
|
174
182
|
|
|
175
|
-
|
|
183
|
+
### Company Logo & Logged-in User
|
|
184
|
+
|
|
185
|
+
You can display your company logo in the page builder interface and set the currently logged-in user by passing both a logo URL and user information in your config object:
|
|
186
|
+
|
|
187
|
+
- **Company Logo:** Set the logo URL in your config object and pass it to the PageBuilder using `pageBuilderClass.setConfigPageBuilder(configPageBuilder)`. When provided, the logo will appear at the top of the page builder with proper spacing in the toolbar.
|
|
188
|
+
- **Logged-in User:** Pass a `userForPageBuilder` object in your config to display or use the logged-in user's information within the builder (e.g., for audit trails, personalization, or permissions).
|
|
189
|
+
|
|
190
|
+
**Basic Usage:**
|
|
191
|
+
|
|
192
|
+
- You can display your company logo in the page builder interface by setting the `src` in your config object and passing it to the PageBuilder using `pageBuilderClass.setConfigPageBuilder(configPageBuilder)`. When provided, the logo will appear in the top of the page builder.
|
|
193
|
+
|
|
194
|
+
Basic Usage:
|
|
195
|
+
|
|
196
|
+
```vue
|
|
197
|
+
<script setup>
|
|
198
|
+
import {
|
|
199
|
+
PageBuilder,
|
|
200
|
+
PageBuilderClass,
|
|
201
|
+
sharedPageBuilderStore,
|
|
202
|
+
} from '@myissue/vue-website-page-builder'
|
|
203
|
+
import '@myissue/vue-website-page-builder/style.css'
|
|
204
|
+
|
|
205
|
+
const configPageBuilder = {
|
|
206
|
+
pageBuilderLogo: {
|
|
207
|
+
src: '/logo/logo.svg',
|
|
208
|
+
},
|
|
209
|
+
userForPageBuilder: { name: 'John Doe' },
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
// Use sharedPageBuilderStore for shared state between PageBuilderClass and PageBuilder component
|
|
213
|
+
const pageBuilderStateStore = sharedPageBuilderStore
|
|
214
|
+
const pageBuilderClass = new PageBuilderClass(pageBuilderStateStore)
|
|
215
|
+
|
|
216
|
+
// Initializing page builder with essential configuration
|
|
217
|
+
pageBuilderClass.setConfigPageBuilder(configPageBuilder)
|
|
218
|
+
</script>
|
|
219
|
+
|
|
220
|
+
<template>
|
|
221
|
+
<PageBuilder />
|
|
222
|
+
</template>
|
|
223
|
+
```
|
|
224
|
+
|
|
225
|
+
configuration Options
|
|
226
|
+
|
|
227
|
+
| Prop | Type | Default | Description |
|
|
228
|
+
| ----------------- | -------- | ------- | ----------------------------------- |
|
|
229
|
+
| `PageBuilderLogo` | `String` | `null` | URL path to your company logo image |
|
|
176
230
|
|
|
177
231
|
### Updating Existing Resources
|
|
178
232
|
|
|
@@ -181,7 +235,7 @@ To load existing content that was created with this PageBuilder:
|
|
|
181
235
|
- Use `sharedPageBuilderStore` to ensure the external PageBuilderClass and internal PageBuilder component share the same state
|
|
182
236
|
- Import `PageBuilderClass` which contains all methods to manipulate and control the page builder state - in this case we need the `loadExistingContent()` method to load existing content into the page builder
|
|
183
237
|
- The PageBuilderClass uses the shared store to maintain state consistency between external operations and the internal PageBuilder component, ensuring that when you load content externally it appears correctly in the PageBuilder interface
|
|
184
|
-
- Set `formType` to `"update"` in your config object and pass it to the PageBuilder using `pageBuilderClass.setConfigPageBuilder(configPageBuilder)
|
|
238
|
+
- Set `formType` to `"update"` in your config object and pass it to the PageBuilder using `pageBuilderClass.setConfigPageBuilder(configPageBuilder)`. This tells the PageBuilder that you're editing an existing resource rather than creating a new one, which affects how the component handles data and interactions.
|
|
185
239
|
|
|
186
240
|
1. **Set formType to "update"** in template:
|
|
187
241
|
|
|
@@ -189,15 +243,15 @@ To load existing content that was created with this PageBuilder:
|
|
|
189
243
|
<PageBuilder />
|
|
190
244
|
```
|
|
191
245
|
|
|
192
|
-
|
|
246
|
+
1. **Load existing content on mount**:
|
|
193
247
|
|
|
194
248
|
```javascript
|
|
195
|
-
import { onMounted } from 'vue'
|
|
196
249
|
import {
|
|
197
250
|
PageBuilder,
|
|
198
251
|
PageBuilderClass,
|
|
199
252
|
sharedPageBuilderStore,
|
|
200
253
|
} from '@myissue/vue-website-page-builder'
|
|
254
|
+
import '@myissue/vue-website-page-builder/style.css'
|
|
201
255
|
|
|
202
256
|
const configPageBuilder = {
|
|
203
257
|
updateOrCreate: {
|
|
@@ -205,22 +259,67 @@ const configPageBuilder = {
|
|
|
205
259
|
},
|
|
206
260
|
}
|
|
207
261
|
|
|
208
|
-
|
|
262
|
+
// Use sharedPageBuilderStore for shared state between PageBuilderClass and PageBuilder component
|
|
209
263
|
const pageBuilderClass = new PageBuilderClass(pageBuilderStateStore)
|
|
210
264
|
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
265
|
+
// Initializing page builder with essential configuration
|
|
266
|
+
pageBuilderClass.setConfigPageBuilder(configPageBuilder)
|
|
267
|
+
// Populating page builder with existing resource content
|
|
268
|
+
pageBuilderClass.loadExistingContent(existingResourceFromBackend)
|
|
269
|
+
```
|
|
270
|
+
|
|
271
|
+
#### How should `existingResourceFromBackend` look?
|
|
272
|
+
|
|
273
|
+
When loading an existing resource, each component object will have an `id` assigned by the page builder.
|
|
274
|
+
The example below shows the structure as it would appear when loaded from local storage after components have been added in the builder.
|
|
275
|
+
|
|
276
|
+
- Example JSON string (from localStorage or backend)
|
|
277
|
+
- For existing resources, id will always be present and set by the page builder.
|
|
278
|
+
|
|
279
|
+
```typescript
|
|
280
|
+
// TypeScript interface for reference
|
|
281
|
+
export interface ComponentObject {
|
|
282
|
+
id: string | number | null
|
|
283
|
+
html_code: string
|
|
284
|
+
title?: string
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
// Example JSON string (from localStorage or backend)
|
|
288
|
+
const existingResourceFromBackend = JSON.stringify([
|
|
289
|
+
{
|
|
290
|
+
html_code: `<section>
|
|
291
|
+
<div>
|
|
292
|
+
<h1>Article Title</h1>
|
|
293
|
+
<p>Content</p>
|
|
294
|
+
</div>
|
|
295
|
+
</section>`,
|
|
296
|
+
id: null,
|
|
297
|
+
title: 'Component Title',
|
|
298
|
+
},
|
|
299
|
+
{
|
|
300
|
+
html_code: `<section>
|
|
301
|
+
<div>
|
|
302
|
+
<h1>Article Title</h1>
|
|
303
|
+
<p>Content</p>
|
|
304
|
+
</div>
|
|
305
|
+
</section>`,
|
|
306
|
+
id: null,
|
|
307
|
+
title: 'Component Title',
|
|
308
|
+
},
|
|
309
|
+
])
|
|
215
310
|
```
|
|
216
311
|
|
|
312
|
+
Alternatively, you can provide a raw HTML string containing your `<section>` components:
|
|
313
|
+
|
|
217
314
|
### Customization
|
|
218
315
|
|
|
219
316
|
Customizing the page builder is made simple since all the logic resides in the PageBuilder Class.
|
|
220
317
|
|
|
318
|
+
- Google Fonts (Jost, Cormorant) and Material Icons are automatically loaded when you import the CSS file. No additional setup required for fonts or icons!
|
|
319
|
+
|
|
221
320
|
### Custom Components
|
|
222
321
|
|
|
223
|
-
Want to add your own media library or
|
|
322
|
+
Want to add your own media library or Create custom components that can be injected into the page builder:
|
|
224
323
|
|
|
225
324
|
📚 **[Custom Components Setup Guide](./CUSTOM_COMPONENTS_SETUP.md)** - Learn how to create and integrate your own components
|
|
226
325
|
|
|
@@ -238,53 +337,6 @@ import SearchComponent from './ComponentsPageBuilder/SearchComponent.vue'
|
|
|
238
337
|
</template>
|
|
239
338
|
```
|
|
240
339
|
|
|
241
|
-
### Company Logo
|
|
242
|
-
|
|
243
|
-
You can display your company logo in the page builder interface by passing a logo URL:
|
|
244
|
-
|
|
245
|
-
- You can display your company logo in the page builder interface by setting the logo URL in your config object and passing it to the PageBuilder using `pageBuilderClass.setConfigPageBuilder(configPageBuilder)` inside `onMounted`. When provided, the logo will appear in the top toolbar of the page builder.
|
|
246
|
-
|
|
247
|
-
Basic Usage:
|
|
248
|
-
|
|
249
|
-
```vue
|
|
250
|
-
<script setup>
|
|
251
|
-
import { PageBuilder } from '@myissue/vue-website-page-builder'
|
|
252
|
-
import '@myissue/vue-website-page-builder/style.css'
|
|
253
|
-
|
|
254
|
-
const configPageBuilder = {
|
|
255
|
-
pageBuilderLogo: {
|
|
256
|
-
src: '/logo/logo.svg',
|
|
257
|
-
},
|
|
258
|
-
userForPageBuilder: { name: 'John Doe' },
|
|
259
|
-
resourceData: {
|
|
260
|
-
title: 'Demo Article',
|
|
261
|
-
id: 1,
|
|
262
|
-
},
|
|
263
|
-
}
|
|
264
|
-
|
|
265
|
-
const pageBuilderStateStore = sharedPageBuilderStore
|
|
266
|
-
const pageBuilderClass = new PageBuilderClass(pageBuilderStateStore)
|
|
267
|
-
|
|
268
|
-
onMounted(() => {
|
|
269
|
-
pageBuilderClass.setConfigPageBuilder(configPageBuilder)
|
|
270
|
-
})
|
|
271
|
-
</script>
|
|
272
|
-
|
|
273
|
-
<template>
|
|
274
|
-
<PageBuilder />
|
|
275
|
-
</template>
|
|
276
|
-
```
|
|
277
|
-
|
|
278
|
-
configuration Options
|
|
279
|
-
|
|
280
|
-
| Prop | Type | Default | Description |
|
|
281
|
-
| ----------------- | -------- | ------- | ----------------------------------- |
|
|
282
|
-
| `PageBuilderLogo` | `String` | `null` | URL path to your company logo image |
|
|
283
|
-
|
|
284
|
-
#### Examples
|
|
285
|
-
|
|
286
|
-
The logo will be displayed with a subtle border separator and proper spacing in the page builder toolbar.
|
|
287
|
-
|
|
288
340
|
## Troubleshooting
|
|
289
341
|
|
|
290
342
|
### Fonts or Icons Not Displaying
|