@myissue/vue-website-page-builder 3.1.25 → 3.1.26

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@myissue/vue-website-page-builder",
3
- "version": "v3.1.25",
3
+ "version": "v3.1.26",
4
4
  "description": "🚧 DEVELOPMENT VERSION - Vue.js page builder component with drag & drop functionality. Not ready for production use.",
5
5
  "type": "module",
6
6
  "main": "./dist/vue-website-page-builder.umd.cjs",
@@ -1150,7 +1150,10 @@ class PageBuilderClass {
1150
1150
  }
1151
1151
 
1152
1152
  // Logic for update
1153
- if (updateOrCreate === 'update') {
1153
+ if (
1154
+ (updateOrCreate === 'update' && typeof resourceFormName !== 'string') ||
1155
+ (typeof resourceFormName === 'string' && resourceFormName?.length < 1)
1156
+ ) {
1154
1157
  // if resource data is null
1155
1158
  if (resourceData === null) {
1156
1159
  this.pageBuilderStateStore.setLocalStorageItemName(`page-builder-update-resource`)
@@ -1188,6 +1191,49 @@ class PageBuilderClass {
1188
1191
  return
1189
1192
  }
1190
1193
  }
1194
+ // Logic for update and with resource form name
1195
+ if (
1196
+ updateOrCreate === 'update' &&
1197
+ typeof resourceFormName === 'string' &&
1198
+ resourceFormName.length > 0
1199
+ ) {
1200
+ // if resource data is null
1201
+ if (resourceData === null) {
1202
+ this.pageBuilderStateStore.setLocalStorageItemName(`page-builder-update-resource`)
1203
+ return
1204
+ }
1205
+
1206
+ // If resource is present
1207
+
1208
+ // Runs when resourceData has id but no title
1209
+ if (typeof resourceData === 'object' && 'id' in resourceData && !('title' in resourceData)) {
1210
+ const sanitizedId = this.sanitizeForLocalStorage(String(resourceData['id']))
1211
+ this.pageBuilderStateStore.setLocalStorageItemName(
1212
+ `page-builder-update-resource-${sanitizedId}-${this.sanitizeForLocalStorage(resourceFormName)}`,
1213
+ )
1214
+ return
1215
+ }
1216
+
1217
+ // Runs when resourceData has title but no id
1218
+ if (typeof resourceData === 'object' && 'title' in resourceData && !('id' in resourceData)) {
1219
+ const sanitizedTitle = this.sanitizeForLocalStorage(String(resourceData['title']))
1220
+ this.pageBuilderStateStore.setLocalStorageItemName(
1221
+ `page-builder-update-resource-${sanitizedTitle}-${this.sanitizeForLocalStorage(resourceFormName)}`,
1222
+ )
1223
+ return
1224
+ }
1225
+
1226
+ // Runs when resourceData has both title and id
1227
+ if (typeof resourceData === 'object' && 'title' in resourceData && 'id' in resourceData) {
1228
+ const sanitizedId = this.sanitizeForLocalStorage(String(resourceData['id']))
1229
+ const sanitizedTitle = this.sanitizeForLocalStorage(String(resourceData['title']))
1230
+
1231
+ this.pageBuilderStateStore.setLocalStorageItemName(
1232
+ `page-builder-update-resource-${sanitizedTitle}-${this.sanitizeForLocalStorage(resourceFormName)}-${sanitizedId}`,
1233
+ )
1234
+ return
1235
+ }
1236
+ }
1191
1237
  }
1192
1238
 
1193
1239
  async saveComponentsLocalStorage() {