@myissue/vue-website-page-builder 3.2.68 → 3.2.69

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
@@ -318,7 +318,7 @@ try {
318
318
  <script>
319
319
  ```
320
320
 
321
- #### Clearing the Draft After Successful Creation
321
+ #### Resetting the Builder After Successful Resource Creation
322
322
 
323
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
324
 
@@ -347,8 +347,45 @@ const configPageBuilder = {
347
347
 
348
348
  pageBuilderClass.setConfigPageBuilder(configPageBuilder);
349
349
 
350
+ const createResource = async function(){
350
351
  pageBuilderClass.deleteAllComponents();
351
- await pageBuilderClass.removeItemComponentsLocalStorageCreate();
352
+ await pageBuilderClass.removeItemComponentsLocalStorage();
353
+ };
354
+ <script>
355
+ ```
356
+
357
+ #### Resetting the Builder After Successful Resource Update
358
+
359
+ After you have successfully updated an existing resource (such as a post, article, or listing) using the Page Builder with formType: 'update', you should clear the builder’s state and remove the corresponding local storage entry. This prevents outdated drafts from being loaded the next time you edit the same resource.
360
+
361
+ ```js
362
+ <script setup>
363
+ import {
364
+ PageBuilder,
365
+ PageBuilderClass,
366
+ sharedPageBuilderStore,
367
+ } from "@myissue/vue-website-page-builder";
368
+ import "@myissue/vue-website-page-builder/style.css";
369
+
370
+ // Make sure to initialize these before using
371
+ const pageBuilderStateStore = sharedPageBuilderStore;
372
+ const pageBuilderClass = new PageBuilderClass(pageBuilderStateStore);
373
+
374
+
375
+ const configPageBuilder = {
376
+ updateOrCreate: {
377
+ formType: 'update',
378
+ formName: 'article',
379
+ },
380
+ };
381
+
382
+ pageBuilderClass.setConfigPageBuilder(configPageBuilder);
383
+
384
+ const updateResource = async function() {
385
+ pageBuilderClass.deleteAllComponents();
386
+ await pageBuilderClass.removeItemComponentsLocalStorage();
387
+ };
388
+
352
389
  <script>
353
390
  ```
354
391
 
@@ -1478,11 +1478,11 @@ class Se {
1478
1478
  async saveComponentsLocalStorage() {
1479
1479
  await this.nextTick, await Go(this, Os).call(this);
1480
1480
  }
1481
- async removeItemComponentsLocalStorageCreate() {
1481
+ async removeItemComponentsLocalStorage() {
1482
1482
  await this.nextTick, this.getLocalStorageItemName.value && localStorage.removeItem(this.getLocalStorageItemName.value);
1483
1483
  }
1484
- async removeItemComponentsLocalStorageUpdate() {
1485
- this.getLocalStorageItemName.value && localStorage.removeItem(this.getLocalStorageItemName.value);
1484
+ getStorageItemNameForResource() {
1485
+ return this.getLocalStorageItemName.value;
1486
1486
  }
1487
1487
  areComponentsStoredInLocalStorage() {
1488
1488
  if (!this.getLocalStorageItemName.value) return !1;
@@ -23000,7 +23000,7 @@ const k3 = ["src"], S3 = {
23000
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 = {
23001
23001
  __name: "PageBuilderSettings",
23002
23002
  setup(r) {
23003
- const e = "v3.2.68", t = be;
23003
+ const e = "v3.2.69", t = be;
23004
23004
  new Se(t);
23005
23005
  const o = O(null), n = $(() => t.getConfigPageBuilder), i = $(() => t.getComponents), s = function(l, d) {
23006
23006
  const c = document.createElement("a");
@@ -23620,7 +23620,7 @@ const k3 = ["src"], S3 = {
23620
23620
  n.value = !0, i.value = "delete", s.value = 2, a.value = "Remove all Components", l.value = "Are you sure you want to remove all Components?", d.value = "Close", c.value = null, p.value = "Delete", m.value = function() {
23621
23621
  n.value = !1;
23622
23622
  }, g.value = async function() {
23623
- o.deleteAllComponents(), await o.clearHtmlSelection(), t.value.updateOrCreate && typeof t.value.updateOrCreate.formType == "string" && (t.value.updateOrCreate.formType === "create" && await o.removeItemComponentsLocalStorageCreate(), t.value.updateOrCreate.formType === "update" && await o.removeItemComponentsLocalStorageUpdate()), n.value = !1;
23623
+ o.deleteAllComponents(), await o.clearHtmlSelection(), t.value.updateOrCreate && typeof t.value.updateOrCreate.formType == "string" && (t.value.updateOrCreate.formType === "create" && await o.removeItemComponentsLocalStorage(), t.value.updateOrCreate.formType === "update" && await o.removeItemComponentsLocalStorage()), n.value = !1;
23624
23624
  };
23625
23625
  }, b = O(!1), w = function() {
23626
23626
  b.value = !1;