@myissue/vue-website-page-builder 3.2.66 → 3.2.68
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
|
@@ -8,6 +8,13 @@
|
|
|
8
8
|
|
|
9
9
|
A Vue 3 page builder component with drag & drop functionality for creating dynamic web pages.
|
|
10
10
|
|
|
11
|
+
Tailored for Vue Developers
|
|
12
|
+
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, and autosave preferences, making it a personalized experience for every user.
|
|
13
|
+
|
|
14
|
+
Integration is easy, and content is safely auto stored in the browser's local storage. You can retrieve HTML content when you're ready to publish, giving you total control over content output.
|
|
15
|
+
|
|
16
|
+
Want to include your company logo in the editor toolbar or reflect your brand's color scheme throughout the builder interface? Done. With robust configuration options, branding the builder to match your product or client identity is quick and effortless.
|
|
17
|
+
|
|
11
18
|
## Installation
|
|
12
19
|
|
|
13
20
|
The web builder for stunning pages. Enable users to design and publish modern pages at any scale.
|
|
@@ -54,6 +61,7 @@ The Page Builder is packed with features:
|
|
|
54
61
|
- **Reordering**: Change the order of your content without hassle.
|
|
55
62
|
- **True Visual Editing**: See your changes in real-time as you make them.
|
|
56
63
|
- **Media Library**: Access and manage your media files.
|
|
64
|
+
- **Local Storage & Auto-Save**: Never lose your work - changes are saved as you go.
|
|
57
65
|
- **Unsplash**: Unsplash Integration.
|
|
58
66
|
- **Responsive Editing**: Ensure your site looks great on all devices.
|
|
59
67
|
- **Text Editing:** Edit text content live and in real-time.
|
|
@@ -245,6 +253,105 @@ The Page Builder automatically manages all changes using the browser's local sto
|
|
|
245
253
|
- **Auto-Save:** The builder periodically auto-saves your changes to local storage, so you don't have to worry about losing your work.
|
|
246
254
|
- **Manual Save:** When the user clicks the Save button, the current state is also saved to local storage.
|
|
247
255
|
|
|
256
|
+
### Getting HTML Content from Local Storage for Form Submission
|
|
257
|
+
|
|
258
|
+
To use the builder’s saved data in your form submission, you may want both the combined HTML content and the titles of each component. The PageBuilderClass provides a method to access the latest saved state from local storage. The example below demonstrates how to retrieve and parse this data, combining all component HTML into a single string and collecting all titles into an array. This is useful if you want to display or store both the rendered content and the structure or headings of your page.
|
|
259
|
+
|
|
260
|
+
You should call this logic when you want to submit or save the builder’s output, for example, when the user clicks a “Save” or “Publish” button. The code safely parses the local storage data, handles errors, and assigns the results to your form fields.
|
|
261
|
+
|
|
262
|
+
**Important:**
|
|
263
|
+
To retrieve the correct content from local storage, you must pass the same resourceData (such as formType and formName) to the Page Builder that was used when the content was originally saved. If the resource data does not match, the Page Builder will look for a different local storage key and may not find the expected content.
|
|
264
|
+
Example:
|
|
265
|
+
|
|
266
|
+
```js
|
|
267
|
+
const configPageBuilder = {
|
|
268
|
+
updateOrCreate: {
|
|
269
|
+
formType: 'create',
|
|
270
|
+
formName: 'article',
|
|
271
|
+
},
|
|
272
|
+
}
|
|
273
|
+
```
|
|
274
|
+
|
|
275
|
+
Example Getting HTML Content from Local Storage for Form Submission
|
|
276
|
+
|
|
277
|
+
```js
|
|
278
|
+
<script setup>
|
|
279
|
+
import {
|
|
280
|
+
PageBuilder,
|
|
281
|
+
PageBuilderClass,
|
|
282
|
+
sharedPageBuilderStore,
|
|
283
|
+
} from "@myissue/vue-website-page-builder";
|
|
284
|
+
import "@myissue/vue-website-page-builder/style.css";
|
|
285
|
+
|
|
286
|
+
// Make sure to initialize these before using
|
|
287
|
+
const pageBuilderStateStore = sharedPageBuilderStore;
|
|
288
|
+
const pageBuilderClass = new PageBuilderClass(pageBuilderStateStore);
|
|
289
|
+
|
|
290
|
+
|
|
291
|
+
const configPageBuilder = {
|
|
292
|
+
updateOrCreate: {
|
|
293
|
+
formType: 'create',
|
|
294
|
+
formName: 'article',
|
|
295
|
+
},
|
|
296
|
+
};
|
|
297
|
+
|
|
298
|
+
pageBuilderClass.setConfigPageBuilder(configPageBuilder);
|
|
299
|
+
|
|
300
|
+
|
|
301
|
+
let storedComponents = pageBuilderClass.areComponentsStoredInLocalStorage();
|
|
302
|
+
let contentFromPageBuilder = "";
|
|
303
|
+
|
|
304
|
+
try {
|
|
305
|
+
storedComponents = JSON.parse(storedComponents);
|
|
306
|
+
contentFromPageBuilder = Array.isArray(storedComponents)
|
|
307
|
+
? storedComponents.map((component) => component.html_code).join("")
|
|
308
|
+
: "";
|
|
309
|
+
} catch (e) {
|
|
310
|
+
console.error(
|
|
311
|
+
"Unable to parse storedComponents from localStorage:",
|
|
312
|
+
e
|
|
313
|
+
);
|
|
314
|
+
contentFromPageBuilder = "";
|
|
315
|
+
} finally {
|
|
316
|
+
yourForm.content = contentFromPageBuilder;
|
|
317
|
+
}
|
|
318
|
+
<script>
|
|
319
|
+
```
|
|
320
|
+
|
|
321
|
+
#### Clearing the Draft After Successful Creation
|
|
322
|
+
|
|
323
|
+
After you have successfully created a new resource (such as a post, article, or listing) using the Page Builder with formType: 'create', it is important to clear the builder’s draft state and remove the corresponding local storage entry. This ensures that old drafts do not appear the next time the builder is opened for a new resource.
|
|
324
|
+
|
|
325
|
+
Always call these methods after a successful post or resource creation to ensure users start with a fresh builder the next time they create a new resource.
|
|
326
|
+
|
|
327
|
+
```js
|
|
328
|
+
<script setup>
|
|
329
|
+
import {
|
|
330
|
+
PageBuilder,
|
|
331
|
+
PageBuilderClass,
|
|
332
|
+
sharedPageBuilderStore,
|
|
333
|
+
} from "@myissue/vue-website-page-builder";
|
|
334
|
+
import "@myissue/vue-website-page-builder/style.css";
|
|
335
|
+
|
|
336
|
+
// Make sure to initialize these before using
|
|
337
|
+
const pageBuilderStateStore = sharedPageBuilderStore;
|
|
338
|
+
const pageBuilderClass = new PageBuilderClass(pageBuilderStateStore);
|
|
339
|
+
|
|
340
|
+
|
|
341
|
+
const configPageBuilder = {
|
|
342
|
+
updateOrCreate: {
|
|
343
|
+
formType: 'create',
|
|
344
|
+
formName: 'article',
|
|
345
|
+
},
|
|
346
|
+
};
|
|
347
|
+
|
|
348
|
+
pageBuilderClass.setConfigPageBuilder(configPageBuilder);
|
|
349
|
+
|
|
350
|
+
pageBuilderClass.deleteAllComponents();
|
|
351
|
+
await pageBuilderClass.removeItemComponentsLocalStorageCreate();
|
|
352
|
+
<script>
|
|
353
|
+
```
|
|
354
|
+
|
|
248
355
|
#### Resource-Specific Storage Keys
|
|
249
356
|
|
|
250
357
|
Each save is stored in local storage using a unique key. The key is determined by whether you are creating a new resource or updating an existing one:
|
|
@@ -1145,7 +1145,6 @@ class Se {
|
|
|
1145
1145
|
const e = this.getElement.value, t = e.tagName;
|
|
1146
1146
|
["DIV"].includes(t) && e.tagName.toLowerCase() !== "img" && e.textContent && Number(e.textContent.length) === 0 ? (e.classList.add("h-6"), e.classList.add("bg-red-50")) : (e.classList.remove("h-6"), e.classList.remove("bg-red-50"));
|
|
1147
1147
|
});
|
|
1148
|
-
//
|
|
1149
1148
|
he(this, "handleTextInput", async (e) => {
|
|
1150
1149
|
var t;
|
|
1151
1150
|
typeof ((t = this.getElement.value) == null ? void 0 : t.innerHTML) == "string" && (typeof this.getElement.value.innerHTML == "string" && (await this.nextTick, this.getElement.value.textContent = e, this.pageBuilderStateStore.setTextAreaVueModel(this.getElement.value.innerHTML), this.getElement.value.innerHTML = e), this.ensureTextAreaHasContent());
|
|
@@ -23001,7 +23000,7 @@ const k3 = ["src"], S3 = {
|
|
|
23001
23000
|
}, Xk = { class: "overflow-hidden shadow ring-1 ring-black ring-opacity-5 md:rounded-lg" }, Zk = { class: "overflow-x-auto" }, e6 = { class: "w-max" }, t6 = { class: "bg-white divide-y divide-gray-200" }, r6 = { class: "px-6 py-4 whitespace-nowrap text-sm text-gray-500" }, o6 = { class: "min-w-[30rem] w-max" }, n6 = { key: 0 }, i6 = { key: 1 }, s6 = { key: 0 }, a6 = { class: "px-6 py-4 whitespace-nowrap text-sm text-gray-500" }, l6 = { class: "min-w-[30rem] w-max" }, d6 = { class: "inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium" }, c6 = { class: "mt-4 mb-4 py-8 border-b border-myPrimbryLightGrayColor" }, p6 = { class: "mt-4 whitespace-pre-wrap text-white overflow-hidden bg-gray-900" }, u6 = { class: "px-4 pb-8 pt-4 text-white text-xs break-all" }, m6 = { class: "myPrimaryParagraph text-xs text-white" }, h6 = {
|
|
23002
23001
|
__name: "PageBuilderSettings",
|
|
23003
23002
|
setup(r) {
|
|
23004
|
-
const e = "v3.2.
|
|
23003
|
+
const e = "v3.2.68", t = be;
|
|
23005
23004
|
new Se(t);
|
|
23006
23005
|
const o = O(null), n = $(() => t.getConfigPageBuilder), i = $(() => t.getComponents), s = function(l, d) {
|
|
23007
23006
|
const c = document.createElement("a");
|