pukaad-ui-lib 1.277.0 → 1.279.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
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
/>
|
|
35
35
|
|
|
36
36
|
<!-- <InputCheckbox
|
|
37
|
-
name="disableComment"
|
|
37
|
+
name="disableComment"โโห
|
|
38
38
|
label="ไม่อนุญาตให้แสดงความคิดเห็น"
|
|
39
39
|
v-model="form.disableComment"
|
|
40
40
|
/> -->
|
|
@@ -149,26 +149,51 @@ const onSaveDraft = async () => {
|
|
|
149
149
|
emit("success", res.data);
|
|
150
150
|
isOpen.value = false;
|
|
151
151
|
} catch (error) {
|
|
152
|
-
$toast.error(
|
|
152
|
+
$toast.error(
|
|
153
|
+
error?.data?.message?.description || "\u0E1A\u0E31\u0E19\u0E17\u0E36\u0E01\u0E41\u0E1A\u0E1A\u0E23\u0E48\u0E32\u0E07\u0E44\u0E21\u0E48\u0E2A\u0E33\u0E40\u0E23\u0E47\u0E08"
|
|
154
|
+
);
|
|
153
155
|
} finally {
|
|
154
156
|
isLoading.value = false;
|
|
155
157
|
}
|
|
156
158
|
} else {
|
|
157
159
|
try {
|
|
158
|
-
const
|
|
160
|
+
const rawCoverImage = form.value.coverImage?.map((img) => ({
|
|
161
|
+
file: img.file,
|
|
162
|
+
// File object is not a proxy, safe to copy reference
|
|
163
|
+
url: img.url
|
|
164
|
+
})) || [];
|
|
159
165
|
const draftData = {
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
166
|
+
id: form.value.id || `draft_${Date.now()}`,
|
|
167
|
+
title: form.value.title,
|
|
168
|
+
content: JSON.parse(JSON.stringify(form.value.content || [])),
|
|
169
|
+
tags: JSON.parse(JSON.stringify(form.value.tags || [])),
|
|
170
|
+
disableComment: form.value.disableComment,
|
|
171
|
+
coverImage: rawCoverImage,
|
|
172
|
+
savedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
163
173
|
};
|
|
164
|
-
const
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
174
|
+
const request = indexedDB.open("PukaadDraftsDB", 1);
|
|
175
|
+
request.onupgradeneeded = (e) => {
|
|
176
|
+
e.target.result.createObjectStore("blogDrafts", { keyPath: "id" });
|
|
177
|
+
};
|
|
178
|
+
request.onsuccess = (e) => {
|
|
179
|
+
const db = e.target.result;
|
|
180
|
+
const tx = db.transaction("blogDrafts", "readwrite");
|
|
181
|
+
const store = tx.objectStore("blogDrafts");
|
|
182
|
+
store.put(draftData);
|
|
183
|
+
tx.oncomplete = () => {
|
|
184
|
+
$toast.success("\u0E1A\u0E31\u0E19\u0E17\u0E36\u0E01\u0E41\u0E1A\u0E1A\u0E23\u0E48\u0E32\u0E07\u0E44\u0E27\u0E49\u0E43\u0E19\u0E40\u0E04\u0E23\u0E37\u0E48\u0E2D\u0E07\u0E2A\u0E33\u0E40\u0E23\u0E47\u0E08");
|
|
185
|
+
emit("saveDraft", form.value);
|
|
186
|
+
isOpen.value = false;
|
|
187
|
+
};
|
|
188
|
+
tx.onerror = () => {
|
|
189
|
+
$toast.error("\u0E44\u0E21\u0E48\u0E2A\u0E32\u0E21\u0E32\u0E23\u0E16\u0E1A\u0E31\u0E19\u0E17\u0E36\u0E01\u0E41\u0E1A\u0E1A\u0E23\u0E48\u0E32\u0E07\u0E44\u0E14\u0E49");
|
|
190
|
+
};
|
|
191
|
+
};
|
|
192
|
+
request.onerror = () => {
|
|
193
|
+
$toast.error("\u0E44\u0E21\u0E48\u0E2A\u0E32\u0E21\u0E32\u0E23\u0E16\u0E1A\u0E31\u0E19\u0E17\u0E36\u0E01\u0E41\u0E1A\u0E1A\u0E23\u0E48\u0E32\u0E07\u0E44\u0E14\u0E49");
|
|
194
|
+
};
|
|
195
|
+
} catch (e) {
|
|
196
|
+
console.error(e);
|
|
172
197
|
$toast.error("\u0E44\u0E21\u0E48\u0E2A\u0E32\u0E21\u0E32\u0E23\u0E16\u0E1A\u0E31\u0E19\u0E17\u0E36\u0E01\u0E41\u0E1A\u0E1A\u0E23\u0E48\u0E32\u0E07\u0E44\u0E14\u0E49");
|
|
173
198
|
}
|
|
174
199
|
}
|