pukaad-ui-lib 1.278.0 → 1.280.0

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/dist/module.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "pukaad-ui-lib",
3
3
  "configKey": "pukaadUI",
4
- "version": "1.278.0",
4
+ "version": "1.280.0",
5
5
  "builder": {
6
6
  "@nuxt/module-builder": "1.0.2",
7
7
  "unbuild": "3.6.1"
@@ -87,7 +87,14 @@ const props = defineProps({
87
87
  coverImage: []
88
88
  }) }
89
89
  });
90
- const form = ref(JSON.parse(JSON.stringify(props.item)));
90
+ function cloneItem(item) {
91
+ const { coverImage, ...rest } = item;
92
+ return {
93
+ ...JSON.parse(JSON.stringify(rest)),
94
+ coverImage: coverImage?.map((img) => ({ ...img })) ?? []
95
+ };
96
+ }
97
+ const form = ref(cloneItem(props.item));
91
98
  const isLoading = ref(false);
92
99
  const isOpen = defineModel({ type: Boolean, ...{
93
100
  default: false
@@ -98,7 +105,7 @@ const drawerTitle = computed(() => {
98
105
  });
99
106
  watch(isOpen, (newVal) => {
100
107
  if (newVal) {
101
- form.value = JSON.parse(JSON.stringify(props.item));
108
+ form.value = cloneItem(props.item);
102
109
  }
103
110
  });
104
111
  const onClose = async () => {
@@ -157,10 +164,19 @@ const onSaveDraft = async () => {
157
164
  }
158
165
  } else {
159
166
  try {
167
+ const rawCoverImage = form.value.coverImage?.map((img) => ({
168
+ file: img.file,
169
+ // File object is not a proxy, safe to copy reference
170
+ url: img.url
171
+ })) || [];
160
172
  const draftData = {
161
- ...form.value,
162
- savedAt: (/* @__PURE__ */ new Date()).toISOString(),
163
- id: form.value.id || `draft_${Date.now()}`
173
+ id: form.value.id || `draft_${Date.now()}`,
174
+ title: form.value.title,
175
+ content: JSON.parse(JSON.stringify(form.value.content || [])),
176
+ tags: JSON.parse(JSON.stringify(form.value.tags || [])),
177
+ disableComment: form.value.disableComment,
178
+ coverImage: rawCoverImage,
179
+ savedAt: (/* @__PURE__ */ new Date()).toISOString()
164
180
  };
165
181
  const request = indexedDB.open("PukaadDraftsDB", 1);
166
182
  request.onupgradeneeded = (e) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pukaad-ui-lib",
3
- "version": "1.278.0",
3
+ "version": "1.280.0",
4
4
  "description": "pukaad-ui for MeMSG",
5
5
  "repository": {
6
6
  "type": "git",