@unhingged/vizu-core 0.1.16 → 0.1.17
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/auto.cjs +22 -3
- package/dist/auto.cjs.map +1 -1
- package/dist/auto.js +22 -3
- package/dist/auto.js.map +1 -1
- package/dist/index.cjs +22 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +22 -3
- package/dist/index.js.map +1 -1
- package/dist/internal.cjs.map +1 -1
- package/dist/internal.js.map +1 -1
- package/dist/vizu.min.js +6 -6
- package/dist/vizu.min.js.map +1 -1
- package/package.json +3 -1
package/dist/auto.cjs
CHANGED
|
@@ -112,6 +112,9 @@ function renderAttachmentsHtml(attachments) {
|
|
|
112
112
|
function migrateComment(raw) {
|
|
113
113
|
if (!raw || typeof raw !== "object") return raw;
|
|
114
114
|
const next = { ...raw };
|
|
115
|
+
if (next.id == null && next._id != null) {
|
|
116
|
+
next.id = next._id;
|
|
117
|
+
}
|
|
115
118
|
if (!Array.isArray(next.fingerprints) || next.fingerprints.length === 0) {
|
|
116
119
|
if (next.fingerprint) {
|
|
117
120
|
next.fingerprints = [next.fingerprint];
|
|
@@ -4307,10 +4310,26 @@ var Vizu = class {
|
|
|
4307
4310
|
this.refreshUi();
|
|
4308
4311
|
}
|
|
4309
4312
|
async removeComment(id) {
|
|
4310
|
-
const
|
|
4311
|
-
if (
|
|
4313
|
+
const idx = this.comments.findIndex((c) => c.id === id);
|
|
4314
|
+
if (idx === -1) return;
|
|
4315
|
+
const comment = this.comments[idx];
|
|
4312
4316
|
this.comments = this.comments.filter((c) => c.id !== id);
|
|
4313
|
-
|
|
4317
|
+
try {
|
|
4318
|
+
await this.storage.removeComment(this.opts.namespace, id);
|
|
4319
|
+
} catch (err) {
|
|
4320
|
+
this.comments.splice(idx, 0, comment);
|
|
4321
|
+
const status = err?.status;
|
|
4322
|
+
const code = err?.code ?? "";
|
|
4323
|
+
const msg = status === 403 || code === "forbidden" ? "Delete failed \u2014 you don't have permission." : status === 401 || code === "auth_required" ? "Delete failed \u2014 please sign in again." : "Delete failed. Please try again.";
|
|
4324
|
+
this.pill?.toast(msg);
|
|
4325
|
+
if (this.popover?.isOpen()) {
|
|
4326
|
+
const anchors = this.popover.getAnchors();
|
|
4327
|
+
if (anchors[0]) this.popover.update(this.commentsForElement(anchors[0]));
|
|
4328
|
+
}
|
|
4329
|
+
this.refreshUi();
|
|
4330
|
+
if (typeof console !== "undefined") console.warn("[vizu] removeComment failed", err);
|
|
4331
|
+
return;
|
|
4332
|
+
}
|
|
4314
4333
|
this.bus.emit("comment:removed", { id, comment });
|
|
4315
4334
|
if (this.popover?.isOpen()) {
|
|
4316
4335
|
const anchors = this.popover.getAnchors();
|