@webx-ui/module-blog 0.5.7 → 0.5.9
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/index.js +659 -645
- package/dist/index.js.map +1 -1
- package/dist/style.css +1 -1
- package/package.json +5 -5
package/dist/index.js
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import { useAdmin as le, useTranslate as
|
|
2
|
-
import { provide as
|
|
3
|
-
import { WxSelect as
|
|
4
|
-
import { useRoute as
|
|
5
|
-
import { provideBlocksPreview as
|
|
6
|
-
const
|
|
7
|
-
function
|
|
8
|
-
|
|
1
|
+
import { useAdmin as le, useTranslate as Z, useDates as ut, useErrorText as we, WxScreenHead as ct, WxScreen as dt, WxSaveState as pt, WxDate as Ee, rowMenuWidth as Ye, WxListScreen as et, WxRowMenu as ze, WxFilterChips as vt, categoryRoutes as gt } from "@webx-ui/module-admin";
|
|
2
|
+
import { provide as ht, inject as ft, defineComponent as Q, useModel as Le, computed as h, openBlock as x, createBlock as I, unref as e, mergeModels as Fe, ref as M, watch as ve, onMounted as Ne, onBeforeUnmount as Ke, createElementBlock as H, Fragment as Te, createVNode as r, withCtx as i, createTextVNode as V, toDisplayString as k, createCommentVNode as K, createElementVNode as F, renderList as qe, normalizeClass as tt, normalizeProps as mt, guardReactiveProps as bt, useTemplateRef as Ie, nextTick as He, isRef as Pe, withKeys as Me, useId as yt, withModifiers as Je } from "vue";
|
|
3
|
+
import { WxSelect as $e, useLocales as at, localizedValue as wt, confirm as de, WxSkeleton as Oe, WxCard as xt, WxBadge as ae, WxBreadcrumb as _t, WxBreadcrumbItem as Ze, WxAlert as Ue, WxButton as G, WxActionBar as lt, toast as D, WxEmpty as kt, WxText as te, WxSortableList as $t, WxAction as Tt, WxInput as Ce, WxFormItem as pe, useModal as Re, WxDialog as De, WxSpace as Be, useElementWidth as At, createModal as Ve, WxTable as it, WxEntityCard as St, WxIcon as Ae, WxTooltip as nt, WxCheckbox as Wt } from "@webx-ui/core";
|
|
4
|
+
import { useRoute as Ge, useRouter as je, onBeforeRouteLeave as Ct } from "vue-router";
|
|
5
|
+
import { provideBlocksPreview as Vt } from "@webx-ui/module-blocks";
|
|
6
|
+
const st = /* @__PURE__ */ Symbol("wx-article-editor");
|
|
7
|
+
function zt(v) {
|
|
8
|
+
ht(st, v);
|
|
9
9
|
}
|
|
10
|
-
function
|
|
11
|
-
return
|
|
10
|
+
function Se() {
|
|
11
|
+
return ft(st, null);
|
|
12
12
|
}
|
|
13
|
-
const
|
|
13
|
+
const Mt = {
|
|
14
14
|
module: {
|
|
15
15
|
group: "Blog",
|
|
16
16
|
articles: "Articles",
|
|
@@ -223,18 +223,18 @@ const Vt = {
|
|
|
223
223
|
"merge-warning": ":count articles will carry “:tag” instead. :merged tags will be deleted, and there is no undoing it.",
|
|
224
224
|
"merge-confirm": "Merge"
|
|
225
225
|
}
|
|
226
|
-
},
|
|
226
|
+
}, Qe = /* @__PURE__ */ new WeakSet();
|
|
227
227
|
function X() {
|
|
228
228
|
try {
|
|
229
229
|
const { i18n: v } = le();
|
|
230
|
-
|
|
230
|
+
Qe.has(v) || (v.defaults("webx-blog", Mt), Qe.add(v));
|
|
231
231
|
} catch {
|
|
232
232
|
}
|
|
233
233
|
}
|
|
234
|
-
const
|
|
234
|
+
const Ut = /* @__PURE__ */ Q({
|
|
235
235
|
name: "WxArticleAuthor",
|
|
236
236
|
__name: "ArticleAuthor",
|
|
237
|
-
props: /* @__PURE__ */
|
|
237
|
+
props: /* @__PURE__ */ Fe({
|
|
238
238
|
disabled: { type: Boolean, default: !1 }
|
|
239
239
|
}, {
|
|
240
240
|
modelValue: { default: null },
|
|
@@ -242,9 +242,9 @@ const zt = /* @__PURE__ */ Q({
|
|
|
242
242
|
}),
|
|
243
243
|
emits: ["update:modelValue"],
|
|
244
244
|
setup(v) {
|
|
245
|
-
const c = v, p =
|
|
245
|
+
const c = v, p = Le(v, "modelValue"), g = Se();
|
|
246
246
|
X();
|
|
247
|
-
const a =
|
|
247
|
+
const a = Z("webx-blog"), s = h(() => c.disabled || g?.disabled.value === !0), t = h(
|
|
248
248
|
() => (g?.options.value.authors ?? []).map((l) => ({
|
|
249
249
|
label: l.title,
|
|
250
250
|
value: l.id
|
|
@@ -255,9 +255,9 @@ const zt = /* @__PURE__ */ Q({
|
|
|
255
255
|
p.value = typeof l == "number" ? l : null;
|
|
256
256
|
}
|
|
257
257
|
});
|
|
258
|
-
return (l,
|
|
258
|
+
return (l, b) => (x(), I(e($e), {
|
|
259
259
|
modelValue: o.value,
|
|
260
|
-
"onUpdate:modelValue":
|
|
260
|
+
"onUpdate:modelValue": b[0] || (b[0] = (f) => o.value = f),
|
|
261
261
|
options: t.value,
|
|
262
262
|
placeholder: e(a)("article.no-author"),
|
|
263
263
|
disabled: s.value,
|
|
@@ -268,7 +268,7 @@ const zt = /* @__PURE__ */ Q({
|
|
|
268
268
|
}, null, 8, ["modelValue", "options", "placeholder", "disabled", "aria-label"]));
|
|
269
269
|
}
|
|
270
270
|
});
|
|
271
|
-
function
|
|
271
|
+
function oe(v) {
|
|
272
272
|
const c = `${v.apiPath}/blog/articles`, p = `${v.apiPath}/blog/tags`, g = (a) => a.data;
|
|
273
273
|
return {
|
|
274
274
|
articles: (a = {}) => {
|
|
@@ -306,215 +306,229 @@ function re(v) {
|
|
|
306
306
|
mergeTags: (a, s, t) => v.http.post(`${p}/merge`, { ids: a, keep: s, redirect: t }).then(g)
|
|
307
307
|
};
|
|
308
308
|
}
|
|
309
|
-
const
|
|
309
|
+
const Nt = { class: "wx-article-editor__screen" }, qt = 1200, It = /* @__PURE__ */ Q({
|
|
310
310
|
__name: "ArticleEditorPage",
|
|
311
311
|
props: {
|
|
312
312
|
base: { default: "/blog" }
|
|
313
313
|
},
|
|
314
314
|
setup(v) {
|
|
315
|
-
const c = v, p = le(), g =
|
|
315
|
+
const c = v, p = le(), g = oe(p), a = Ge(), s = je(), t = at(), o = ut();
|
|
316
316
|
X();
|
|
317
|
-
const l =
|
|
318
|
-
const
|
|
319
|
-
return
|
|
320
|
-
}),
|
|
321
|
-
const
|
|
322
|
-
return typeof
|
|
317
|
+
const l = Z("webx-blog"), b = we(), f = h(() => Number(a.params.id)), T = h(() => `${c.base}/articles`), m = M(null), A = M({}), z = M(""), S = M(""), B = M(null), R = M({ rubrics: [], authors: [] }), y = M([]), W = M(!0), N = M(!1), U = M(!1), $ = M({}), P = M(null), E = M(""), ie = M(0), Y = h(() => p.can("blog.articles.manage")), ne = h(() => !Y.value || U.value), se = h(() => JSON.stringify(A.value)), O = h(() => E.value !== "" && se.value !== E.value), he = h(() => N.value ? "saving" : O.value ? "unsaved" : "saved"), xe = h(() => {
|
|
318
|
+
const w = A.value.title;
|
|
319
|
+
return wt(w, t.active.value, m.value?.title ?? "");
|
|
320
|
+
}), re = h(() => {
|
|
321
|
+
const w = A.value.published_at;
|
|
322
|
+
return typeof w == "string" && w !== "" ? w : null;
|
|
323
323
|
}), fe = h(() => {
|
|
324
|
-
if (
|
|
325
|
-
const
|
|
326
|
-
return !Number.isNaN(
|
|
327
|
-
}),
|
|
328
|
-
const
|
|
329
|
-
if (!
|
|
330
|
-
const
|
|
324
|
+
if (re.value === null) return !1;
|
|
325
|
+
const w = new Date(re.value.replace(" ", "T"));
|
|
326
|
+
return !Number.isNaN(w.valueOf()) && w.valueOf() > Date.now();
|
|
327
|
+
}), We = h(() => {
|
|
328
|
+
const w = m.value;
|
|
329
|
+
if (!w) return "";
|
|
330
|
+
const L = o.short(w.published_at);
|
|
331
331
|
return {
|
|
332
|
-
scheduled: l("article.live-scheduled", { date:
|
|
333
|
-
published: l("article.live-since", { date:
|
|
334
|
-
modified: l("article.live-since", { date:
|
|
335
|
-
}[
|
|
332
|
+
scheduled: l("article.live-scheduled", { date: L }),
|
|
333
|
+
published: l("article.live-since", { date: L }),
|
|
334
|
+
modified: l("article.live-since", { date: L })
|
|
335
|
+
}[w.status] ?? "";
|
|
336
336
|
});
|
|
337
|
-
|
|
337
|
+
Vt({ url: h(() => B.value), reload: ie }), zt({
|
|
338
338
|
article: m,
|
|
339
339
|
values: A,
|
|
340
340
|
options: R,
|
|
341
|
-
related:
|
|
341
|
+
related: y,
|
|
342
342
|
prefix: S,
|
|
343
343
|
base: c.base,
|
|
344
344
|
canManage: Y.value,
|
|
345
345
|
disabled: ne,
|
|
346
|
-
reload: () =>
|
|
347
|
-
save: () =>
|
|
346
|
+
reload: () => ue(!0),
|
|
347
|
+
save: () => _()
|
|
348
348
|
});
|
|
349
|
-
function
|
|
350
|
-
m.value =
|
|
349
|
+
function _e(w) {
|
|
350
|
+
m.value = w.article, A.value = w.values, z.value = w.revision, S.value = w.prefix, B.value = w.preview_url, R.value = w.options, y.value = w.related, E.value = JSON.stringify(w.values), P.value = null;
|
|
351
351
|
}
|
|
352
|
-
async function
|
|
353
|
-
|
|
352
|
+
async function ue(w = !1) {
|
|
353
|
+
w || (W.value = !0);
|
|
354
354
|
try {
|
|
355
|
-
|
|
356
|
-
} catch (
|
|
357
|
-
D.danger(
|
|
355
|
+
_e(await g.get(f.value));
|
|
356
|
+
} catch (L) {
|
|
357
|
+
D.danger(b(L)), s.push(T.value);
|
|
358
358
|
} finally {
|
|
359
359
|
W.value = !1;
|
|
360
360
|
}
|
|
361
361
|
}
|
|
362
362
|
let ee;
|
|
363
|
-
function
|
|
364
|
-
!Y.value || P.value || !
|
|
365
|
-
|
|
366
|
-
},
|
|
363
|
+
function ce() {
|
|
364
|
+
!Y.value || P.value || !O.value || (clearTimeout(ee), ee = setTimeout(() => {
|
|
365
|
+
_();
|
|
366
|
+
}, qt));
|
|
367
367
|
}
|
|
368
368
|
function u() {
|
|
369
|
-
!Y.value || P.value || !
|
|
369
|
+
!Y.value || P.value || !O.value || N.value || (clearTimeout(ee), _());
|
|
370
370
|
}
|
|
371
|
-
|
|
372
|
-
|
|
371
|
+
let C;
|
|
372
|
+
async function _() {
|
|
373
|
+
for (; C; ) {
|
|
374
|
+
const { carried: j, done: ye } = C;
|
|
375
|
+
if (await ye, !O.value || P.value || se.value === j) return;
|
|
376
|
+
}
|
|
377
|
+
const w = se.value, L = J();
|
|
378
|
+
C = { carried: w, done: L };
|
|
379
|
+
try {
|
|
380
|
+
await L;
|
|
381
|
+
} finally {
|
|
382
|
+
C?.done === L && (C = void 0);
|
|
383
|
+
}
|
|
384
|
+
}
|
|
385
|
+
async function J() {
|
|
386
|
+
if (!m.value || !Y.value) return;
|
|
373
387
|
clearTimeout(ee);
|
|
374
|
-
const
|
|
375
|
-
|
|
388
|
+
const w = se.value, L = A.value;
|
|
389
|
+
N.value = !0, $.value = {};
|
|
376
390
|
try {
|
|
377
|
-
const
|
|
378
|
-
m.value =
|
|
379
|
-
} catch (
|
|
380
|
-
const
|
|
381
|
-
|
|
391
|
+
const j = await g.save(m.value.id, { values: L, revision: z.value });
|
|
392
|
+
m.value = j.article, z.value = j.revision, S.value = j.prefix, B.value = j.preview_url, R.value = j.options, y.value = j.related, P.value = null, se.value === w && (E.value = w), ie.value += 1;
|
|
393
|
+
} catch (j) {
|
|
394
|
+
const ye = j;
|
|
395
|
+
ye.status === 409 && ye.body?.data ? P.value = ye.body : ye.body?.errors ? ($.value = ye.body.errors, D.danger(l("article.save-failed"))) : D.danger(b(j));
|
|
382
396
|
} finally {
|
|
383
|
-
|
|
397
|
+
N.value = !1;
|
|
384
398
|
}
|
|
385
399
|
}
|
|
386
|
-
async function
|
|
387
|
-
await
|
|
400
|
+
async function me() {
|
|
401
|
+
await de({
|
|
388
402
|
title: l("article.conflict-theirs-title"),
|
|
389
403
|
message: l("article.conflict-theirs-text"),
|
|
390
404
|
confirmText: l("article.conflict-theirs"),
|
|
391
405
|
cancelText: l("panel.cancel"),
|
|
392
406
|
tone: "danger"
|
|
393
|
-
}) && await
|
|
407
|
+
}) && await ue(!0);
|
|
394
408
|
}
|
|
395
|
-
async function
|
|
396
|
-
const
|
|
397
|
-
|
|
409
|
+
async function n() {
|
|
410
|
+
const w = P.value;
|
|
411
|
+
w && (z.value = w.data.revision, P.value = null, await _());
|
|
398
412
|
}
|
|
399
|
-
async function
|
|
400
|
-
if (!(!m.value || !await
|
|
413
|
+
async function q() {
|
|
414
|
+
if (!(!m.value || !await de({
|
|
401
415
|
title: l("article.discard-title"),
|
|
402
416
|
message: l("article.discard-text"),
|
|
403
417
|
confirmText: l("article.discard"),
|
|
404
418
|
cancelText: l("panel.cancel"),
|
|
405
419
|
tone: "danger"
|
|
406
420
|
}))) {
|
|
407
|
-
|
|
421
|
+
U.value = !0;
|
|
408
422
|
try {
|
|
409
|
-
|
|
410
|
-
} catch (
|
|
411
|
-
D.danger(
|
|
423
|
+
_e(await g.discard(m.value.id)), D.success(l("article.discarded"));
|
|
424
|
+
} catch (L) {
|
|
425
|
+
D.danger(b(L));
|
|
412
426
|
} finally {
|
|
413
|
-
|
|
427
|
+
U.value = !1;
|
|
414
428
|
}
|
|
415
429
|
}
|
|
416
430
|
}
|
|
417
|
-
async function
|
|
418
|
-
const
|
|
419
|
-
if (!
|
|
420
|
-
const
|
|
421
|
-
if (await
|
|
422
|
-
title: l("article.publish-title", { title:
|
|
423
|
-
message: fe.value ? l("article.publish-later", { date:
|
|
431
|
+
async function d() {
|
|
432
|
+
const w = m.value;
|
|
433
|
+
if (!w) return;
|
|
434
|
+
const L = w.path === null ? null : `/${w.path}`, j = re.value === null ? l("article.publish-now") : o.short(re.value);
|
|
435
|
+
if (await de({
|
|
436
|
+
title: l("article.publish-title", { title: w.title }),
|
|
437
|
+
message: fe.value ? l("article.publish-later", { date: j }) : L === null ? l("article.publish-nowhere") : l("article.publish-text", { address: L }),
|
|
424
438
|
confirmText: fe.value ? l("article.schedule") : l("panel.publish"),
|
|
425
439
|
cancelText: l("panel.cancel")
|
|
426
|
-
}) && (
|
|
427
|
-
|
|
440
|
+
}) && (O.value && await _(), !P.value)) {
|
|
441
|
+
U.value = !0;
|
|
428
442
|
try {
|
|
429
|
-
await g.publish(
|
|
430
|
-
} catch (
|
|
431
|
-
D.danger(
|
|
443
|
+
await g.publish(w.id, re.value), await ue(!0), D.success(fe.value ? l("article.scheduled") : l("panel.published"));
|
|
444
|
+
} catch (ot) {
|
|
445
|
+
D.danger(b(ot));
|
|
432
446
|
} finally {
|
|
433
|
-
|
|
447
|
+
U.value = !1;
|
|
434
448
|
}
|
|
435
449
|
}
|
|
436
450
|
}
|
|
437
|
-
function
|
|
438
|
-
const
|
|
439
|
-
return
|
|
451
|
+
function ke() {
|
|
452
|
+
const w = m.value?.status;
|
|
453
|
+
return w === "published" ? "success" : w === "modified" ? "warning" : w === "scheduled" ? "primary" : "default";
|
|
440
454
|
}
|
|
441
|
-
function
|
|
442
|
-
|
|
455
|
+
function be(w) {
|
|
456
|
+
O.value && w.preventDefault();
|
|
443
457
|
}
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
}),
|
|
447
|
-
|
|
448
|
-
}),
|
|
449
|
-
clearTimeout(ee), window.removeEventListener("beforeunload",
|
|
450
|
-
}),
|
|
458
|
+
ve(se, ce), ve(f, () => {
|
|
459
|
+
ue();
|
|
460
|
+
}), Ne(() => {
|
|
461
|
+
ue(), window.addEventListener("beforeunload", be);
|
|
462
|
+
}), Ke(() => {
|
|
463
|
+
clearTimeout(ee), window.removeEventListener("beforeunload", be);
|
|
464
|
+
}), Ct(async () => !O.value || !Y.value || (await _(), !O.value) ? !0 : await de({
|
|
451
465
|
title: l("article.leave-title"),
|
|
452
466
|
message: l("article.leave-text"),
|
|
453
467
|
confirmText: l("article.leave"),
|
|
454
468
|
cancelText: l("panel.cancel"),
|
|
455
469
|
tone: "danger"
|
|
456
470
|
}));
|
|
457
|
-
const
|
|
458
|
-
const
|
|
459
|
-
return B.value &&
|
|
471
|
+
const rt = h(() => {
|
|
472
|
+
const w = [];
|
|
473
|
+
return B.value && w.push({ key: "preview", label: l("article.preview"), icon: "eye", href: B.value }), m.value?.url && m.value.status !== "draft" && w.push({
|
|
460
474
|
key: "site",
|
|
461
475
|
label: l("panel.open-on-site"),
|
|
462
476
|
icon: "link",
|
|
463
477
|
href: m.value.url
|
|
464
|
-
}), m.value?.status === "modified" &&
|
|
478
|
+
}), m.value?.status === "modified" && w.push({
|
|
465
479
|
key: "discard",
|
|
466
480
|
label: l("article.discard"),
|
|
467
481
|
icon: "refresh",
|
|
468
482
|
danger: !0,
|
|
469
483
|
menu: !0,
|
|
470
484
|
run: () => {
|
|
471
|
-
|
|
485
|
+
q();
|
|
472
486
|
}
|
|
473
|
-
}),
|
|
487
|
+
}), w;
|
|
474
488
|
});
|
|
475
|
-
return (
|
|
489
|
+
return (w, L) => (x(), H("div", {
|
|
476
490
|
class: "wx-article-editor",
|
|
477
491
|
onFocusout: u
|
|
478
492
|
}, [
|
|
479
|
-
W.value || !m.value ? (x(),
|
|
480
|
-
r(e(
|
|
493
|
+
W.value || !m.value ? (x(), H(Te, { key: 0 }, [
|
|
494
|
+
r(e(Oe), {
|
|
481
495
|
class: "wx-article-editor__ghost",
|
|
482
496
|
title: "",
|
|
483
497
|
rows: 1
|
|
484
498
|
}),
|
|
485
|
-
r(e(
|
|
499
|
+
r(e(xt), null, {
|
|
486
500
|
default: i(() => [
|
|
487
|
-
r(e(
|
|
501
|
+
r(e(Oe), { rows: 8 })
|
|
488
502
|
]),
|
|
489
503
|
_: 1
|
|
490
504
|
})
|
|
491
|
-
], 64)) : (x(),
|
|
492
|
-
r(e(
|
|
505
|
+
], 64)) : (x(), H(Te, { key: 1 }, [
|
|
506
|
+
r(e(ct), {
|
|
493
507
|
divider: "",
|
|
494
|
-
back:
|
|
508
|
+
back: T.value,
|
|
495
509
|
"back-label": e(l)("module.articles"),
|
|
496
|
-
title:
|
|
497
|
-
subtitle:
|
|
498
|
-
actions:
|
|
510
|
+
title: xe.value || e(l)("article.untitled"),
|
|
511
|
+
subtitle: We.value,
|
|
512
|
+
actions: rt.value
|
|
499
513
|
}, {
|
|
500
514
|
trail: i(() => [
|
|
501
|
-
r(e(
|
|
515
|
+
r(e(_t), {
|
|
502
516
|
size: "sm",
|
|
503
517
|
label: e(l)("article.trail")
|
|
504
518
|
}, {
|
|
505
519
|
default: i(() => [
|
|
506
|
-
r(e(
|
|
520
|
+
r(e(Ze), {
|
|
507
521
|
as: "router-link",
|
|
508
|
-
to:
|
|
522
|
+
to: T.value
|
|
509
523
|
}, {
|
|
510
524
|
default: i(() => [
|
|
511
|
-
V(
|
|
525
|
+
V(k(e(l)("module.articles")), 1)
|
|
512
526
|
]),
|
|
513
527
|
_: 1
|
|
514
528
|
}, 8, ["to"]),
|
|
515
|
-
r(e(
|
|
529
|
+
r(e(Ze), { current: "" }, {
|
|
516
530
|
default: i(() => [
|
|
517
|
-
V(
|
|
531
|
+
V(k(xe.value || e(l)("article.untitled")), 1)
|
|
518
532
|
]),
|
|
519
533
|
_: 1
|
|
520
534
|
})
|
|
@@ -524,11 +538,11 @@ const Mt = { class: "wx-article-editor__screen" }, Ut = 1200, Nt = /* @__PURE__
|
|
|
524
538
|
]),
|
|
525
539
|
"title-after": i(() => [
|
|
526
540
|
r(e(ae), {
|
|
527
|
-
type:
|
|
541
|
+
type: ke(),
|
|
528
542
|
dot: ""
|
|
529
543
|
}, {
|
|
530
544
|
default: i(() => [
|
|
531
|
-
V(
|
|
545
|
+
V(k(e(l)(`panel.status-${m.value.status}`)), 1)
|
|
532
546
|
]),
|
|
533
547
|
_: 1
|
|
534
548
|
}, 8, ["type"]),
|
|
@@ -538,100 +552,100 @@ const Mt = { class: "wx-article-editor__screen" }, Ut = 1200, Nt = /* @__PURE__
|
|
|
538
552
|
round: ""
|
|
539
553
|
}, {
|
|
540
554
|
default: i(() => [
|
|
541
|
-
V(
|
|
555
|
+
V(k(e(l)("panel.edits")), 1)
|
|
542
556
|
]),
|
|
543
557
|
_: 1
|
|
544
|
-
})) :
|
|
558
|
+
})) : K("", !0)
|
|
545
559
|
]),
|
|
546
560
|
_: 1
|
|
547
561
|
}, 8, ["back", "back-label", "title", "subtitle", "actions"]),
|
|
548
|
-
P.value ? (x(), I(e(
|
|
562
|
+
P.value ? (x(), I(e(Ue), {
|
|
549
563
|
key: 0,
|
|
550
564
|
type: "warning",
|
|
551
565
|
title: e(l)("article.conflict-title"),
|
|
552
566
|
description: P.value.message
|
|
553
567
|
}, {
|
|
554
568
|
actions: i(() => [
|
|
555
|
-
r(e(
|
|
569
|
+
r(e(G), {
|
|
556
570
|
size: "sm",
|
|
557
571
|
variant: "outline",
|
|
558
|
-
onClick:
|
|
572
|
+
onClick: me
|
|
559
573
|
}, {
|
|
560
574
|
default: i(() => [
|
|
561
|
-
V(
|
|
575
|
+
V(k(e(l)("article.conflict-theirs")), 1)
|
|
562
576
|
]),
|
|
563
577
|
_: 1
|
|
564
578
|
}),
|
|
565
|
-
r(e(
|
|
579
|
+
r(e(G), {
|
|
566
580
|
size: "sm",
|
|
567
581
|
type: "primary",
|
|
568
|
-
onClick:
|
|
582
|
+
onClick: n
|
|
569
583
|
}, {
|
|
570
584
|
default: i(() => [
|
|
571
|
-
V(
|
|
585
|
+
V(k(e(l)("article.conflict-mine")), 1)
|
|
572
586
|
]),
|
|
573
587
|
_: 1
|
|
574
588
|
})
|
|
575
589
|
]),
|
|
576
590
|
_: 1
|
|
577
|
-
}, 8, ["title", "description"])) :
|
|
578
|
-
|
|
579
|
-
r(e(
|
|
591
|
+
}, 8, ["title", "description"])) : K("", !0),
|
|
592
|
+
F("div", Nt, [
|
|
593
|
+
r(e(dt), {
|
|
580
594
|
modelValue: A.value,
|
|
581
|
-
"onUpdate:modelValue":
|
|
595
|
+
"onUpdate:modelValue": L[0] || (L[0] = (j) => A.value = j),
|
|
582
596
|
name: "blog.article-form",
|
|
583
|
-
errors:
|
|
597
|
+
errors: $.value,
|
|
584
598
|
disabled: ne.value
|
|
585
599
|
}, null, 8, ["modelValue", "errors", "disabled"])
|
|
586
600
|
]),
|
|
587
|
-
Y.value ? (x(), I(e(
|
|
601
|
+
Y.value ? (x(), I(e(lt), { key: 1 }, {
|
|
588
602
|
state: i(() => [
|
|
589
|
-
r(e(
|
|
603
|
+
r(e(pt), { state: he.value }, null, 8, ["state"])
|
|
590
604
|
]),
|
|
591
605
|
default: i(() => [
|
|
592
|
-
r(e(
|
|
606
|
+
r(e(G), {
|
|
593
607
|
variant: "outline",
|
|
594
|
-
loading:
|
|
595
|
-
disabled: !
|
|
596
|
-
onClick:
|
|
608
|
+
loading: N.value,
|
|
609
|
+
disabled: !O.value,
|
|
610
|
+
onClick: _
|
|
597
611
|
}, {
|
|
598
612
|
default: i(() => [
|
|
599
|
-
V(
|
|
613
|
+
V(k(e(l)("article.save")), 1)
|
|
600
614
|
]),
|
|
601
615
|
_: 1
|
|
602
616
|
}, 8, ["loading", "disabled"]),
|
|
603
|
-
r(e(
|
|
617
|
+
r(e(G), {
|
|
604
618
|
type: "primary",
|
|
605
|
-
loading:
|
|
606
|
-
disabled: m.value.status === "published" && !
|
|
607
|
-
onClick:
|
|
619
|
+
loading: U.value,
|
|
620
|
+
disabled: m.value.status === "published" && !O.value,
|
|
621
|
+
onClick: d
|
|
608
622
|
}, {
|
|
609
623
|
default: i(() => [
|
|
610
|
-
V(
|
|
624
|
+
V(k(fe.value ? e(l)("article.schedule") : e(l)("panel.publish")), 1)
|
|
611
625
|
]),
|
|
612
626
|
_: 1
|
|
613
627
|
}, 8, ["loading", "disabled"])
|
|
614
628
|
]),
|
|
615
629
|
_: 1
|
|
616
|
-
})) :
|
|
630
|
+
})) : K("", !0)
|
|
617
631
|
], 64))
|
|
618
632
|
], 32));
|
|
619
633
|
}
|
|
620
|
-
}),
|
|
634
|
+
}), ge = (v, c) => {
|
|
621
635
|
const p = v.__vccOpts || v;
|
|
622
636
|
for (const [g, a] of c)
|
|
623
637
|
p[g] = a;
|
|
624
638
|
return p;
|
|
625
|
-
},
|
|
639
|
+
}, Pt = /* @__PURE__ */ ge(It, [["__scopeId", "data-v-c8b3304e"]]), Rt = { class: "wx-article-history" }, Dt = { class: "wx-article-history__number" }, Bt = { class: "wx-article-history__who" }, Et = /* @__PURE__ */ Q({
|
|
626
640
|
name: "WxArticleHistory",
|
|
627
641
|
__name: "ArticleHistory",
|
|
628
642
|
setup(v) {
|
|
629
|
-
const c = le(), p =
|
|
643
|
+
const c = le(), p = oe(c), g = Se();
|
|
630
644
|
X();
|
|
631
|
-
const a =
|
|
645
|
+
const a = Z("webx-blog"), s = we(), t = M(null), o = M(!1), l = h(() => g?.article.value ?? null), b = h(() => c.can("blog.articles.manage")), f = h(
|
|
632
646
|
() => l.value?.status === "published" || l.value?.status === "modified" ? t.value?.[0]?.number ?? null : null
|
|
633
647
|
);
|
|
634
|
-
async function
|
|
648
|
+
async function T() {
|
|
635
649
|
const A = l.value;
|
|
636
650
|
if (A)
|
|
637
651
|
try {
|
|
@@ -642,7 +656,7 @@ const Mt = { class: "wx-article-editor__screen" }, Ut = 1200, Nt = /* @__PURE__
|
|
|
642
656
|
}
|
|
643
657
|
async function m(A) {
|
|
644
658
|
const z = l.value;
|
|
645
|
-
if (!(!z || !await
|
|
659
|
+
if (!(!z || !await de({
|
|
646
660
|
title: a("article.restore-title", { number: A.number }),
|
|
647
661
|
message: a("article.restore-text"),
|
|
648
662
|
confirmText: a("article.restore-version"),
|
|
@@ -658,41 +672,41 @@ const Mt = { class: "wx-article-editor__screen" }, Ut = 1200, Nt = /* @__PURE__
|
|
|
658
672
|
}
|
|
659
673
|
}
|
|
660
674
|
}
|
|
661
|
-
return
|
|
675
|
+
return ve(
|
|
662
676
|
() => [l.value?.id, l.value?.published_at, l.value?.updated_at],
|
|
663
677
|
() => {
|
|
664
|
-
|
|
678
|
+
T();
|
|
665
679
|
},
|
|
666
680
|
{ immediate: !0 }
|
|
667
|
-
), (A, z) => (x(),
|
|
668
|
-
t.value === null ? (x(), I(e(
|
|
681
|
+
), (A, z) => (x(), H("div", Rt, [
|
|
682
|
+
t.value === null ? (x(), I(e(Oe), {
|
|
669
683
|
key: 0,
|
|
670
684
|
class: "wx-article-history__ghost",
|
|
671
685
|
rows: 3
|
|
672
|
-
})) : t.value.length === 0 ? (x(), I(e(
|
|
686
|
+
})) : t.value.length === 0 ? (x(), I(e(kt), {
|
|
673
687
|
key: 1,
|
|
674
688
|
description: e(a)("article.history-empty")
|
|
675
|
-
}, null, 8, ["description"])) : (x(!0),
|
|
689
|
+
}, null, 8, ["description"])) : (x(!0), H(Te, { key: 2 }, qe(t.value, (S) => (x(), H("div", {
|
|
676
690
|
key: S.number,
|
|
677
|
-
class:
|
|
691
|
+
class: tt(["wx-article-history__row", { "is-live": S.number === f.value }])
|
|
678
692
|
}, [
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
S.created_at ? (x(), I(e(
|
|
693
|
+
F("code", Dt, k(e(a)("article.version", { number: S.number })), 1),
|
|
694
|
+
F("div", Bt, [
|
|
695
|
+
S.created_at ? (x(), I(e(Ee), {
|
|
682
696
|
key: 0,
|
|
683
697
|
value: S.created_at,
|
|
684
698
|
size: "md",
|
|
685
699
|
tone: "default"
|
|
686
|
-
}, null, 8, ["value"])) :
|
|
700
|
+
}, null, 8, ["value"])) : K("", !0),
|
|
687
701
|
r(e(te), {
|
|
688
702
|
size: "sm",
|
|
689
703
|
tone: "muted"
|
|
690
704
|
}, {
|
|
691
705
|
default: i(() => [
|
|
692
|
-
V(
|
|
693
|
-
S.comment ? (x(),
|
|
694
|
-
V(" · " +
|
|
695
|
-
], 64)) :
|
|
706
|
+
V(k(S.author ?? e(a)(`article.source-${S.source}`)) + " ", 1),
|
|
707
|
+
S.comment ? (x(), H(Te, { key: 0 }, [
|
|
708
|
+
V(" · " + k(S.comment), 1)
|
|
709
|
+
], 64)) : K("", !0)
|
|
696
710
|
]),
|
|
697
711
|
_: 2
|
|
698
712
|
}, 1024)
|
|
@@ -703,11 +717,11 @@ const Mt = { class: "wx-article-editor__screen" }, Ut = 1200, Nt = /* @__PURE__
|
|
|
703
717
|
dot: ""
|
|
704
718
|
}, {
|
|
705
719
|
default: i(() => [
|
|
706
|
-
V(
|
|
720
|
+
V(k(e(a)("article.version-live")), 1)
|
|
707
721
|
]),
|
|
708
722
|
_: 1
|
|
709
|
-
})) :
|
|
710
|
-
|
|
723
|
+
})) : K("", !0),
|
|
724
|
+
b.value && S.number !== f.value ? (x(), I(e(G), {
|
|
711
725
|
key: 1,
|
|
712
726
|
size: "sm",
|
|
713
727
|
variant: "outline",
|
|
@@ -715,17 +729,17 @@ const Mt = { class: "wx-article-editor__screen" }, Ut = 1200, Nt = /* @__PURE__
|
|
|
715
729
|
onClick: (B) => m(S)
|
|
716
730
|
}, {
|
|
717
731
|
default: i(() => [
|
|
718
|
-
V(
|
|
732
|
+
V(k(e(a)("article.restore-version")), 1)
|
|
719
733
|
]),
|
|
720
734
|
_: 1
|
|
721
|
-
}, 8, ["loading", "onClick"])) :
|
|
735
|
+
}, 8, ["loading", "onClick"])) : K("", !0)
|
|
722
736
|
], 2))), 128))
|
|
723
737
|
]));
|
|
724
738
|
}
|
|
725
|
-
}),
|
|
739
|
+
}), Ot = /* @__PURE__ */ ge(Et, [["__scopeId", "data-v-0a997938"]]), Lt = { class: "wx-article-related" }, Ft = { class: "wx-article-related__name" }, Kt = 250, Ht = 10, Gt = /* @__PURE__ */ Q({
|
|
726
740
|
name: "WxArticleRelated",
|
|
727
741
|
__name: "ArticleRelated",
|
|
728
|
-
props: /* @__PURE__ */
|
|
742
|
+
props: /* @__PURE__ */ Fe({
|
|
729
743
|
disabled: { type: Boolean, default: !1 }
|
|
730
744
|
}, {
|
|
731
745
|
modelValue: { default: () => [] },
|
|
@@ -733,60 +747,60 @@ const Mt = { class: "wx-article-editor__screen" }, Ut = 1200, Nt = /* @__PURE__
|
|
|
733
747
|
}),
|
|
734
748
|
emits: ["update:modelValue"],
|
|
735
749
|
setup(v) {
|
|
736
|
-
const c = v, p =
|
|
750
|
+
const c = v, p = Le(v, "modelValue"), g = le(), a = oe(g), s = Se();
|
|
737
751
|
X();
|
|
738
|
-
const t =
|
|
739
|
-
let
|
|
740
|
-
|
|
752
|
+
const t = Z("webx-blog"), o = we(), l = h(() => c.disabled || s?.disabled.value === !0), b = M(/* @__PURE__ */ new Map()), f = M([]);
|
|
753
|
+
let T;
|
|
754
|
+
ve(
|
|
741
755
|
() => s?.related.value,
|
|
742
|
-
(
|
|
743
|
-
const W = new Map(
|
|
744
|
-
for (const
|
|
745
|
-
|
|
756
|
+
(y) => {
|
|
757
|
+
const W = new Map(b.value);
|
|
758
|
+
for (const N of y ?? []) W.set(N.id, N.title);
|
|
759
|
+
b.value = W;
|
|
746
760
|
},
|
|
747
761
|
{ immediate: !0, deep: !0 }
|
|
748
762
|
);
|
|
749
763
|
const m = h({
|
|
750
|
-
get: () => p.value.map((
|
|
751
|
-
set: (
|
|
752
|
-
p.value =
|
|
764
|
+
get: () => p.value.map((y) => ({ id: y, title: b.value.get(y) ?? `#${y}` })),
|
|
765
|
+
set: (y) => {
|
|
766
|
+
p.value = y.map((W) => W.id);
|
|
753
767
|
}
|
|
754
768
|
}), A = h(
|
|
755
|
-
() => f.value.filter((
|
|
769
|
+
() => f.value.filter((y) => !p.value.includes(y.id)).map((y) => ({ label: y.title, value: y.id }))
|
|
756
770
|
);
|
|
757
|
-
async function z(
|
|
771
|
+
async function z(y) {
|
|
758
772
|
const W = s?.article.value?.id;
|
|
759
773
|
try {
|
|
760
|
-
const
|
|
761
|
-
f.value =
|
|
762
|
-
const
|
|
763
|
-
for (const
|
|
764
|
-
|
|
765
|
-
} catch (
|
|
766
|
-
D.danger(o(
|
|
774
|
+
const N = await a.articles({ q: y, per_page: Ht });
|
|
775
|
+
f.value = N.data.filter(($) => $.id !== W).map(($) => ({ id: $.id, title: $.title }));
|
|
776
|
+
const U = new Map(b.value);
|
|
777
|
+
for (const $ of f.value) U.set($.id, $.title);
|
|
778
|
+
b.value = U;
|
|
779
|
+
} catch (N) {
|
|
780
|
+
D.danger(o(N));
|
|
767
781
|
}
|
|
768
782
|
}
|
|
769
|
-
function S(
|
|
770
|
-
clearTimeout(
|
|
771
|
-
z(
|
|
772
|
-
},
|
|
783
|
+
function S(y) {
|
|
784
|
+
clearTimeout(T), T = setTimeout(() => {
|
|
785
|
+
z(y);
|
|
786
|
+
}, Kt);
|
|
773
787
|
}
|
|
774
|
-
function B(
|
|
775
|
-
typeof
|
|
788
|
+
function B(y) {
|
|
789
|
+
typeof y != "number" || p.value.includes(y) || (p.value = [...p.value, y]);
|
|
776
790
|
}
|
|
777
|
-
function R(
|
|
778
|
-
p.value = p.value.filter((W) => W !==
|
|
791
|
+
function R(y) {
|
|
792
|
+
p.value = p.value.filter((W) => W !== y);
|
|
779
793
|
}
|
|
780
|
-
return
|
|
794
|
+
return ve(
|
|
781
795
|
() => s?.article.value?.id,
|
|
782
796
|
() => {
|
|
783
797
|
z("");
|
|
784
798
|
},
|
|
785
799
|
{ immediate: !0 }
|
|
786
|
-
),
|
|
787
|
-
r(e(
|
|
800
|
+
), Ke(() => clearTimeout(T)), (y, W) => (x(), H("div", Lt, [
|
|
801
|
+
r(e($t), {
|
|
788
802
|
modelValue: m.value,
|
|
789
|
-
"onUpdate:modelValue": W[0] || (W[0] = (
|
|
803
|
+
"onUpdate:modelValue": W[0] || (W[0] = (N) => m.value = N),
|
|
790
804
|
plain: "",
|
|
791
805
|
size: "sm",
|
|
792
806
|
"item-key": "id",
|
|
@@ -795,21 +809,21 @@ const Mt = { class: "wx-article-editor__screen" }, Ut = 1200, Nt = /* @__PURE__
|
|
|
795
809
|
"empty-text": e(t)("article.related-empty"),
|
|
796
810
|
"aria-label": e(t)("article.related")
|
|
797
811
|
}, {
|
|
798
|
-
default: i(({ item:
|
|
799
|
-
|
|
812
|
+
default: i(({ item: N }) => [
|
|
813
|
+
F("span", Ft, k(N.title), 1)
|
|
800
814
|
]),
|
|
801
|
-
actions: i(({ item:
|
|
802
|
-
r(e(
|
|
815
|
+
actions: i(({ item: N }) => [
|
|
816
|
+
r(e(Tt), {
|
|
803
817
|
type: "remove",
|
|
804
818
|
size: "sm",
|
|
805
819
|
disabled: l.value,
|
|
806
820
|
title: e(t)("article.related-remove"),
|
|
807
|
-
onClick: (
|
|
821
|
+
onClick: (U) => R(N.id)
|
|
808
822
|
}, null, 8, ["disabled", "title", "onClick"])
|
|
809
823
|
]),
|
|
810
824
|
_: 1
|
|
811
825
|
}, 8, ["modelValue", "disabled", "empty-text", "aria-label"]),
|
|
812
|
-
r(e(
|
|
826
|
+
r(e($e), {
|
|
813
827
|
"model-value": null,
|
|
814
828
|
options: A.value,
|
|
815
829
|
placeholder: e(t)("article.related-add"),
|
|
@@ -823,14 +837,14 @@ const Mt = { class: "wx-article-editor__screen" }, Ut = 1200, Nt = /* @__PURE__
|
|
|
823
837
|
}, null, 8, ["options", "placeholder", "empty-text", "disabled", "aria-label"])
|
|
824
838
|
]));
|
|
825
839
|
}
|
|
826
|
-
}),
|
|
840
|
+
}), jt = /* @__PURE__ */ ge(Gt, [["__scopeId", "data-v-164e86fe"]]), Jt = { class: "wx-article-slug" }, Zt = { class: "wx-article-slug__prefix" }, Qt = /* @__PURE__ */ Q({
|
|
827
841
|
name: "WxArticleSlug",
|
|
828
842
|
inheritAttrs: !1,
|
|
829
843
|
__name: "ArticleSlug",
|
|
830
844
|
setup(v) {
|
|
831
|
-
const c =
|
|
845
|
+
const c = Se(), p = at();
|
|
832
846
|
X();
|
|
833
|
-
const g =
|
|
847
|
+
const g = Z("webx-blog"), a = h(() => {
|
|
834
848
|
const o = c?.prefix.value ?? "";
|
|
835
849
|
return o === "" ? "/" : `/${o}/`;
|
|
836
850
|
}), s = h(() => {
|
|
@@ -840,28 +854,28 @@ const Mt = { class: "wx-article-editor__screen" }, Ut = 1200, Nt = /* @__PURE__
|
|
|
840
854
|
const o = c?.article.value?.path;
|
|
841
855
|
return typeof o == "string" && s.value !== "" && `${a.value}${s.value}` != `/${o}`;
|
|
842
856
|
});
|
|
843
|
-
return (o, l) => (x(),
|
|
844
|
-
r(e(
|
|
857
|
+
return (o, l) => (x(), H("div", Jt, [
|
|
858
|
+
r(e(Ce), mt(bt(o.$attrs)), {
|
|
845
859
|
prefix: i(() => [
|
|
846
|
-
|
|
860
|
+
F("span", Zt, k(a.value), 1)
|
|
847
861
|
]),
|
|
848
862
|
_: 1
|
|
849
863
|
}, 16),
|
|
850
|
-
t.value ? (x(), I(e(
|
|
864
|
+
t.value ? (x(), I(e(Ue), {
|
|
851
865
|
key: 0,
|
|
852
866
|
type: "info",
|
|
853
867
|
variant: "soft",
|
|
854
868
|
description: e(g)("article.address-moving")
|
|
855
|
-
}, null, 8, ["description"])) :
|
|
869
|
+
}, null, 8, ["description"])) : K("", !0)
|
|
856
870
|
]));
|
|
857
871
|
}
|
|
858
|
-
}),
|
|
872
|
+
}), Xt = /* @__PURE__ */ ge(Qt, [["__scopeId", "data-v-5da20e5e"]]), Yt = { class: "wx-article-tags" }, ea = {
|
|
859
873
|
key: 0,
|
|
860
874
|
class: "wx-article-tags__chips"
|
|
861
|
-
},
|
|
875
|
+
}, ta = { class: "wx-article-tags__pick" }, aa = 250, la = /* @__PURE__ */ Q({
|
|
862
876
|
name: "WxArticleTags",
|
|
863
877
|
__name: "ArticleTags",
|
|
864
|
-
props: /* @__PURE__ */
|
|
878
|
+
props: /* @__PURE__ */ Fe({
|
|
865
879
|
disabled: { type: Boolean, default: !1 }
|
|
866
880
|
}, {
|
|
867
881
|
modelValue: { default: () => [] },
|
|
@@ -869,62 +883,62 @@ const Mt = { class: "wx-article-editor__screen" }, Ut = 1200, Nt = /* @__PURE__
|
|
|
869
883
|
}),
|
|
870
884
|
emits: ["update:modelValue"],
|
|
871
885
|
setup(v) {
|
|
872
|
-
const c = v, p =
|
|
886
|
+
const c = v, p = Le(v, "modelValue"), g = le(), a = oe(g), s = Se();
|
|
873
887
|
X();
|
|
874
|
-
const t =
|
|
888
|
+
const t = Z("webx-blog"), o = we(), l = h(() => c.disabled || s?.disabled.value === !0), b = M(/* @__PURE__ */ new Map()), f = M([]), T = M(""), m = M(!1);
|
|
875
889
|
let A;
|
|
876
|
-
|
|
890
|
+
ve(
|
|
877
891
|
() => s?.article.value?.tags,
|
|
878
|
-
(
|
|
879
|
-
const P = new Map(
|
|
880
|
-
for (const E of
|
|
881
|
-
|
|
892
|
+
($) => {
|
|
893
|
+
const P = new Map(b.value);
|
|
894
|
+
for (const E of $ ?? []) P.set(E.id, E.title);
|
|
895
|
+
b.value = P;
|
|
882
896
|
},
|
|
883
897
|
{ immediate: !0, deep: !0 }
|
|
884
898
|
);
|
|
885
899
|
const z = h(
|
|
886
|
-
() => p.value.map((
|
|
900
|
+
() => p.value.map(($) => ({ id: $, title: b.value.get($) ?? `#${$}` }))
|
|
887
901
|
), S = h(
|
|
888
|
-
() => f.value.filter((
|
|
902
|
+
() => f.value.filter(($) => !p.value.includes($.id)).map(($) => ({
|
|
889
903
|
// The count is part of the label rather than a column: a select draws a line of text, and
|
|
890
904
|
// the number is what the reader is choosing between two near-identical words on.
|
|
891
|
-
label: t("article.tag-option", { title:
|
|
892
|
-
value:
|
|
905
|
+
label: t("article.tag-option", { title: $.title, count: $.articles_count }),
|
|
906
|
+
value: $.id
|
|
893
907
|
}))
|
|
894
908
|
), B = h(() => {
|
|
895
|
-
const
|
|
896
|
-
if (
|
|
897
|
-
const P = (E) => E.toLowerCase() ===
|
|
898
|
-
return f.value.some((E) => P(E.title)) ? null :
|
|
909
|
+
const $ = T.value.trim();
|
|
910
|
+
if ($ === "") return null;
|
|
911
|
+
const P = (E) => E.toLowerCase() === $.toLowerCase();
|
|
912
|
+
return f.value.some((E) => P(E.title)) ? null : $;
|
|
899
913
|
});
|
|
900
914
|
async function R() {
|
|
901
915
|
try {
|
|
902
|
-
f.value = await a.tags(
|
|
903
|
-
const
|
|
904
|
-
for (const P of f.value)
|
|
905
|
-
|
|
906
|
-
} catch (
|
|
907
|
-
D.danger(o(
|
|
916
|
+
f.value = await a.tags(T.value);
|
|
917
|
+
const $ = new Map(b.value);
|
|
918
|
+
for (const P of f.value) $.set(P.id, P.title);
|
|
919
|
+
b.value = $;
|
|
920
|
+
} catch ($) {
|
|
921
|
+
D.danger(o($));
|
|
908
922
|
}
|
|
909
923
|
}
|
|
910
|
-
function
|
|
911
|
-
|
|
924
|
+
function y($) {
|
|
925
|
+
T.value = $, clearTimeout(A), A = setTimeout(() => {
|
|
912
926
|
R();
|
|
913
|
-
},
|
|
927
|
+
}, aa);
|
|
914
928
|
}
|
|
915
|
-
function W(
|
|
916
|
-
typeof
|
|
929
|
+
function W($) {
|
|
930
|
+
typeof $ != "number" || p.value.includes($) || (p.value = [...p.value, $], T.value = "");
|
|
917
931
|
}
|
|
918
|
-
function
|
|
919
|
-
p.value = p.value.filter((P) => P !==
|
|
932
|
+
function N($) {
|
|
933
|
+
p.value = p.value.filter((P) => P !== $);
|
|
920
934
|
}
|
|
921
|
-
async function
|
|
922
|
-
const
|
|
923
|
-
if (!(
|
|
935
|
+
async function U() {
|
|
936
|
+
const $ = B.value;
|
|
937
|
+
if (!($ === null || m.value)) {
|
|
924
938
|
m.value = !0;
|
|
925
939
|
try {
|
|
926
|
-
const P = await a.createTag({ title:
|
|
927
|
-
|
|
940
|
+
const P = await a.createTag({ title: $ });
|
|
941
|
+
b.value = new Map(b.value).set(P.id, P.title), f.value = [P, ...f.value], W(P.id);
|
|
928
942
|
} catch (P) {
|
|
929
943
|
D.danger(o(P));
|
|
930
944
|
} finally {
|
|
@@ -932,23 +946,23 @@ const Mt = { class: "wx-article-editor__screen" }, Ut = 1200, Nt = /* @__PURE__
|
|
|
932
946
|
}
|
|
933
947
|
}
|
|
934
948
|
}
|
|
935
|
-
return
|
|
949
|
+
return ve(
|
|
936
950
|
() => s?.article.value?.id,
|
|
937
951
|
() => {
|
|
938
952
|
R();
|
|
939
953
|
},
|
|
940
954
|
{ immediate: !0 }
|
|
941
|
-
),
|
|
942
|
-
z.value.length > 0 ? (x(),
|
|
943
|
-
(x(!0),
|
|
955
|
+
), Ke(() => clearTimeout(A)), ($, P) => (x(), H("div", Yt, [
|
|
956
|
+
z.value.length > 0 ? (x(), H("div", ea, [
|
|
957
|
+
(x(!0), H(Te, null, qe(z.value, (E) => (x(), I(e(ae), {
|
|
944
958
|
key: E.id,
|
|
945
959
|
type: "default",
|
|
946
960
|
closable: !l.value,
|
|
947
961
|
"close-label": e(t)("article.tag-remove"),
|
|
948
|
-
onClose: (ie) =>
|
|
962
|
+
onClose: (ie) => N(E.id)
|
|
949
963
|
}, {
|
|
950
964
|
default: i(() => [
|
|
951
|
-
V(
|
|
965
|
+
V(k(E.title), 1)
|
|
952
966
|
]),
|
|
953
967
|
_: 2
|
|
954
968
|
}, 1032, ["closable", "close-label", "onClose"]))), 128))
|
|
@@ -958,12 +972,12 @@ const Mt = { class: "wx-article-editor__screen" }, Ut = 1200, Nt = /* @__PURE__
|
|
|
958
972
|
tone: "muted"
|
|
959
973
|
}, {
|
|
960
974
|
default: i(() => [
|
|
961
|
-
V(
|
|
975
|
+
V(k(e(t)("article.tags-empty")), 1)
|
|
962
976
|
]),
|
|
963
977
|
_: 1
|
|
964
978
|
})),
|
|
965
|
-
|
|
966
|
-
r(e(
|
|
979
|
+
F("div", ta, [
|
|
980
|
+
r(e($e), {
|
|
967
981
|
"model-value": null,
|
|
968
982
|
options: S.value,
|
|
969
983
|
placeholder: e(t)("article.tag-add"),
|
|
@@ -972,38 +986,38 @@ const Mt = { class: "wx-article-editor__screen" }, Ut = 1200, Nt = /* @__PURE__
|
|
|
972
986
|
filterable: "",
|
|
973
987
|
teleport: "",
|
|
974
988
|
"aria-label": e(t)("article.tag-add"),
|
|
975
|
-
onSearch:
|
|
989
|
+
onSearch: y,
|
|
976
990
|
"onUpdate:modelValue": W
|
|
977
991
|
}, null, 8, ["options", "placeholder", "empty-text", "disabled", "aria-label"]),
|
|
978
|
-
B.value ? (x(), I(e(
|
|
992
|
+
B.value ? (x(), I(e(G), {
|
|
979
993
|
key: 0,
|
|
980
994
|
variant: "outline",
|
|
981
995
|
icon: "plus",
|
|
982
996
|
loading: m.value,
|
|
983
997
|
disabled: l.value,
|
|
984
|
-
onClick:
|
|
998
|
+
onClick: U
|
|
985
999
|
}, {
|
|
986
1000
|
default: i(() => [
|
|
987
|
-
V(
|
|
1001
|
+
V(k(e(t)("article.tag-create", { title: B.value })), 1)
|
|
988
1002
|
]),
|
|
989
1003
|
_: 1
|
|
990
|
-
}, 8, ["loading", "disabled"])) :
|
|
1004
|
+
}, 8, ["loading", "disabled"])) : K("", !0)
|
|
991
1005
|
])
|
|
992
1006
|
]));
|
|
993
1007
|
}
|
|
994
|
-
}),
|
|
1008
|
+
}), ia = /* @__PURE__ */ ge(la, [["__scopeId", "data-v-faf5adec"]]), na = /* @__PURE__ */ Q({
|
|
995
1009
|
name: "WxArticleUnpublish",
|
|
996
1010
|
__name: "ArticleUnpublish",
|
|
997
1011
|
setup(v) {
|
|
998
|
-
const c = le(), p =
|
|
1012
|
+
const c = le(), p = oe(c), g = Se();
|
|
999
1013
|
X();
|
|
1000
|
-
const a =
|
|
1014
|
+
const a = Z("webx-blog"), s = we(), t = M(!1), o = h(() => {
|
|
1001
1015
|
const f = g?.article.value?.status;
|
|
1002
1016
|
return f === "published" || f === "modified" || f === "scheduled";
|
|
1003
1017
|
}), l = h(() => g?.disabled.value === !0 || t.value);
|
|
1004
|
-
async function
|
|
1018
|
+
async function b() {
|
|
1005
1019
|
const f = g?.article.value;
|
|
1006
|
-
if (!(!f || !await
|
|
1020
|
+
if (!(!f || !await de({
|
|
1007
1021
|
title: a("article.unpublish-title", { title: f.title }),
|
|
1008
1022
|
message: f.status === "scheduled" ? a("article.unpublish-waiting") : a("article.unpublish-text"),
|
|
1009
1023
|
confirmText: a("panel.unpublish"),
|
|
@@ -1020,76 +1034,76 @@ const Mt = { class: "wx-article-editor__screen" }, Ut = 1200, Nt = /* @__PURE__
|
|
|
1020
1034
|
}
|
|
1021
1035
|
}
|
|
1022
1036
|
}
|
|
1023
|
-
return (f,
|
|
1037
|
+
return (f, T) => o.value && e(g)?.canManage ? (x(), I(e(pe), {
|
|
1024
1038
|
key: 0,
|
|
1025
1039
|
class: "wx-article-unpublish",
|
|
1026
1040
|
help: e(a)("article.unpublish-help")
|
|
1027
1041
|
}, {
|
|
1028
1042
|
default: i(() => [
|
|
1029
|
-
r(e(
|
|
1043
|
+
r(e(G), {
|
|
1030
1044
|
variant: "outline",
|
|
1031
1045
|
type: "danger",
|
|
1032
1046
|
icon: "eye-off",
|
|
1033
1047
|
loading: t.value,
|
|
1034
1048
|
disabled: l.value,
|
|
1035
|
-
onClick:
|
|
1049
|
+
onClick: b
|
|
1036
1050
|
}, {
|
|
1037
1051
|
default: i(() => [
|
|
1038
|
-
V(
|
|
1052
|
+
V(k(e(a)("panel.unpublish")), 1)
|
|
1039
1053
|
]),
|
|
1040
1054
|
_: 1
|
|
1041
1055
|
}, 8, ["loading", "disabled"])
|
|
1042
1056
|
]),
|
|
1043
1057
|
_: 1
|
|
1044
|
-
}, 8, ["help"])) :
|
|
1058
|
+
}, 8, ["help"])) : K("", !0);
|
|
1045
1059
|
}
|
|
1046
|
-
}),
|
|
1060
|
+
}), sa = /* @__PURE__ */ ge(na, [["__scopeId", "data-v-c311cff2"]]), ra = /* @__PURE__ */ Q({
|
|
1047
1061
|
__name: "ArticleCreateDialog",
|
|
1048
1062
|
setup(v) {
|
|
1049
|
-
const { open: c, resolve: p, dismiss: g } =
|
|
1063
|
+
const { open: c, resolve: p, dismiss: g } = Re(), a = le(), s = oe(a);
|
|
1050
1064
|
X();
|
|
1051
|
-
const t =
|
|
1052
|
-
|
|
1053
|
-
await
|
|
1065
|
+
const t = Z("webx-blog"), o = M(""), l = M(!1), b = M({}), f = Ie("field");
|
|
1066
|
+
Ne(async () => {
|
|
1067
|
+
await He(), f.value?.querySelector("input")?.focus();
|
|
1054
1068
|
});
|
|
1055
|
-
async function
|
|
1069
|
+
async function T() {
|
|
1056
1070
|
if (!(o.value.trim() === "" || l.value)) {
|
|
1057
|
-
l.value = !0,
|
|
1071
|
+
l.value = !0, b.value = {};
|
|
1058
1072
|
try {
|
|
1059
1073
|
p(await s.create({ title: o.value.trim() }));
|
|
1060
1074
|
} catch (m) {
|
|
1061
|
-
|
|
1075
|
+
b.value = m.body?.errors ?? {};
|
|
1062
1076
|
} finally {
|
|
1063
1077
|
l.value = !1;
|
|
1064
1078
|
}
|
|
1065
1079
|
}
|
|
1066
1080
|
}
|
|
1067
|
-
return (m, A) => (x(), I(e(
|
|
1081
|
+
return (m, A) => (x(), I(e(De), {
|
|
1068
1082
|
open: e(c),
|
|
1069
|
-
"onUpdate:open": A[2] || (A[2] = (z) =>
|
|
1083
|
+
"onUpdate:open": A[2] || (A[2] = (z) => Pe(c) ? c.value = z : null),
|
|
1070
1084
|
title: e(t)("panel.new-title"),
|
|
1071
1085
|
width: 440
|
|
1072
1086
|
}, {
|
|
1073
1087
|
footer: i(() => [
|
|
1074
|
-
r(e(
|
|
1088
|
+
r(e(Be), { size: "sm" }, {
|
|
1075
1089
|
default: i(() => [
|
|
1076
|
-
r(e(
|
|
1090
|
+
r(e(G), {
|
|
1077
1091
|
variant: "outline",
|
|
1078
1092
|
onClick: A[1] || (A[1] = (z) => e(g)())
|
|
1079
1093
|
}, {
|
|
1080
1094
|
default: i(() => [
|
|
1081
|
-
V(
|
|
1095
|
+
V(k(e(t)("panel.cancel")), 1)
|
|
1082
1096
|
]),
|
|
1083
1097
|
_: 1
|
|
1084
1098
|
}),
|
|
1085
|
-
r(e(
|
|
1099
|
+
r(e(G), {
|
|
1086
1100
|
type: "primary",
|
|
1087
1101
|
loading: l.value,
|
|
1088
1102
|
disabled: o.value.trim() === "",
|
|
1089
|
-
onClick:
|
|
1103
|
+
onClick: T
|
|
1090
1104
|
}, {
|
|
1091
1105
|
default: i(() => [
|
|
1092
|
-
V(
|
|
1106
|
+
V(k(e(t)("panel.create")), 1)
|
|
1093
1107
|
]),
|
|
1094
1108
|
_: 1
|
|
1095
1109
|
}, 8, ["loading", "disabled"])
|
|
@@ -1098,21 +1112,21 @@ const Mt = { class: "wx-article-editor__screen" }, Ut = 1200, Nt = /* @__PURE__
|
|
|
1098
1112
|
})
|
|
1099
1113
|
]),
|
|
1100
1114
|
default: i(() => [
|
|
1101
|
-
r(e(
|
|
1115
|
+
r(e(pe), {
|
|
1102
1116
|
label: e(t)("panel.field-title"),
|
|
1103
|
-
error:
|
|
1117
|
+
error: b.value.title?.[0] ?? b.value.slug?.[0],
|
|
1104
1118
|
required: ""
|
|
1105
1119
|
}, {
|
|
1106
1120
|
default: i(() => [
|
|
1107
|
-
|
|
1121
|
+
F("div", {
|
|
1108
1122
|
ref_key: "field",
|
|
1109
1123
|
ref: f
|
|
1110
1124
|
}, [
|
|
1111
|
-
r(e(
|
|
1125
|
+
r(e(Ce), {
|
|
1112
1126
|
modelValue: o.value,
|
|
1113
1127
|
"onUpdate:modelValue": A[0] || (A[0] = (z) => o.value = z),
|
|
1114
1128
|
"aria-label": e(t)("panel.field-title"),
|
|
1115
|
-
onKeyup:
|
|
1129
|
+
onKeyup: Me(T, ["enter"])
|
|
1116
1130
|
}, null, 8, ["modelValue", "aria-label"])
|
|
1117
1131
|
], 512)
|
|
1118
1132
|
]),
|
|
@@ -1122,15 +1136,15 @@ const Mt = { class: "wx-article-editor__screen" }, Ut = 1200, Nt = /* @__PURE__
|
|
|
1122
1136
|
_: 1
|
|
1123
1137
|
}, 8, ["open", "title"]));
|
|
1124
1138
|
}
|
|
1125
|
-
}),
|
|
1139
|
+
}), oa = ["src"], ua = { class: "wx-articles__name" }, ca = { class: "wx-articles__name-text" }, da = { class: "wx-articles__title" }, pa = { class: "wx-articles__address" }, va = { class: "wx-articles__chips" }, ga = { class: "wx-articles__state" }, Xe = 640, ha = /* @__PURE__ */ Q({
|
|
1126
1140
|
__name: "ArticlesPage",
|
|
1127
1141
|
props: {
|
|
1128
1142
|
base: { default: "/blog" }
|
|
1129
1143
|
},
|
|
1130
1144
|
setup(v) {
|
|
1131
|
-
const c = v, p = le(), g =
|
|
1145
|
+
const c = v, p = le(), g = oe(p), a = Ge(), s = je();
|
|
1132
1146
|
X();
|
|
1133
|
-
const t =
|
|
1147
|
+
const t = Z("webx-blog"), o = Z("webx-admin"), l = we(), b = Ie("root"), f = At(b), T = M(null), m = M(!0), A = Ve(ra), z = h(() => p.can("blog.articles.manage")), S = h(
|
|
1134
1148
|
() => p.state.manifest?.modules.find((n) => n.id === "articles")?.title ?? t("module.articles")
|
|
1135
1149
|
), B = h({
|
|
1136
1150
|
get: () => typeof a.query.view == "string" ? a.query.view : "",
|
|
@@ -1139,7 +1153,7 @@ const Mt = { class: "wx-article-editor__screen" }, Ut = 1200, Nt = /* @__PURE__
|
|
|
1139
1153
|
query: { ...a.query, view: n === "" ? void 0 : String(n), page: void 0 }
|
|
1140
1154
|
});
|
|
1141
1155
|
}
|
|
1142
|
-
}), R = h(() => B.value === "trashed"),
|
|
1156
|
+
}), R = h(() => B.value === "trashed"), y = h(() => ({
|
|
1143
1157
|
q: typeof a.query.q == "string" ? a.query.q : "",
|
|
1144
1158
|
rubric: W(a.query.rubric),
|
|
1145
1159
|
tag: W(a.query.tag),
|
|
@@ -1150,14 +1164,14 @@ const Mt = { class: "wx-article-editor__screen" }, Ut = 1200, Nt = /* @__PURE__
|
|
|
1150
1164
|
function W(n) {
|
|
1151
1165
|
return typeof n == "string" && n !== "" && Number(n) || null;
|
|
1152
1166
|
}
|
|
1153
|
-
const
|
|
1167
|
+
const N = h(() => [
|
|
1154
1168
|
{ value: "", label: t("panel.view-all") },
|
|
1155
1169
|
{ value: "published", label: t("panel.view-published") },
|
|
1156
1170
|
{ value: "scheduled", label: t("panel.view-scheduled") },
|
|
1157
1171
|
{ value: "draft", label: t("panel.view-draft") },
|
|
1158
1172
|
{ value: "unpublished", label: t("panel.view-unpublished") },
|
|
1159
1173
|
{ value: "trashed", label: t("panel.bin"), icon: "trash" }
|
|
1160
|
-
]),
|
|
1174
|
+
]), U = h(() => T.value?.filters ?? { rubrics: [], tags: [], authors: [] }), $ = h(() => f.value > 0 && f.value < Xe), P = h(() => $.value ? [{ key: "card", label: "" }] : [
|
|
1161
1175
|
{ key: "cover", label: "", width: 68 },
|
|
1162
1176
|
/* The one that takes what the others leave, and the only one without a number. */
|
|
1163
1177
|
{ key: "title", label: t("panel.column-title"), minWidth: 220 },
|
|
@@ -1173,25 +1187,25 @@ const Mt = { class: "wx-article-editor__screen" }, Ut = 1200, Nt = /* @__PURE__
|
|
|
1173
1187
|
cellClass: "wx-articles__when"
|
|
1174
1188
|
},
|
|
1175
1189
|
{ key: "status", label: t("panel.column-status"), width: 170 },
|
|
1176
|
-
{ key: "actions", label: "", width:
|
|
1177
|
-
]), E = h(() =>
|
|
1178
|
-
const n = [], q =
|
|
1190
|
+
{ key: "actions", label: "", width: Ye, align: "right" }
|
|
1191
|
+
]), E = h(() => y.value.q !== "" ? t("panel.empty-search") : R.value ? t("panel.empty-bin") : t("panel.empty")), ie = h(() => {
|
|
1192
|
+
const n = [], q = U.value.rubrics.find((be) => be.id === y.value.rubric);
|
|
1179
1193
|
q && n.push({
|
|
1180
1194
|
key: "rubric",
|
|
1181
1195
|
label: `${t("panel.filter-rubric")}: ${q.title}`,
|
|
1182
|
-
clear: () =>
|
|
1196
|
+
clear: () => O("rubric", void 0)
|
|
1183
1197
|
});
|
|
1184
|
-
const d =
|
|
1198
|
+
const d = U.value.tags.find((be) => be.id === y.value.tag);
|
|
1185
1199
|
d && n.push({
|
|
1186
1200
|
key: "tag",
|
|
1187
1201
|
label: `${t("panel.filter-tag")}: ${d.title}`,
|
|
1188
|
-
clear: () =>
|
|
1202
|
+
clear: () => O("tag", void 0)
|
|
1189
1203
|
});
|
|
1190
|
-
const
|
|
1191
|
-
return
|
|
1204
|
+
const ke = U.value.authors.find((be) => be.id === y.value.author);
|
|
1205
|
+
return ke && n.push({
|
|
1192
1206
|
key: "author",
|
|
1193
|
-
label: `${t("panel.filter-author")}: ${
|
|
1194
|
-
clear: () =>
|
|
1207
|
+
label: `${t("panel.filter-author")}: ${ke.title}`,
|
|
1208
|
+
clear: () => O("author", void 0)
|
|
1195
1209
|
}), n;
|
|
1196
1210
|
});
|
|
1197
1211
|
function Y() {
|
|
@@ -1208,15 +1222,15 @@ const Mt = { class: "wx-article-editor__screen" }, Ut = 1200, Nt = /* @__PURE__
|
|
|
1208
1222
|
async function ne(n) {
|
|
1209
1223
|
m.value = !0;
|
|
1210
1224
|
try {
|
|
1211
|
-
|
|
1212
|
-
q: n?.search ??
|
|
1225
|
+
T.value = await g.articles({
|
|
1226
|
+
q: n?.search ?? y.value.q,
|
|
1213
1227
|
status: R.value ? "" : B.value,
|
|
1214
1228
|
trashed: R.value,
|
|
1215
|
-
rubric:
|
|
1216
|
-
tag:
|
|
1217
|
-
author:
|
|
1229
|
+
rubric: y.value.rubric,
|
|
1230
|
+
tag: y.value.tag,
|
|
1231
|
+
author: y.value.author,
|
|
1218
1232
|
sort: n?.sort ? `${n.sort.order === "desc" ? "-" : ""}${n.sort.key}` : null,
|
|
1219
|
-
page: n?.page ??
|
|
1233
|
+
page: n?.page ?? y.value.page,
|
|
1220
1234
|
per_page: n?.perPage
|
|
1221
1235
|
});
|
|
1222
1236
|
} catch (q) {
|
|
@@ -1225,7 +1239,7 @@ const Mt = { class: "wx-article-editor__screen" }, Ut = 1200, Nt = /* @__PURE__
|
|
|
1225
1239
|
m.value = !1;
|
|
1226
1240
|
}
|
|
1227
1241
|
}
|
|
1228
|
-
function
|
|
1242
|
+
function se(n) {
|
|
1229
1243
|
const q = {
|
|
1230
1244
|
...a.query,
|
|
1231
1245
|
q: n.search === "" ? void 0 : n.search,
|
|
@@ -1234,7 +1248,7 @@ const Mt = { class: "wx-article-editor__screen" }, Ut = 1200, Nt = /* @__PURE__
|
|
|
1234
1248
|
};
|
|
1235
1249
|
s.replace({ query: q }), ne(n);
|
|
1236
1250
|
}
|
|
1237
|
-
function
|
|
1251
|
+
function O(n, q) {
|
|
1238
1252
|
s.replace({
|
|
1239
1253
|
query: {
|
|
1240
1254
|
...a.query,
|
|
@@ -1243,8 +1257,8 @@ const Mt = { class: "wx-article-editor__screen" }, Ut = 1200, Nt = /* @__PURE__
|
|
|
1243
1257
|
}
|
|
1244
1258
|
});
|
|
1245
1259
|
}
|
|
1246
|
-
|
|
1247
|
-
() =>
|
|
1260
|
+
ve(
|
|
1261
|
+
[B, () => y.value.rubric, () => y.value.tag, () => y.value.author],
|
|
1248
1262
|
() => {
|
|
1249
1263
|
ne();
|
|
1250
1264
|
}
|
|
@@ -1253,11 +1267,11 @@ const Mt = { class: "wx-article-editor__screen" }, Ut = 1200, Nt = /* @__PURE__
|
|
|
1253
1267
|
const q = `${c.base}/articles/${n.id}`;
|
|
1254
1268
|
s.resolve(q).matched.length > 0 && s.push({ path: q, query: { ...a.query } });
|
|
1255
1269
|
}
|
|
1256
|
-
async function
|
|
1270
|
+
async function xe() {
|
|
1257
1271
|
const n = await A({});
|
|
1258
1272
|
n && (await ne(), he(n));
|
|
1259
1273
|
}
|
|
1260
|
-
function
|
|
1274
|
+
function re(n) {
|
|
1261
1275
|
if (!z.value) return [];
|
|
1262
1276
|
if (R.value)
|
|
1263
1277
|
return [
|
|
@@ -1290,7 +1304,7 @@ const Mt = { class: "wx-article-editor__screen" }, Ut = 1200, Nt = /* @__PURE__
|
|
|
1290
1304
|
icon: "star",
|
|
1291
1305
|
label: n.pinned ? t("panel.unpin") : t("panel.pin"),
|
|
1292
1306
|
run: () => {
|
|
1293
|
-
|
|
1307
|
+
_e(n, !n.pinned);
|
|
1294
1308
|
}
|
|
1295
1309
|
}), q.push(
|
|
1296
1310
|
n.status === "published" || n.status === "modified" || n.status === "scheduled" ? {
|
|
@@ -1298,7 +1312,7 @@ const Mt = { class: "wx-article-editor__screen" }, Ut = 1200, Nt = /* @__PURE__
|
|
|
1298
1312
|
icon: "eye-off",
|
|
1299
1313
|
label: t("panel.unpublish"),
|
|
1300
1314
|
run: () => {
|
|
1301
|
-
|
|
1315
|
+
We(n);
|
|
1302
1316
|
}
|
|
1303
1317
|
} : {
|
|
1304
1318
|
key: "publish",
|
|
@@ -1314,35 +1328,35 @@ const Mt = { class: "wx-article-editor__screen" }, Ut = 1200, Nt = /* @__PURE__
|
|
|
1314
1328
|
label: t("panel.delete"),
|
|
1315
1329
|
danger: !0,
|
|
1316
1330
|
run: () => {
|
|
1317
|
-
|
|
1331
|
+
ue(n);
|
|
1318
1332
|
}
|
|
1319
1333
|
}), q;
|
|
1320
1334
|
}
|
|
1321
1335
|
async function fe(n) {
|
|
1322
|
-
await
|
|
1336
|
+
await ce(() => g.publish(n.id), t("panel.published"));
|
|
1323
1337
|
}
|
|
1324
|
-
async function
|
|
1325
|
-
await
|
|
1338
|
+
async function We(n) {
|
|
1339
|
+
await ce(() => g.unpublish(n.id), t("panel.unpublished-done"));
|
|
1326
1340
|
}
|
|
1327
|
-
async function
|
|
1328
|
-
await
|
|
1341
|
+
async function _e(n, q) {
|
|
1342
|
+
await ce(
|
|
1329
1343
|
() => g.save(n.id, { values: { pinned: q }, revision: n.revision }),
|
|
1330
1344
|
t(q ? "panel.pinned-done" : "panel.unpinned")
|
|
1331
1345
|
);
|
|
1332
1346
|
}
|
|
1333
|
-
async function
|
|
1334
|
-
await
|
|
1347
|
+
async function ue(n) {
|
|
1348
|
+
await de({
|
|
1335
1349
|
title: t("panel.delete-title", { title: n.title }),
|
|
1336
1350
|
message: t("panel.delete-text"),
|
|
1337
1351
|
confirmText: t("panel.delete"),
|
|
1338
1352
|
cancelText: t("panel.cancel"),
|
|
1339
1353
|
tone: "danger"
|
|
1340
|
-
}) && await
|
|
1354
|
+
}) && await ce(() => g.remove(n.id), t("panel.deleted"));
|
|
1341
1355
|
}
|
|
1342
1356
|
async function ee(n) {
|
|
1343
|
-
await
|
|
1357
|
+
await ce(() => g.restore(n.id), t("panel.restored"));
|
|
1344
1358
|
}
|
|
1345
|
-
async function
|
|
1359
|
+
async function ce(n, q) {
|
|
1346
1360
|
try {
|
|
1347
1361
|
await n(), D.success(q);
|
|
1348
1362
|
} catch (d) {
|
|
@@ -1358,35 +1372,35 @@ const Mt = { class: "wx-article-editor__screen" }, Ut = 1200, Nt = /* @__PURE__
|
|
|
1358
1372
|
} catch {
|
|
1359
1373
|
}
|
|
1360
1374
|
}
|
|
1361
|
-
function
|
|
1375
|
+
function C(n) {
|
|
1362
1376
|
return n === "published" || n === "modified" ? "success" : n === "scheduled" ? "warning" : "default";
|
|
1363
1377
|
}
|
|
1364
|
-
function
|
|
1378
|
+
function _(n) {
|
|
1365
1379
|
return R.value ? "—" : n.path === null ? t("panel.no-address") : `/${n.path}`;
|
|
1366
1380
|
}
|
|
1367
|
-
function
|
|
1381
|
+
function J(n) {
|
|
1368
1382
|
return R.value ? n.deleted_at : n.published_at;
|
|
1369
1383
|
}
|
|
1370
1384
|
const me = h(
|
|
1371
1385
|
() => z.value ? [{ key: "new", label: t("panel.new"), icon: "plus", primary: !0, run: () => {
|
|
1372
|
-
|
|
1386
|
+
xe();
|
|
1373
1387
|
} }] : []
|
|
1374
1388
|
);
|
|
1375
|
-
return (n, q) => (x(),
|
|
1389
|
+
return (n, q) => (x(), H("div", {
|
|
1376
1390
|
ref_key: "root",
|
|
1377
|
-
ref:
|
|
1391
|
+
ref: b,
|
|
1378
1392
|
class: "wx-articles"
|
|
1379
1393
|
}, [
|
|
1380
|
-
r(e(
|
|
1394
|
+
r(e(et), {
|
|
1381
1395
|
view: B.value,
|
|
1382
1396
|
"onUpdate:view": q[3] || (q[3] = (d) => B.value = d),
|
|
1383
1397
|
title: S.value,
|
|
1384
|
-
views:
|
|
1398
|
+
views: N.value,
|
|
1385
1399
|
actions: me.value
|
|
1386
1400
|
}, {
|
|
1387
1401
|
default: i(() => [
|
|
1388
|
-
r(e(
|
|
1389
|
-
data:
|
|
1402
|
+
r(e(it), {
|
|
1403
|
+
data: T.value,
|
|
1390
1404
|
columns: P.value,
|
|
1391
1405
|
"row-key": "id",
|
|
1392
1406
|
searchable: "",
|
|
@@ -1395,63 +1409,63 @@ const Mt = { class: "wx-article-editor__screen" }, Ut = 1200, Nt = /* @__PURE__
|
|
|
1395
1409
|
flush: "",
|
|
1396
1410
|
loading: m.value,
|
|
1397
1411
|
layout: "fixed",
|
|
1398
|
-
"cards-below":
|
|
1412
|
+
"cards-below": Xe,
|
|
1399
1413
|
"filters-count": ie.value.length,
|
|
1400
1414
|
"filters-label": e(o)("filters.title"),
|
|
1401
1415
|
"search-placeholder": e(t)("panel.search"),
|
|
1402
1416
|
"empty-text": E.value,
|
|
1403
1417
|
"aria-label": S.value,
|
|
1404
1418
|
onRowClick: he,
|
|
1405
|
-
onStateChange:
|
|
1419
|
+
onStateChange: se
|
|
1406
1420
|
}, {
|
|
1407
1421
|
filters: i(() => [
|
|
1408
|
-
r(e(
|
|
1422
|
+
r(e(pe), {
|
|
1409
1423
|
label: e(t)("panel.filter-rubric")
|
|
1410
1424
|
}, {
|
|
1411
1425
|
default: i(() => [
|
|
1412
|
-
r(e(
|
|
1413
|
-
"model-value":
|
|
1414
|
-
options:
|
|
1426
|
+
r(e($e), {
|
|
1427
|
+
"model-value": y.value.rubric,
|
|
1428
|
+
options: U.value.rubrics.map((d) => ({ value: d.id, label: d.title })),
|
|
1415
1429
|
placeholder: e(t)("panel.any-rubric"),
|
|
1416
1430
|
clearable: "",
|
|
1417
1431
|
size: "sm",
|
|
1418
|
-
"onUpdate:modelValue": q[0] || (q[0] = (d) =>
|
|
1432
|
+
"onUpdate:modelValue": q[0] || (q[0] = (d) => O("rubric", d))
|
|
1419
1433
|
}, null, 8, ["model-value", "options", "placeholder"])
|
|
1420
1434
|
]),
|
|
1421
1435
|
_: 1
|
|
1422
1436
|
}, 8, ["label"]),
|
|
1423
|
-
r(e(
|
|
1437
|
+
r(e(pe), {
|
|
1424
1438
|
label: e(t)("panel.filter-tag")
|
|
1425
1439
|
}, {
|
|
1426
1440
|
default: i(() => [
|
|
1427
|
-
r(e(
|
|
1428
|
-
"model-value":
|
|
1429
|
-
options:
|
|
1441
|
+
r(e($e), {
|
|
1442
|
+
"model-value": y.value.tag,
|
|
1443
|
+
options: U.value.tags.map((d) => ({ value: d.id, label: d.title })),
|
|
1430
1444
|
placeholder: e(t)("panel.any-tag"),
|
|
1431
1445
|
clearable: "",
|
|
1432
1446
|
filterable: "",
|
|
1433
1447
|
size: "sm",
|
|
1434
|
-
"onUpdate:modelValue": q[1] || (q[1] = (d) =>
|
|
1448
|
+
"onUpdate:modelValue": q[1] || (q[1] = (d) => O("tag", d))
|
|
1435
1449
|
}, null, 8, ["model-value", "options", "placeholder"])
|
|
1436
1450
|
]),
|
|
1437
1451
|
_: 1
|
|
1438
1452
|
}, 8, ["label"]),
|
|
1439
|
-
r(e(
|
|
1453
|
+
r(e(pe), {
|
|
1440
1454
|
label: e(t)("panel.filter-author")
|
|
1441
1455
|
}, {
|
|
1442
1456
|
default: i(() => [
|
|
1443
|
-
r(e(
|
|
1444
|
-
"model-value":
|
|
1445
|
-
options:
|
|
1457
|
+
r(e($e), {
|
|
1458
|
+
"model-value": y.value.author,
|
|
1459
|
+
options: U.value.authors.map((d) => ({ value: d.id, label: d.title })),
|
|
1446
1460
|
placeholder: e(t)("panel.any-author"),
|
|
1447
1461
|
clearable: "",
|
|
1448
1462
|
size: "sm",
|
|
1449
|
-
"onUpdate:modelValue": q[2] || (q[2] = (d) =>
|
|
1463
|
+
"onUpdate:modelValue": q[2] || (q[2] = (d) => O("author", d))
|
|
1450
1464
|
}, null, 8, ["model-value", "options", "placeholder"])
|
|
1451
1465
|
]),
|
|
1452
1466
|
_: 1
|
|
1453
1467
|
}, 8, ["label"]),
|
|
1454
|
-
ie.value.length > 0 ? (x(), I(e(
|
|
1468
|
+
ie.value.length > 0 ? (x(), I(e(G), {
|
|
1455
1469
|
key: 0,
|
|
1456
1470
|
variant: "text",
|
|
1457
1471
|
size: "sm",
|
|
@@ -1459,27 +1473,27 @@ const Mt = { class: "wx-article-editor__screen" }, Ut = 1200, Nt = /* @__PURE__
|
|
|
1459
1473
|
onClick: Y
|
|
1460
1474
|
}, {
|
|
1461
1475
|
icon: i(() => [
|
|
1462
|
-
r(e(
|
|
1476
|
+
r(e(Ae), { name: "close" })
|
|
1463
1477
|
]),
|
|
1464
1478
|
default: i(() => [
|
|
1465
|
-
V(" " +
|
|
1479
|
+
V(" " + k(e(o)("filters.reset")), 1)
|
|
1466
1480
|
]),
|
|
1467
1481
|
_: 1
|
|
1468
|
-
})) :
|
|
1482
|
+
})) : K("", !0)
|
|
1469
1483
|
]),
|
|
1470
1484
|
applied: i(() => [
|
|
1471
|
-
r(e(
|
|
1485
|
+
r(e(vt), { filters: ie.value }, null, 8, ["filters"])
|
|
1472
1486
|
]),
|
|
1473
1487
|
"cell-cover": i(({ row: d }) => [
|
|
1474
|
-
|
|
1475
|
-
class:
|
|
1488
|
+
F("span", {
|
|
1489
|
+
class: tt(["wx-articles__cover", { "is-empty": !d.cover }])
|
|
1476
1490
|
}, [
|
|
1477
|
-
d.cover?.thumb ? (x(),
|
|
1491
|
+
d.cover?.thumb ? (x(), H("img", {
|
|
1478
1492
|
key: 0,
|
|
1479
1493
|
src: d.cover.thumb,
|
|
1480
1494
|
alt: "",
|
|
1481
1495
|
loading: "lazy"
|
|
1482
|
-
}, null, 8,
|
|
1496
|
+
}, null, 8, oa)) : (x(), I(e(Ae), {
|
|
1483
1497
|
key: 1,
|
|
1484
1498
|
name: "image",
|
|
1485
1499
|
size: "sm"
|
|
@@ -1487,35 +1501,35 @@ const Mt = { class: "wx-article-editor__screen" }, Ut = 1200, Nt = /* @__PURE__
|
|
|
1487
1501
|
], 2)
|
|
1488
1502
|
]),
|
|
1489
1503
|
"cell-title": i(({ row: d }) => [
|
|
1490
|
-
|
|
1491
|
-
d.pinned ? (x(), I(e(
|
|
1504
|
+
F("div", ua, [
|
|
1505
|
+
d.pinned ? (x(), I(e(nt), {
|
|
1492
1506
|
key: 0,
|
|
1493
1507
|
content: e(t)("panel.pinned")
|
|
1494
1508
|
}, {
|
|
1495
1509
|
default: i(() => [
|
|
1496
|
-
r(e(
|
|
1510
|
+
r(e(Ae), {
|
|
1497
1511
|
class: "wx-articles__pin",
|
|
1498
1512
|
name: "star",
|
|
1499
1513
|
size: "sm"
|
|
1500
1514
|
})
|
|
1501
1515
|
]),
|
|
1502
1516
|
_: 1
|
|
1503
|
-
}, 8, ["content"])) :
|
|
1504
|
-
|
|
1505
|
-
|
|
1506
|
-
|
|
1517
|
+
}, 8, ["content"])) : K("", !0),
|
|
1518
|
+
F("div", ca, [
|
|
1519
|
+
F("span", da, k(d.title), 1),
|
|
1520
|
+
F("span", pa, k(_(d)), 1)
|
|
1507
1521
|
])
|
|
1508
1522
|
])
|
|
1509
1523
|
]),
|
|
1510
1524
|
"cell-rubrics": i(({ row: d }) => [
|
|
1511
|
-
|
|
1512
|
-
(x(!0),
|
|
1513
|
-
key:
|
|
1525
|
+
F("span", va, [
|
|
1526
|
+
(x(!0), H(Te, null, qe(d.rubrics, (ke) => (x(), I(e(ae), {
|
|
1527
|
+
key: ke.id,
|
|
1514
1528
|
size: "sm",
|
|
1515
1529
|
round: ""
|
|
1516
1530
|
}, {
|
|
1517
1531
|
default: i(() => [
|
|
1518
|
-
V(
|
|
1532
|
+
V(k(ke.title), 1)
|
|
1519
1533
|
]),
|
|
1520
1534
|
_: 2
|
|
1521
1535
|
}, 1024))), 128))
|
|
@@ -1528,15 +1542,15 @@ const Mt = { class: "wx-article-editor__screen" }, Ut = 1200, Nt = /* @__PURE__
|
|
|
1528
1542
|
truncate: ""
|
|
1529
1543
|
}, {
|
|
1530
1544
|
default: i(() => [
|
|
1531
|
-
V(
|
|
1545
|
+
V(k(d.author ? d.author.name : "—"), 1)
|
|
1532
1546
|
]),
|
|
1533
1547
|
_: 2
|
|
1534
1548
|
}, 1024)
|
|
1535
1549
|
]),
|
|
1536
1550
|
"cell-date": i(({ row: d }) => [
|
|
1537
|
-
|
|
1551
|
+
J(d) ? (x(), I(e(Ee), {
|
|
1538
1552
|
key: 0,
|
|
1539
|
-
value:
|
|
1553
|
+
value: J(d),
|
|
1540
1554
|
compact: ""
|
|
1541
1555
|
}, null, 8, ["value"])) : (x(), I(e(te), {
|
|
1542
1556
|
key: 1,
|
|
@@ -1550,14 +1564,14 @@ const Mt = { class: "wx-article-editor__screen" }, Ut = 1200, Nt = /* @__PURE__
|
|
|
1550
1564
|
}))
|
|
1551
1565
|
]),
|
|
1552
1566
|
"cell-status": i(({ row: d }) => [
|
|
1553
|
-
|
|
1567
|
+
F("span", ga, [
|
|
1554
1568
|
r(e(ae), {
|
|
1555
|
-
type:
|
|
1569
|
+
type: C(d.status),
|
|
1556
1570
|
dot: "",
|
|
1557
1571
|
size: "sm"
|
|
1558
1572
|
}, {
|
|
1559
1573
|
default: i(() => [
|
|
1560
|
-
V(
|
|
1574
|
+
V(k(e(t)(`panel.status-${d.status}`)), 1)
|
|
1561
1575
|
]),
|
|
1562
1576
|
_: 2
|
|
1563
1577
|
}, 1032, ["type"]),
|
|
@@ -1568,30 +1582,30 @@ const Mt = { class: "wx-article-editor__screen" }, Ut = 1200, Nt = /* @__PURE__
|
|
|
1568
1582
|
round: ""
|
|
1569
1583
|
}, {
|
|
1570
1584
|
default: i(() => [
|
|
1571
|
-
V(
|
|
1585
|
+
V(k(e(t)("panel.edits")), 1)
|
|
1572
1586
|
]),
|
|
1573
1587
|
_: 1
|
|
1574
|
-
})) :
|
|
1588
|
+
})) : K("", !0)
|
|
1575
1589
|
])
|
|
1576
1590
|
]),
|
|
1577
1591
|
"cell-card": i(({ row: d }) => [
|
|
1578
|
-
r(e(
|
|
1592
|
+
r(e(St), {
|
|
1579
1593
|
class: "wx-articles__entity",
|
|
1580
1594
|
variant: "plain",
|
|
1581
1595
|
title: d.title,
|
|
1582
1596
|
image: d.cover?.thumb ?? void 0,
|
|
1583
1597
|
"image-size": "56px",
|
|
1584
1598
|
"title-lines": 2,
|
|
1585
|
-
subtitle:
|
|
1599
|
+
subtitle: _(d)
|
|
1586
1600
|
}, {
|
|
1587
1601
|
title: i(() => [
|
|
1588
|
-
d.pinned ? (x(), I(e(
|
|
1602
|
+
d.pinned ? (x(), I(e(Ae), {
|
|
1589
1603
|
key: 0,
|
|
1590
1604
|
class: "wx-articles__pin",
|
|
1591
1605
|
name: "star",
|
|
1592
1606
|
size: "sm"
|
|
1593
|
-
})) :
|
|
1594
|
-
V(" " +
|
|
1607
|
+
})) : K("", !0),
|
|
1608
|
+
V(" " + k(d.title), 1)
|
|
1595
1609
|
]),
|
|
1596
1610
|
meta: i(() => [
|
|
1597
1611
|
d.rubrics[0] ? (x(), I(e(ae), {
|
|
@@ -1600,37 +1614,37 @@ const Mt = { class: "wx-article-editor__screen" }, Ut = 1200, Nt = /* @__PURE__
|
|
|
1600
1614
|
round: ""
|
|
1601
1615
|
}, {
|
|
1602
1616
|
default: i(() => [
|
|
1603
|
-
V(
|
|
1617
|
+
V(k(d.rubrics[0].title), 1)
|
|
1604
1618
|
]),
|
|
1605
1619
|
_: 2
|
|
1606
|
-
}, 1024)) :
|
|
1620
|
+
}, 1024)) : K("", !0),
|
|
1607
1621
|
r(e(ae), {
|
|
1608
|
-
type:
|
|
1622
|
+
type: C(d.status),
|
|
1609
1623
|
dot: "",
|
|
1610
1624
|
size: "sm"
|
|
1611
1625
|
}, {
|
|
1612
1626
|
default: i(() => [
|
|
1613
|
-
V(
|
|
1627
|
+
V(k(e(t)(`panel.status-${d.status}`)), 1)
|
|
1614
1628
|
]),
|
|
1615
1629
|
_: 2
|
|
1616
1630
|
}, 1032, ["type"]),
|
|
1617
|
-
|
|
1631
|
+
J(d) ? (x(), I(e(Ee), {
|
|
1618
1632
|
key: 1,
|
|
1619
|
-
value:
|
|
1620
|
-
}, null, 8, ["value"])) :
|
|
1633
|
+
value: J(d)
|
|
1634
|
+
}, null, 8, ["value"])) : K("", !0)
|
|
1621
1635
|
]),
|
|
1622
1636
|
_: 2
|
|
1623
1637
|
}, 1032, ["title", "image", "subtitle"])
|
|
1624
1638
|
]),
|
|
1625
1639
|
"card-actions": i(({ row: d }) => [
|
|
1626
|
-
r(e(
|
|
1627
|
-
actions:
|
|
1640
|
+
r(e(ze), {
|
|
1641
|
+
actions: re(d),
|
|
1628
1642
|
label: d.title
|
|
1629
1643
|
}, null, 8, ["actions", "label"])
|
|
1630
1644
|
]),
|
|
1631
1645
|
"cell-actions": i(({ row: d }) => [
|
|
1632
|
-
r(e(
|
|
1633
|
-
actions:
|
|
1646
|
+
r(e(ze), {
|
|
1647
|
+
actions: re(d),
|
|
1634
1648
|
label: d.title
|
|
1635
1649
|
}, null, 8, ["actions", "label"])
|
|
1636
1650
|
]),
|
|
@@ -1641,18 +1655,18 @@ const Mt = { class: "wx-article-editor__screen" }, Ut = 1200, Nt = /* @__PURE__
|
|
|
1641
1655
|
}, 8, ["view", "title", "views", "actions"])
|
|
1642
1656
|
], 512));
|
|
1643
1657
|
}
|
|
1644
|
-
}),
|
|
1658
|
+
}), fa = /* @__PURE__ */ ge(ha, [["__scopeId", "data-v-d6800820"]]), ma = /* @__PURE__ */ Q({
|
|
1645
1659
|
__name: "TagCreateDialog",
|
|
1646
1660
|
setup(v) {
|
|
1647
|
-
const { open: c, resolve: p, dismiss: g } =
|
|
1661
|
+
const { open: c, resolve: p, dismiss: g } = Re(), a = le(), s = oe(a);
|
|
1648
1662
|
X();
|
|
1649
|
-
const t =
|
|
1650
|
-
|
|
1651
|
-
await
|
|
1663
|
+
const t = Z("webx-blog"), o = M(""), l = M(""), b = M(!1), f = M({}), T = Ie("field");
|
|
1664
|
+
Ne(async () => {
|
|
1665
|
+
await He(), T.value?.querySelector("input")?.focus();
|
|
1652
1666
|
});
|
|
1653
1667
|
async function m() {
|
|
1654
|
-
if (!(o.value.trim() === "" ||
|
|
1655
|
-
|
|
1668
|
+
if (!(o.value.trim() === "" || b.value)) {
|
|
1669
|
+
b.value = !0, f.value = {};
|
|
1656
1670
|
try {
|
|
1657
1671
|
p(
|
|
1658
1672
|
await s.createTag({
|
|
@@ -1663,36 +1677,36 @@ const Mt = { class: "wx-article-editor__screen" }, Ut = 1200, Nt = /* @__PURE__
|
|
|
1663
1677
|
} catch (A) {
|
|
1664
1678
|
f.value = A.body?.errors ?? {};
|
|
1665
1679
|
} finally {
|
|
1666
|
-
|
|
1680
|
+
b.value = !1;
|
|
1667
1681
|
}
|
|
1668
1682
|
}
|
|
1669
1683
|
}
|
|
1670
|
-
return (A, z) => (x(), I(e(
|
|
1684
|
+
return (A, z) => (x(), I(e(De), {
|
|
1671
1685
|
open: e(c),
|
|
1672
|
-
"onUpdate:open": z[3] || (z[3] = (S) =>
|
|
1686
|
+
"onUpdate:open": z[3] || (z[3] = (S) => Pe(c) ? c.value = S : null),
|
|
1673
1687
|
title: e(t)("tag.new-title"),
|
|
1674
1688
|
width: 440
|
|
1675
1689
|
}, {
|
|
1676
1690
|
footer: i(() => [
|
|
1677
|
-
r(e(
|
|
1691
|
+
r(e(Be), { size: "sm" }, {
|
|
1678
1692
|
default: i(() => [
|
|
1679
|
-
r(e(
|
|
1693
|
+
r(e(G), {
|
|
1680
1694
|
variant: "outline",
|
|
1681
1695
|
onClick: z[2] || (z[2] = (S) => e(g)())
|
|
1682
1696
|
}, {
|
|
1683
1697
|
default: i(() => [
|
|
1684
|
-
V(
|
|
1698
|
+
V(k(e(t)("tag.cancel")), 1)
|
|
1685
1699
|
]),
|
|
1686
1700
|
_: 1
|
|
1687
1701
|
}),
|
|
1688
|
-
r(e(
|
|
1702
|
+
r(e(G), {
|
|
1689
1703
|
type: "primary",
|
|
1690
|
-
loading:
|
|
1704
|
+
loading: b.value,
|
|
1691
1705
|
disabled: o.value.trim() === "",
|
|
1692
1706
|
onClick: m
|
|
1693
1707
|
}, {
|
|
1694
1708
|
default: i(() => [
|
|
1695
|
-
V(
|
|
1709
|
+
V(k(e(t)("tag.create")), 1)
|
|
1696
1710
|
]),
|
|
1697
1711
|
_: 1
|
|
1698
1712
|
}, 8, ["loading", "disabled"])
|
|
@@ -1701,37 +1715,37 @@ const Mt = { class: "wx-article-editor__screen" }, Ut = 1200, Nt = /* @__PURE__
|
|
|
1701
1715
|
})
|
|
1702
1716
|
]),
|
|
1703
1717
|
default: i(() => [
|
|
1704
|
-
r(e(
|
|
1718
|
+
r(e(pe), {
|
|
1705
1719
|
label: e(t)("tag.field-title"),
|
|
1706
1720
|
error: f.value.title?.[0],
|
|
1707
1721
|
required: ""
|
|
1708
1722
|
}, {
|
|
1709
1723
|
default: i(() => [
|
|
1710
|
-
|
|
1724
|
+
F("div", {
|
|
1711
1725
|
ref_key: "field",
|
|
1712
|
-
ref:
|
|
1726
|
+
ref: T
|
|
1713
1727
|
}, [
|
|
1714
|
-
r(e(
|
|
1728
|
+
r(e(Ce), {
|
|
1715
1729
|
modelValue: o.value,
|
|
1716
1730
|
"onUpdate:modelValue": z[0] || (z[0] = (S) => o.value = S),
|
|
1717
1731
|
"aria-label": e(t)("tag.field-title"),
|
|
1718
|
-
onKeyup:
|
|
1732
|
+
onKeyup: Me(m, ["enter"])
|
|
1719
1733
|
}, null, 8, ["modelValue", "aria-label"])
|
|
1720
1734
|
], 512)
|
|
1721
1735
|
]),
|
|
1722
1736
|
_: 1
|
|
1723
1737
|
}, 8, ["label", "error"]),
|
|
1724
|
-
r(e(
|
|
1738
|
+
r(e(pe), {
|
|
1725
1739
|
label: e(t)("tag.field-slug"),
|
|
1726
1740
|
error: f.value.slug?.[0],
|
|
1727
1741
|
help: e(t)("tag.field-slug-help")
|
|
1728
1742
|
}, {
|
|
1729
1743
|
default: i(() => [
|
|
1730
|
-
r(e(
|
|
1744
|
+
r(e(Ce), {
|
|
1731
1745
|
modelValue: l.value,
|
|
1732
1746
|
"onUpdate:modelValue": z[1] || (z[1] = (S) => l.value = S),
|
|
1733
1747
|
"aria-label": e(t)("tag.field-slug"),
|
|
1734
|
-
onKeyup:
|
|
1748
|
+
onKeyup: Me(m, ["enter"])
|
|
1735
1749
|
}, null, 8, ["modelValue", "aria-label"])
|
|
1736
1750
|
]),
|
|
1737
1751
|
_: 1
|
|
@@ -1740,54 +1754,54 @@ const Mt = { class: "wx-article-editor__screen" }, Ut = 1200, Nt = /* @__PURE__
|
|
|
1740
1754
|
_: 1
|
|
1741
1755
|
}, 8, ["open", "title"]));
|
|
1742
1756
|
}
|
|
1743
|
-
}),
|
|
1757
|
+
}), ba = ["id"], ya = /* @__PURE__ */ Q({
|
|
1744
1758
|
__name: "TagRenameDialog",
|
|
1745
1759
|
props: {
|
|
1746
1760
|
name: {}
|
|
1747
1761
|
},
|
|
1748
1762
|
setup(v) {
|
|
1749
|
-
const c = v, { open: p, resolve: g, dismiss: a } =
|
|
1763
|
+
const c = v, { open: p, resolve: g, dismiss: a } = Re();
|
|
1750
1764
|
X();
|
|
1751
|
-
const s =
|
|
1752
|
-
|
|
1753
|
-
await
|
|
1754
|
-
const
|
|
1755
|
-
|
|
1765
|
+
const s = Z("webx-blog"), t = Z("webx-admin"), o = yt(), l = M(c.name), b = Ie("field");
|
|
1766
|
+
Ne(async () => {
|
|
1767
|
+
await He();
|
|
1768
|
+
const T = b.value?.querySelector("input");
|
|
1769
|
+
T?.focus(), T?.select();
|
|
1756
1770
|
});
|
|
1757
1771
|
function f() {
|
|
1758
|
-
const
|
|
1759
|
-
if (
|
|
1772
|
+
const T = l.value.trim();
|
|
1773
|
+
if (T === "" || T === c.name) {
|
|
1760
1774
|
a();
|
|
1761
1775
|
return;
|
|
1762
1776
|
}
|
|
1763
|
-
g(
|
|
1777
|
+
g(T);
|
|
1764
1778
|
}
|
|
1765
|
-
return (
|
|
1779
|
+
return (T, m) => (x(), I(e(De), {
|
|
1766
1780
|
open: e(p),
|
|
1767
|
-
"onUpdate:open": m[2] || (m[2] = (A) =>
|
|
1781
|
+
"onUpdate:open": m[2] || (m[2] = (A) => Pe(p) ? p.value = A : null),
|
|
1768
1782
|
title: e(s)("tag.rename"),
|
|
1769
1783
|
width: 420
|
|
1770
1784
|
}, {
|
|
1771
1785
|
footer: i(() => [
|
|
1772
|
-
r(e(
|
|
1786
|
+
r(e(Be), { size: "sm" }, {
|
|
1773
1787
|
default: i(() => [
|
|
1774
|
-
r(e(
|
|
1788
|
+
r(e(G), {
|
|
1775
1789
|
variant: "outline",
|
|
1776
1790
|
onClick: m[1] || (m[1] = (A) => e(a)())
|
|
1777
1791
|
}, {
|
|
1778
1792
|
default: i(() => [
|
|
1779
|
-
V(
|
|
1793
|
+
V(k(e(s)("tag.cancel")), 1)
|
|
1780
1794
|
]),
|
|
1781
1795
|
_: 1
|
|
1782
1796
|
}),
|
|
1783
|
-
r(e(
|
|
1797
|
+
r(e(G), {
|
|
1784
1798
|
type: "primary",
|
|
1785
1799
|
"native-type": "submit",
|
|
1786
1800
|
form: e(o),
|
|
1787
1801
|
disabled: l.value.trim() === ""
|
|
1788
1802
|
}, {
|
|
1789
1803
|
default: i(() => [
|
|
1790
|
-
V(
|
|
1804
|
+
V(k(e(t)("editor.save")), 1)
|
|
1791
1805
|
]),
|
|
1792
1806
|
_: 1
|
|
1793
1807
|
}, 8, ["form", "disabled"])
|
|
@@ -1796,53 +1810,53 @@ const Mt = { class: "wx-article-editor__screen" }, Ut = 1200, Nt = /* @__PURE__
|
|
|
1796
1810
|
})
|
|
1797
1811
|
]),
|
|
1798
1812
|
default: i(() => [
|
|
1799
|
-
|
|
1813
|
+
F("form", {
|
|
1800
1814
|
id: e(o),
|
|
1801
1815
|
ref_key: "field",
|
|
1802
|
-
ref:
|
|
1803
|
-
onSubmit:
|
|
1816
|
+
ref: b,
|
|
1817
|
+
onSubmit: Je(f, ["prevent"])
|
|
1804
1818
|
}, [
|
|
1805
|
-
r(e(
|
|
1819
|
+
r(e(pe), {
|
|
1806
1820
|
label: e(s)("tag.field-title"),
|
|
1807
1821
|
required: ""
|
|
1808
1822
|
}, {
|
|
1809
1823
|
default: i(() => [
|
|
1810
|
-
r(e(
|
|
1824
|
+
r(e(Ce), {
|
|
1811
1825
|
modelValue: l.value,
|
|
1812
1826
|
"onUpdate:modelValue": m[0] || (m[0] = (A) => l.value = A),
|
|
1813
1827
|
"aria-label": e(s)("tag.field-title"),
|
|
1814
|
-
onKeydown:
|
|
1828
|
+
onKeydown: Me(Je(f, ["prevent"]), ["enter"])
|
|
1815
1829
|
}, null, 8, ["modelValue", "aria-label", "onKeydown"])
|
|
1816
1830
|
]),
|
|
1817
1831
|
_: 1
|
|
1818
1832
|
}, 8, ["label"])
|
|
1819
|
-
], 40,
|
|
1833
|
+
], 40, ba)
|
|
1820
1834
|
]),
|
|
1821
1835
|
_: 1
|
|
1822
1836
|
}, 8, ["open", "title"]));
|
|
1823
1837
|
}
|
|
1824
|
-
}),
|
|
1838
|
+
}), wa = { class: "wx-tag-merge" }, xa = { class: "wx-tag-merge__chips" }, _a = { class: "wx-tag-merge__redirect" }, ka = /* @__PURE__ */ Q({
|
|
1825
1839
|
__name: "TagMergeDialog",
|
|
1826
1840
|
props: {
|
|
1827
1841
|
tags: {}
|
|
1828
1842
|
},
|
|
1829
1843
|
setup(v) {
|
|
1830
|
-
const c = v, { open: p, resolve: g, dismiss: a } =
|
|
1844
|
+
const c = v, { open: p, resolve: g, dismiss: a } = Re(), s = le(), t = oe(s);
|
|
1831
1845
|
X();
|
|
1832
|
-
const o =
|
|
1833
|
-
[...c.tags].sort((W,
|
|
1834
|
-
), f = M(!1),
|
|
1846
|
+
const o = Z("webx-blog"), l = we(), b = M(
|
|
1847
|
+
[...c.tags].sort((W, N) => N.articles_count - W.articles_count)[0]?.id ?? 0
|
|
1848
|
+
), f = M(!1), T = M(!0), m = M(null), A = h(
|
|
1835
1849
|
() => c.tags.map((W) => ({ value: W.id, label: `${W.title} · ${W.articles_count}` }))
|
|
1836
|
-
), z = h(() => c.tags.find((W) => W.id ===
|
|
1837
|
-
async function
|
|
1850
|
+
), z = h(() => c.tags.find((W) => W.id === b.value) ?? null), S = h(() => c.tags.filter((W) => W.id !== b.value)), B = h(() => S.value.reduce((W, N) => W + N.articles_count, 0)), R = h(() => S.value.map((W) => W.path).filter(Boolean));
|
|
1851
|
+
async function y() {
|
|
1838
1852
|
if (!(z.value === null || S.value.length === 0 || f.value)) {
|
|
1839
1853
|
f.value = !0, m.value = null;
|
|
1840
1854
|
try {
|
|
1841
1855
|
g(
|
|
1842
1856
|
await t.mergeTags(
|
|
1843
1857
|
S.value.map((W) => W.id),
|
|
1844
|
-
|
|
1845
|
-
|
|
1858
|
+
b.value,
|
|
1859
|
+
T.value
|
|
1846
1860
|
)
|
|
1847
1861
|
);
|
|
1848
1862
|
} catch (W) {
|
|
@@ -1852,32 +1866,32 @@ const Mt = { class: "wx-article-editor__screen" }, Ut = 1200, Nt = /* @__PURE__
|
|
|
1852
1866
|
}
|
|
1853
1867
|
}
|
|
1854
1868
|
}
|
|
1855
|
-
return (W,
|
|
1869
|
+
return (W, N) => (x(), I(e(De), {
|
|
1856
1870
|
open: e(p),
|
|
1857
|
-
"onUpdate:open":
|
|
1871
|
+
"onUpdate:open": N[3] || (N[3] = (U) => Pe(p) ? p.value = U : null),
|
|
1858
1872
|
title: e(o)("tag.merge-title"),
|
|
1859
1873
|
width: 520
|
|
1860
1874
|
}, {
|
|
1861
1875
|
footer: i(() => [
|
|
1862
|
-
r(e(
|
|
1876
|
+
r(e(Be), { size: "sm" }, {
|
|
1863
1877
|
default: i(() => [
|
|
1864
|
-
r(e(
|
|
1878
|
+
r(e(G), {
|
|
1865
1879
|
variant: "outline",
|
|
1866
|
-
onClick:
|
|
1880
|
+
onClick: N[2] || (N[2] = (U) => e(a)())
|
|
1867
1881
|
}, {
|
|
1868
1882
|
default: i(() => [
|
|
1869
|
-
V(
|
|
1883
|
+
V(k(e(o)("tag.cancel")), 1)
|
|
1870
1884
|
]),
|
|
1871
1885
|
_: 1
|
|
1872
1886
|
}),
|
|
1873
|
-
r(e(
|
|
1887
|
+
r(e(G), {
|
|
1874
1888
|
type: "primary",
|
|
1875
1889
|
loading: f.value,
|
|
1876
1890
|
disabled: S.value.length === 0,
|
|
1877
|
-
onClick:
|
|
1891
|
+
onClick: y
|
|
1878
1892
|
}, {
|
|
1879
1893
|
default: i(() => [
|
|
1880
|
-
V(
|
|
1894
|
+
V(k(e(o)("tag.merge-confirm")), 1)
|
|
1881
1895
|
]),
|
|
1882
1896
|
_: 1
|
|
1883
1897
|
}, 8, ["loading", "disabled"])
|
|
@@ -1886,19 +1900,19 @@ const Mt = { class: "wx-article-editor__screen" }, Ut = 1200, Nt = /* @__PURE__
|
|
|
1886
1900
|
})
|
|
1887
1901
|
]),
|
|
1888
1902
|
default: i(() => [
|
|
1889
|
-
|
|
1890
|
-
|
|
1891
|
-
(x(!0),
|
|
1892
|
-
key:
|
|
1903
|
+
F("div", wa, [
|
|
1904
|
+
F("div", xa, [
|
|
1905
|
+
(x(!0), H(Te, null, qe(S.value, (U) => (x(), I(e(ae), {
|
|
1906
|
+
key: U.id,
|
|
1893
1907
|
size: "sm",
|
|
1894
1908
|
round: ""
|
|
1895
1909
|
}, {
|
|
1896
1910
|
default: i(() => [
|
|
1897
|
-
V(
|
|
1911
|
+
V(k(U.title) + " · " + k(U.articles_count), 1)
|
|
1898
1912
|
]),
|
|
1899
1913
|
_: 2
|
|
1900
1914
|
}, 1024))), 128)),
|
|
1901
|
-
r(e(
|
|
1915
|
+
r(e(Ae), {
|
|
1902
1916
|
name: "arrow-right",
|
|
1903
1917
|
size: "sm"
|
|
1904
1918
|
}),
|
|
@@ -1909,28 +1923,28 @@ const Mt = { class: "wx-article-editor__screen" }, Ut = 1200, Nt = /* @__PURE__
|
|
|
1909
1923
|
round: ""
|
|
1910
1924
|
}, {
|
|
1911
1925
|
default: i(() => [
|
|
1912
|
-
V(
|
|
1926
|
+
V(k(z.value.title) + " · " + k(z.value.articles_count), 1)
|
|
1913
1927
|
]),
|
|
1914
1928
|
_: 1
|
|
1915
|
-
})) :
|
|
1929
|
+
})) : K("", !0)
|
|
1916
1930
|
]),
|
|
1917
|
-
r(e(
|
|
1931
|
+
r(e(pe), {
|
|
1918
1932
|
label: e(o)("tag.merge-keep")
|
|
1919
1933
|
}, {
|
|
1920
1934
|
default: i(() => [
|
|
1921
|
-
r(e(
|
|
1922
|
-
modelValue:
|
|
1923
|
-
"onUpdate:modelValue":
|
|
1935
|
+
r(e($e), {
|
|
1936
|
+
modelValue: b.value,
|
|
1937
|
+
"onUpdate:modelValue": N[0] || (N[0] = (U) => b.value = U),
|
|
1924
1938
|
options: A.value,
|
|
1925
1939
|
"aria-label": e(o)("tag.merge-keep")
|
|
1926
1940
|
}, null, 8, ["modelValue", "options", "aria-label"])
|
|
1927
1941
|
]),
|
|
1928
1942
|
_: 1
|
|
1929
1943
|
}, 8, ["label"]),
|
|
1930
|
-
|
|
1931
|
-
r(e(
|
|
1932
|
-
modelValue:
|
|
1933
|
-
"onUpdate:modelValue":
|
|
1944
|
+
F("div", _a, [
|
|
1945
|
+
r(e(Wt), {
|
|
1946
|
+
modelValue: T.value,
|
|
1947
|
+
"onUpdate:modelValue": N[1] || (N[1] = (U) => T.value = U),
|
|
1934
1948
|
label: e(o)("tag.merge-redirect")
|
|
1935
1949
|
}, null, 8, ["modelValue", "label"]),
|
|
1936
1950
|
r(e(te), {
|
|
@@ -1938,12 +1952,12 @@ const Mt = { class: "wx-article-editor__screen" }, Ut = 1200, Nt = /* @__PURE__
|
|
|
1938
1952
|
tone: "muted"
|
|
1939
1953
|
}, {
|
|
1940
1954
|
default: i(() => [
|
|
1941
|
-
V(
|
|
1955
|
+
V(k(R.value.length === 0 ? e(o)("tag.merge-redirect-none") : e(o)("tag.merge-redirect-help", { addresses: R.value.join(", ") })), 1)
|
|
1942
1956
|
]),
|
|
1943
1957
|
_: 1
|
|
1944
1958
|
})
|
|
1945
1959
|
]),
|
|
1946
|
-
r(e(
|
|
1960
|
+
r(e(Ue), {
|
|
1947
1961
|
type: "warning",
|
|
1948
1962
|
variant: "soft",
|
|
1949
1963
|
description: e(o)("tag.merge-warning", {
|
|
@@ -1952,26 +1966,26 @@ const Mt = { class: "wx-article-editor__screen" }, Ut = 1200, Nt = /* @__PURE__
|
|
|
1952
1966
|
merged: S.value.length
|
|
1953
1967
|
})
|
|
1954
1968
|
}, null, 8, ["description"]),
|
|
1955
|
-
m.value ? (x(), I(e(
|
|
1969
|
+
m.value ? (x(), I(e(Ue), {
|
|
1956
1970
|
key: 0,
|
|
1957
1971
|
type: "danger",
|
|
1958
1972
|
variant: "soft",
|
|
1959
1973
|
description: m.value
|
|
1960
|
-
}, null, 8, ["description"])) :
|
|
1974
|
+
}, null, 8, ["description"])) : K("", !0)
|
|
1961
1975
|
])
|
|
1962
1976
|
]),
|
|
1963
1977
|
_: 1
|
|
1964
1978
|
}, 8, ["open", "title"]));
|
|
1965
1979
|
}
|
|
1966
|
-
}),
|
|
1980
|
+
}), $a = /* @__PURE__ */ ge(ka, [["__scopeId", "data-v-aa68b3a8"]]), Ta = { class: "wx-tags" }, Aa = /* @__PURE__ */ Q({
|
|
1967
1981
|
__name: "TagsPage",
|
|
1968
1982
|
props: {
|
|
1969
1983
|
base: { default: "/blog" }
|
|
1970
1984
|
},
|
|
1971
1985
|
setup(v) {
|
|
1972
|
-
const c = v, p = le(), g =
|
|
1986
|
+
const c = v, p = le(), g = oe(p), a = Ge(), s = je();
|
|
1973
1987
|
X();
|
|
1974
|
-
const t =
|
|
1988
|
+
const t = Z("webx-blog"), o = we(), l = M(null), b = M(!0), f = M([]), T = M(!1), m = Ve(ya), A = Ve(ma), z = Ve($a), S = h(() => p.can("blog.taxonomy.manage")), B = h(
|
|
1975
1989
|
() => p.state.manifest?.modules.find((u) => u.id === "tags")?.title ?? t("module.tags")
|
|
1976
1990
|
), R = h({
|
|
1977
1991
|
get: () => typeof a.query.view == "string" ? a.query.view : "",
|
|
@@ -1980,11 +1994,11 @@ const Mt = { class: "wx-article-editor__screen" }, Ut = 1200, Nt = /* @__PURE__
|
|
|
1980
1994
|
query: { ...a.query, view: u === "" ? void 0 : String(u), page: void 0 }
|
|
1981
1995
|
});
|
|
1982
1996
|
}
|
|
1983
|
-
}),
|
|
1984
|
-
{ value: "", label: t("tag.view-all"), badge:
|
|
1985
|
-
{ value: "empty", label: t("tag.view-empty"), badge:
|
|
1986
|
-
{ value: "noindex", label: t("tag.view-noindex"), badge:
|
|
1987
|
-
]),
|
|
1997
|
+
}), y = h(() => l.value?.filters ?? { total: 0, empty: 0, noindex: 0 }), W = h(() => [
|
|
1998
|
+
{ value: "", label: t("tag.view-all"), badge: y.value.total },
|
|
1999
|
+
{ value: "empty", label: t("tag.view-empty"), badge: y.value.empty },
|
|
2000
|
+
{ value: "noindex", label: t("tag.view-noindex"), badge: y.value.noindex }
|
|
2001
|
+
]), N = h(() => l.value?.data ?? []), U = h(() => N.value.filter((u) => f.value.includes(u.id))), $ = h(() => [
|
|
1988
2002
|
{ key: "title", label: t("tag.column-title"), minWidth: 150, sortable: !0 },
|
|
1989
2003
|
// The number is what the other columns and the narrowest the title may be add up to without
|
|
1990
2004
|
// this one: below it the address is what does not fit, and a fixed table does not shrink —
|
|
@@ -2002,7 +2016,7 @@ const Mt = { class: "wx-article-editor__screen" }, Ut = 1200, Nt = /* @__PURE__
|
|
|
2002
2016
|
// at 180px of text, and a cell keeps 32 of its own. Narrower, the ruled row wrapped and
|
|
2003
2017
|
// stood eighteen pixels taller than the ones around it.
|
|
2004
2018
|
{ key: "indexing", label: t("tag.column-indexing"), width: 230, hideBelow: 560 },
|
|
2005
|
-
{ key: "actions", label: "", width:
|
|
2019
|
+
{ key: "actions", label: "", width: Ye, align: "right" }
|
|
2006
2020
|
]);
|
|
2007
2021
|
function P(u) {
|
|
2008
2022
|
return {
|
|
@@ -2017,62 +2031,62 @@ const Mt = { class: "wx-article-editor__screen" }, Ut = 1200, Nt = /* @__PURE__
|
|
|
2017
2031
|
};
|
|
2018
2032
|
}
|
|
2019
2033
|
async function E(u) {
|
|
2020
|
-
|
|
2034
|
+
b.value = !0;
|
|
2021
2035
|
try {
|
|
2022
2036
|
l.value = await g.tagsPage(P(u));
|
|
2023
|
-
} catch (
|
|
2024
|
-
D.danger(o(
|
|
2037
|
+
} catch (C) {
|
|
2038
|
+
D.danger(o(C));
|
|
2025
2039
|
} finally {
|
|
2026
|
-
|
|
2040
|
+
b.value = !1;
|
|
2027
2041
|
}
|
|
2028
2042
|
}
|
|
2029
2043
|
function ie(u) {
|
|
2030
|
-
const
|
|
2031
|
-
if (!
|
|
2032
|
-
const
|
|
2033
|
-
return
|
|
2044
|
+
const C = u?.sort ?? Y();
|
|
2045
|
+
if (!C) return;
|
|
2046
|
+
const _ = C.key === "title" ? "name" : "articles", J = `${C.order === "desc" ? "-" : ""}${_}`;
|
|
2047
|
+
return J === "articles" ? void 0 : J;
|
|
2034
2048
|
}
|
|
2035
2049
|
function Y() {
|
|
2036
2050
|
const u = typeof a.query.sort == "string" ? a.query.sort : "";
|
|
2037
2051
|
if (u === "") return null;
|
|
2038
|
-
const
|
|
2039
|
-
return { key: (
|
|
2052
|
+
const C = u.startsWith("-");
|
|
2053
|
+
return { key: (C ? u.slice(1) : u) === "name" ? "title" : "articles_count", order: C ? "desc" : "asc" };
|
|
2040
2054
|
}
|
|
2041
2055
|
function ne(u) {
|
|
2042
|
-
const
|
|
2056
|
+
const C = {
|
|
2043
2057
|
...a.query,
|
|
2044
2058
|
q: u.search === "" ? void 0 : u.search,
|
|
2045
2059
|
sort: ie(u),
|
|
2046
2060
|
page: u.page === 1 ? void 0 : String(u.page)
|
|
2047
2061
|
};
|
|
2048
|
-
s.replace({ query:
|
|
2062
|
+
s.replace({ query: C }), E(u);
|
|
2049
2063
|
}
|
|
2050
|
-
|
|
2064
|
+
ve(R, () => {
|
|
2051
2065
|
f.value = [], E();
|
|
2052
2066
|
}), E();
|
|
2053
|
-
async function
|
|
2067
|
+
async function se() {
|
|
2054
2068
|
await A({}) && await E();
|
|
2055
2069
|
}
|
|
2056
|
-
async function
|
|
2057
|
-
const
|
|
2058
|
-
|
|
2070
|
+
async function O(u) {
|
|
2071
|
+
const C = await m({ name: u.title });
|
|
2072
|
+
C && await xe(u, { title: C }, t("tag.renamed"));
|
|
2059
2073
|
}
|
|
2060
|
-
async function he(u,
|
|
2061
|
-
await
|
|
2074
|
+
async function he(u, C) {
|
|
2075
|
+
await xe(u, { noindex: C }, t(C ? "tag.kept-out" : "tag.indexed"));
|
|
2062
2076
|
}
|
|
2063
|
-
async function
|
|
2077
|
+
async function xe(u, C, _) {
|
|
2064
2078
|
try {
|
|
2065
|
-
const
|
|
2079
|
+
const J = await g.saveTag(u.id, C);
|
|
2066
2080
|
l.value && (l.value = {
|
|
2067
2081
|
...l.value,
|
|
2068
|
-
data: l.value.data.map((me) => me.id ===
|
|
2069
|
-
}), D.success(
|
|
2070
|
-
} catch (
|
|
2071
|
-
D.danger(o(
|
|
2082
|
+
data: l.value.data.map((me) => me.id === J.id ? J : me)
|
|
2083
|
+
}), D.success(_);
|
|
2084
|
+
} catch (J) {
|
|
2085
|
+
D.danger(o(J));
|
|
2072
2086
|
}
|
|
2073
2087
|
}
|
|
2074
|
-
async function
|
|
2075
|
-
if (await
|
|
2088
|
+
async function re(u) {
|
|
2089
|
+
if (await de({
|
|
2076
2090
|
title: t("tag.delete-title", { title: u.title }),
|
|
2077
2091
|
message: u.articles_count > 0 ? t("tag.delete-text-used", { count: u.articles_count }) : t("tag.delete-text"),
|
|
2078
2092
|
confirmText: t("tag.delete"),
|
|
@@ -2080,9 +2094,9 @@ const Mt = { class: "wx-article-editor__screen" }, Ut = 1200, Nt = /* @__PURE__
|
|
|
2080
2094
|
tone: "danger"
|
|
2081
2095
|
}))
|
|
2082
2096
|
try {
|
|
2083
|
-
await g.removeTag(u.id), D.success(t("tag.deleted")), f.value = f.value.filter((
|
|
2084
|
-
} catch (
|
|
2085
|
-
D.danger(o(
|
|
2097
|
+
await g.removeTag(u.id), D.success(t("tag.deleted")), f.value = f.value.filter((_) => _ !== u.id), await E();
|
|
2098
|
+
} catch (_) {
|
|
2099
|
+
D.danger(o(_));
|
|
2086
2100
|
}
|
|
2087
2101
|
}
|
|
2088
2102
|
const fe = h(() => [
|
|
@@ -2090,7 +2104,7 @@ const Mt = { class: "wx-article-editor__screen" }, Ut = 1200, Nt = /* @__PURE__
|
|
|
2090
2104
|
key: "index",
|
|
2091
2105
|
icon: "eye",
|
|
2092
2106
|
label: t("tag.index"),
|
|
2093
|
-
disabled:
|
|
2107
|
+
disabled: T.value,
|
|
2094
2108
|
run: () => {
|
|
2095
2109
|
ee("index");
|
|
2096
2110
|
}
|
|
@@ -2099,7 +2113,7 @@ const Mt = { class: "wx-article-editor__screen" }, Ut = 1200, Nt = /* @__PURE__
|
|
|
2099
2113
|
key: "noindex",
|
|
2100
2114
|
icon: "eye-off",
|
|
2101
2115
|
label: t("tag.noindex"),
|
|
2102
|
-
disabled:
|
|
2116
|
+
disabled: T.value,
|
|
2103
2117
|
run: () => {
|
|
2104
2118
|
ee("noindex");
|
|
2105
2119
|
}
|
|
@@ -2109,32 +2123,32 @@ const Mt = { class: "wx-article-editor__screen" }, Ut = 1200, Nt = /* @__PURE__
|
|
|
2109
2123
|
icon: "trash",
|
|
2110
2124
|
label: t("tag.delete"),
|
|
2111
2125
|
danger: !0,
|
|
2112
|
-
disabled:
|
|
2126
|
+
disabled: T.value,
|
|
2113
2127
|
run: () => {
|
|
2114
2128
|
ee("delete");
|
|
2115
2129
|
}
|
|
2116
2130
|
}
|
|
2117
2131
|
]);
|
|
2118
|
-
function
|
|
2132
|
+
function We(u) {
|
|
2119
2133
|
if (!S.value) return [];
|
|
2120
|
-
const
|
|
2134
|
+
const C = [
|
|
2121
2135
|
{ key: "rename", icon: "edit", label: t("tag.rename"), run: () => {
|
|
2122
|
-
|
|
2136
|
+
O(u);
|
|
2123
2137
|
} }
|
|
2124
2138
|
];
|
|
2125
|
-
return u.url &&
|
|
2139
|
+
return u.url && C.push({
|
|
2126
2140
|
key: "site",
|
|
2127
2141
|
icon: "external-link",
|
|
2128
2142
|
label: t("tag.open-on-site"),
|
|
2129
2143
|
href: u.url
|
|
2130
|
-
}),
|
|
2144
|
+
}), C.push({
|
|
2131
2145
|
key: "articles",
|
|
2132
2146
|
icon: "list",
|
|
2133
2147
|
label: t("tag.show-articles"),
|
|
2134
2148
|
run: () => {
|
|
2135
2149
|
s.push({ path: `${c.base}/articles`, query: { tag: String(u.id) } });
|
|
2136
2150
|
}
|
|
2137
|
-
}),
|
|
2151
|
+
}), C.push(
|
|
2138
2152
|
u.noindex ? {
|
|
2139
2153
|
key: "index",
|
|
2140
2154
|
icon: "eye",
|
|
@@ -2150,91 +2164,91 @@ const Mt = { class: "wx-article-editor__screen" }, Ut = 1200, Nt = /* @__PURE__
|
|
|
2150
2164
|
he(u, !0);
|
|
2151
2165
|
}
|
|
2152
2166
|
}
|
|
2153
|
-
),
|
|
2167
|
+
), C.push({
|
|
2154
2168
|
key: "delete",
|
|
2155
2169
|
icon: "trash",
|
|
2156
2170
|
label: t("tag.delete"),
|
|
2157
2171
|
danger: !0,
|
|
2158
2172
|
run: () => {
|
|
2159
|
-
|
|
2173
|
+
re(u);
|
|
2160
2174
|
}
|
|
2161
|
-
}),
|
|
2175
|
+
}), C;
|
|
2162
2176
|
}
|
|
2163
|
-
function
|
|
2177
|
+
function _e(u) {
|
|
2164
2178
|
return u === "noindex" ? "muted" : "success";
|
|
2165
2179
|
}
|
|
2166
|
-
async function
|
|
2167
|
-
if (
|
|
2168
|
-
const u = await z({ tags:
|
|
2180
|
+
async function ue() {
|
|
2181
|
+
if (U.value.length < 2) return;
|
|
2182
|
+
const u = await z({ tags: U.value });
|
|
2169
2183
|
u && (D.success(t("tag.merged", { tag: u.tag.title, count: u.articles_count })), f.value = [], await E());
|
|
2170
2184
|
}
|
|
2171
2185
|
async function ee(u) {
|
|
2172
|
-
const
|
|
2173
|
-
if (!(
|
|
2186
|
+
const C = U.value.map((_) => _.id);
|
|
2187
|
+
if (!(C.length === 0 || T.value)) {
|
|
2174
2188
|
if (u === "delete") {
|
|
2175
|
-
const
|
|
2176
|
-
if (!await
|
|
2177
|
-
title: t("tag.delete-many-title", { count:
|
|
2178
|
-
message:
|
|
2189
|
+
const _ = U.value.reduce((me, n) => me + n.articles_count, 0);
|
|
2190
|
+
if (!await de({
|
|
2191
|
+
title: t("tag.delete-many-title", { count: C.length }),
|
|
2192
|
+
message: _ > 0 ? t("tag.delete-many-text-used", { count: _ }) : t("tag.delete-many-text"),
|
|
2179
2193
|
confirmText: t("tag.delete"),
|
|
2180
2194
|
cancelText: t("tag.cancel"),
|
|
2181
2195
|
tone: "danger"
|
|
2182
2196
|
})) return;
|
|
2183
2197
|
}
|
|
2184
|
-
|
|
2198
|
+
T.value = !0;
|
|
2185
2199
|
try {
|
|
2186
|
-
const
|
|
2200
|
+
const _ = await g.massTags(C, u);
|
|
2187
2201
|
D.success(
|
|
2188
|
-
u === "delete" ? t("tag.deleted-many", { count:
|
|
2202
|
+
u === "delete" ? t("tag.deleted-many", { count: _ }) : u === "index" ? t("tag.indexed-many", { count: _ }) : t("tag.kept-out-many", { count: _ })
|
|
2189
2203
|
), f.value = [], await E();
|
|
2190
|
-
} catch (
|
|
2191
|
-
D.danger(o(
|
|
2204
|
+
} catch (_) {
|
|
2205
|
+
D.danger(o(_));
|
|
2192
2206
|
} finally {
|
|
2193
|
-
|
|
2207
|
+
T.value = !1;
|
|
2194
2208
|
}
|
|
2195
2209
|
}
|
|
2196
2210
|
}
|
|
2197
|
-
const
|
|
2211
|
+
const ce = h(
|
|
2198
2212
|
() => S.value ? [{ key: "new", label: t("tag.new"), icon: "plus", primary: !0, run: () => {
|
|
2199
|
-
|
|
2213
|
+
se();
|
|
2200
2214
|
} }] : []
|
|
2201
2215
|
);
|
|
2202
|
-
return (u,
|
|
2203
|
-
r(e(
|
|
2216
|
+
return (u, C) => (x(), H("div", Ta, [
|
|
2217
|
+
r(e(et), {
|
|
2204
2218
|
view: R.value,
|
|
2205
|
-
"onUpdate:view":
|
|
2219
|
+
"onUpdate:view": C[1] || (C[1] = (_) => R.value = _),
|
|
2206
2220
|
title: B.value,
|
|
2207
2221
|
views: W.value,
|
|
2208
|
-
actions:
|
|
2222
|
+
actions: ce.value
|
|
2209
2223
|
}, {
|
|
2210
2224
|
default: i(() => [
|
|
2211
|
-
r(e(
|
|
2225
|
+
r(e(it), {
|
|
2212
2226
|
selected: f.value,
|
|
2213
|
-
"onUpdate:selected":
|
|
2227
|
+
"onUpdate:selected": C[0] || (C[0] = (_) => f.value = _),
|
|
2214
2228
|
data: l.value,
|
|
2215
|
-
columns:
|
|
2229
|
+
columns: $.value,
|
|
2216
2230
|
"row-key": "id",
|
|
2217
2231
|
searchable: "",
|
|
2218
2232
|
hover: "",
|
|
2219
2233
|
flush: "",
|
|
2220
2234
|
layout: "fixed",
|
|
2221
|
-
loading:
|
|
2235
|
+
loading: b.value,
|
|
2222
2236
|
selectable: S.value,
|
|
2223
2237
|
"cards-below": 0,
|
|
2224
2238
|
"search-placeholder": e(t)("tag.search"),
|
|
2225
|
-
"empty-text":
|
|
2239
|
+
"empty-text": N.value.length === 0 && !b.value ? e(t)("tag.empty") : void 0,
|
|
2226
2240
|
"aria-label": B.value,
|
|
2227
2241
|
onStateChange: ne
|
|
2228
2242
|
}, {
|
|
2229
|
-
"cell-title": i(({ row:
|
|
2243
|
+
"cell-title": i(({ row: _ }) => [
|
|
2230
2244
|
r(e(te), { truncate: "" }, {
|
|
2231
2245
|
default: i(() => [
|
|
2232
|
-
V(_
|
|
2246
|
+
V(k(_.title), 1)
|
|
2233
2247
|
]),
|
|
2234
2248
|
_: 2
|
|
2235
2249
|
}, 1024)
|
|
2236
2250
|
]),
|
|
2237
|
-
"cell-path": i(({ row:
|
|
2251
|
+
"cell-path": i(({ row: _ }) => [
|
|
2238
2252
|
r(e(te), {
|
|
2239
2253
|
size: "sm",
|
|
2240
2254
|
tone: "muted",
|
|
@@ -2242,33 +2256,33 @@ const Mt = { class: "wx-article-editor__screen" }, Ut = 1200, Nt = /* @__PURE__
|
|
|
2242
2256
|
truncate: ""
|
|
2243
2257
|
}, {
|
|
2244
2258
|
default: i(() => [
|
|
2245
|
-
V(_
|
|
2259
|
+
V(k(_.path ?? e(t)("tag.no-address")), 1)
|
|
2246
2260
|
]),
|
|
2247
2261
|
_: 2
|
|
2248
2262
|
}, 1024)
|
|
2249
2263
|
]),
|
|
2250
|
-
"cell-articles_count": i(({ row:
|
|
2264
|
+
"cell-articles_count": i(({ row: _ }) => [
|
|
2251
2265
|
r(e(te), {
|
|
2252
|
-
tone:
|
|
2266
|
+
tone: _.articles_count === 0 ? "muted" : "default"
|
|
2253
2267
|
}, {
|
|
2254
2268
|
default: i(() => [
|
|
2255
|
-
V(_
|
|
2269
|
+
V(k(_.articles_count), 1)
|
|
2256
2270
|
]),
|
|
2257
2271
|
_: 2
|
|
2258
2272
|
}, 1032, ["tone"])
|
|
2259
2273
|
]),
|
|
2260
|
-
"cell-indexing": i(({ row:
|
|
2261
|
-
|
|
2274
|
+
"cell-indexing": i(({ row: _ }) => [
|
|
2275
|
+
_.indexing === "rule" ? (x(), I(e(nt), {
|
|
2262
2276
|
key: 0,
|
|
2263
2277
|
content: e(t)("tag.indexing-rule-help")
|
|
2264
2278
|
}, {
|
|
2265
2279
|
default: i(() => [
|
|
2266
2280
|
r(e(te), {
|
|
2267
2281
|
size: "sm",
|
|
2268
|
-
tone:
|
|
2282
|
+
tone: _e(_.indexing)
|
|
2269
2283
|
}, {
|
|
2270
2284
|
default: i(() => [
|
|
2271
|
-
V(
|
|
2285
|
+
V(k(e(t)("tag.indexing-rule")), 1)
|
|
2272
2286
|
]),
|
|
2273
2287
|
_: 1
|
|
2274
2288
|
}, 8, ["tone"])
|
|
@@ -2277,18 +2291,18 @@ const Mt = { class: "wx-article-editor__screen" }, Ut = 1200, Nt = /* @__PURE__
|
|
|
2277
2291
|
}, 1032, ["content"])) : (x(), I(e(te), {
|
|
2278
2292
|
key: 1,
|
|
2279
2293
|
size: "sm",
|
|
2280
|
-
tone:
|
|
2294
|
+
tone: _e(_.indexing)
|
|
2281
2295
|
}, {
|
|
2282
2296
|
default: i(() => [
|
|
2283
|
-
V(
|
|
2297
|
+
V(k(e(t)(`tag.indexing-${_.indexing}`)), 1)
|
|
2284
2298
|
]),
|
|
2285
2299
|
_: 2
|
|
2286
2300
|
}, 1032, ["tone"]))
|
|
2287
2301
|
]),
|
|
2288
|
-
"cell-actions": i(({ row:
|
|
2289
|
-
r(e(
|
|
2290
|
-
actions:
|
|
2291
|
-
label:
|
|
2302
|
+
"cell-actions": i(({ row: _ }) => [
|
|
2303
|
+
r(e(ze), {
|
|
2304
|
+
actions: We(_),
|
|
2305
|
+
label: _.title
|
|
2292
2306
|
}, null, 8, ["actions", "label"])
|
|
2293
2307
|
]),
|
|
2294
2308
|
_: 1
|
|
@@ -2296,7 +2310,7 @@ const Mt = { class: "wx-article-editor__screen" }, Ut = 1200, Nt = /* @__PURE__
|
|
|
2296
2310
|
]),
|
|
2297
2311
|
_: 1
|
|
2298
2312
|
}, 8, ["view", "title", "views", "actions"]),
|
|
2299
|
-
|
|
2313
|
+
U.value.length > 0 ? (x(), I(e(lt), {
|
|
2300
2314
|
key: 0,
|
|
2301
2315
|
class: "wx-tags__bar",
|
|
2302
2316
|
sticky: ""
|
|
@@ -2304,37 +2318,37 @@ const Mt = { class: "wx-article-editor__screen" }, Ut = 1200, Nt = /* @__PURE__
|
|
|
2304
2318
|
state: i(() => [
|
|
2305
2319
|
r(e(te), { weight: "medium" }, {
|
|
2306
2320
|
default: i(() => [
|
|
2307
|
-
V(
|
|
2321
|
+
V(k(e(t)("tag.selected", { count: U.value.length })), 1)
|
|
2308
2322
|
]),
|
|
2309
2323
|
_: 1
|
|
2310
2324
|
})
|
|
2311
2325
|
]),
|
|
2312
2326
|
default: i(() => [
|
|
2313
|
-
r(e(
|
|
2327
|
+
r(e(G), {
|
|
2314
2328
|
type: "primary",
|
|
2315
|
-
disabled:
|
|
2316
|
-
onClick:
|
|
2329
|
+
disabled: U.value.length < 2 || T.value,
|
|
2330
|
+
onClick: ue
|
|
2317
2331
|
}, {
|
|
2318
2332
|
icon: i(() => [
|
|
2319
|
-
r(e(
|
|
2333
|
+
r(e(Ae), { name: "link" })
|
|
2320
2334
|
]),
|
|
2321
2335
|
default: i(() => [
|
|
2322
|
-
V(" " +
|
|
2336
|
+
V(" " + k(e(t)("tag.merge")), 1)
|
|
2323
2337
|
]),
|
|
2324
2338
|
_: 1
|
|
2325
2339
|
}, 8, ["disabled"]),
|
|
2326
|
-
r(e(
|
|
2340
|
+
r(e(ze), {
|
|
2327
2341
|
size: "lg",
|
|
2328
2342
|
actions: fe.value,
|
|
2329
|
-
label: e(t)("tag.selected", { count:
|
|
2343
|
+
label: e(t)("tag.selected", { count: U.value.length })
|
|
2330
2344
|
}, null, 8, ["actions", "label"])
|
|
2331
2345
|
]),
|
|
2332
2346
|
_: 1
|
|
2333
|
-
})) :
|
|
2347
|
+
})) : K("", !0)
|
|
2334
2348
|
]));
|
|
2335
2349
|
}
|
|
2336
|
-
}),
|
|
2337
|
-
function
|
|
2350
|
+
}), Sa = /* @__PURE__ */ ge(Aa, [["__scopeId", "data-v-beb86d88"]]);
|
|
2351
|
+
function Wa(v = "/blog") {
|
|
2338
2352
|
return {
|
|
2339
2353
|
api: "blog/rubrics",
|
|
2340
2354
|
path: `${v}/rubrics`,
|
|
@@ -2363,7 +2377,7 @@ function Aa(v = "/blog") {
|
|
|
2363
2377
|
}
|
|
2364
2378
|
};
|
|
2365
2379
|
}
|
|
2366
|
-
function
|
|
2380
|
+
function Na(v = {}) {
|
|
2367
2381
|
const c = v.path ?? "/blog";
|
|
2368
2382
|
return [
|
|
2369
2383
|
{
|
|
@@ -2375,13 +2389,13 @@ function Ma(v = {}) {
|
|
|
2375
2389
|
{
|
|
2376
2390
|
path: `${c}/articles`,
|
|
2377
2391
|
name: "webx.blog.articles",
|
|
2378
|
-
component:
|
|
2392
|
+
component: fa,
|
|
2379
2393
|
props: { base: c }
|
|
2380
2394
|
},
|
|
2381
2395
|
{
|
|
2382
2396
|
path: `${c}/articles/:id(\\d+)`,
|
|
2383
2397
|
name: "webx.blog.articles.edit",
|
|
2384
|
-
component:
|
|
2398
|
+
component: Pt,
|
|
2385
2399
|
props: { base: c }
|
|
2386
2400
|
}
|
|
2387
2401
|
],
|
|
@@ -2400,12 +2414,12 @@ function Ma(v = {}) {
|
|
|
2400
2414
|
* description — it is configuration the editor was handed with the record.
|
|
2401
2415
|
*/
|
|
2402
2416
|
types: {
|
|
2403
|
-
"wx-article-slug": { component:
|
|
2404
|
-
"wx-article-author": { component:
|
|
2405
|
-
"wx-article-tags": { component:
|
|
2406
|
-
"wx-article-related": { component:
|
|
2407
|
-
"wx-article-unpublish": { component:
|
|
2408
|
-
"wx-article-history": { component:
|
|
2417
|
+
"wx-article-slug": { component: Xt, kind: "field" },
|
|
2418
|
+
"wx-article-author": { component: Ut, kind: "field" },
|
|
2419
|
+
"wx-article-tags": { component: ia, kind: "field" },
|
|
2420
|
+
"wx-article-related": { component: jt, kind: "field" },
|
|
2421
|
+
"wx-article-unpublish": { component: sa, kind: "display" },
|
|
2422
|
+
"wx-article-history": { component: Ot, kind: "display" }
|
|
2409
2423
|
}
|
|
2410
2424
|
},
|
|
2411
2425
|
{
|
|
@@ -2413,7 +2427,7 @@ function Ma(v = {}) {
|
|
|
2413
2427
|
path: `${c}/rubrics`,
|
|
2414
2428
|
// The list and the page of one rubric are the panel's shared category screens (§3.6 of
|
|
2415
2429
|
// the services spec); what is the blog's is the description they are handed.
|
|
2416
|
-
routes:
|
|
2430
|
+
routes: gt(Wa(c))
|
|
2417
2431
|
},
|
|
2418
2432
|
{
|
|
2419
2433
|
id: "tags",
|
|
@@ -2422,7 +2436,7 @@ function Ma(v = {}) {
|
|
|
2422
2436
|
{
|
|
2423
2437
|
path: `${c}/tags`,
|
|
2424
2438
|
name: "webx.blog.tags",
|
|
2425
|
-
component:
|
|
2439
|
+
component: Sa,
|
|
2426
2440
|
props: { base: c }
|
|
2427
2441
|
}
|
|
2428
2442
|
]
|
|
@@ -2430,24 +2444,24 @@ function Ma(v = {}) {
|
|
|
2430
2444
|
];
|
|
2431
2445
|
}
|
|
2432
2446
|
export {
|
|
2433
|
-
|
|
2434
|
-
|
|
2435
|
-
|
|
2436
|
-
|
|
2437
|
-
|
|
2438
|
-
|
|
2439
|
-
|
|
2440
|
-
|
|
2441
|
-
|
|
2442
|
-
|
|
2443
|
-
|
|
2444
|
-
|
|
2445
|
-
|
|
2446
|
-
|
|
2447
|
-
|
|
2448
|
-
|
|
2449
|
-
|
|
2450
|
-
|
|
2451
|
-
|
|
2447
|
+
Ut as WxArticleAuthorField,
|
|
2448
|
+
ra as WxArticleCreateDialog,
|
|
2449
|
+
Pt as WxArticleEditorPage,
|
|
2450
|
+
Ot as WxArticleHistory,
|
|
2451
|
+
jt as WxArticleRelated,
|
|
2452
|
+
Xt as WxArticleSlug,
|
|
2453
|
+
ia as WxArticleTags,
|
|
2454
|
+
sa as WxArticleUnpublish,
|
|
2455
|
+
fa as WxArticlesPage,
|
|
2456
|
+
ma as WxTagCreateDialog,
|
|
2457
|
+
$a as WxTagMergeDialog,
|
|
2458
|
+
Sa as WxTagsPage,
|
|
2459
|
+
st as articleEditorKey,
|
|
2460
|
+
Na as blog,
|
|
2461
|
+
Mt as blogMessages,
|
|
2462
|
+
oe as createBlogApi,
|
|
2463
|
+
zt as provideArticleEditor,
|
|
2464
|
+
Wa as rubricsOptions,
|
|
2465
|
+
Se as useArticleEditor
|
|
2452
2466
|
};
|
|
2453
2467
|
//# sourceMappingURL=index.js.map
|