@webx-ui/module-blog 0.1.0 → 0.2.2
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/ArticleEditorPage.d.ts +1 -3
- package/dist/TagRenameDialog.d.ts +20 -0
- package/dist/TagsPage.d.ts +1 -3
- package/dist/index.js +1579 -1579
- 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 { provide as
|
|
2
|
-
import { useAdmin as
|
|
3
|
-
import { useLocales as
|
|
4
|
-
import { useRoute as
|
|
5
|
-
import { provideBlocksPreview as
|
|
6
|
-
const
|
|
7
|
-
function
|
|
8
|
-
|
|
1
|
+
import { provide as ct, inject as vt, defineComponent as ee, computed as v, openBlock as p, createElementBlock as Z, createVNode as n, unref as e, withCtx as l, createBlock as C, createTextVNode as w, toDisplayString as b, createCommentVNode as H, useModel as qe, mergeModels as Me, ref as z, watch as ue, onMounted as Ne, onBeforeUnmount as Je, Fragment as be, createElementVNode as j, renderList as Be, normalizeClass as Pe, useTemplateRef as De, nextTick as Ze, isRef as Ie, withKeys as ze, resolveDynamicComponent as tt, mergeProps as pt, useId as ft, withModifiers as at } from "vue";
|
|
2
|
+
import { useAdmin as ne, useTranslate as Q, useDates as mt, useErrorText as ge, WxScreenHead as bt, WxScreen as gt, WxSaveState as ht, WxDate as je, rowMenuWidth as st, WxListScreen as Qe, WxRowMenu as Re, WxFilterChips as yt } from "@webx-ui/module-admin";
|
|
3
|
+
import { useLocales as Xe, WxFormItem as ie, WxText as G, WxAlert as We, WxSelect as _e, localizedValue as wt, confirm as me, WxSkeleton as Ue, WxBadge as oe, WxBreadcrumb as _t, WxBreadcrumbItem as lt, WxButton as J, WxActionBar as rt, toast as L, WxEmpty as Ge, WxSortableList as Ye, WxAction as Oe, useModal as Ee, WxDialog as Fe, WxInput as Ae, WxSpace as Le, useElementWidth as xt, createModal as Ce, WxTable as ot, WxEntityCard as kt, WxIcon as we, WxTooltip as et, WxHeading as $t, WxTextarea as Tt, WxSwitch as Vt, WxCard as At, WxListDetail as St, WxCheckbox as Wt } from "@webx-ui/core";
|
|
4
|
+
import { useRoute as He, useRouter as Ke, onBeforeRouteLeave as Ct } from "vue-router";
|
|
5
|
+
import { provideBlocksPreview as zt } from "@webx-ui/module-blocks";
|
|
6
|
+
const ut = /* @__PURE__ */ Symbol("wx-article-editor");
|
|
7
|
+
function Rt(f) {
|
|
8
|
+
ct(ut, f);
|
|
9
9
|
}
|
|
10
|
-
function
|
|
11
|
-
return
|
|
10
|
+
function Se() {
|
|
11
|
+
return vt(ut, null);
|
|
12
12
|
}
|
|
13
|
-
const
|
|
13
|
+
const Ut = {
|
|
14
14
|
module: {
|
|
15
15
|
group: "Blog",
|
|
16
16
|
articles: "Articles",
|
|
@@ -44,6 +44,9 @@ const Rt = {
|
|
|
44
44
|
"view-draft": "Drafts",
|
|
45
45
|
"view-unpublished": "Off the site",
|
|
46
46
|
bin: "Bin",
|
|
47
|
+
"filter-rubric": "Rubric",
|
|
48
|
+
"filter-tag": "Tag",
|
|
49
|
+
"filter-author": "Author",
|
|
47
50
|
"any-rubric": "Any rubric",
|
|
48
51
|
"any-tag": "Any tag",
|
|
49
52
|
"any-author": "Any author",
|
|
@@ -73,9 +76,6 @@ const Rt = {
|
|
|
73
76
|
article: {
|
|
74
77
|
trail: "Where this article sits",
|
|
75
78
|
untitled: "Untitled",
|
|
76
|
-
"state-saved": "Saved",
|
|
77
|
-
"state-saving": "Saving…",
|
|
78
|
-
"state-unsaved": "Not saved yet",
|
|
79
79
|
save: "Save draft",
|
|
80
80
|
"save-failed": "The article was not saved.",
|
|
81
81
|
schedule: "Schedule",
|
|
@@ -226,681 +226,622 @@ const Rt = {
|
|
|
226
226
|
"merge-confirm": "Merge"
|
|
227
227
|
}
|
|
228
228
|
}, it = /* @__PURE__ */ new WeakSet();
|
|
229
|
-
function
|
|
229
|
+
function te() {
|
|
230
230
|
try {
|
|
231
|
-
const { i18n:
|
|
232
|
-
it.has(
|
|
231
|
+
const { i18n: f } = ne();
|
|
232
|
+
it.has(f) || (f.defaults("webx-blog", Ut), it.add(f));
|
|
233
233
|
} catch {
|
|
234
234
|
}
|
|
235
235
|
}
|
|
236
|
-
const
|
|
236
|
+
const qt = { class: "wx-article-address" }, Mt = /* @__PURE__ */ ee({
|
|
237
237
|
name: "WxArticleAddress",
|
|
238
238
|
__name: "ArticleAddress",
|
|
239
|
-
setup(
|
|
240
|
-
const
|
|
241
|
-
|
|
242
|
-
const
|
|
243
|
-
const
|
|
244
|
-
return typeof
|
|
245
|
-
}),
|
|
246
|
-
const
|
|
247
|
-
return typeof
|
|
239
|
+
setup(f) {
|
|
240
|
+
const m = Se(), r = Xe();
|
|
241
|
+
te();
|
|
242
|
+
const y = Q("webx-blog"), u = v(() => {
|
|
243
|
+
const s = m?.values.value.slug;
|
|
244
|
+
return typeof s == "string" ? s : s?.[r.active.value] ?? "";
|
|
245
|
+
}), a = v(() => u.value === "" ? null : `/${[m?.prefix.value ?? "", u.value].filter(Boolean).join("/")}`), t = v(() => {
|
|
246
|
+
const s = m?.article.value?.path;
|
|
247
|
+
return typeof s == "string" && a.value !== null && a.value !== `/${s}`;
|
|
248
248
|
});
|
|
249
|
-
return (
|
|
250
|
-
n(e(
|
|
251
|
-
label: e(
|
|
249
|
+
return (s, i) => (p(), Z("div", qt, [
|
|
250
|
+
n(e(ie), {
|
|
251
|
+
label: e(y)("article.address")
|
|
252
252
|
}, {
|
|
253
|
-
default:
|
|
254
|
-
|
|
253
|
+
default: l(() => [
|
|
254
|
+
a.value ? (p(), C(e(G), {
|
|
255
255
|
key: 0,
|
|
256
256
|
mono: "",
|
|
257
257
|
class: "wx-article-address__value"
|
|
258
258
|
}, {
|
|
259
|
-
default:
|
|
260
|
-
|
|
259
|
+
default: l(() => [
|
|
260
|
+
w(b(a.value), 1)
|
|
261
261
|
]),
|
|
262
262
|
_: 1
|
|
263
|
-
})) : (p(),
|
|
263
|
+
})) : (p(), C(e(G), {
|
|
264
264
|
key: 1,
|
|
265
265
|
size: "sm",
|
|
266
266
|
tone: "muted"
|
|
267
267
|
}, {
|
|
268
|
-
default:
|
|
269
|
-
|
|
268
|
+
default: l(() => [
|
|
269
|
+
w(b(e(y)("article.no-address")), 1)
|
|
270
270
|
]),
|
|
271
271
|
_: 1
|
|
272
272
|
}))
|
|
273
273
|
]),
|
|
274
274
|
_: 1
|
|
275
275
|
}, 8, ["label"]),
|
|
276
|
-
t.value ? (p(),
|
|
276
|
+
t.value ? (p(), C(e(We), {
|
|
277
277
|
key: 0,
|
|
278
278
|
type: "info",
|
|
279
279
|
variant: "soft",
|
|
280
|
-
description: e(
|
|
281
|
-
}, null, 8, ["description"])) :
|
|
280
|
+
description: e(y)("article.address-moving")
|
|
281
|
+
}, null, 8, ["description"])) : H("", !0)
|
|
282
282
|
]));
|
|
283
283
|
}
|
|
284
|
-
}),
|
|
285
|
-
const
|
|
286
|
-
for (const [
|
|
287
|
-
|
|
288
|
-
return
|
|
289
|
-
}, Nt = /* @__PURE__ */
|
|
284
|
+
}), ve = (f, m) => {
|
|
285
|
+
const r = f.__vccOpts || f;
|
|
286
|
+
for (const [y, u] of m)
|
|
287
|
+
r[y] = u;
|
|
288
|
+
return r;
|
|
289
|
+
}, Nt = /* @__PURE__ */ ve(Mt, [["__scopeId", "data-v-2ee0dcfe"]]), Bt = /* @__PURE__ */ ee({
|
|
290
290
|
name: "WxArticleAuthor",
|
|
291
291
|
__name: "ArticleAuthor",
|
|
292
|
-
props: /* @__PURE__ */
|
|
292
|
+
props: /* @__PURE__ */ Me({
|
|
293
293
|
disabled: { type: Boolean, default: !1 }
|
|
294
294
|
}, {
|
|
295
295
|
modelValue: { default: null },
|
|
296
296
|
modelModifiers: {}
|
|
297
297
|
}),
|
|
298
298
|
emits: ["update:modelValue"],
|
|
299
|
-
setup(
|
|
300
|
-
const
|
|
301
|
-
|
|
302
|
-
const
|
|
303
|
-
() => (
|
|
299
|
+
setup(f) {
|
|
300
|
+
const m = f, r = qe(f, "modelValue"), y = Se();
|
|
301
|
+
te();
|
|
302
|
+
const u = Q("webx-blog"), a = v(() => m.disabled || y?.disabled.value === !0), t = v(
|
|
303
|
+
() => (y?.options.value.authors ?? []).map((i) => ({
|
|
304
304
|
label: i.title,
|
|
305
305
|
value: i.id
|
|
306
306
|
}))
|
|
307
|
-
),
|
|
308
|
-
get: () =>
|
|
307
|
+
), s = v({
|
|
308
|
+
get: () => r.value,
|
|
309
309
|
set: (i) => {
|
|
310
|
-
|
|
310
|
+
r.value = typeof i == "number" ? i : null;
|
|
311
311
|
}
|
|
312
312
|
});
|
|
313
|
-
return (i,
|
|
314
|
-
modelValue:
|
|
315
|
-
"onUpdate:modelValue":
|
|
313
|
+
return (i, x) => (p(), C(e(_e), {
|
|
314
|
+
modelValue: s.value,
|
|
315
|
+
"onUpdate:modelValue": x[0] || (x[0] = (T) => s.value = T),
|
|
316
316
|
options: t.value,
|
|
317
|
-
placeholder: e(
|
|
318
|
-
disabled:
|
|
317
|
+
placeholder: e(u)("article.no-author"),
|
|
318
|
+
disabled: a.value,
|
|
319
319
|
clearable: "",
|
|
320
320
|
filterable: "",
|
|
321
321
|
teleport: "",
|
|
322
|
-
"aria-label": e(
|
|
322
|
+
"aria-label": e(u)("article.author")
|
|
323
323
|
}, null, 8, ["modelValue", "options", "placeholder", "disabled", "aria-label"]));
|
|
324
324
|
}
|
|
325
325
|
});
|
|
326
|
-
function
|
|
327
|
-
const
|
|
326
|
+
function de(f) {
|
|
327
|
+
const m = `${f.apiPath}/blog/articles`, r = `${f.apiPath}/blog/rubrics`, y = `${f.apiPath}/blog/tags`, u = (a) => a.data;
|
|
328
328
|
return {
|
|
329
|
-
articles: (
|
|
329
|
+
articles: (a = {}) => {
|
|
330
330
|
const t = new URLSearchParams();
|
|
331
|
-
|
|
332
|
-
const
|
|
333
|
-
return
|
|
331
|
+
a.q && t.set("q", a.q), a.rubric != null && t.set("rubric", String(a.rubric)), a.tag != null && t.set("tag", String(a.tag)), a.author != null && t.set("author", String(a.author)), a.status && t.set("status", a.status), a.sort && t.set("sort", a.sort), a.trashed && t.set("trashed", "1"), a.page && a.page > 1 && t.set("page", String(a.page)), a.per_page && t.set("per_page", String(a.per_page));
|
|
332
|
+
const s = t.size > 0 ? `?${t}` : "";
|
|
333
|
+
return f.http.get(`${m}${s}`).then((i) => ({ ...i.meta, data: i.data, filters: i.filters }));
|
|
334
334
|
},
|
|
335
|
-
get: (
|
|
336
|
-
create: (
|
|
337
|
-
save: (
|
|
338
|
-
discard: (
|
|
339
|
-
versions: (
|
|
340
|
-
restoreVersion: (
|
|
341
|
-
tags: (
|
|
342
|
-
const t =
|
|
343
|
-
return
|
|
335
|
+
get: (a) => f.http.get(`${m}/${a}`).then(u),
|
|
336
|
+
create: (a) => f.http.post(m, a).then(u),
|
|
337
|
+
save: (a, t) => f.http.put(`${m}/${a}`, t).then(u),
|
|
338
|
+
discard: (a) => f.http.post(`${m}/${a}/discard`, {}).then(u),
|
|
339
|
+
versions: (a) => f.http.get(`${m}/${a}/versions`).then(u),
|
|
340
|
+
restoreVersion: (a, t) => f.http.post(`${m}/${a}/versions/${t}/restore`, {}).then(u),
|
|
341
|
+
tags: (a = "") => {
|
|
342
|
+
const t = a.trim() === "" ? "" : `?q=${encodeURIComponent(a.trim())}`;
|
|
343
|
+
return f.http.get(`${y}${t}`).then(u);
|
|
344
344
|
},
|
|
345
|
-
createTag: (
|
|
346
|
-
publish: (
|
|
347
|
-
unpublish: (
|
|
348
|
-
remove: (
|
|
345
|
+
createTag: (a) => f.http.post(y, a).then(u),
|
|
346
|
+
publish: (a, t) => f.http.post(`${m}/${a}/publish`, t == null ? {} : { at: t }).then(u),
|
|
347
|
+
unpublish: (a) => f.http.post(`${m}/${a}/unpublish`, {}).then(u),
|
|
348
|
+
remove: (a) => f.http.delete(`${m}/${a}`).then(() => {
|
|
349
349
|
}),
|
|
350
|
-
restore: (
|
|
351
|
-
rubrics: () =>
|
|
352
|
-
createRubric: (
|
|
353
|
-
saveRubric: (
|
|
354
|
-
removeRubric: (
|
|
350
|
+
restore: (a) => f.http.post(`${m}/${a}/restore`, {}).then(u),
|
|
351
|
+
rubrics: () => f.http.get(r),
|
|
352
|
+
createRubric: (a) => f.http.post(r, a).then(u),
|
|
353
|
+
saveRubric: (a, t) => f.http.put(`${r}/${a}`, t).then(u),
|
|
354
|
+
removeRubric: (a) => f.http.delete(`${r}/${a}`).then(() => {
|
|
355
355
|
}),
|
|
356
|
-
sortRubrics: (
|
|
356
|
+
sortRubrics: (a) => f.http.post(`${r}/reorder`, { ids: a }).then(() => {
|
|
357
357
|
}),
|
|
358
|
-
tagsPage: (
|
|
358
|
+
tagsPage: (a = {}) => {
|
|
359
359
|
const t = new URLSearchParams();
|
|
360
|
-
|
|
361
|
-
const
|
|
362
|
-
return
|
|
360
|
+
a.q && t.set("q", a.q), a.empty && t.set("empty", "1"), a.noindex && t.set("noindex", "1"), a.sort && t.set("sort", a.sort), a.page && a.page > 1 && t.set("page", String(a.page)), a.per_page && t.set("per_page", String(a.per_page));
|
|
361
|
+
const s = t.size > 0 ? `?${t}` : "";
|
|
362
|
+
return f.http.get(`${y}${s}`).then((i) => ({ ...i.meta, data: i.data, filters: i.filters }));
|
|
363
363
|
},
|
|
364
|
-
saveTag: (
|
|
365
|
-
removeTag: (
|
|
364
|
+
saveTag: (a, t) => f.http.put(`${y}/${a}`, t).then(u),
|
|
365
|
+
removeTag: (a) => f.http.delete(`${y}/${a}`).then(() => {
|
|
366
366
|
}),
|
|
367
|
-
massTags: (
|
|
368
|
-
mergeTags: (
|
|
367
|
+
massTags: (a, t) => f.http.post(`${y}/mass`, { ids: a, action: t }).then((s) => s.data.affected),
|
|
368
|
+
mergeTags: (a, t, s) => f.http.post(`${y}/merge`, { ids: a, keep: t, redirect: s }).then(u)
|
|
369
369
|
};
|
|
370
370
|
}
|
|
371
|
-
const
|
|
371
|
+
const Pt = { class: "wx-article-editor__screen" }, Dt = 1200, It = /* @__PURE__ */ ee({
|
|
372
372
|
__name: "ArticleEditorPage",
|
|
373
373
|
props: {
|
|
374
374
|
base: { default: "/blog" }
|
|
375
375
|
},
|
|
376
|
-
setup(
|
|
377
|
-
const
|
|
378
|
-
|
|
379
|
-
const i =
|
|
380
|
-
const
|
|
381
|
-
return
|
|
382
|
-
}),
|
|
383
|
-
const
|
|
384
|
-
return typeof
|
|
385
|
-
}),
|
|
386
|
-
if (
|
|
387
|
-
const
|
|
388
|
-
return !Number.isNaN(
|
|
389
|
-
}),
|
|
390
|
-
const
|
|
391
|
-
if (!
|
|
392
|
-
const
|
|
376
|
+
setup(f) {
|
|
377
|
+
const m = f, r = ne(), y = de(r), u = He(), a = Ke(), t = Xe(), s = mt();
|
|
378
|
+
te();
|
|
379
|
+
const i = Q("webx-blog"), x = ge(), T = v(() => Number(u.params.id)), c = v(() => `${m.base}/articles`), o = z(null), _ = z({}), W = z(""), S = z(""), E = z(null), F = z({ rubrics: [], authors: [] }), $ = z([]), U = z(!0), R = z(!1), M = z(!1), A = z({}), I = z(null), K = z(""), P = z(0), q = v(() => r.can("blog.articles.manage")), k = v(() => !q.value || M.value), le = v(() => JSON.stringify(_.value)), O = v(() => K.value !== "" && le.value !== K.value), se = v(() => R.value ? "saving" : O.value ? "unsaved" : "saved"), xe = v(() => {
|
|
380
|
+
const V = _.value.title;
|
|
381
|
+
return wt(V, t.active.value, o.value?.title ?? "");
|
|
382
|
+
}), ce = v(() => {
|
|
383
|
+
const V = _.value.published_at;
|
|
384
|
+
return typeof V == "string" && V !== "" ? V : null;
|
|
385
|
+
}), he = v(() => {
|
|
386
|
+
if (ce.value === null) return !1;
|
|
387
|
+
const V = new Date(ce.value.replace(" ", "T"));
|
|
388
|
+
return !Number.isNaN(V.valueOf()) && V.valueOf() > Date.now();
|
|
389
|
+
}), Te = v(() => {
|
|
390
|
+
const V = o.value;
|
|
391
|
+
if (!V) return "";
|
|
392
|
+
const Y = s.short(V.published_at);
|
|
393
393
|
return {
|
|
394
394
|
draft: i("article.live-never"),
|
|
395
|
-
scheduled: i("article.live-scheduled", { date:
|
|
396
|
-
published: i("article.live-since", { date:
|
|
397
|
-
modified: `${i("article.live-since", { date:
|
|
395
|
+
scheduled: i("article.live-scheduled", { date: Y }),
|
|
396
|
+
published: i("article.live-since", { date: Y }),
|
|
397
|
+
modified: `${i("article.live-since", { date: Y })} · ${i("article.live-edited")}`,
|
|
398
398
|
unpublished: i("article.live-off")
|
|
399
|
-
}[
|
|
399
|
+
}[V.status] ?? "";
|
|
400
400
|
});
|
|
401
|
-
|
|
402
|
-
article:
|
|
403
|
-
values:
|
|
404
|
-
options:
|
|
405
|
-
related:
|
|
406
|
-
prefix:
|
|
407
|
-
base:
|
|
408
|
-
canManage:
|
|
409
|
-
disabled:
|
|
410
|
-
reload: () =>
|
|
411
|
-
save: () =>
|
|
401
|
+
zt({ url: v(() => E.value), reload: P }), Rt({
|
|
402
|
+
article: o,
|
|
403
|
+
values: _,
|
|
404
|
+
options: F,
|
|
405
|
+
related: $,
|
|
406
|
+
prefix: S,
|
|
407
|
+
base: m.base,
|
|
408
|
+
canManage: q.value,
|
|
409
|
+
disabled: k,
|
|
410
|
+
reload: () => pe(!0),
|
|
411
|
+
save: () => N()
|
|
412
412
|
});
|
|
413
|
-
function
|
|
414
|
-
|
|
413
|
+
function ke(V) {
|
|
414
|
+
o.value = V.article, _.value = V.values, W.value = V.revision, S.value = V.prefix, E.value = V.preview_url, F.value = V.options, $.value = V.related, K.value = JSON.stringify(V.values), I.value = null;
|
|
415
415
|
}
|
|
416
|
-
async function
|
|
417
|
-
|
|
416
|
+
async function pe(V = !1) {
|
|
417
|
+
V || (U.value = !0);
|
|
418
418
|
try {
|
|
419
|
-
|
|
420
|
-
} catch (
|
|
421
|
-
L.danger(
|
|
419
|
+
ke(await y.get(T.value));
|
|
420
|
+
} catch (Y) {
|
|
421
|
+
L.danger(x(Y)), a.push(c.value);
|
|
422
422
|
} finally {
|
|
423
|
-
|
|
423
|
+
U.value = !1;
|
|
424
424
|
}
|
|
425
425
|
}
|
|
426
|
-
let
|
|
427
|
-
function
|
|
428
|
-
!
|
|
429
|
-
|
|
430
|
-
},
|
|
426
|
+
let re;
|
|
427
|
+
function fe() {
|
|
428
|
+
!q.value || I.value || !O.value || (clearTimeout(re), re = setTimeout(() => {
|
|
429
|
+
N();
|
|
430
|
+
}, Dt));
|
|
431
431
|
}
|
|
432
|
-
function
|
|
433
|
-
!
|
|
432
|
+
function g() {
|
|
433
|
+
!q.value || I.value || !O.value || R.value || (clearTimeout(re), N());
|
|
434
434
|
}
|
|
435
|
-
async function
|
|
436
|
-
if (!
|
|
437
|
-
clearTimeout(
|
|
438
|
-
const
|
|
439
|
-
|
|
435
|
+
async function N() {
|
|
436
|
+
if (!o.value || R.value || !q.value) return;
|
|
437
|
+
clearTimeout(re);
|
|
438
|
+
const V = le.value, Y = _.value;
|
|
439
|
+
R.value = !0, A.value = {};
|
|
440
440
|
try {
|
|
441
|
-
const
|
|
442
|
-
|
|
443
|
-
} catch (
|
|
444
|
-
const
|
|
445
|
-
|
|
441
|
+
const ae = await y.save(o.value.id, { values: Y, revision: W.value });
|
|
442
|
+
o.value = ae.article, W.value = ae.revision, S.value = ae.prefix, E.value = ae.preview_url, F.value = ae.options, $.value = ae.related, I.value = null, le.value === V && (K.value = V), P.value += 1;
|
|
443
|
+
} catch (ae) {
|
|
444
|
+
const Ve = ae;
|
|
445
|
+
Ve.status === 409 && Ve.body?.data ? I.value = Ve.body : Ve.body?.errors ? (A.value = Ve.body.errors, L.danger(i("article.save-failed"))) : L.danger(x(ae));
|
|
446
446
|
} finally {
|
|
447
|
-
|
|
447
|
+
R.value = !1;
|
|
448
448
|
}
|
|
449
449
|
}
|
|
450
|
-
async function
|
|
451
|
-
await
|
|
450
|
+
async function B() {
|
|
451
|
+
await me({
|
|
452
452
|
title: i("article.conflict-theirs-title"),
|
|
453
453
|
message: i("article.conflict-theirs-text"),
|
|
454
454
|
confirmText: i("article.conflict-theirs"),
|
|
455
455
|
cancelText: i("panel.cancel"),
|
|
456
456
|
tone: "danger"
|
|
457
|
-
}) && await
|
|
457
|
+
}) && await pe(!0);
|
|
458
458
|
}
|
|
459
|
-
async function
|
|
460
|
-
const
|
|
461
|
-
|
|
459
|
+
async function X() {
|
|
460
|
+
const V = I.value;
|
|
461
|
+
V && (W.value = V.data.revision, I.value = null, await N());
|
|
462
462
|
}
|
|
463
|
-
async function
|
|
464
|
-
if (!(!
|
|
463
|
+
async function ye() {
|
|
464
|
+
if (!(!o.value || !await me({
|
|
465
465
|
title: i("article.discard-title"),
|
|
466
466
|
message: i("article.discard-text"),
|
|
467
467
|
confirmText: i("article.discard"),
|
|
468
468
|
cancelText: i("panel.cancel"),
|
|
469
469
|
tone: "danger"
|
|
470
470
|
}))) {
|
|
471
|
-
|
|
471
|
+
M.value = !0;
|
|
472
472
|
try {
|
|
473
|
-
|
|
474
|
-
} catch (
|
|
475
|
-
L.danger(
|
|
473
|
+
ke(await y.discard(o.value.id)), L.success(i("article.discarded"));
|
|
474
|
+
} catch (Y) {
|
|
475
|
+
L.danger(x(Y));
|
|
476
476
|
} finally {
|
|
477
|
-
|
|
477
|
+
M.value = !1;
|
|
478
478
|
}
|
|
479
479
|
}
|
|
480
480
|
}
|
|
481
|
-
async function
|
|
482
|
-
const
|
|
483
|
-
if (!
|
|
484
|
-
const
|
|
485
|
-
if (await
|
|
486
|
-
title: i("article.publish-title", { title:
|
|
487
|
-
message:
|
|
488
|
-
confirmText:
|
|
481
|
+
async function d() {
|
|
482
|
+
const V = o.value;
|
|
483
|
+
if (!V) return;
|
|
484
|
+
const Y = V.path === null ? null : `/${V.path}`, ae = ce.value === null ? i("article.publish-now") : s.short(ce.value);
|
|
485
|
+
if (await me({
|
|
486
|
+
title: i("article.publish-title", { title: V.title }),
|
|
487
|
+
message: he.value ? i("article.publish-later", { date: ae }) : Y === null ? i("article.publish-nowhere") : i("article.publish-text", { address: Y }),
|
|
488
|
+
confirmText: he.value ? i("article.schedule") : i("panel.publish"),
|
|
489
489
|
cancelText: i("panel.cancel")
|
|
490
|
-
}) && (
|
|
491
|
-
|
|
490
|
+
}) && (O.value && await N(), !I.value)) {
|
|
491
|
+
M.value = !0;
|
|
492
492
|
try {
|
|
493
|
-
await
|
|
494
|
-
} catch (
|
|
495
|
-
L.danger(
|
|
493
|
+
await y.publish(V.id, ce.value), await pe(!0), L.success(he.value ? i("article.scheduled") : i("panel.published"));
|
|
494
|
+
} catch (dt) {
|
|
495
|
+
L.danger(x(dt));
|
|
496
496
|
} finally {
|
|
497
|
-
|
|
497
|
+
M.value = !1;
|
|
498
498
|
}
|
|
499
499
|
}
|
|
500
500
|
}
|
|
501
|
-
function
|
|
502
|
-
const
|
|
503
|
-
return
|
|
501
|
+
function D() {
|
|
502
|
+
const V = o.value?.status;
|
|
503
|
+
return V === "published" ? "success" : V === "modified" ? "warning" : V === "scheduled" ? "primary" : "default";
|
|
504
504
|
}
|
|
505
|
-
function
|
|
506
|
-
|
|
505
|
+
function h(V) {
|
|
506
|
+
O.value && V.preventDefault();
|
|
507
507
|
}
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
}),
|
|
511
|
-
|
|
512
|
-
}),
|
|
513
|
-
clearTimeout(
|
|
514
|
-
}),
|
|
508
|
+
ue(le, fe), ue(T, () => {
|
|
509
|
+
pe();
|
|
510
|
+
}), Ne(() => {
|
|
511
|
+
pe(), window.addEventListener("beforeunload", h);
|
|
512
|
+
}), Je(() => {
|
|
513
|
+
clearTimeout(re), window.removeEventListener("beforeunload", h);
|
|
514
|
+
}), Ct(async () => !O.value || !q.value || (await N(), !O.value) ? !0 : await me({
|
|
515
515
|
title: i("article.leave-title"),
|
|
516
516
|
message: i("article.leave-text"),
|
|
517
517
|
confirmText: i("article.leave"),
|
|
518
518
|
cancelText: i("panel.cancel"),
|
|
519
519
|
tone: "danger"
|
|
520
|
-
}))
|
|
521
|
-
|
|
522
|
-
|
|
520
|
+
}));
|
|
521
|
+
const $e = v(() => {
|
|
522
|
+
const V = [];
|
|
523
|
+
return E.value && V.push({ key: "preview", label: i("article.preview"), icon: "eye", href: E.value }), o.value?.url && o.value.status !== "draft" && V.push({
|
|
524
|
+
key: "site",
|
|
525
|
+
label: i("panel.open-on-site"),
|
|
526
|
+
icon: "link",
|
|
527
|
+
href: o.value.url
|
|
528
|
+
}), V;
|
|
529
|
+
});
|
|
530
|
+
return (V, Y) => (p(), Z("div", {
|
|
523
531
|
class: "wx-article-editor",
|
|
524
|
-
onFocusout:
|
|
532
|
+
onFocusout: g
|
|
525
533
|
}, [
|
|
526
|
-
|
|
534
|
+
U.value || !o.value ? (p(), Z(be, { key: 0 }, [
|
|
527
535
|
n(e(Ue), {
|
|
528
536
|
class: "wx-article-editor__ghost",
|
|
529
537
|
title: "",
|
|
530
538
|
rows: 1
|
|
531
539
|
}),
|
|
532
540
|
n(e(Ue), { rows: 8 })
|
|
533
|
-
], 64)) : (p(),
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
541
|
+
], 64)) : (p(), Z(be, { key: 1 }, [
|
|
542
|
+
n(e(bt), {
|
|
543
|
+
divider: "",
|
|
544
|
+
back: c.value,
|
|
545
|
+
"back-label": e(i)("module.articles"),
|
|
546
|
+
title: xe.value || e(i)("article.untitled"),
|
|
547
|
+
actions: $e.value
|
|
548
|
+
}, {
|
|
549
|
+
trail: l(() => [
|
|
550
|
+
n(e(_t), {
|
|
542
551
|
size: "sm",
|
|
543
552
|
label: e(i)("article.trail")
|
|
544
553
|
}, {
|
|
545
|
-
default:
|
|
546
|
-
n(e(
|
|
554
|
+
default: l(() => [
|
|
555
|
+
n(e(lt), {
|
|
547
556
|
as: "router-link",
|
|
548
|
-
to:
|
|
557
|
+
to: c.value
|
|
549
558
|
}, {
|
|
550
|
-
default:
|
|
551
|
-
|
|
559
|
+
default: l(() => [
|
|
560
|
+
w(b(e(i)("module.articles")), 1)
|
|
552
561
|
]),
|
|
553
562
|
_: 1
|
|
554
563
|
}, 8, ["to"]),
|
|
555
|
-
n(e(
|
|
556
|
-
default:
|
|
557
|
-
|
|
564
|
+
n(e(lt), { current: "" }, {
|
|
565
|
+
default: l(() => [
|
|
566
|
+
w(b(xe.value || e(i)("article.untitled")), 1)
|
|
558
567
|
]),
|
|
559
568
|
_: 1
|
|
560
569
|
})
|
|
561
570
|
]),
|
|
562
571
|
_: 1
|
|
563
|
-
}, 8, ["label"])
|
|
564
|
-
q("div", Dt, [
|
|
565
|
-
q("span", It, f(he.value || e(i)("article.untitled")), 1),
|
|
566
|
-
n(e(re), {
|
|
567
|
-
type: vt(),
|
|
568
|
-
dot: ""
|
|
569
|
-
}, {
|
|
570
|
-
default: a(() => [
|
|
571
|
-
g(f(e(i)(`panel.status-${d.value.status}`)), 1)
|
|
572
|
-
]),
|
|
573
|
-
_: 1
|
|
574
|
-
}, 8, ["type"])
|
|
575
|
-
])
|
|
572
|
+
}, 8, ["label"])
|
|
576
573
|
]),
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
574
|
+
"title-after": l(() => [
|
|
575
|
+
n(e(oe), {
|
|
576
|
+
type: D(),
|
|
577
|
+
dot: ""
|
|
581
578
|
}, {
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
type: "more",
|
|
585
|
-
title: e(i)("article.more")
|
|
586
|
-
}, null, 8, ["title"])
|
|
587
|
-
]),
|
|
588
|
-
default: a(() => [
|
|
589
|
-
M.value ? (p(), V(e(lt), {
|
|
590
|
-
key: 0,
|
|
591
|
-
icon: "eye",
|
|
592
|
-
href: M.value,
|
|
593
|
-
target: "_blank",
|
|
594
|
-
rel: "noopener"
|
|
595
|
-
}, {
|
|
596
|
-
default: a(() => [
|
|
597
|
-
g(f(e(i)("article.preview")), 1)
|
|
598
|
-
]),
|
|
599
|
-
_: 1
|
|
600
|
-
}, 8, ["href"])) : I("", !0),
|
|
601
|
-
d.value.url && d.value.status !== "draft" ? (p(), V(e(lt), {
|
|
602
|
-
key: 1,
|
|
603
|
-
icon: "link",
|
|
604
|
-
href: d.value.url,
|
|
605
|
-
target: "_blank",
|
|
606
|
-
rel: "noopener"
|
|
607
|
-
}, {
|
|
608
|
-
default: a(() => [
|
|
609
|
-
g(f(e(i)("panel.open-on-site")), 1)
|
|
610
|
-
]),
|
|
611
|
-
_: 1
|
|
612
|
-
}, 8, ["href"])) : I("", !0)
|
|
579
|
+
default: l(() => [
|
|
580
|
+
w(b(e(i)(`panel.status-${o.value.status}`)), 1)
|
|
613
581
|
]),
|
|
614
582
|
_: 1
|
|
615
|
-
}
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
href: M.value,
|
|
621
|
-
target: "_blank",
|
|
622
|
-
rel: "noopener"
|
|
623
|
-
}, {
|
|
624
|
-
default: a(() => [
|
|
625
|
-
g(f(e(i)("article.preview")), 1)
|
|
626
|
-
]),
|
|
627
|
-
_: 1
|
|
628
|
-
}, 8, ["href"])) : I("", !0),
|
|
629
|
-
d.value.url && d.value.status !== "draft" ? (p(), V(e(F), {
|
|
630
|
-
key: 1,
|
|
631
|
-
variant: "outline",
|
|
632
|
-
icon: "link",
|
|
633
|
-
href: d.value.url,
|
|
634
|
-
target: "_blank",
|
|
635
|
-
rel: "noopener"
|
|
636
|
-
}, {
|
|
637
|
-
default: a(() => [
|
|
638
|
-
g(f(e(i)("panel.open-on-site")), 1)
|
|
639
|
-
]),
|
|
640
|
-
_: 1
|
|
641
|
-
}, 8, ["href"])) : I("", !0)
|
|
642
|
-
], 64))
|
|
643
|
-
])
|
|
644
|
-
]),
|
|
645
|
-
N.value ? (p(), V(e(Se), {
|
|
583
|
+
}, 8, ["type"])
|
|
584
|
+
]),
|
|
585
|
+
_: 1
|
|
586
|
+
}, 8, ["back", "back-label", "title", "actions"]),
|
|
587
|
+
I.value ? (p(), C(e(We), {
|
|
646
588
|
key: 0,
|
|
647
589
|
type: "warning",
|
|
648
590
|
title: e(i)("article.conflict-title"),
|
|
649
|
-
description:
|
|
591
|
+
description: I.value.message
|
|
650
592
|
}, {
|
|
651
|
-
actions:
|
|
652
|
-
n(e(
|
|
593
|
+
actions: l(() => [
|
|
594
|
+
n(e(J), {
|
|
653
595
|
size: "sm",
|
|
654
596
|
variant: "outline",
|
|
655
|
-
onClick:
|
|
597
|
+
onClick: B
|
|
656
598
|
}, {
|
|
657
|
-
default:
|
|
658
|
-
|
|
599
|
+
default: l(() => [
|
|
600
|
+
w(b(e(i)("article.conflict-theirs")), 1)
|
|
659
601
|
]),
|
|
660
602
|
_: 1
|
|
661
603
|
}),
|
|
662
|
-
n(e(
|
|
604
|
+
n(e(J), {
|
|
663
605
|
size: "sm",
|
|
664
606
|
type: "primary",
|
|
665
|
-
onClick:
|
|
607
|
+
onClick: X
|
|
666
608
|
}, {
|
|
667
|
-
default:
|
|
668
|
-
|
|
609
|
+
default: l(() => [
|
|
610
|
+
w(b(e(i)("article.conflict-mine")), 1)
|
|
669
611
|
]),
|
|
670
612
|
_: 1
|
|
671
613
|
})
|
|
672
614
|
]),
|
|
673
615
|
_: 1
|
|
674
|
-
}, 8, ["title", "description"])) :
|
|
675
|
-
|
|
676
|
-
n(e(
|
|
677
|
-
modelValue:
|
|
678
|
-
"onUpdate:modelValue":
|
|
616
|
+
}, 8, ["title", "description"])) : H("", !0),
|
|
617
|
+
j("div", Pt, [
|
|
618
|
+
n(e(gt), {
|
|
619
|
+
modelValue: _.value,
|
|
620
|
+
"onUpdate:modelValue": Y[0] || (Y[0] = (ae) => _.value = ae),
|
|
679
621
|
name: "blog.article-form",
|
|
680
622
|
errors: A.value,
|
|
681
|
-
disabled:
|
|
623
|
+
disabled: k.value
|
|
682
624
|
}, null, 8, ["modelValue", "errors", "disabled"])
|
|
683
625
|
]),
|
|
684
|
-
|
|
685
|
-
state:
|
|
686
|
-
n(e(
|
|
626
|
+
q.value ? (p(), C(e(rt), { key: 1 }, {
|
|
627
|
+
state: l(() => [
|
|
628
|
+
n(e(ht), { state: se.value }, null, 8, ["state"]),
|
|
629
|
+
Te.value ? (p(), C(e(G), {
|
|
630
|
+
key: 0,
|
|
687
631
|
size: "sm",
|
|
688
632
|
tone: "muted"
|
|
689
633
|
}, {
|
|
690
|
-
default:
|
|
691
|
-
|
|
692
|
-
ye.value ? (p(), K(ne, { key: 0 }, [
|
|
693
|
-
g(" · " + f(ye.value), 1)
|
|
694
|
-
], 64)) : I("", !0)
|
|
634
|
+
default: l(() => [
|
|
635
|
+
w(b(Te.value), 1)
|
|
695
636
|
]),
|
|
696
637
|
_: 1
|
|
697
|
-
})
|
|
638
|
+
})) : H("", !0)
|
|
698
639
|
]),
|
|
699
|
-
default:
|
|
700
|
-
|
|
640
|
+
default: l(() => [
|
|
641
|
+
o.value.status === "modified" ? (p(), C(e(J), {
|
|
701
642
|
key: 0,
|
|
702
643
|
variant: "text",
|
|
703
|
-
loading:
|
|
704
|
-
onClick:
|
|
644
|
+
loading: M.value,
|
|
645
|
+
onClick: ye
|
|
705
646
|
}, {
|
|
706
|
-
default:
|
|
707
|
-
|
|
647
|
+
default: l(() => [
|
|
648
|
+
w(b(e(i)("article.discard")), 1)
|
|
708
649
|
]),
|
|
709
650
|
_: 1
|
|
710
|
-
}, 8, ["loading"])) :
|
|
711
|
-
n(e(
|
|
651
|
+
}, 8, ["loading"])) : H("", !0),
|
|
652
|
+
n(e(J), {
|
|
712
653
|
variant: "outline",
|
|
713
|
-
loading:
|
|
714
|
-
disabled: !
|
|
715
|
-
onClick:
|
|
654
|
+
loading: R.value,
|
|
655
|
+
disabled: !O.value,
|
|
656
|
+
onClick: N
|
|
716
657
|
}, {
|
|
717
|
-
default:
|
|
718
|
-
|
|
658
|
+
default: l(() => [
|
|
659
|
+
w(b(e(i)("article.save")), 1)
|
|
719
660
|
]),
|
|
720
661
|
_: 1
|
|
721
662
|
}, 8, ["loading", "disabled"]),
|
|
722
|
-
n(e(
|
|
663
|
+
n(e(J), {
|
|
723
664
|
type: "primary",
|
|
724
|
-
loading:
|
|
725
|
-
disabled:
|
|
726
|
-
onClick:
|
|
665
|
+
loading: M.value,
|
|
666
|
+
disabled: o.value.status === "published" && !O.value,
|
|
667
|
+
onClick: d
|
|
727
668
|
}, {
|
|
728
|
-
default:
|
|
729
|
-
|
|
669
|
+
default: l(() => [
|
|
670
|
+
w(b(he.value ? e(i)("article.schedule") : e(i)("panel.publish")), 1)
|
|
730
671
|
]),
|
|
731
672
|
_: 1
|
|
732
673
|
}, 8, ["loading", "disabled"])
|
|
733
674
|
]),
|
|
734
675
|
_: 1
|
|
735
|
-
})) :
|
|
676
|
+
})) : H("", !0)
|
|
736
677
|
], 64))
|
|
737
|
-
],
|
|
678
|
+
], 32));
|
|
738
679
|
}
|
|
739
|
-
}),
|
|
680
|
+
}), Ot = /* @__PURE__ */ ve(It, [["__scopeId", "data-v-45a48838"]]), Et = { class: "wx-article-history" }, Ft = { class: "wx-article-history__number" }, Lt = { class: "wx-article-history__who" }, Ht = /* @__PURE__ */ ee({
|
|
740
681
|
name: "WxArticleHistory",
|
|
741
682
|
__name: "ArticleHistory",
|
|
742
|
-
setup(
|
|
743
|
-
const
|
|
744
|
-
|
|
745
|
-
const
|
|
683
|
+
setup(f) {
|
|
684
|
+
const m = ne(), r = de(m), y = Se();
|
|
685
|
+
te();
|
|
686
|
+
const u = Q("webx-blog"), a = ge(), t = z(null), s = z(!1), i = v(() => y?.article.value ?? null), x = v(() => m.can("blog.articles.manage")), T = v(
|
|
746
687
|
() => i.value?.status === "published" || i.value?.status === "modified" ? t.value?.[0]?.number ?? null : null
|
|
747
688
|
);
|
|
748
|
-
async function
|
|
749
|
-
const
|
|
750
|
-
if (
|
|
689
|
+
async function c() {
|
|
690
|
+
const _ = i.value;
|
|
691
|
+
if (_)
|
|
751
692
|
try {
|
|
752
|
-
t.value = await
|
|
753
|
-
} catch (
|
|
754
|
-
t.value = [], L.danger(
|
|
693
|
+
t.value = await r.versions(_.id);
|
|
694
|
+
} catch (W) {
|
|
695
|
+
t.value = [], L.danger(a(W));
|
|
755
696
|
}
|
|
756
697
|
}
|
|
757
|
-
async function
|
|
758
|
-
const
|
|
759
|
-
if (!(!
|
|
760
|
-
title:
|
|
761
|
-
message:
|
|
762
|
-
confirmText:
|
|
763
|
-
cancelText:
|
|
698
|
+
async function o(_) {
|
|
699
|
+
const W = i.value;
|
|
700
|
+
if (!(!W || !await me({
|
|
701
|
+
title: u("article.restore-title", { number: _.number }),
|
|
702
|
+
message: u("article.restore-text"),
|
|
703
|
+
confirmText: u("article.restore-version"),
|
|
704
|
+
cancelText: u("panel.cancel")
|
|
764
705
|
}))) {
|
|
765
|
-
|
|
706
|
+
s.value = !0;
|
|
766
707
|
try {
|
|
767
|
-
await
|
|
768
|
-
} catch (
|
|
769
|
-
L.danger(
|
|
708
|
+
await r.restoreVersion(W.id, _.number), await y?.reload(), L.success(u("article.restored-version", { number: _.number }));
|
|
709
|
+
} catch (E) {
|
|
710
|
+
L.danger(a(E));
|
|
770
711
|
} finally {
|
|
771
|
-
|
|
712
|
+
s.value = !1;
|
|
772
713
|
}
|
|
773
714
|
}
|
|
774
715
|
}
|
|
775
|
-
return
|
|
716
|
+
return ue(
|
|
776
717
|
() => [i.value?.id, i.value?.published_at, i.value?.updated_at],
|
|
777
718
|
() => {
|
|
778
|
-
|
|
719
|
+
c();
|
|
779
720
|
},
|
|
780
721
|
{ immediate: !0 }
|
|
781
|
-
), (
|
|
782
|
-
t.value === null ? (p(),
|
|
722
|
+
), (_, W) => (p(), Z("div", Et, [
|
|
723
|
+
t.value === null ? (p(), C(e(Ue), {
|
|
783
724
|
key: 0,
|
|
784
725
|
class: "wx-article-history__ghost",
|
|
785
726
|
rows: 3
|
|
786
|
-
})) : t.value.length === 0 ? (p(),
|
|
727
|
+
})) : t.value.length === 0 ? (p(), C(e(Ge), {
|
|
787
728
|
key: 1,
|
|
788
|
-
description: e(
|
|
789
|
-
}, null, 8, ["description"])) : (p(!0),
|
|
790
|
-
key:
|
|
791
|
-
class:
|
|
729
|
+
description: e(u)("article.history-empty")
|
|
730
|
+
}, null, 8, ["description"])) : (p(!0), Z(be, { key: 2 }, Be(t.value, (S) => (p(), Z("div", {
|
|
731
|
+
key: S.number,
|
|
732
|
+
class: Pe(["wx-article-history__row", { "is-live": S.number === T.value }])
|
|
792
733
|
}, [
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
734
|
+
j("code", Ft, b(e(u)("article.version", { number: S.number })), 1),
|
|
735
|
+
j("div", Lt, [
|
|
736
|
+
S.created_at ? (p(), C(e(je), {
|
|
796
737
|
key: 0,
|
|
797
|
-
value:
|
|
738
|
+
value: S.created_at,
|
|
798
739
|
size: "md",
|
|
799
740
|
tone: "default"
|
|
800
|
-
}, null, 8, ["value"])) :
|
|
741
|
+
}, null, 8, ["value"])) : H("", !0),
|
|
801
742
|
n(e(G), {
|
|
802
743
|
size: "sm",
|
|
803
744
|
tone: "muted"
|
|
804
745
|
}, {
|
|
805
|
-
default:
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
], 64)) :
|
|
746
|
+
default: l(() => [
|
|
747
|
+
w(b(S.author ?? e(u)(`article.source-${S.source}`)) + " ", 1),
|
|
748
|
+
S.comment ? (p(), Z(be, { key: 0 }, [
|
|
749
|
+
w(" · " + b(S.comment), 1)
|
|
750
|
+
], 64)) : H("", !0)
|
|
810
751
|
]),
|
|
811
752
|
_: 2
|
|
812
753
|
}, 1024)
|
|
813
754
|
]),
|
|
814
|
-
|
|
755
|
+
S.number === T.value ? (p(), C(e(oe), {
|
|
815
756
|
key: 0,
|
|
816
757
|
type: "success",
|
|
817
758
|
dot: ""
|
|
818
759
|
}, {
|
|
819
|
-
default:
|
|
820
|
-
|
|
760
|
+
default: l(() => [
|
|
761
|
+
w(b(e(u)("article.version-live")), 1)
|
|
821
762
|
]),
|
|
822
763
|
_: 1
|
|
823
|
-
})) :
|
|
824
|
-
|
|
764
|
+
})) : H("", !0),
|
|
765
|
+
x.value && S.number !== T.value ? (p(), C(e(J), {
|
|
825
766
|
key: 1,
|
|
826
767
|
size: "sm",
|
|
827
768
|
variant: "outline",
|
|
828
|
-
loading:
|
|
829
|
-
onClick: (
|
|
769
|
+
loading: s.value,
|
|
770
|
+
onClick: (E) => o(S)
|
|
830
771
|
}, {
|
|
831
|
-
default:
|
|
832
|
-
|
|
772
|
+
default: l(() => [
|
|
773
|
+
w(b(e(u)("article.restore-version")), 1)
|
|
833
774
|
]),
|
|
834
775
|
_: 1
|
|
835
|
-
}, 8, ["loading", "onClick"])) :
|
|
776
|
+
}, 8, ["loading", "onClick"])) : H("", !0)
|
|
836
777
|
], 2))), 128))
|
|
837
778
|
]));
|
|
838
779
|
}
|
|
839
|
-
}),
|
|
780
|
+
}), Kt = /* @__PURE__ */ ve(Ht, [["__scopeId", "data-v-0a997938"]]), jt = { class: "wx-article-related" }, Gt = { class: "wx-article-related__name" }, Jt = 250, Zt = 10, Qt = /* @__PURE__ */ ee({
|
|
840
781
|
name: "WxArticleRelated",
|
|
841
782
|
__name: "ArticleRelated",
|
|
842
|
-
props: /* @__PURE__ */
|
|
783
|
+
props: /* @__PURE__ */ Me({
|
|
843
784
|
disabled: { type: Boolean, default: !1 }
|
|
844
785
|
}, {
|
|
845
786
|
modelValue: { default: () => [] },
|
|
846
787
|
modelModifiers: {}
|
|
847
788
|
}),
|
|
848
789
|
emits: ["update:modelValue"],
|
|
849
|
-
setup(
|
|
850
|
-
const
|
|
851
|
-
|
|
852
|
-
const t =
|
|
853
|
-
let
|
|
854
|
-
|
|
855
|
-
() =>
|
|
856
|
-
(
|
|
857
|
-
const
|
|
858
|
-
for (const
|
|
859
|
-
|
|
790
|
+
setup(f) {
|
|
791
|
+
const m = f, r = qe(f, "modelValue"), y = ne(), u = de(y), a = Se();
|
|
792
|
+
te();
|
|
793
|
+
const t = Q("webx-blog"), s = ge(), i = v(() => m.disabled || a?.disabled.value === !0), x = z(/* @__PURE__ */ new Map()), T = z([]);
|
|
794
|
+
let c;
|
|
795
|
+
ue(
|
|
796
|
+
() => a?.related.value,
|
|
797
|
+
($) => {
|
|
798
|
+
const U = new Map(x.value);
|
|
799
|
+
for (const R of $ ?? []) U.set(R.id, R.title);
|
|
800
|
+
x.value = U;
|
|
860
801
|
},
|
|
861
802
|
{ immediate: !0, deep: !0 }
|
|
862
803
|
);
|
|
863
|
-
const
|
|
864
|
-
get: () =>
|
|
865
|
-
set: (
|
|
866
|
-
|
|
804
|
+
const o = v({
|
|
805
|
+
get: () => r.value.map(($) => ({ id: $, title: x.value.get($) ?? `#${$}` })),
|
|
806
|
+
set: ($) => {
|
|
807
|
+
r.value = $.map((U) => U.id);
|
|
867
808
|
}
|
|
868
|
-
}),
|
|
869
|
-
() => T.value.filter((
|
|
809
|
+
}), _ = v(
|
|
810
|
+
() => T.value.filter(($) => !r.value.includes($.id)).map(($) => ({ label: $.title, value: $.id }))
|
|
870
811
|
);
|
|
871
|
-
async function
|
|
872
|
-
const
|
|
812
|
+
async function W($) {
|
|
813
|
+
const U = a?.article.value?.id;
|
|
873
814
|
try {
|
|
874
|
-
const
|
|
875
|
-
T.value =
|
|
876
|
-
const
|
|
877
|
-
for (const A of T.value)
|
|
878
|
-
|
|
879
|
-
} catch (
|
|
880
|
-
L.danger(
|
|
815
|
+
const R = await u.articles({ q: $, per_page: Zt });
|
|
816
|
+
T.value = R.data.filter((A) => A.id !== U).map((A) => ({ id: A.id, title: A.title }));
|
|
817
|
+
const M = new Map(x.value);
|
|
818
|
+
for (const A of T.value) M.set(A.id, A.title);
|
|
819
|
+
x.value = M;
|
|
820
|
+
} catch (R) {
|
|
821
|
+
L.danger(s(R));
|
|
881
822
|
}
|
|
882
823
|
}
|
|
883
|
-
function
|
|
884
|
-
clearTimeout(
|
|
885
|
-
|
|
886
|
-
},
|
|
824
|
+
function S($) {
|
|
825
|
+
clearTimeout(c), c = setTimeout(() => {
|
|
826
|
+
W($);
|
|
827
|
+
}, Jt);
|
|
887
828
|
}
|
|
888
|
-
function
|
|
889
|
-
typeof
|
|
829
|
+
function E($) {
|
|
830
|
+
typeof $ != "number" || r.value.includes($) || (r.value = [...r.value, $]);
|
|
890
831
|
}
|
|
891
|
-
function
|
|
892
|
-
|
|
832
|
+
function F($) {
|
|
833
|
+
r.value = r.value.filter((U) => U !== $);
|
|
893
834
|
}
|
|
894
|
-
return
|
|
895
|
-
() =>
|
|
835
|
+
return ue(
|
|
836
|
+
() => a?.article.value?.id,
|
|
896
837
|
() => {
|
|
897
|
-
|
|
838
|
+
W("");
|
|
898
839
|
},
|
|
899
840
|
{ immediate: !0 }
|
|
900
|
-
),
|
|
901
|
-
n(e(
|
|
902
|
-
modelValue:
|
|
903
|
-
"onUpdate:modelValue":
|
|
841
|
+
), Je(() => clearTimeout(c)), ($, U) => (p(), Z("div", jt, [
|
|
842
|
+
n(e(Ye), {
|
|
843
|
+
modelValue: o.value,
|
|
844
|
+
"onUpdate:modelValue": U[0] || (U[0] = (R) => o.value = R),
|
|
904
845
|
plain: "",
|
|
905
846
|
size: "sm",
|
|
906
847
|
"item-key": "id",
|
|
@@ -909,302 +850,302 @@ const Mt = { class: "wx-article-editor__head" }, Pt = { class: "wx-article-edito
|
|
|
909
850
|
"empty-text": e(t)("article.related-empty"),
|
|
910
851
|
"aria-label": e(t)("article.related")
|
|
911
852
|
}, {
|
|
912
|
-
default:
|
|
913
|
-
|
|
853
|
+
default: l(({ item: R }) => [
|
|
854
|
+
j("span", Gt, b(R.title), 1)
|
|
914
855
|
]),
|
|
915
|
-
actions:
|
|
916
|
-
n(e(
|
|
856
|
+
actions: l(({ item: R }) => [
|
|
857
|
+
n(e(Oe), {
|
|
917
858
|
type: "remove",
|
|
918
859
|
size: "sm",
|
|
919
860
|
disabled: i.value,
|
|
920
861
|
title: e(t)("article.related-remove"),
|
|
921
|
-
onClick: (
|
|
862
|
+
onClick: (M) => F(R.id)
|
|
922
863
|
}, null, 8, ["disabled", "title", "onClick"])
|
|
923
864
|
]),
|
|
924
865
|
_: 1
|
|
925
866
|
}, 8, ["modelValue", "disabled", "empty-text", "aria-label"]),
|
|
926
|
-
n(e(
|
|
867
|
+
n(e(_e), {
|
|
927
868
|
"model-value": null,
|
|
928
|
-
options:
|
|
869
|
+
options: _.value,
|
|
929
870
|
placeholder: e(t)("article.related-add"),
|
|
930
871
|
"empty-text": e(t)("article.related-nothing"),
|
|
931
872
|
disabled: i.value,
|
|
932
873
|
filterable: "",
|
|
933
874
|
teleport: "",
|
|
934
875
|
"aria-label": e(t)("article.related-add"),
|
|
935
|
-
onSearch:
|
|
936
|
-
"onUpdate:modelValue":
|
|
876
|
+
onSearch: S,
|
|
877
|
+
"onUpdate:modelValue": E
|
|
937
878
|
}, null, 8, ["options", "placeholder", "empty-text", "disabled", "aria-label"])
|
|
938
879
|
]));
|
|
939
880
|
}
|
|
940
|
-
}),
|
|
881
|
+
}), Xt = /* @__PURE__ */ ve(Qt, [["__scopeId", "data-v-164e86fe"]]), Yt = { class: "wx-article-rubrics" }, ea = { class: "wx-article-rubrics__name" }, ta = /* @__PURE__ */ ee({
|
|
941
882
|
name: "WxArticleRubrics",
|
|
942
883
|
__name: "ArticleRubrics",
|
|
943
|
-
props: /* @__PURE__ */
|
|
884
|
+
props: /* @__PURE__ */ Me({
|
|
944
885
|
disabled: { type: Boolean, default: !1 }
|
|
945
886
|
}, {
|
|
946
887
|
modelValue: { default: () => [] },
|
|
947
888
|
modelModifiers: {}
|
|
948
889
|
}),
|
|
949
890
|
emits: ["update:modelValue"],
|
|
950
|
-
setup(
|
|
951
|
-
const
|
|
952
|
-
|
|
953
|
-
const
|
|
954
|
-
const
|
|
955
|
-
for (const
|
|
956
|
-
return
|
|
957
|
-
}),
|
|
958
|
-
get: () =>
|
|
959
|
-
set: (
|
|
960
|
-
|
|
891
|
+
setup(f) {
|
|
892
|
+
const m = f, r = qe(f, "modelValue"), y = Se();
|
|
893
|
+
te();
|
|
894
|
+
const u = Q("webx-blog"), a = v(() => m.disabled || y?.disabled.value === !0), t = v(() => {
|
|
895
|
+
const c = /* @__PURE__ */ new Map();
|
|
896
|
+
for (const o of y?.options.value.rubrics ?? []) c.set(o.id, o.title);
|
|
897
|
+
return c;
|
|
898
|
+
}), s = v({
|
|
899
|
+
get: () => r.value.map((c) => ({ id: c, title: t.value.get(c) ?? `#${c}` })),
|
|
900
|
+
set: (c) => {
|
|
901
|
+
r.value = c.map((o) => o.id);
|
|
961
902
|
}
|
|
962
|
-
}), i =
|
|
963
|
-
() => (
|
|
903
|
+
}), i = v(
|
|
904
|
+
() => (y?.options.value.rubrics ?? []).filter((c) => !r.value.includes(c.id)).map((c) => ({ label: c.title, value: c.id }))
|
|
964
905
|
);
|
|
965
|
-
function
|
|
966
|
-
typeof
|
|
906
|
+
function x(c) {
|
|
907
|
+
typeof c != "number" || r.value.includes(c) || (r.value = [...r.value, c]);
|
|
967
908
|
}
|
|
968
|
-
function T(
|
|
969
|
-
|
|
909
|
+
function T(c) {
|
|
910
|
+
r.value = r.value.filter((o) => o !== c);
|
|
970
911
|
}
|
|
971
|
-
return (
|
|
972
|
-
n(e(
|
|
973
|
-
modelValue:
|
|
974
|
-
"onUpdate:modelValue":
|
|
912
|
+
return (c, o) => (p(), Z("div", Yt, [
|
|
913
|
+
n(e(Ye), {
|
|
914
|
+
modelValue: s.value,
|
|
915
|
+
"onUpdate:modelValue": o[0] || (o[0] = (_) => s.value = _),
|
|
975
916
|
plain: "",
|
|
976
917
|
size: "sm",
|
|
977
918
|
"item-key": "id",
|
|
978
919
|
"item-label": "title",
|
|
979
|
-
disabled:
|
|
980
|
-
"empty-text": e(
|
|
981
|
-
"aria-label": e(
|
|
920
|
+
disabled: a.value,
|
|
921
|
+
"empty-text": e(u)("article.rubrics-empty"),
|
|
922
|
+
"aria-label": e(u)("article.rubrics")
|
|
982
923
|
}, {
|
|
983
|
-
default:
|
|
984
|
-
|
|
985
|
-
|
|
924
|
+
default: l(({ item: _, index: W }) => [
|
|
925
|
+
j("span", ea, b(_.title), 1),
|
|
926
|
+
W === 0 ? (p(), C(e(oe), {
|
|
986
927
|
key: 0,
|
|
987
928
|
type: "primary"
|
|
988
929
|
}, {
|
|
989
|
-
default:
|
|
990
|
-
|
|
930
|
+
default: l(() => [
|
|
931
|
+
w(b(e(u)("article.rubric-main")), 1)
|
|
991
932
|
]),
|
|
992
933
|
_: 1
|
|
993
|
-
})) :
|
|
934
|
+
})) : H("", !0)
|
|
994
935
|
]),
|
|
995
|
-
actions:
|
|
996
|
-
n(e(
|
|
936
|
+
actions: l(({ item: _ }) => [
|
|
937
|
+
n(e(Oe), {
|
|
997
938
|
type: "remove",
|
|
998
939
|
size: "sm",
|
|
999
|
-
disabled:
|
|
1000
|
-
title: e(
|
|
1001
|
-
onClick: (
|
|
940
|
+
disabled: a.value,
|
|
941
|
+
title: e(u)("article.rubric-remove"),
|
|
942
|
+
onClick: (W) => T(_.id)
|
|
1002
943
|
}, null, 8, ["disabled", "title", "onClick"])
|
|
1003
944
|
]),
|
|
1004
945
|
_: 1
|
|
1005
946
|
}, 8, ["modelValue", "disabled", "empty-text", "aria-label"]),
|
|
1006
|
-
n(e(
|
|
947
|
+
n(e(_e), {
|
|
1007
948
|
"model-value": null,
|
|
1008
949
|
options: i.value,
|
|
1009
|
-
placeholder: e(
|
|
1010
|
-
disabled:
|
|
1011
|
-
"empty-text": e(
|
|
950
|
+
placeholder: e(u)("article.rubric-add"),
|
|
951
|
+
disabled: a.value || i.value.length === 0,
|
|
952
|
+
"empty-text": e(u)("article.rubric-none-left"),
|
|
1012
953
|
filterable: "",
|
|
1013
954
|
teleport: "",
|
|
1014
|
-
"aria-label": e(
|
|
1015
|
-
"onUpdate:modelValue":
|
|
955
|
+
"aria-label": e(u)("article.rubric-add"),
|
|
956
|
+
"onUpdate:modelValue": x
|
|
1016
957
|
}, null, 8, ["options", "placeholder", "disabled", "empty-text", "aria-label"])
|
|
1017
958
|
]));
|
|
1018
959
|
}
|
|
1019
|
-
}),
|
|
960
|
+
}), aa = /* @__PURE__ */ ve(ta, [["__scopeId", "data-v-db8c5bc8"]]), la = { class: "wx-article-tags" }, ia = {
|
|
1020
961
|
key: 0,
|
|
1021
962
|
class: "wx-article-tags__chips"
|
|
1022
|
-
},
|
|
963
|
+
}, na = { class: "wx-article-tags__pick" }, sa = 250, ra = /* @__PURE__ */ ee({
|
|
1023
964
|
name: "WxArticleTags",
|
|
1024
965
|
__name: "ArticleTags",
|
|
1025
|
-
props: /* @__PURE__ */
|
|
966
|
+
props: /* @__PURE__ */ Me({
|
|
1026
967
|
disabled: { type: Boolean, default: !1 }
|
|
1027
968
|
}, {
|
|
1028
969
|
modelValue: { default: () => [] },
|
|
1029
970
|
modelModifiers: {}
|
|
1030
971
|
}),
|
|
1031
972
|
emits: ["update:modelValue"],
|
|
1032
|
-
setup(
|
|
1033
|
-
const
|
|
1034
|
-
|
|
1035
|
-
const t =
|
|
1036
|
-
let
|
|
1037
|
-
|
|
1038
|
-
() =>
|
|
973
|
+
setup(f) {
|
|
974
|
+
const m = f, r = qe(f, "modelValue"), y = ne(), u = de(y), a = Se();
|
|
975
|
+
te();
|
|
976
|
+
const t = Q("webx-blog"), s = ge(), i = v(() => m.disabled || a?.disabled.value === !0), x = z(/* @__PURE__ */ new Map()), T = z([]), c = z(""), o = z(!1);
|
|
977
|
+
let _;
|
|
978
|
+
ue(
|
|
979
|
+
() => a?.article.value?.tags,
|
|
1039
980
|
(A) => {
|
|
1040
|
-
const
|
|
1041
|
-
for (const
|
|
1042
|
-
|
|
981
|
+
const I = new Map(x.value);
|
|
982
|
+
for (const K of A ?? []) I.set(K.id, K.title);
|
|
983
|
+
x.value = I;
|
|
1043
984
|
},
|
|
1044
985
|
{ immediate: !0, deep: !0 }
|
|
1045
986
|
);
|
|
1046
|
-
const
|
|
1047
|
-
() =>
|
|
1048
|
-
),
|
|
1049
|
-
() => T.value.filter((A) => !
|
|
987
|
+
const W = v(
|
|
988
|
+
() => r.value.map((A) => ({ id: A, title: x.value.get(A) ?? `#${A}` }))
|
|
989
|
+
), S = v(
|
|
990
|
+
() => T.value.filter((A) => !r.value.includes(A.id)).map((A) => ({
|
|
1050
991
|
// The count is part of the label rather than a column: a select draws a line of text, and
|
|
1051
992
|
// the number is what the reader is choosing between two near-identical words on.
|
|
1052
993
|
label: t("article.tag-option", { title: A.title, count: A.articles_count }),
|
|
1053
994
|
value: A.id
|
|
1054
995
|
}))
|
|
1055
|
-
),
|
|
1056
|
-
const A =
|
|
996
|
+
), E = v(() => {
|
|
997
|
+
const A = c.value.trim();
|
|
1057
998
|
if (A === "") return null;
|
|
1058
|
-
const
|
|
1059
|
-
return T.value.some((
|
|
999
|
+
const I = (K) => K.toLowerCase() === A.toLowerCase();
|
|
1000
|
+
return T.value.some((K) => I(K.title)) ? null : A;
|
|
1060
1001
|
});
|
|
1061
|
-
async function
|
|
1002
|
+
async function F() {
|
|
1062
1003
|
try {
|
|
1063
|
-
T.value = await
|
|
1064
|
-
const A = new Map(
|
|
1065
|
-
for (const
|
|
1066
|
-
|
|
1004
|
+
T.value = await u.tags(c.value);
|
|
1005
|
+
const A = new Map(x.value);
|
|
1006
|
+
for (const I of T.value) A.set(I.id, I.title);
|
|
1007
|
+
x.value = A;
|
|
1067
1008
|
} catch (A) {
|
|
1068
|
-
L.danger(
|
|
1009
|
+
L.danger(s(A));
|
|
1069
1010
|
}
|
|
1070
1011
|
}
|
|
1012
|
+
function $(A) {
|
|
1013
|
+
c.value = A, clearTimeout(_), _ = setTimeout(() => {
|
|
1014
|
+
F();
|
|
1015
|
+
}, sa);
|
|
1016
|
+
}
|
|
1071
1017
|
function U(A) {
|
|
1072
|
-
|
|
1073
|
-
P();
|
|
1074
|
-
}, ca);
|
|
1018
|
+
typeof A != "number" || r.value.includes(A) || (r.value = [...r.value, A], c.value = "");
|
|
1075
1019
|
}
|
|
1076
1020
|
function R(A) {
|
|
1077
|
-
|
|
1078
|
-
}
|
|
1079
|
-
function W(A) {
|
|
1080
|
-
u.value = u.value.filter((N) => N !== A);
|
|
1021
|
+
r.value = r.value.filter((I) => I !== A);
|
|
1081
1022
|
}
|
|
1082
|
-
async function
|
|
1083
|
-
const A =
|
|
1084
|
-
if (!(A === null ||
|
|
1085
|
-
|
|
1023
|
+
async function M() {
|
|
1024
|
+
const A = E.value;
|
|
1025
|
+
if (!(A === null || o.value)) {
|
|
1026
|
+
o.value = !0;
|
|
1086
1027
|
try {
|
|
1087
|
-
const
|
|
1088
|
-
|
|
1089
|
-
} catch (
|
|
1090
|
-
L.danger(
|
|
1028
|
+
const I = await u.createTag({ title: A });
|
|
1029
|
+
x.value = new Map(x.value).set(I.id, I.title), T.value = [I, ...T.value], U(I.id);
|
|
1030
|
+
} catch (I) {
|
|
1031
|
+
L.danger(s(I));
|
|
1091
1032
|
} finally {
|
|
1092
|
-
|
|
1033
|
+
o.value = !1;
|
|
1093
1034
|
}
|
|
1094
1035
|
}
|
|
1095
1036
|
}
|
|
1096
|
-
return
|
|
1097
|
-
() =>
|
|
1037
|
+
return ue(
|
|
1038
|
+
() => a?.article.value?.id,
|
|
1098
1039
|
() => {
|
|
1099
|
-
|
|
1040
|
+
F();
|
|
1100
1041
|
},
|
|
1101
1042
|
{ immediate: !0 }
|
|
1102
|
-
),
|
|
1103
|
-
|
|
1104
|
-
(p(!0),
|
|
1105
|
-
key:
|
|
1043
|
+
), Je(() => clearTimeout(_)), (A, I) => (p(), Z("div", la, [
|
|
1044
|
+
W.value.length > 0 ? (p(), Z("div", ia, [
|
|
1045
|
+
(p(!0), Z(be, null, Be(W.value, (K) => (p(), C(e(oe), {
|
|
1046
|
+
key: K.id,
|
|
1106
1047
|
type: "default",
|
|
1107
1048
|
class: "wx-article-tags__chip"
|
|
1108
1049
|
}, {
|
|
1109
|
-
default:
|
|
1110
|
-
|
|
1111
|
-
n(e(
|
|
1050
|
+
default: l(() => [
|
|
1051
|
+
w(b(K.title) + " ", 1),
|
|
1052
|
+
n(e(Oe), {
|
|
1112
1053
|
icon: "close",
|
|
1113
1054
|
tone: "neutral",
|
|
1114
1055
|
size: "sm",
|
|
1115
1056
|
disabled: i.value,
|
|
1116
1057
|
title: e(t)("article.tag-remove"),
|
|
1117
|
-
onClick: (
|
|
1058
|
+
onClick: (P) => R(K.id)
|
|
1118
1059
|
}, null, 8, ["disabled", "title", "onClick"])
|
|
1119
1060
|
]),
|
|
1120
1061
|
_: 2
|
|
1121
1062
|
}, 1024))), 128))
|
|
1122
|
-
])) : (p(),
|
|
1063
|
+
])) : (p(), C(e(G), {
|
|
1123
1064
|
key: 1,
|
|
1124
1065
|
size: "sm",
|
|
1125
1066
|
tone: "muted"
|
|
1126
1067
|
}, {
|
|
1127
|
-
default:
|
|
1128
|
-
|
|
1068
|
+
default: l(() => [
|
|
1069
|
+
w(b(e(t)("article.tags-empty")), 1)
|
|
1129
1070
|
]),
|
|
1130
1071
|
_: 1
|
|
1131
1072
|
})),
|
|
1132
|
-
|
|
1133
|
-
n(e(
|
|
1073
|
+
j("div", na, [
|
|
1074
|
+
n(e(_e), {
|
|
1134
1075
|
"model-value": null,
|
|
1135
|
-
options:
|
|
1076
|
+
options: S.value,
|
|
1136
1077
|
placeholder: e(t)("article.tag-add"),
|
|
1137
1078
|
"empty-text": e(t)("article.tag-nothing"),
|
|
1138
1079
|
disabled: i.value,
|
|
1139
1080
|
filterable: "",
|
|
1140
1081
|
teleport: "",
|
|
1141
1082
|
"aria-label": e(t)("article.tag-add"),
|
|
1142
|
-
onSearch:
|
|
1143
|
-
"onUpdate:modelValue":
|
|
1083
|
+
onSearch: $,
|
|
1084
|
+
"onUpdate:modelValue": U
|
|
1144
1085
|
}, null, 8, ["options", "placeholder", "empty-text", "disabled", "aria-label"]),
|
|
1145
|
-
|
|
1086
|
+
E.value ? (p(), C(e(J), {
|
|
1146
1087
|
key: 0,
|
|
1147
1088
|
variant: "outline",
|
|
1148
1089
|
icon: "plus",
|
|
1149
|
-
loading:
|
|
1090
|
+
loading: o.value,
|
|
1150
1091
|
disabled: i.value,
|
|
1151
|
-
onClick:
|
|
1092
|
+
onClick: M
|
|
1152
1093
|
}, {
|
|
1153
|
-
default:
|
|
1154
|
-
|
|
1094
|
+
default: l(() => [
|
|
1095
|
+
w(b(e(t)("article.tag-create", { title: E.value })), 1)
|
|
1155
1096
|
]),
|
|
1156
1097
|
_: 1
|
|
1157
|
-
}, 8, ["loading", "disabled"])) :
|
|
1098
|
+
}, 8, ["loading", "disabled"])) : H("", !0)
|
|
1158
1099
|
])
|
|
1159
1100
|
]));
|
|
1160
1101
|
}
|
|
1161
|
-
}),
|
|
1102
|
+
}), oa = /* @__PURE__ */ ve(ra, [["__scopeId", "data-v-ce095e37"]]), ua = /* @__PURE__ */ ee({
|
|
1162
1103
|
__name: "ArticleCreateDialog",
|
|
1163
|
-
setup(
|
|
1164
|
-
const { open:
|
|
1165
|
-
|
|
1166
|
-
const t =
|
|
1167
|
-
|
|
1168
|
-
await
|
|
1104
|
+
setup(f) {
|
|
1105
|
+
const { open: m, resolve: r, dismiss: y } = Ee(), u = ne(), a = de(u);
|
|
1106
|
+
te();
|
|
1107
|
+
const t = Q("webx-blog"), s = z(""), i = z(!1), x = z({}), T = De("field");
|
|
1108
|
+
Ne(async () => {
|
|
1109
|
+
await Ze(), T.value?.querySelector("input")?.focus();
|
|
1169
1110
|
});
|
|
1170
|
-
async function
|
|
1171
|
-
if (!(
|
|
1172
|
-
i.value = !0,
|
|
1111
|
+
async function c() {
|
|
1112
|
+
if (!(s.value.trim() === "" || i.value)) {
|
|
1113
|
+
i.value = !0, x.value = {};
|
|
1173
1114
|
try {
|
|
1174
|
-
|
|
1175
|
-
} catch (
|
|
1176
|
-
|
|
1115
|
+
r(await a.create({ title: s.value.trim() }));
|
|
1116
|
+
} catch (o) {
|
|
1117
|
+
x.value = o.body?.errors ?? {};
|
|
1177
1118
|
} finally {
|
|
1178
1119
|
i.value = !1;
|
|
1179
1120
|
}
|
|
1180
1121
|
}
|
|
1181
1122
|
}
|
|
1182
|
-
return (
|
|
1183
|
-
open: e(
|
|
1184
|
-
"onUpdate:open":
|
|
1123
|
+
return (o, _) => (p(), C(e(Fe), {
|
|
1124
|
+
open: e(m),
|
|
1125
|
+
"onUpdate:open": _[2] || (_[2] = (W) => Ie(m) ? m.value = W : null),
|
|
1185
1126
|
title: e(t)("panel.new-title"),
|
|
1186
1127
|
width: 440
|
|
1187
1128
|
}, {
|
|
1188
|
-
footer:
|
|
1189
|
-
n(e(
|
|
1190
|
-
default:
|
|
1191
|
-
n(e(
|
|
1129
|
+
footer: l(() => [
|
|
1130
|
+
n(e(Le), { size: "sm" }, {
|
|
1131
|
+
default: l(() => [
|
|
1132
|
+
n(e(J), {
|
|
1192
1133
|
variant: "outline",
|
|
1193
|
-
onClick:
|
|
1134
|
+
onClick: _[1] || (_[1] = (W) => e(y)())
|
|
1194
1135
|
}, {
|
|
1195
|
-
default:
|
|
1196
|
-
|
|
1136
|
+
default: l(() => [
|
|
1137
|
+
w(b(e(t)("panel.cancel")), 1)
|
|
1197
1138
|
]),
|
|
1198
1139
|
_: 1
|
|
1199
1140
|
}),
|
|
1200
|
-
n(e(
|
|
1141
|
+
n(e(J), {
|
|
1201
1142
|
type: "primary",
|
|
1202
1143
|
loading: i.value,
|
|
1203
|
-
disabled:
|
|
1204
|
-
onClick:
|
|
1144
|
+
disabled: s.value.trim() === "",
|
|
1145
|
+
onClick: c
|
|
1205
1146
|
}, {
|
|
1206
|
-
default:
|
|
1207
|
-
|
|
1147
|
+
default: l(() => [
|
|
1148
|
+
w(b(e(t)("panel.create")), 1)
|
|
1208
1149
|
]),
|
|
1209
1150
|
_: 1
|
|
1210
1151
|
}, 8, ["loading", "disabled"])
|
|
@@ -1212,22 +1153,22 @@ const Mt = { class: "wx-article-editor__head" }, Pt = { class: "wx-article-edito
|
|
|
1212
1153
|
_: 1
|
|
1213
1154
|
})
|
|
1214
1155
|
]),
|
|
1215
|
-
default:
|
|
1216
|
-
n(e(
|
|
1156
|
+
default: l(() => [
|
|
1157
|
+
n(e(ie), {
|
|
1217
1158
|
label: e(t)("panel.field-title"),
|
|
1218
|
-
error:
|
|
1159
|
+
error: x.value.title?.[0] ?? x.value.slug?.[0],
|
|
1219
1160
|
required: ""
|
|
1220
1161
|
}, {
|
|
1221
|
-
default:
|
|
1222
|
-
|
|
1162
|
+
default: l(() => [
|
|
1163
|
+
j("div", {
|
|
1223
1164
|
ref_key: "field",
|
|
1224
1165
|
ref: T
|
|
1225
1166
|
}, [
|
|
1226
|
-
n(e(
|
|
1227
|
-
modelValue:
|
|
1228
|
-
"onUpdate:modelValue":
|
|
1167
|
+
n(e(Ae), {
|
|
1168
|
+
modelValue: s.value,
|
|
1169
|
+
"onUpdate:modelValue": _[0] || (_[0] = (W) => s.value = W),
|
|
1229
1170
|
"aria-label": e(t)("panel.field-title"),
|
|
1230
|
-
onKeyup:
|
|
1171
|
+
onKeyup: ze(c, ["enter"])
|
|
1231
1172
|
}, null, 8, ["modelValue", "aria-label"])
|
|
1232
1173
|
], 512)
|
|
1233
1174
|
]),
|
|
@@ -1237,485 +1178,529 @@ const Mt = { class: "wx-article-editor__head" }, Pt = { class: "wx-article-edito
|
|
|
1237
1178
|
_: 1
|
|
1238
1179
|
}, 8, ["open", "title"]));
|
|
1239
1180
|
}
|
|
1240
|
-
}),
|
|
1181
|
+
}), da = ["src"], ca = { class: "wx-articles__name" }, va = { class: "wx-articles__name-text" }, pa = { class: "wx-articles__title" }, fa = { class: "wx-articles__address" }, ma = { class: "wx-articles__chips" }, ba = { class: "wx-articles__state" }, nt = 640, ga = /* @__PURE__ */ ee({
|
|
1241
1182
|
__name: "ArticlesPage",
|
|
1242
1183
|
props: {
|
|
1243
1184
|
base: { default: "/blog" }
|
|
1244
1185
|
},
|
|
1245
|
-
setup(
|
|
1246
|
-
const
|
|
1247
|
-
|
|
1248
|
-
const t =
|
|
1249
|
-
() =>
|
|
1250
|
-
),
|
|
1251
|
-
get: () => typeof
|
|
1252
|
-
set: (
|
|
1253
|
-
|
|
1254
|
-
query: { ...
|
|
1186
|
+
setup(f) {
|
|
1187
|
+
const m = f, r = ne(), y = de(r), u = He(), a = Ke();
|
|
1188
|
+
te();
|
|
1189
|
+
const t = Q("webx-blog"), s = Q("webx-admin"), i = ge(), x = De("root"), T = xt(x), c = z(null), o = z(!0), _ = Ce(ua), W = v(() => r.can("blog.articles.manage")), S = v(
|
|
1190
|
+
() => r.state.manifest?.modules.find((d) => d.id === "articles")?.title ?? t("module.articles")
|
|
1191
|
+
), E = v({
|
|
1192
|
+
get: () => typeof u.query.view == "string" ? u.query.view : "",
|
|
1193
|
+
set: (d) => {
|
|
1194
|
+
a.replace({
|
|
1195
|
+
query: { ...u.query, view: d === "" ? void 0 : String(d), page: void 0 }
|
|
1255
1196
|
});
|
|
1256
1197
|
}
|
|
1257
|
-
}),
|
|
1258
|
-
q: typeof
|
|
1259
|
-
rubric: U(
|
|
1260
|
-
tag: U(
|
|
1261
|
-
author: U(
|
|
1262
|
-
sort: typeof
|
|
1263
|
-
page: Number(
|
|
1198
|
+
}), F = v(() => E.value === "trashed"), $ = v(() => ({
|
|
1199
|
+
q: typeof u.query.q == "string" ? u.query.q : "",
|
|
1200
|
+
rubric: U(u.query.rubric),
|
|
1201
|
+
tag: U(u.query.tag),
|
|
1202
|
+
author: U(u.query.author),
|
|
1203
|
+
sort: typeof u.query.sort == "string" ? u.query.sort : null,
|
|
1204
|
+
page: Number(u.query.page ?? 1) || 1
|
|
1264
1205
|
}));
|
|
1265
|
-
function U(
|
|
1266
|
-
return typeof
|
|
1206
|
+
function U(d) {
|
|
1207
|
+
return typeof d == "string" && d !== "" && Number(d) || null;
|
|
1267
1208
|
}
|
|
1268
|
-
const R =
|
|
1209
|
+
const R = v(() => [
|
|
1269
1210
|
{ value: "", label: t("panel.view-all") },
|
|
1270
1211
|
{ value: "published", label: t("panel.view-published") },
|
|
1271
1212
|
{ value: "scheduled", label: t("panel.view-scheduled") },
|
|
1272
1213
|
{ value: "draft", label: t("panel.view-draft") },
|
|
1273
1214
|
{ value: "unpublished", label: t("panel.view-unpublished") },
|
|
1274
1215
|
{ value: "trashed", label: t("panel.bin"), icon: "trash" }
|
|
1275
|
-
]),
|
|
1216
|
+
]), M = v(() => c.value?.filters ?? { rubrics: [], tags: [], authors: [] }), A = v(() => T.value > 0 && T.value < nt), I = v(() => A.value ? [{ key: "card", label: "" }] : [
|
|
1276
1217
|
{ key: "cover", label: "", width: 68 },
|
|
1218
|
+
/* The one that takes what the others leave, and the only one without a number. */
|
|
1277
1219
|
{ key: "title", label: t("panel.column-title"), minWidth: 220 },
|
|
1278
|
-
{ key: "rubrics", label: t("panel.column-rubrics"), width: 190, hideBelow:
|
|
1279
|
-
{ key: "author", label: t("panel.column-author"), width: 160, hideBelow:
|
|
1220
|
+
{ key: "rubrics", label: t("panel.column-rubrics"), width: 190, hideBelow: 1e3 },
|
|
1221
|
+
{ key: "author", label: t("panel.column-author"), width: 160, hideBelow: 1200 },
|
|
1280
1222
|
{
|
|
1281
1223
|
key: "date",
|
|
1282
|
-
label:
|
|
1283
|
-
width:
|
|
1224
|
+
label: F.value ? t("panel.column-deleted") : t("panel.column-date"),
|
|
1225
|
+
width: 120,
|
|
1284
1226
|
hideBelow: 700,
|
|
1285
1227
|
// "today at 16:22" is three words the table will break over two lines given half a
|
|
1286
1228
|
// chance, and a date read down a column has to be one line to be read at all.
|
|
1287
1229
|
cellClass: "wx-articles__when"
|
|
1288
1230
|
},
|
|
1289
|
-
{ key: "status", label: t("panel.column-status"), width:
|
|
1290
|
-
{ key: "actions", label: "", width:
|
|
1291
|
-
]),
|
|
1292
|
-
|
|
1293
|
-
|
|
1231
|
+
{ key: "status", label: t("panel.column-status"), width: 170 },
|
|
1232
|
+
{ key: "actions", label: "", width: st, align: "right" }
|
|
1233
|
+
]), K = v(() => $.value.q !== "" ? t("panel.empty-search") : F.value ? t("panel.empty-bin") : t("panel.empty")), P = v(() => {
|
|
1234
|
+
const d = [], D = M.value.rubrics.find((V) => V.id === $.value.rubric);
|
|
1235
|
+
D && d.push({
|
|
1236
|
+
key: "rubric",
|
|
1237
|
+
label: `${t("panel.filter-rubric")}: ${D.title}`,
|
|
1238
|
+
clear: () => O("rubric", void 0)
|
|
1239
|
+
});
|
|
1240
|
+
const h = M.value.tags.find((V) => V.id === $.value.tag);
|
|
1241
|
+
h && d.push({
|
|
1242
|
+
key: "tag",
|
|
1243
|
+
label: `${t("panel.filter-tag")}: ${h.title}`,
|
|
1244
|
+
clear: () => O("tag", void 0)
|
|
1245
|
+
});
|
|
1246
|
+
const $e = M.value.authors.find((V) => V.id === $.value.author);
|
|
1247
|
+
return $e && d.push({
|
|
1248
|
+
key: "author",
|
|
1249
|
+
label: `${t("panel.filter-author")}: ${$e.title}`,
|
|
1250
|
+
clear: () => O("author", void 0)
|
|
1251
|
+
}), d;
|
|
1252
|
+
});
|
|
1253
|
+
function q() {
|
|
1254
|
+
a.replace({
|
|
1255
|
+
query: {
|
|
1256
|
+
...u.query,
|
|
1257
|
+
rubric: void 0,
|
|
1258
|
+
tag: void 0,
|
|
1259
|
+
author: void 0,
|
|
1260
|
+
page: void 0
|
|
1261
|
+
}
|
|
1262
|
+
});
|
|
1263
|
+
}
|
|
1264
|
+
async function k(d) {
|
|
1265
|
+
o.value = !0;
|
|
1294
1266
|
try {
|
|
1295
|
-
|
|
1296
|
-
q:
|
|
1297
|
-
status:
|
|
1298
|
-
trashed:
|
|
1299
|
-
rubric:
|
|
1300
|
-
tag:
|
|
1301
|
-
author:
|
|
1302
|
-
sort:
|
|
1303
|
-
page:
|
|
1304
|
-
per_page:
|
|
1267
|
+
c.value = await y.articles({
|
|
1268
|
+
q: d?.search ?? $.value.q,
|
|
1269
|
+
status: F.value ? "" : E.value,
|
|
1270
|
+
trashed: F.value,
|
|
1271
|
+
rubric: $.value.rubric,
|
|
1272
|
+
tag: $.value.tag,
|
|
1273
|
+
author: $.value.author,
|
|
1274
|
+
sort: d?.sort ? `${d.sort.order === "desc" ? "-" : ""}${d.sort.key}` : null,
|
|
1275
|
+
page: d?.page ?? $.value.page,
|
|
1276
|
+
per_page: d?.perPage
|
|
1305
1277
|
});
|
|
1306
|
-
} catch (
|
|
1307
|
-
L.danger(
|
|
1278
|
+
} catch (D) {
|
|
1279
|
+
L.danger(i(D));
|
|
1308
1280
|
} finally {
|
|
1309
|
-
|
|
1281
|
+
o.value = !1;
|
|
1310
1282
|
}
|
|
1311
1283
|
}
|
|
1312
|
-
function
|
|
1313
|
-
const
|
|
1314
|
-
...
|
|
1315
|
-
q:
|
|
1316
|
-
sort:
|
|
1317
|
-
page:
|
|
1284
|
+
function le(d) {
|
|
1285
|
+
const D = {
|
|
1286
|
+
...u.query,
|
|
1287
|
+
q: d.search === "" ? void 0 : d.search,
|
|
1288
|
+
sort: d.sort === null ? void 0 : `${d.sort.order === "desc" ? "-" : ""}${d.sort.key}`,
|
|
1289
|
+
page: d.page === 1 ? void 0 : String(d.page)
|
|
1318
1290
|
};
|
|
1319
|
-
|
|
1291
|
+
a.replace({ query: D }), k(d);
|
|
1320
1292
|
}
|
|
1321
|
-
function
|
|
1322
|
-
|
|
1293
|
+
function O(d, D) {
|
|
1294
|
+
a.replace({
|
|
1323
1295
|
query: {
|
|
1324
|
-
...
|
|
1325
|
-
[
|
|
1296
|
+
...u.query,
|
|
1297
|
+
[d]: typeof D == "number" ? String(D) : void 0,
|
|
1326
1298
|
page: void 0
|
|
1327
1299
|
}
|
|
1328
1300
|
});
|
|
1329
1301
|
}
|
|
1330
|
-
|
|
1331
|
-
() => [
|
|
1302
|
+
ue(
|
|
1303
|
+
() => [E.value, $.value.rubric, $.value.tag, $.value.author],
|
|
1332
1304
|
() => {
|
|
1333
|
-
|
|
1305
|
+
k();
|
|
1334
1306
|
}
|
|
1335
|
-
),
|
|
1336
|
-
function
|
|
1337
|
-
const
|
|
1338
|
-
|
|
1339
|
-
}
|
|
1340
|
-
async function
|
|
1341
|
-
const
|
|
1342
|
-
|
|
1343
|
-
}
|
|
1344
|
-
function
|
|
1345
|
-
if (!
|
|
1346
|
-
if (
|
|
1307
|
+
), k();
|
|
1308
|
+
function se(d) {
|
|
1309
|
+
const D = `${m.base}/articles/${d.id}`;
|
|
1310
|
+
a.resolve(D).matched.length > 0 && a.push({ path: D, query: { ...u.query } });
|
|
1311
|
+
}
|
|
1312
|
+
async function xe() {
|
|
1313
|
+
const d = await _({});
|
|
1314
|
+
d && (await k(), se(d));
|
|
1315
|
+
}
|
|
1316
|
+
function ce(d) {
|
|
1317
|
+
if (!W.value) return [];
|
|
1318
|
+
if (F.value)
|
|
1347
1319
|
return [
|
|
1348
1320
|
{
|
|
1349
1321
|
key: "restore",
|
|
1350
1322
|
icon: "refresh",
|
|
1351
1323
|
label: t("panel.restore"),
|
|
1352
1324
|
run: () => {
|
|
1353
|
-
|
|
1325
|
+
re(d);
|
|
1354
1326
|
}
|
|
1355
1327
|
}
|
|
1356
1328
|
];
|
|
1357
|
-
const
|
|
1358
|
-
{ key: "open", icon: "edit", label: t("panel.open"), run: () =>
|
|
1329
|
+
const D = [
|
|
1330
|
+
{ key: "open", icon: "edit", label: t("panel.open"), run: () => se(d) }
|
|
1359
1331
|
];
|
|
1360
|
-
return
|
|
1332
|
+
return d.url && d.status !== "draft" && D.push({
|
|
1361
1333
|
key: "site",
|
|
1362
1334
|
icon: "external-link",
|
|
1363
1335
|
label: t("panel.open-on-site"),
|
|
1364
|
-
href:
|
|
1365
|
-
}),
|
|
1336
|
+
href: d.url
|
|
1337
|
+
}), d.path !== null && D.push({
|
|
1366
1338
|
key: "copy",
|
|
1367
1339
|
icon: "copy",
|
|
1368
1340
|
label: t("panel.copy-address"),
|
|
1369
1341
|
run: () => {
|
|
1370
|
-
|
|
1342
|
+
g(d);
|
|
1371
1343
|
}
|
|
1372
|
-
}),
|
|
1344
|
+
}), D.push({
|
|
1373
1345
|
key: "pin",
|
|
1374
1346
|
icon: "star",
|
|
1375
|
-
label:
|
|
1347
|
+
label: d.pinned ? t("panel.unpin") : t("panel.pin"),
|
|
1376
1348
|
run: () => {
|
|
1377
|
-
|
|
1349
|
+
ke(d, !d.pinned);
|
|
1378
1350
|
}
|
|
1379
|
-
}),
|
|
1380
|
-
|
|
1351
|
+
}), D.push(
|
|
1352
|
+
d.status === "published" || d.status === "modified" || d.status === "scheduled" ? {
|
|
1381
1353
|
key: "unpublish",
|
|
1382
1354
|
icon: "eye-off",
|
|
1383
1355
|
label: t("panel.unpublish"),
|
|
1384
1356
|
run: () => {
|
|
1385
|
-
|
|
1357
|
+
Te(d);
|
|
1386
1358
|
}
|
|
1387
1359
|
} : {
|
|
1388
1360
|
key: "publish",
|
|
1389
1361
|
icon: "upload",
|
|
1390
1362
|
label: t("panel.publish"),
|
|
1391
1363
|
run: () => {
|
|
1392
|
-
|
|
1364
|
+
he(d);
|
|
1393
1365
|
}
|
|
1394
1366
|
}
|
|
1395
|
-
),
|
|
1367
|
+
), D.push({
|
|
1396
1368
|
key: "delete",
|
|
1397
1369
|
icon: "trash",
|
|
1398
1370
|
label: t("panel.delete"),
|
|
1399
1371
|
danger: !0,
|
|
1400
1372
|
run: () => {
|
|
1401
|
-
|
|
1373
|
+
pe(d);
|
|
1402
1374
|
}
|
|
1403
|
-
}),
|
|
1375
|
+
}), D;
|
|
1404
1376
|
}
|
|
1405
|
-
async function
|
|
1406
|
-
await
|
|
1377
|
+
async function he(d) {
|
|
1378
|
+
await fe(() => y.publish(d.id), t("panel.published"));
|
|
1407
1379
|
}
|
|
1408
|
-
async function
|
|
1409
|
-
await
|
|
1380
|
+
async function Te(d) {
|
|
1381
|
+
await fe(() => y.unpublish(d.id), t("panel.unpublished-done"));
|
|
1410
1382
|
}
|
|
1411
|
-
async function
|
|
1412
|
-
await
|
|
1413
|
-
() =>
|
|
1414
|
-
t(
|
|
1383
|
+
async function ke(d, D) {
|
|
1384
|
+
await fe(
|
|
1385
|
+
() => y.save(d.id, { values: { pinned: D }, revision: d.revision }),
|
|
1386
|
+
t(D ? "panel.pinned-done" : "panel.unpinned")
|
|
1415
1387
|
);
|
|
1416
1388
|
}
|
|
1417
|
-
async function
|
|
1418
|
-
await
|
|
1419
|
-
title: t("panel.delete-title", { title:
|
|
1389
|
+
async function pe(d) {
|
|
1390
|
+
await me({
|
|
1391
|
+
title: t("panel.delete-title", { title: d.title }),
|
|
1420
1392
|
message: t("panel.delete-text"),
|
|
1421
1393
|
confirmText: t("panel.delete"),
|
|
1422
1394
|
cancelText: t("panel.cancel"),
|
|
1423
1395
|
tone: "danger"
|
|
1424
|
-
}) && await
|
|
1396
|
+
}) && await fe(() => y.remove(d.id), t("panel.deleted"));
|
|
1425
1397
|
}
|
|
1426
|
-
async function
|
|
1427
|
-
await
|
|
1398
|
+
async function re(d) {
|
|
1399
|
+
await fe(() => y.restore(d.id), t("panel.restored"));
|
|
1428
1400
|
}
|
|
1429
|
-
async function
|
|
1401
|
+
async function fe(d, D) {
|
|
1430
1402
|
try {
|
|
1431
|
-
await
|
|
1432
|
-
} catch (
|
|
1433
|
-
L.danger(
|
|
1403
|
+
await d(), L.success(D);
|
|
1404
|
+
} catch (h) {
|
|
1405
|
+
L.danger(i(h));
|
|
1434
1406
|
} finally {
|
|
1435
|
-
await
|
|
1407
|
+
await k();
|
|
1436
1408
|
}
|
|
1437
1409
|
}
|
|
1438
|
-
async function
|
|
1439
|
-
if (
|
|
1410
|
+
async function g(d) {
|
|
1411
|
+
if (d.url)
|
|
1440
1412
|
try {
|
|
1441
|
-
await navigator.clipboard.writeText(
|
|
1413
|
+
await navigator.clipboard.writeText(d.url), L.success(t("panel.address-copied"));
|
|
1442
1414
|
} catch {
|
|
1443
1415
|
}
|
|
1444
1416
|
}
|
|
1445
|
-
function
|
|
1446
|
-
return
|
|
1417
|
+
function N(d) {
|
|
1418
|
+
return d === "published" || d === "modified" ? "success" : d === "scheduled" ? "warning" : "default";
|
|
1447
1419
|
}
|
|
1448
|
-
function
|
|
1449
|
-
return
|
|
1420
|
+
function B(d) {
|
|
1421
|
+
return F.value ? "—" : d.path === null ? t("panel.no-address") : `/${d.path}`;
|
|
1450
1422
|
}
|
|
1451
|
-
function
|
|
1452
|
-
return
|
|
1423
|
+
function X(d) {
|
|
1424
|
+
return F.value ? d.deleted_at : d.published_at;
|
|
1453
1425
|
}
|
|
1454
|
-
|
|
1426
|
+
const ye = v(
|
|
1427
|
+
() => W.value ? [{ key: "new", label: t("panel.new"), icon: "plus", primary: !0, run: () => {
|
|
1428
|
+
xe();
|
|
1429
|
+
} }] : []
|
|
1430
|
+
);
|
|
1431
|
+
return (d, D) => (p(), Z("div", {
|
|
1455
1432
|
ref_key: "root",
|
|
1456
|
-
ref:
|
|
1433
|
+
ref: x,
|
|
1457
1434
|
class: "wx-articles"
|
|
1458
1435
|
}, [
|
|
1459
|
-
n(e(
|
|
1460
|
-
view:
|
|
1461
|
-
"onUpdate:view":
|
|
1436
|
+
n(e(Qe), {
|
|
1437
|
+
view: E.value,
|
|
1438
|
+
"onUpdate:view": D[3] || (D[3] = (h) => E.value = h),
|
|
1462
1439
|
title: S.value,
|
|
1463
|
-
views: R.value
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
|
|
1440
|
+
views: R.value,
|
|
1441
|
+
actions: ye.value
|
|
1442
|
+
}, {
|
|
1443
|
+
default: l(() => [
|
|
1444
|
+
n(e(ot), {
|
|
1445
|
+
data: c.value,
|
|
1446
|
+
columns: I.value,
|
|
1469
1447
|
"row-key": "id",
|
|
1470
1448
|
searchable: "",
|
|
1471
|
-
clickable: !
|
|
1472
|
-
hover: !
|
|
1449
|
+
clickable: !F.value,
|
|
1450
|
+
hover: !F.value,
|
|
1473
1451
|
flush: "",
|
|
1452
|
+
loading: o.value,
|
|
1474
1453
|
layout: "fixed",
|
|
1475
|
-
loading: h.value,
|
|
1476
1454
|
"cards-below": nt,
|
|
1455
|
+
"filters-count": P.value.length,
|
|
1456
|
+
"filters-label": e(s)("filters.title"),
|
|
1477
1457
|
"search-placeholder": e(t)("panel.search"),
|
|
1478
|
-
"empty-text":
|
|
1458
|
+
"empty-text": K.value,
|
|
1479
1459
|
"aria-label": S.value,
|
|
1480
|
-
onRowClick:
|
|
1481
|
-
onStateChange:
|
|
1460
|
+
onRowClick: se,
|
|
1461
|
+
onStateChange: le
|
|
1482
1462
|
}, {
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
|
|
1510
|
-
|
|
1463
|
+
filters: l(() => [
|
|
1464
|
+
n(e(ie), {
|
|
1465
|
+
label: e(t)("panel.filter-rubric")
|
|
1466
|
+
}, {
|
|
1467
|
+
default: l(() => [
|
|
1468
|
+
n(e(_e), {
|
|
1469
|
+
"model-value": $.value.rubric,
|
|
1470
|
+
options: M.value.rubrics.map((h) => ({ value: h.id, label: h.title })),
|
|
1471
|
+
placeholder: e(t)("panel.any-rubric"),
|
|
1472
|
+
clearable: "",
|
|
1473
|
+
size: "sm",
|
|
1474
|
+
"onUpdate:modelValue": D[0] || (D[0] = (h) => O("rubric", h))
|
|
1475
|
+
}, null, 8, ["model-value", "options", "placeholder"])
|
|
1476
|
+
]),
|
|
1477
|
+
_: 1
|
|
1478
|
+
}, 8, ["label"]),
|
|
1479
|
+
n(e(ie), {
|
|
1480
|
+
label: e(t)("panel.filter-tag")
|
|
1481
|
+
}, {
|
|
1482
|
+
default: l(() => [
|
|
1483
|
+
n(e(_e), {
|
|
1484
|
+
"model-value": $.value.tag,
|
|
1485
|
+
options: M.value.tags.map((h) => ({ value: h.id, label: h.title })),
|
|
1486
|
+
placeholder: e(t)("panel.any-tag"),
|
|
1487
|
+
clearable: "",
|
|
1488
|
+
filterable: "",
|
|
1489
|
+
size: "sm",
|
|
1490
|
+
"onUpdate:modelValue": D[1] || (D[1] = (h) => O("tag", h))
|
|
1491
|
+
}, null, 8, ["model-value", "options", "placeholder"])
|
|
1492
|
+
]),
|
|
1493
|
+
_: 1
|
|
1494
|
+
}, 8, ["label"]),
|
|
1495
|
+
n(e(ie), {
|
|
1496
|
+
label: e(t)("panel.filter-author")
|
|
1497
|
+
}, {
|
|
1498
|
+
default: l(() => [
|
|
1499
|
+
n(e(_e), {
|
|
1500
|
+
"model-value": $.value.author,
|
|
1501
|
+
options: M.value.authors.map((h) => ({ value: h.id, label: h.title })),
|
|
1502
|
+
placeholder: e(t)("panel.any-author"),
|
|
1503
|
+
clearable: "",
|
|
1504
|
+
size: "sm",
|
|
1505
|
+
"onUpdate:modelValue": D[2] || (D[2] = (h) => O("author", h))
|
|
1506
|
+
}, null, 8, ["model-value", "options", "placeholder"])
|
|
1507
|
+
]),
|
|
1508
|
+
_: 1
|
|
1509
|
+
}, 8, ["label"]),
|
|
1510
|
+
P.value.length > 0 ? (p(), C(e(J), {
|
|
1511
|
+
key: 0,
|
|
1512
|
+
variant: "text",
|
|
1513
|
+
size: "sm",
|
|
1514
|
+
block: "",
|
|
1515
|
+
onClick: q
|
|
1516
|
+
}, {
|
|
1517
|
+
icon: l(() => [
|
|
1518
|
+
n(e(we), { name: "close" })
|
|
1519
|
+
]),
|
|
1520
|
+
default: l(() => [
|
|
1521
|
+
w(" " + b(e(s)("filters.reset")), 1)
|
|
1522
|
+
]),
|
|
1523
|
+
_: 1
|
|
1524
|
+
})) : H("", !0)
|
|
1511
1525
|
]),
|
|
1512
|
-
|
|
1513
|
-
|
|
1514
|
-
|
|
1526
|
+
applied: l(() => [
|
|
1527
|
+
n(e(yt), { filters: P.value }, null, 8, ["filters"])
|
|
1528
|
+
]),
|
|
1529
|
+
"cell-cover": l(({ row: h }) => [
|
|
1530
|
+
j("span", {
|
|
1531
|
+
class: Pe(["wx-articles__cover", { "is-empty": !h.cover }])
|
|
1515
1532
|
}, [
|
|
1516
|
-
|
|
1533
|
+
h.cover?.thumb ? (p(), Z("img", {
|
|
1517
1534
|
key: 0,
|
|
1518
|
-
src:
|
|
1535
|
+
src: h.cover.thumb,
|
|
1519
1536
|
alt: "",
|
|
1520
1537
|
loading: "lazy"
|
|
1521
|
-
}, null, 8,
|
|
1538
|
+
}, null, 8, da)) : (p(), C(e(we), {
|
|
1522
1539
|
key: 1,
|
|
1523
1540
|
name: "image",
|
|
1524
1541
|
size: "sm"
|
|
1525
1542
|
}))
|
|
1526
1543
|
], 2)
|
|
1527
1544
|
]),
|
|
1528
|
-
"cell-title":
|
|
1529
|
-
|
|
1530
|
-
|
|
1545
|
+
"cell-title": l(({ row: h }) => [
|
|
1546
|
+
j("div", ca, [
|
|
1547
|
+
h.pinned ? (p(), C(e(et), {
|
|
1531
1548
|
key: 0,
|
|
1532
1549
|
content: e(t)("panel.pinned")
|
|
1533
1550
|
}, {
|
|
1534
|
-
default:
|
|
1535
|
-
n(e(
|
|
1551
|
+
default: l(() => [
|
|
1552
|
+
n(e(we), {
|
|
1536
1553
|
class: "wx-articles__pin",
|
|
1537
1554
|
name: "star",
|
|
1538
1555
|
size: "sm"
|
|
1539
1556
|
})
|
|
1540
1557
|
]),
|
|
1541
1558
|
_: 1
|
|
1542
|
-
}, 8, ["content"])) :
|
|
1543
|
-
|
|
1544
|
-
|
|
1545
|
-
|
|
1559
|
+
}, 8, ["content"])) : H("", !0),
|
|
1560
|
+
j("div", va, [
|
|
1561
|
+
j("span", pa, b(h.title), 1),
|
|
1562
|
+
j("span", fa, b(B(h)), 1)
|
|
1546
1563
|
])
|
|
1547
1564
|
])
|
|
1548
1565
|
]),
|
|
1549
|
-
"cell-rubrics":
|
|
1550
|
-
|
|
1551
|
-
(p(!0),
|
|
1552
|
-
key:
|
|
1566
|
+
"cell-rubrics": l(({ row: h }) => [
|
|
1567
|
+
j("span", ma, [
|
|
1568
|
+
(p(!0), Z(be, null, Be(h.rubrics, ($e) => (p(), C(e(oe), {
|
|
1569
|
+
key: $e.id,
|
|
1553
1570
|
size: "sm",
|
|
1554
1571
|
round: ""
|
|
1555
1572
|
}, {
|
|
1556
|
-
default:
|
|
1557
|
-
|
|
1573
|
+
default: l(() => [
|
|
1574
|
+
w(b($e.title), 1)
|
|
1558
1575
|
]),
|
|
1559
1576
|
_: 2
|
|
1560
1577
|
}, 1024))), 128))
|
|
1561
1578
|
])
|
|
1562
1579
|
]),
|
|
1563
|
-
"cell-author":
|
|
1580
|
+
"cell-author": l(({ row: h }) => [
|
|
1564
1581
|
n(e(G), {
|
|
1565
1582
|
size: "sm",
|
|
1566
1583
|
tone: "muted",
|
|
1567
1584
|
truncate: ""
|
|
1568
1585
|
}, {
|
|
1569
|
-
default:
|
|
1570
|
-
|
|
1586
|
+
default: l(() => [
|
|
1587
|
+
w(b(h.author ? h.author.name : "—"), 1)
|
|
1571
1588
|
]),
|
|
1572
1589
|
_: 2
|
|
1573
1590
|
}, 1024)
|
|
1574
1591
|
]),
|
|
1575
|
-
"cell-date":
|
|
1576
|
-
|
|
1592
|
+
"cell-date": l(({ row: h }) => [
|
|
1593
|
+
X(h) ? (p(), C(e(je), {
|
|
1577
1594
|
key: 0,
|
|
1578
|
-
value:
|
|
1579
|
-
|
|
1595
|
+
value: X(h),
|
|
1596
|
+
compact: ""
|
|
1597
|
+
}, null, 8, ["value"])) : (p(), C(e(G), {
|
|
1580
1598
|
key: 1,
|
|
1581
1599
|
size: "sm",
|
|
1582
1600
|
tone: "muted"
|
|
1583
1601
|
}, {
|
|
1584
|
-
default:
|
|
1585
|
-
|
|
1602
|
+
default: l(() => [...D[4] || (D[4] = [
|
|
1603
|
+
w("—", -1)
|
|
1586
1604
|
])]),
|
|
1587
1605
|
_: 1
|
|
1588
1606
|
}))
|
|
1589
1607
|
]),
|
|
1590
|
-
"cell-status":
|
|
1591
|
-
|
|
1592
|
-
n(e(
|
|
1593
|
-
type:
|
|
1608
|
+
"cell-status": l(({ row: h }) => [
|
|
1609
|
+
j("span", ba, [
|
|
1610
|
+
n(e(oe), {
|
|
1611
|
+
type: N(h.status),
|
|
1594
1612
|
dot: "",
|
|
1595
1613
|
size: "sm"
|
|
1596
1614
|
}, {
|
|
1597
|
-
default:
|
|
1598
|
-
|
|
1615
|
+
default: l(() => [
|
|
1616
|
+
w(b(e(t)(`panel.status-${h.status}`)), 1)
|
|
1599
1617
|
]),
|
|
1600
1618
|
_: 2
|
|
1601
1619
|
}, 1032, ["type"]),
|
|
1602
|
-
|
|
1620
|
+
h.status === "modified" ? (p(), C(e(oe), {
|
|
1603
1621
|
key: 0,
|
|
1604
1622
|
type: "primary",
|
|
1605
1623
|
size: "sm",
|
|
1606
1624
|
round: ""
|
|
1607
1625
|
}, {
|
|
1608
|
-
default:
|
|
1609
|
-
|
|
1626
|
+
default: l(() => [
|
|
1627
|
+
w(b(e(t)("panel.edits")), 1)
|
|
1610
1628
|
]),
|
|
1611
1629
|
_: 1
|
|
1612
|
-
})) :
|
|
1630
|
+
})) : H("", !0)
|
|
1613
1631
|
])
|
|
1614
1632
|
]),
|
|
1615
|
-
"cell-card":
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
|
|
1620
|
-
|
|
1633
|
+
"cell-card": l(({ row: h }) => [
|
|
1634
|
+
n(e(kt), {
|
|
1635
|
+
class: "wx-articles__entity",
|
|
1636
|
+
variant: "plain",
|
|
1637
|
+
title: h.title,
|
|
1638
|
+
image: h.cover?.thumb ?? void 0,
|
|
1639
|
+
"image-size": "56px",
|
|
1640
|
+
"title-lines": 2,
|
|
1641
|
+
subtitle: B(h)
|
|
1642
|
+
}, {
|
|
1643
|
+
title: l(() => [
|
|
1644
|
+
h.pinned ? (p(), C(e(we), {
|
|
1621
1645
|
key: 0,
|
|
1622
|
-
|
|
1623
|
-
|
|
1624
|
-
loading: "lazy"
|
|
1625
|
-
}, null, 8, $a)) : (p(), V(e(Y), {
|
|
1626
|
-
key: 1,
|
|
1627
|
-
name: "image",
|
|
1646
|
+
class: "wx-articles__pin",
|
|
1647
|
+
name: "star",
|
|
1628
1648
|
size: "sm"
|
|
1629
|
-
}))
|
|
1630
|
-
|
|
1631
|
-
q("div", Ta, [
|
|
1632
|
-
q("div", Va, [
|
|
1633
|
-
s.pinned ? (p(), V(e(Y), {
|
|
1634
|
-
key: 0,
|
|
1635
|
-
class: "wx-articles__pin",
|
|
1636
|
-
name: "star",
|
|
1637
|
-
size: "sm"
|
|
1638
|
-
})) : I("", !0),
|
|
1639
|
-
q("span", null, f(s.title), 1)
|
|
1640
|
-
]),
|
|
1641
|
-
q("div", Aa, [
|
|
1642
|
-
s.rubrics[0] ? (p(), V(e(re), {
|
|
1643
|
-
key: 0,
|
|
1644
|
-
size: "sm",
|
|
1645
|
-
round: ""
|
|
1646
|
-
}, {
|
|
1647
|
-
default: a(() => [
|
|
1648
|
-
g(f(s.rubrics[0].title), 1)
|
|
1649
|
-
]),
|
|
1650
|
-
_: 2
|
|
1651
|
-
}, 1024)) : I("", !0),
|
|
1652
|
-
n(e(re), {
|
|
1653
|
-
type: ye(s.status),
|
|
1654
|
-
dot: "",
|
|
1655
|
-
size: "sm"
|
|
1656
|
-
}, {
|
|
1657
|
-
default: a(() => [
|
|
1658
|
-
g(f(e(t)(`panel.status-${s.status}`)), 1)
|
|
1659
|
-
]),
|
|
1660
|
-
_: 2
|
|
1661
|
-
}, 1032, ["type"]),
|
|
1662
|
-
ie(s) ? (p(), V(e(De), {
|
|
1663
|
-
key: 1,
|
|
1664
|
-
value: ie(s)
|
|
1665
|
-
}, null, 8, ["value"])) : I("", !0),
|
|
1666
|
-
s.author ? (p(), V(e(G), {
|
|
1667
|
-
key: 2,
|
|
1668
|
-
size: "sm",
|
|
1669
|
-
tone: "muted",
|
|
1670
|
-
truncate: ""
|
|
1671
|
-
}, {
|
|
1672
|
-
default: a(() => [
|
|
1673
|
-
g(f(s.author.name), 1)
|
|
1674
|
-
]),
|
|
1675
|
-
_: 2
|
|
1676
|
-
}, 1024)) : I("", !0)
|
|
1677
|
-
])
|
|
1649
|
+
})) : H("", !0),
|
|
1650
|
+
w(" " + b(h.title), 1)
|
|
1678
1651
|
]),
|
|
1679
|
-
|
|
1680
|
-
|
|
1681
|
-
|
|
1682
|
-
|
|
1683
|
-
|
|
1652
|
+
meta: l(() => [
|
|
1653
|
+
h.rubrics[0] ? (p(), C(e(oe), {
|
|
1654
|
+
key: 0,
|
|
1655
|
+
size: "sm",
|
|
1656
|
+
round: ""
|
|
1657
|
+
}, {
|
|
1658
|
+
default: l(() => [
|
|
1659
|
+
w(b(h.rubrics[0].title), 1)
|
|
1660
|
+
]),
|
|
1661
|
+
_: 2
|
|
1662
|
+
}, 1024)) : H("", !0),
|
|
1663
|
+
n(e(oe), {
|
|
1664
|
+
type: N(h.status),
|
|
1665
|
+
dot: "",
|
|
1666
|
+
size: "sm"
|
|
1667
|
+
}, {
|
|
1668
|
+
default: l(() => [
|
|
1669
|
+
w(b(e(t)(`panel.status-${h.status}`)), 1)
|
|
1670
|
+
]),
|
|
1671
|
+
_: 2
|
|
1672
|
+
}, 1032, ["type"]),
|
|
1673
|
+
X(h) ? (p(), C(e(je), {
|
|
1674
|
+
key: 1,
|
|
1675
|
+
value: X(h)
|
|
1676
|
+
}, null, 8, ["value"])) : H("", !0)
|
|
1677
|
+
]),
|
|
1678
|
+
_: 2
|
|
1679
|
+
}, 1032, ["title", "image", "subtitle"])
|
|
1680
|
+
]),
|
|
1681
|
+
"card-actions": l(({ row: h }) => [
|
|
1682
|
+
n(e(Re), {
|
|
1683
|
+
actions: ce(h),
|
|
1684
|
+
label: h.title
|
|
1685
|
+
}, null, 8, ["actions", "label"])
|
|
1684
1686
|
]),
|
|
1685
|
-
"cell-actions":
|
|
1686
|
-
n(e(
|
|
1687
|
-
actions:
|
|
1688
|
-
label:
|
|
1687
|
+
"cell-actions": l(({ row: h }) => [
|
|
1688
|
+
n(e(Re), {
|
|
1689
|
+
actions: ce(h),
|
|
1690
|
+
label: h.title
|
|
1689
1691
|
}, null, 8, ["actions", "label"])
|
|
1690
1692
|
]),
|
|
1691
1693
|
_: 1
|
|
1692
|
-
}, 8, ["data", "columns", "clickable", "hover", "loading", "search-placeholder", "empty-text", "aria-label"])
|
|
1694
|
+
}, 8, ["data", "columns", "clickable", "hover", "loading", "filters-count", "filters-label", "search-placeholder", "empty-text", "aria-label"])
|
|
1693
1695
|
]),
|
|
1694
|
-
_:
|
|
1695
|
-
}, [
|
|
1696
|
-
k.value ? {
|
|
1697
|
-
name: "actions",
|
|
1698
|
-
fn: a(() => [
|
|
1699
|
-
n(e(F), {
|
|
1700
|
-
type: "primary",
|
|
1701
|
-
icon: "plus",
|
|
1702
|
-
onClick: j
|
|
1703
|
-
}, {
|
|
1704
|
-
default: a(() => [
|
|
1705
|
-
g(f(e(t)("panel.new")), 1)
|
|
1706
|
-
]),
|
|
1707
|
-
_: 1
|
|
1708
|
-
})
|
|
1709
|
-
]),
|
|
1710
|
-
key: "0"
|
|
1711
|
-
} : void 0
|
|
1712
|
-
]), 1032, ["view", "title", "views"])
|
|
1696
|
+
_: 1
|
|
1697
|
+
}, 8, ["view", "title", "views", "actions"])
|
|
1713
1698
|
], 512));
|
|
1714
1699
|
}
|
|
1715
|
-
}),
|
|
1700
|
+
}), ha = /* @__PURE__ */ ve(ga, [["__scopeId", "data-v-2d93df26"]]), ya = { class: "wx-rubric-form__head" }, wa = { class: "wx-rubric-form__body" }, _a = { class: "wx-rubric-form__row" }, xa = { class: "wx-rubric-form__row" }, ka = { class: "wx-rubric-form__side" }, $a = {
|
|
1716
1701
|
key: 1,
|
|
1717
1702
|
class: "wx-rubric-form__seo"
|
|
1718
|
-
},
|
|
1703
|
+
}, Ta = { class: "wx-rubric-form__foot" }, Va = /* @__PURE__ */ ee({
|
|
1719
1704
|
__name: "RubricForm",
|
|
1720
1705
|
props: {
|
|
1721
1706
|
rubric: {},
|
|
@@ -1724,13 +1709,13 @@ const Mt = { class: "wx-article-editor__head" }, Pt = { class: "wx-article-edito
|
|
|
1724
1709
|
disabled: { type: Boolean, default: !1 }
|
|
1725
1710
|
},
|
|
1726
1711
|
emits: ["back", "saved", "deleted", "articles"],
|
|
1727
|
-
setup(
|
|
1728
|
-
const
|
|
1729
|
-
|
|
1730
|
-
const
|
|
1731
|
-
() =>
|
|
1732
|
-
),
|
|
1733
|
-
function
|
|
1712
|
+
setup(f, { emit: m }) {
|
|
1713
|
+
const r = f, y = m, u = ne(), a = de(u), t = Xe();
|
|
1714
|
+
te();
|
|
1715
|
+
const s = Q("webx-blog"), i = ge(), x = v(() => u.types["wx-media"]?.component), T = v(() => u.types["wx-seo"]?.component), c = v(
|
|
1716
|
+
() => u.types["wx-seo"]?.bind?.({ id: "seo", type: "wx-seo" }) ?? {}
|
|
1717
|
+
), o = z(E()), _ = z({}), W = z(!1), S = z(!1);
|
|
1718
|
+
function E() {
|
|
1734
1719
|
return {
|
|
1735
1720
|
title: {},
|
|
1736
1721
|
slug: {},
|
|
@@ -1740,221 +1725,221 @@ const Mt = { class: "wx-article-editor__head" }, Pt = { class: "wx-article-edito
|
|
|
1740
1725
|
seo: {}
|
|
1741
1726
|
};
|
|
1742
1727
|
}
|
|
1743
|
-
|
|
1744
|
-
() =>
|
|
1745
|
-
(
|
|
1746
|
-
if (
|
|
1747
|
-
|
|
1728
|
+
ue(
|
|
1729
|
+
() => r.rubric,
|
|
1730
|
+
(P) => {
|
|
1731
|
+
if (_.value = {}, S.value = !1, P === null) {
|
|
1732
|
+
o.value = E();
|
|
1748
1733
|
return;
|
|
1749
1734
|
}
|
|
1750
|
-
|
|
1751
|
-
title: { ...
|
|
1752
|
-
slug: { ...
|
|
1753
|
-
lead: { ...
|
|
1754
|
-
cover:
|
|
1755
|
-
is_visible:
|
|
1756
|
-
seo: { ...
|
|
1757
|
-
},
|
|
1735
|
+
o.value = {
|
|
1736
|
+
title: { ...P.title },
|
|
1737
|
+
slug: { ...P.slug },
|
|
1738
|
+
lead: { ...P.lead },
|
|
1739
|
+
cover: P.cover ? { path: P.cover.path, url: P.cover.url } : null,
|
|
1740
|
+
is_visible: P.is_visible,
|
|
1741
|
+
seo: { ...P.seo }
|
|
1742
|
+
}, S.value = Object.keys(P.seo ?? {}).length > 0;
|
|
1758
1743
|
},
|
|
1759
1744
|
{ immediate: !0 }
|
|
1760
1745
|
);
|
|
1761
|
-
const
|
|
1762
|
-
() =>
|
|
1763
|
-
),
|
|
1764
|
-
const
|
|
1765
|
-
return
|
|
1766
|
-
}),
|
|
1767
|
-
const
|
|
1768
|
-
return typeof
|
|
1769
|
-
}),
|
|
1770
|
-
function
|
|
1771
|
-
const
|
|
1772
|
-
(
|
|
1746
|
+
const F = v(
|
|
1747
|
+
() => o.value.title[t.active.value] || r.rubric?.name || s("rubric.new")
|
|
1748
|
+
), $ = v(() => {
|
|
1749
|
+
const P = o.value.slug[t.active.value] ?? "";
|
|
1750
|
+
return P === "" ? null : `/${[r.prefix, P].filter(Boolean).join("/")}`;
|
|
1751
|
+
}), U = v(() => {
|
|
1752
|
+
const P = r.rubric?.path;
|
|
1753
|
+
return typeof P == "string" && $.value !== null && $.value !== `/${P}`;
|
|
1754
|
+
}), R = v(() => r.rubric?.articles_count ?? 0);
|
|
1755
|
+
function M(P) {
|
|
1756
|
+
const q = Object.keys(_.value).find(
|
|
1757
|
+
(k) => k === P || k.startsWith(`${P}.`)
|
|
1773
1758
|
);
|
|
1774
|
-
return
|
|
1759
|
+
return q === void 0 ? void 0 : _.value[q]?.[0];
|
|
1775
1760
|
}
|
|
1776
1761
|
function A() {
|
|
1777
1762
|
return {
|
|
1778
|
-
title:
|
|
1779
|
-
slug:
|
|
1780
|
-
lead:
|
|
1781
|
-
cover:
|
|
1782
|
-
is_visible:
|
|
1763
|
+
title: o.value.title,
|
|
1764
|
+
slug: o.value.slug,
|
|
1765
|
+
lead: o.value.lead,
|
|
1766
|
+
cover: o.value.cover === null ? null : { path: o.value.cover.path },
|
|
1767
|
+
is_visible: o.value.is_visible,
|
|
1783
1768
|
// Only when it was opened: a save of the rest of the form must not empty a card nobody
|
|
1784
1769
|
// looked at, and an untouched card is the rules being left in charge (§12).
|
|
1785
|
-
...
|
|
1770
|
+
...S.value ? { seo: o.value.seo } : {}
|
|
1786
1771
|
};
|
|
1787
1772
|
}
|
|
1788
|
-
async function
|
|
1789
|
-
|
|
1773
|
+
async function I() {
|
|
1774
|
+
W.value = !0, _.value = {};
|
|
1790
1775
|
try {
|
|
1791
|
-
const
|
|
1792
|
-
L.success(
|
|
1793
|
-
} catch (
|
|
1794
|
-
const
|
|
1795
|
-
|
|
1776
|
+
const P = r.rubric === null ? await a.createRubric(A()) : await a.saveRubric(r.rubric.id, A());
|
|
1777
|
+
L.success(r.rubric === null ? s("rubric.created") : s("rubric.saved")), y("saved", P);
|
|
1778
|
+
} catch (P) {
|
|
1779
|
+
const q = P.body;
|
|
1780
|
+
q?.errors && (_.value = q.errors), L.danger(i(P));
|
|
1796
1781
|
} finally {
|
|
1797
|
-
|
|
1782
|
+
W.value = !1;
|
|
1798
1783
|
}
|
|
1799
1784
|
}
|
|
1800
|
-
async function
|
|
1801
|
-
if (!(
|
|
1802
|
-
title:
|
|
1803
|
-
message:
|
|
1804
|
-
confirmText:
|
|
1805
|
-
cancelText:
|
|
1785
|
+
async function K() {
|
|
1786
|
+
if (!(r.rubric === null || !await me({
|
|
1787
|
+
title: s("rubric.delete-title", { name: r.rubric.name }),
|
|
1788
|
+
message: s("rubric.delete-text"),
|
|
1789
|
+
confirmText: s("rubric.delete"),
|
|
1790
|
+
cancelText: s("rubric.cancel"),
|
|
1806
1791
|
tone: "danger"
|
|
1807
1792
|
})))
|
|
1808
1793
|
try {
|
|
1809
|
-
await
|
|
1810
|
-
} catch (
|
|
1811
|
-
L.danger(i(
|
|
1794
|
+
await a.removeRubric(r.rubric.id), L.success(s("rubric.deleted")), y("deleted");
|
|
1795
|
+
} catch (q) {
|
|
1796
|
+
L.danger(i(q));
|
|
1812
1797
|
}
|
|
1813
1798
|
}
|
|
1814
|
-
return (
|
|
1815
|
-
class:
|
|
1799
|
+
return (P, q) => (p(), Z("div", {
|
|
1800
|
+
class: Pe(["wx-rubric-form", { "is-pane": r.inline }])
|
|
1816
1801
|
}, [
|
|
1817
|
-
|
|
1818
|
-
|
|
1802
|
+
j("div", ya, [
|
|
1803
|
+
r.inline ? H("", !0) : (p(), C(e(Oe), {
|
|
1819
1804
|
key: 0,
|
|
1820
1805
|
icon: "arrow-left",
|
|
1821
|
-
title: e(
|
|
1822
|
-
onClick:
|
|
1806
|
+
title: e(s)("rubric.back"),
|
|
1807
|
+
onClick: q[0] || (q[0] = (k) => y("back"))
|
|
1823
1808
|
}, null, 8, ["title"])),
|
|
1824
|
-
n(e(
|
|
1809
|
+
n(e($t), {
|
|
1825
1810
|
level: 3,
|
|
1826
1811
|
truncate: ""
|
|
1827
1812
|
}, {
|
|
1828
|
-
default:
|
|
1829
|
-
|
|
1813
|
+
default: l(() => [
|
|
1814
|
+
w(b(F.value), 1)
|
|
1830
1815
|
]),
|
|
1831
1816
|
_: 1
|
|
1832
1817
|
}),
|
|
1833
|
-
|
|
1818
|
+
r.rubric ? (p(), C(e(G), {
|
|
1834
1819
|
key: 1,
|
|
1835
1820
|
size: "sm",
|
|
1836
1821
|
tone: "muted"
|
|
1837
1822
|
}, {
|
|
1838
|
-
default:
|
|
1839
|
-
|
|
1823
|
+
default: l(() => [
|
|
1824
|
+
w(b(e(s)("rubric.articles", { count: R.value })), 1)
|
|
1840
1825
|
]),
|
|
1841
1826
|
_: 1
|
|
1842
|
-
})) :
|
|
1843
|
-
|
|
1844
|
-
|
|
1827
|
+
})) : H("", !0),
|
|
1828
|
+
q[10] || (q[10] = j("span", { class: "wx-rubric-form__spacer" }, null, -1)),
|
|
1829
|
+
r.rubric && R.value > 0 ? (p(), C(e(J), {
|
|
1845
1830
|
key: 2,
|
|
1846
1831
|
variant: "text",
|
|
1847
1832
|
size: "sm",
|
|
1848
|
-
onClick:
|
|
1833
|
+
onClick: q[1] || (q[1] = (k) => y("articles", r.rubric))
|
|
1849
1834
|
}, {
|
|
1850
|
-
default:
|
|
1851
|
-
|
|
1835
|
+
default: l(() => [
|
|
1836
|
+
w(b(e(s)("rubric.show-articles")), 1)
|
|
1852
1837
|
]),
|
|
1853
1838
|
_: 1
|
|
1854
|
-
})) :
|
|
1839
|
+
})) : H("", !0)
|
|
1855
1840
|
]),
|
|
1856
|
-
|
|
1857
|
-
|
|
1858
|
-
n(e(
|
|
1841
|
+
j("div", wa, [
|
|
1842
|
+
j("div", _a, [
|
|
1843
|
+
n(e(ie), {
|
|
1859
1844
|
class: "wx-rubric-form__title",
|
|
1860
|
-
label: e(
|
|
1861
|
-
error:
|
|
1845
|
+
label: e(s)("rubric.field-title"),
|
|
1846
|
+
error: M("title"),
|
|
1862
1847
|
required: ""
|
|
1863
1848
|
}, {
|
|
1864
|
-
default:
|
|
1865
|
-
n(e(
|
|
1866
|
-
modelValue:
|
|
1867
|
-
"onUpdate:modelValue":
|
|
1849
|
+
default: l(() => [
|
|
1850
|
+
n(e(Ae), {
|
|
1851
|
+
modelValue: o.value.title,
|
|
1852
|
+
"onUpdate:modelValue": q[2] || (q[2] = (k) => o.value.title = k),
|
|
1868
1853
|
localized: "",
|
|
1869
|
-
disabled:
|
|
1854
|
+
disabled: r.disabled
|
|
1870
1855
|
}, null, 8, ["modelValue", "disabled"])
|
|
1871
1856
|
]),
|
|
1872
1857
|
_: 1
|
|
1873
1858
|
}, 8, ["label", "error"]),
|
|
1874
|
-
n(e(
|
|
1859
|
+
n(e(ie), {
|
|
1875
1860
|
class: "wx-rubric-form__slug",
|
|
1876
|
-
label: e(
|
|
1877
|
-
error:
|
|
1878
|
-
help:
|
|
1861
|
+
label: e(s)("rubric.field-slug"),
|
|
1862
|
+
error: M("slug"),
|
|
1863
|
+
help: $.value ?? e(s)("rubric.no-address")
|
|
1879
1864
|
}, {
|
|
1880
|
-
default:
|
|
1881
|
-
n(e(
|
|
1882
|
-
modelValue:
|
|
1883
|
-
"onUpdate:modelValue":
|
|
1865
|
+
default: l(() => [
|
|
1866
|
+
n(e(Ae), {
|
|
1867
|
+
modelValue: o.value.slug,
|
|
1868
|
+
"onUpdate:modelValue": q[3] || (q[3] = (k) => o.value.slug = k),
|
|
1884
1869
|
localized: "",
|
|
1885
|
-
disabled:
|
|
1870
|
+
disabled: r.disabled
|
|
1886
1871
|
}, null, 8, ["modelValue", "disabled"])
|
|
1887
1872
|
]),
|
|
1888
1873
|
_: 1
|
|
1889
1874
|
}, 8, ["label", "error", "help"])
|
|
1890
1875
|
]),
|
|
1891
|
-
|
|
1876
|
+
U.value ? (p(), C(e(We), {
|
|
1892
1877
|
key: 0,
|
|
1893
1878
|
type: "info",
|
|
1894
1879
|
variant: "soft",
|
|
1895
|
-
description: e(
|
|
1896
|
-
}, null, 8, ["description"])) :
|
|
1897
|
-
n(e(
|
|
1898
|
-
label: e(
|
|
1899
|
-
help: e(
|
|
1880
|
+
description: e(s)("rubric.address-moving")
|
|
1881
|
+
}, null, 8, ["description"])) : H("", !0),
|
|
1882
|
+
n(e(ie), {
|
|
1883
|
+
label: e(s)("rubric.field-lead"),
|
|
1884
|
+
help: e(s)("rubric.lead-help"),
|
|
1900
1885
|
wide: ""
|
|
1901
1886
|
}, {
|
|
1902
|
-
default:
|
|
1903
|
-
n(e(
|
|
1904
|
-
modelValue:
|
|
1905
|
-
"onUpdate:modelValue":
|
|
1887
|
+
default: l(() => [
|
|
1888
|
+
n(e(Tt), {
|
|
1889
|
+
modelValue: o.value.lead,
|
|
1890
|
+
"onUpdate:modelValue": q[4] || (q[4] = (k) => o.value.lead = k),
|
|
1906
1891
|
localized: "",
|
|
1907
1892
|
rows: 3,
|
|
1908
|
-
disabled:
|
|
1893
|
+
disabled: r.disabled
|
|
1909
1894
|
}, null, 8, ["modelValue", "disabled"])
|
|
1910
1895
|
]),
|
|
1911
1896
|
_: 1
|
|
1912
1897
|
}, 8, ["label", "help"]),
|
|
1913
|
-
|
|
1914
|
-
|
|
1898
|
+
j("div", xa, [
|
|
1899
|
+
x.value ? (p(), C(tt(x.value), {
|
|
1915
1900
|
key: 0,
|
|
1916
|
-
modelValue:
|
|
1917
|
-
"onUpdate:modelValue":
|
|
1901
|
+
modelValue: o.value.cover,
|
|
1902
|
+
"onUpdate:modelValue": q[5] || (q[5] = (k) => o.value.cover = k),
|
|
1918
1903
|
class: "wx-rubric-form__cover",
|
|
1919
|
-
label: e(
|
|
1904
|
+
label: e(s)("rubric.field-cover"),
|
|
1920
1905
|
accept: "image",
|
|
1921
1906
|
captions: !1,
|
|
1922
1907
|
aspect: "16/9",
|
|
1923
|
-
disabled:
|
|
1924
|
-
}, null, 8, ["modelValue", "label", "disabled"])) :
|
|
1925
|
-
|
|
1926
|
-
n(e(
|
|
1927
|
-
modelValue:
|
|
1928
|
-
"onUpdate:modelValue":
|
|
1929
|
-
label: e(
|
|
1930
|
-
disabled:
|
|
1908
|
+
disabled: r.disabled
|
|
1909
|
+
}, null, 8, ["modelValue", "label", "disabled"])) : H("", !0),
|
|
1910
|
+
j("div", ka, [
|
|
1911
|
+
n(e(Vt), {
|
|
1912
|
+
modelValue: o.value.is_visible,
|
|
1913
|
+
"onUpdate:modelValue": q[6] || (q[6] = (k) => o.value.is_visible = k),
|
|
1914
|
+
label: e(s)("rubric.visible"),
|
|
1915
|
+
disabled: r.disabled
|
|
1931
1916
|
}, null, 8, ["modelValue", "label", "disabled"]),
|
|
1932
1917
|
n(e(G), {
|
|
1933
1918
|
size: "sm",
|
|
1934
1919
|
tone: "muted"
|
|
1935
1920
|
}, {
|
|
1936
|
-
default:
|
|
1937
|
-
|
|
1921
|
+
default: l(() => [
|
|
1922
|
+
w(b(e(s)("rubric.visible-help")), 1)
|
|
1938
1923
|
]),
|
|
1939
1924
|
_: 1
|
|
1940
1925
|
})
|
|
1941
1926
|
])
|
|
1942
1927
|
]),
|
|
1943
|
-
T.value ? (p(),
|
|
1944
|
-
|
|
1928
|
+
T.value ? (p(), Z("div", $a, [
|
|
1929
|
+
S.value ? (p(), C(tt(T.value), pt({
|
|
1945
1930
|
key: 1,
|
|
1946
|
-
modelValue:
|
|
1947
|
-
"onUpdate:modelValue":
|
|
1948
|
-
},
|
|
1931
|
+
modelValue: o.value.seo,
|
|
1932
|
+
"onUpdate:modelValue": q[8] || (q[8] = (k) => o.value.seo = k)
|
|
1933
|
+
}, c.value, {
|
|
1949
1934
|
"structured-data": !1,
|
|
1950
|
-
disabled:
|
|
1951
|
-
}), null, 16, ["modelValue", "disabled"])) : (p(),
|
|
1935
|
+
disabled: r.disabled
|
|
1936
|
+
}), null, 16, ["modelValue", "disabled"])) : (p(), Z(be, { key: 0 }, [
|
|
1952
1937
|
n(e(G), {
|
|
1953
1938
|
size: "sm",
|
|
1954
1939
|
weight: "medium"
|
|
1955
1940
|
}, {
|
|
1956
|
-
default:
|
|
1957
|
-
|
|
1941
|
+
default: l(() => [
|
|
1942
|
+
w(b(e(s)("rubric.seo")), 1)
|
|
1958
1943
|
]),
|
|
1959
1944
|
_: 1
|
|
1960
1945
|
}),
|
|
@@ -1962,211 +1947,202 @@ const Mt = { class: "wx-article-editor__head" }, Pt = { class: "wx-article-edito
|
|
|
1962
1947
|
size: "sm",
|
|
1963
1948
|
tone: "muted"
|
|
1964
1949
|
}, {
|
|
1965
|
-
default:
|
|
1966
|
-
|
|
1950
|
+
default: l(() => [
|
|
1951
|
+
w(b(e(s)("rubric.seo-help")), 1)
|
|
1967
1952
|
]),
|
|
1968
1953
|
_: 1
|
|
1969
1954
|
}),
|
|
1970
|
-
n(e(
|
|
1955
|
+
n(e(J), {
|
|
1971
1956
|
variant: "text",
|
|
1972
1957
|
size: "sm",
|
|
1973
|
-
disabled:
|
|
1974
|
-
onClick:
|
|
1958
|
+
disabled: r.disabled,
|
|
1959
|
+
onClick: q[7] || (q[7] = (k) => S.value = !0)
|
|
1975
1960
|
}, {
|
|
1976
|
-
default:
|
|
1977
|
-
|
|
1961
|
+
default: l(() => [
|
|
1962
|
+
w(b(e(s)("rubric.seo-override", { name: F.value })), 1)
|
|
1978
1963
|
]),
|
|
1979
1964
|
_: 1
|
|
1980
1965
|
}, 8, ["disabled"])
|
|
1981
1966
|
], 64))
|
|
1982
|
-
])) :
|
|
1967
|
+
])) : H("", !0)
|
|
1983
1968
|
]),
|
|
1984
|
-
|
|
1985
|
-
|
|
1986
|
-
n(e(
|
|
1969
|
+
j("div", Ta, [
|
|
1970
|
+
r.rubric ? (p(), Z(be, { key: 0 }, [
|
|
1971
|
+
n(e(J), {
|
|
1987
1972
|
variant: "outline",
|
|
1988
1973
|
type: "danger",
|
|
1989
|
-
disabled:
|
|
1990
|
-
onClick:
|
|
1974
|
+
disabled: r.disabled || R.value > 0,
|
|
1975
|
+
onClick: K
|
|
1991
1976
|
}, {
|
|
1992
|
-
icon:
|
|
1993
|
-
n(e(
|
|
1977
|
+
icon: l(() => [
|
|
1978
|
+
n(e(we), { name: "trash" })
|
|
1994
1979
|
]),
|
|
1995
|
-
default:
|
|
1996
|
-
|
|
1980
|
+
default: l(() => [
|
|
1981
|
+
w(" " + b(e(s)("rubric.delete")), 1)
|
|
1997
1982
|
]),
|
|
1998
1983
|
_: 1
|
|
1999
1984
|
}, 8, ["disabled"]),
|
|
2000
|
-
|
|
1985
|
+
R.value > 0 ? (p(), C(e(G), {
|
|
2001
1986
|
key: 0,
|
|
2002
1987
|
size: "sm",
|
|
2003
1988
|
tone: "muted"
|
|
2004
1989
|
}, {
|
|
2005
|
-
default:
|
|
2006
|
-
|
|
1990
|
+
default: l(() => [
|
|
1991
|
+
w(b(e(s)("rubric.delete-blocked")), 1)
|
|
2007
1992
|
]),
|
|
2008
1993
|
_: 1
|
|
2009
|
-
})) :
|
|
2010
|
-
], 64)) :
|
|
2011
|
-
|
|
2012
|
-
n(e(
|
|
1994
|
+
})) : H("", !0)
|
|
1995
|
+
], 64)) : H("", !0),
|
|
1996
|
+
q[11] || (q[11] = j("span", { class: "wx-rubric-form__spacer" }, null, -1)),
|
|
1997
|
+
n(e(J), {
|
|
2013
1998
|
variant: "outline",
|
|
2014
|
-
onClick:
|
|
1999
|
+
onClick: q[9] || (q[9] = (k) => y("back"))
|
|
2015
2000
|
}, {
|
|
2016
|
-
default:
|
|
2017
|
-
|
|
2001
|
+
default: l(() => [
|
|
2002
|
+
w(b(e(s)("rubric.cancel")), 1)
|
|
2018
2003
|
]),
|
|
2019
2004
|
_: 1
|
|
2020
2005
|
}),
|
|
2021
|
-
n(e(
|
|
2006
|
+
n(e(J), {
|
|
2022
2007
|
type: "primary",
|
|
2023
|
-
loading:
|
|
2024
|
-
disabled:
|
|
2025
|
-
onClick:
|
|
2008
|
+
loading: W.value,
|
|
2009
|
+
disabled: r.disabled,
|
|
2010
|
+
onClick: I
|
|
2026
2011
|
}, {
|
|
2027
|
-
default:
|
|
2028
|
-
|
|
2012
|
+
default: l(() => [
|
|
2013
|
+
w(b(e(s)("rubric.save")), 1)
|
|
2029
2014
|
]),
|
|
2030
2015
|
_: 1
|
|
2031
2016
|
}, 8, ["loading", "disabled"])
|
|
2032
2017
|
])
|
|
2033
2018
|
], 2));
|
|
2034
2019
|
}
|
|
2035
|
-
}),
|
|
2020
|
+
}), Aa = /* @__PURE__ */ ve(Va, [["__scopeId", "data-v-ace40cf4"]]), Sa = ["onClick"], Wa = { class: "wx-rubric-row__name" }, Ca = /* @__PURE__ */ ee({
|
|
2036
2021
|
__name: "RubricsPage",
|
|
2037
2022
|
props: {
|
|
2038
2023
|
base: { default: "/blog" }
|
|
2039
2024
|
},
|
|
2040
|
-
setup(
|
|
2041
|
-
const
|
|
2042
|
-
|
|
2043
|
-
const t =
|
|
2044
|
-
() =>
|
|
2045
|
-
),
|
|
2046
|
-
const
|
|
2047
|
-
return typeof
|
|
2048
|
-
}),
|
|
2049
|
-
async function
|
|
2025
|
+
setup(f) {
|
|
2026
|
+
const m = f, r = ne(), y = de(r), u = He(), a = Ke();
|
|
2027
|
+
te();
|
|
2028
|
+
const t = Q("webx-blog"), s = ge(), i = z([]), x = z(""), T = z(!0), c = z(!1), o = z(!1), _ = v(() => r.can("blog.taxonomy.manage")), W = v(
|
|
2029
|
+
() => r.state.manifest?.modules.find((k) => k.id === "rubrics")?.title ?? t("module.rubrics")
|
|
2030
|
+
), S = v(() => {
|
|
2031
|
+
const k = u.query.rubric;
|
|
2032
|
+
return typeof k == "string" && k !== "" ? Number(k) : null;
|
|
2033
|
+
}), E = v(() => i.value.find((k) => k.id === S.value) ?? null);
|
|
2034
|
+
async function F() {
|
|
2050
2035
|
T.value = !0;
|
|
2051
2036
|
try {
|
|
2052
|
-
const
|
|
2053
|
-
i.value =
|
|
2054
|
-
} catch (
|
|
2055
|
-
L.danger(
|
|
2037
|
+
const k = await y.rubrics();
|
|
2038
|
+
i.value = k.data, x.value = k.prefix;
|
|
2039
|
+
} catch (k) {
|
|
2040
|
+
L.danger(s(k));
|
|
2056
2041
|
} finally {
|
|
2057
2042
|
T.value = !1;
|
|
2058
2043
|
}
|
|
2059
2044
|
}
|
|
2060
|
-
|
|
2061
|
-
|
|
2045
|
+
F(), ue(E, (k) => {
|
|
2046
|
+
k !== null && (c.value = !0);
|
|
2062
2047
|
});
|
|
2063
|
-
function
|
|
2064
|
-
|
|
2048
|
+
function $(k) {
|
|
2049
|
+
o.value = !1, a.replace({ query: { ...u.query, rubric: String(k.id) } }), c.value = !0;
|
|
2065
2050
|
}
|
|
2066
|
-
function
|
|
2067
|
-
|
|
2051
|
+
function U() {
|
|
2052
|
+
o.value = !0, R(), c.value = !0;
|
|
2068
2053
|
}
|
|
2069
|
-
function
|
|
2070
|
-
const
|
|
2071
|
-
delete
|
|
2054
|
+
function R() {
|
|
2055
|
+
const k = { ...u.query };
|
|
2056
|
+
delete k.rubric, a.replace({ query: k });
|
|
2072
2057
|
}
|
|
2073
|
-
async function
|
|
2074
|
-
|
|
2058
|
+
async function M(k) {
|
|
2059
|
+
o.value = !1, await F(), a.replace({ query: { ...u.query, rubric: String(k.id) } });
|
|
2075
2060
|
}
|
|
2076
2061
|
async function A() {
|
|
2077
|
-
|
|
2062
|
+
o.value = !1, R(), c.value = !1, await F();
|
|
2078
2063
|
}
|
|
2079
|
-
function
|
|
2080
|
-
|
|
2064
|
+
function I() {
|
|
2065
|
+
o.value = !1, R(), c.value = !1;
|
|
2081
2066
|
}
|
|
2082
|
-
function
|
|
2083
|
-
|
|
2067
|
+
function K(k) {
|
|
2068
|
+
a.push({ path: `${m.base}/articles`, query: { rubric: String(k.id) } });
|
|
2084
2069
|
}
|
|
2085
|
-
|
|
2070
|
+
const P = v(
|
|
2071
|
+
() => _.value ? [{ key: "new", label: t("rubric.new"), icon: "plus", primary: !0, run: () => {
|
|
2072
|
+
U();
|
|
2073
|
+
} }] : []
|
|
2074
|
+
);
|
|
2075
|
+
async function q() {
|
|
2086
2076
|
try {
|
|
2087
|
-
await
|
|
2088
|
-
} catch (
|
|
2089
|
-
L.danger(
|
|
2077
|
+
await y.sortRubrics(i.value.map((k) => k.id));
|
|
2078
|
+
} catch (k) {
|
|
2079
|
+
L.danger(s(k, t("rubric.reorder-failed"))), await F();
|
|
2090
2080
|
}
|
|
2091
2081
|
}
|
|
2092
|
-
return (
|
|
2093
|
-
title:
|
|
2082
|
+
return (k, le) => (p(), C(e(Qe), {
|
|
2083
|
+
title: W.value,
|
|
2084
|
+
actions: P.value,
|
|
2094
2085
|
card: !1,
|
|
2095
2086
|
fill: ""
|
|
2096
2087
|
}, {
|
|
2097
|
-
|
|
2098
|
-
|
|
2099
|
-
key: 0,
|
|
2100
|
-
type: "primary",
|
|
2101
|
-
onClick: R
|
|
2102
|
-
}, {
|
|
2103
|
-
icon: a(() => [
|
|
2104
|
-
n(e(Y), { name: "plus" })
|
|
2105
|
-
]),
|
|
2106
|
-
default: a(() => [
|
|
2107
|
-
g(" " + f(e(t)("rubric.new")), 1)
|
|
2108
|
-
]),
|
|
2109
|
-
_: 1
|
|
2110
|
-
})) : I("", !0)
|
|
2111
|
-
]),
|
|
2112
|
-
default: a(() => [
|
|
2113
|
-
n(e(Vt), {
|
|
2088
|
+
default: l(() => [
|
|
2089
|
+
n(e(At), {
|
|
2114
2090
|
class: "wx-rubrics",
|
|
2115
2091
|
padding: "none"
|
|
2116
2092
|
}, {
|
|
2117
|
-
default:
|
|
2118
|
-
n(e(
|
|
2119
|
-
open:
|
|
2120
|
-
"onUpdate:open":
|
|
2093
|
+
default: l(() => [
|
|
2094
|
+
n(e(St), {
|
|
2095
|
+
open: c.value,
|
|
2096
|
+
"onUpdate:open": le[1] || (le[1] = (O) => c.value = O),
|
|
2121
2097
|
class: "wx-rubrics__panes",
|
|
2122
2098
|
"list-width": 320,
|
|
2123
2099
|
"detail-min": 440,
|
|
2124
|
-
"detail-label":
|
|
2100
|
+
"detail-label": E.value ? E.value.name : e(t)("rubric.new")
|
|
2125
2101
|
}, {
|
|
2126
|
-
list:
|
|
2127
|
-
T.value ? (p(),
|
|
2102
|
+
list: l(() => [
|
|
2103
|
+
T.value ? (p(), C(e(Ue), {
|
|
2128
2104
|
key: 0,
|
|
2129
2105
|
class: "wx-rubrics__loading",
|
|
2130
2106
|
rows: 5
|
|
2131
|
-
})) : i.value.length === 0 ? (p(),
|
|
2107
|
+
})) : i.value.length === 0 ? (p(), C(e(Ge), {
|
|
2132
2108
|
key: 1,
|
|
2133
2109
|
title: e(t)("rubric.empty"),
|
|
2134
2110
|
description: e(t)("rubric.empty-help")
|
|
2135
|
-
}, null, 8, ["title", "description"])) : (p(),
|
|
2111
|
+
}, null, 8, ["title", "description"])) : (p(), C(e(Ye), {
|
|
2136
2112
|
key: 2,
|
|
2137
2113
|
modelValue: i.value,
|
|
2138
|
-
"onUpdate:modelValue":
|
|
2114
|
+
"onUpdate:modelValue": le[0] || (le[0] = (O) => i.value = O),
|
|
2139
2115
|
class: "wx-rubrics__list",
|
|
2140
2116
|
plain: "",
|
|
2141
2117
|
size: "sm",
|
|
2142
2118
|
"item-key": "id",
|
|
2143
|
-
"item-label": (
|
|
2144
|
-
disabled: !
|
|
2119
|
+
"item-label": (O) => O.name,
|
|
2120
|
+
disabled: !_.value,
|
|
2145
2121
|
title: e(t)("rubric.order"),
|
|
2146
|
-
onMove:
|
|
2122
|
+
onMove: q
|
|
2147
2123
|
}, {
|
|
2148
|
-
default:
|
|
2149
|
-
|
|
2124
|
+
default: l(({ item: O }) => [
|
|
2125
|
+
j("button", {
|
|
2150
2126
|
type: "button",
|
|
2151
|
-
class:
|
|
2152
|
-
onClick: (
|
|
2127
|
+
class: Pe(["wx-rubric-row", { "is-current": O.id === S.value, "is-hidden": !O.is_visible }]),
|
|
2128
|
+
onClick: (se) => $(O)
|
|
2153
2129
|
}, [
|
|
2154
|
-
|
|
2130
|
+
j("span", Wa, [
|
|
2155
2131
|
n(e(G), {
|
|
2156
2132
|
truncate: "",
|
|
2157
2133
|
weight: "medium"
|
|
2158
2134
|
}, {
|
|
2159
|
-
default:
|
|
2160
|
-
|
|
2135
|
+
default: l(() => [
|
|
2136
|
+
w(b(O.name), 1)
|
|
2161
2137
|
]),
|
|
2162
2138
|
_: 2
|
|
2163
2139
|
}, 1024),
|
|
2164
|
-
|
|
2140
|
+
O.is_visible ? H("", !0) : (p(), C(e(et), {
|
|
2165
2141
|
key: 0,
|
|
2166
2142
|
content: e(t)("rubric.hidden")
|
|
2167
2143
|
}, {
|
|
2168
|
-
default:
|
|
2169
|
-
n(e(
|
|
2144
|
+
default: l(() => [
|
|
2145
|
+
n(e(we), {
|
|
2170
2146
|
name: "eye-off",
|
|
2171
2147
|
size: "sm"
|
|
2172
2148
|
})
|
|
@@ -2179,21 +2155,21 @@ const Mt = { class: "wx-article-editor__head" }, Pt = { class: "wx-article-edito
|
|
|
2179
2155
|
tone: "muted",
|
|
2180
2156
|
truncate: ""
|
|
2181
2157
|
}, {
|
|
2182
|
-
default:
|
|
2183
|
-
|
|
2158
|
+
default: l(() => [
|
|
2159
|
+
w(b(O.path === null ? e(t)("rubric.no-address") : `/${O.path}`), 1)
|
|
2184
2160
|
]),
|
|
2185
2161
|
_: 2
|
|
2186
2162
|
}, 1024)
|
|
2187
|
-
], 10,
|
|
2163
|
+
], 10, Sa)
|
|
2188
2164
|
]),
|
|
2189
|
-
actions:
|
|
2165
|
+
actions: l(({ item: O }) => [
|
|
2190
2166
|
n(e(G), {
|
|
2191
2167
|
class: "wx-rubric-row__count",
|
|
2192
2168
|
size: "sm",
|
|
2193
2169
|
tone: "muted"
|
|
2194
2170
|
}, {
|
|
2195
|
-
default:
|
|
2196
|
-
|
|
2171
|
+
default: l(() => [
|
|
2172
|
+
w(b(O.articles_count), 1)
|
|
2197
2173
|
]),
|
|
2198
2174
|
_: 2
|
|
2199
2175
|
}, 1024)
|
|
@@ -2201,25 +2177,25 @@ const Mt = { class: "wx-article-editor__head" }, Pt = { class: "wx-article-edito
|
|
|
2201
2177
|
_: 1
|
|
2202
2178
|
}, 8, ["modelValue", "item-label", "disabled", "title"]))
|
|
2203
2179
|
]),
|
|
2204
|
-
empty:
|
|
2205
|
-
n(e(
|
|
2180
|
+
empty: l(() => [
|
|
2181
|
+
n(e(Ge), {
|
|
2206
2182
|
description: e(t)("rubric.choose")
|
|
2207
2183
|
}, null, 8, ["description"])
|
|
2208
2184
|
]),
|
|
2209
|
-
detail:
|
|
2210
|
-
|
|
2211
|
-
key:
|
|
2212
|
-
rubric:
|
|
2213
|
-
prefix:
|
|
2214
|
-
inline:
|
|
2215
|
-
disabled: !
|
|
2185
|
+
detail: l(({ inline: O, back: se }) => [
|
|
2186
|
+
o.value || E.value ? (p(), C(Aa, {
|
|
2187
|
+
key: o.value ? "new" : String(E.value?.id),
|
|
2188
|
+
rubric: o.value ? null : E.value,
|
|
2189
|
+
prefix: x.value,
|
|
2190
|
+
inline: O,
|
|
2191
|
+
disabled: !_.value,
|
|
2216
2192
|
onBack: () => {
|
|
2217
|
-
|
|
2193
|
+
se(), I();
|
|
2218
2194
|
},
|
|
2219
|
-
onArticles:
|
|
2220
|
-
onSaved:
|
|
2195
|
+
onArticles: K,
|
|
2196
|
+
onSaved: M,
|
|
2221
2197
|
onDeleted: A
|
|
2222
|
-
}, null, 8, ["rubric", "prefix", "inline", "disabled", "onBack"])) :
|
|
2198
|
+
}, null, 8, ["rubric", "prefix", "inline", "disabled", "onBack"])) : H("", !0)
|
|
2223
2199
|
]),
|
|
2224
2200
|
_: 1
|
|
2225
2201
|
}, 8, ["open", "detail-label"])
|
|
@@ -2228,60 +2204,60 @@ const Mt = { class: "wx-article-editor__head" }, Pt = { class: "wx-article-edito
|
|
|
2228
2204
|
})
|
|
2229
2205
|
]),
|
|
2230
2206
|
_: 1
|
|
2231
|
-
}, 8, ["title"]));
|
|
2207
|
+
}, 8, ["title", "actions"]));
|
|
2232
2208
|
}
|
|
2233
|
-
}),
|
|
2209
|
+
}), za = /* @__PURE__ */ ee({
|
|
2234
2210
|
__name: "TagCreateDialog",
|
|
2235
|
-
setup(
|
|
2236
|
-
const { open:
|
|
2237
|
-
|
|
2238
|
-
const t =
|
|
2239
|
-
|
|
2240
|
-
await
|
|
2211
|
+
setup(f) {
|
|
2212
|
+
const { open: m, resolve: r, dismiss: y } = Ee(), u = ne(), a = de(u);
|
|
2213
|
+
te();
|
|
2214
|
+
const t = Q("webx-blog"), s = z(""), i = z(""), x = z(!1), T = z({}), c = De("field");
|
|
2215
|
+
Ne(async () => {
|
|
2216
|
+
await Ze(), c.value?.querySelector("input")?.focus();
|
|
2241
2217
|
});
|
|
2242
|
-
async function
|
|
2243
|
-
if (!(
|
|
2244
|
-
|
|
2218
|
+
async function o() {
|
|
2219
|
+
if (!(s.value.trim() === "" || x.value)) {
|
|
2220
|
+
x.value = !0, T.value = {};
|
|
2245
2221
|
try {
|
|
2246
|
-
|
|
2247
|
-
await
|
|
2248
|
-
title:
|
|
2222
|
+
r(
|
|
2223
|
+
await a.createTag({
|
|
2224
|
+
title: s.value.trim(),
|
|
2249
2225
|
...i.value.trim() === "" ? {} : { slug: i.value.trim() }
|
|
2250
2226
|
})
|
|
2251
2227
|
);
|
|
2252
|
-
} catch (
|
|
2253
|
-
T.value =
|
|
2228
|
+
} catch (_) {
|
|
2229
|
+
T.value = _.body?.errors ?? {};
|
|
2254
2230
|
} finally {
|
|
2255
|
-
|
|
2231
|
+
x.value = !1;
|
|
2256
2232
|
}
|
|
2257
2233
|
}
|
|
2258
2234
|
}
|
|
2259
|
-
return (
|
|
2260
|
-
open: e(
|
|
2261
|
-
"onUpdate:open":
|
|
2235
|
+
return (_, W) => (p(), C(e(Fe), {
|
|
2236
|
+
open: e(m),
|
|
2237
|
+
"onUpdate:open": W[3] || (W[3] = (S) => Ie(m) ? m.value = S : null),
|
|
2262
2238
|
title: e(t)("tag.new-title"),
|
|
2263
2239
|
width: 440
|
|
2264
2240
|
}, {
|
|
2265
|
-
footer:
|
|
2266
|
-
n(e(
|
|
2267
|
-
default:
|
|
2268
|
-
n(e(
|
|
2241
|
+
footer: l(() => [
|
|
2242
|
+
n(e(Le), { size: "sm" }, {
|
|
2243
|
+
default: l(() => [
|
|
2244
|
+
n(e(J), {
|
|
2269
2245
|
variant: "outline",
|
|
2270
|
-
onClick:
|
|
2246
|
+
onClick: W[2] || (W[2] = (S) => e(y)())
|
|
2271
2247
|
}, {
|
|
2272
|
-
default:
|
|
2273
|
-
|
|
2248
|
+
default: l(() => [
|
|
2249
|
+
w(b(e(t)("tag.cancel")), 1)
|
|
2274
2250
|
]),
|
|
2275
2251
|
_: 1
|
|
2276
2252
|
}),
|
|
2277
|
-
n(e(
|
|
2253
|
+
n(e(J), {
|
|
2278
2254
|
type: "primary",
|
|
2279
|
-
loading:
|
|
2280
|
-
disabled:
|
|
2281
|
-
onClick:
|
|
2255
|
+
loading: x.value,
|
|
2256
|
+
disabled: s.value.trim() === "",
|
|
2257
|
+
onClick: o
|
|
2282
2258
|
}, {
|
|
2283
|
-
default:
|
|
2284
|
-
|
|
2259
|
+
default: l(() => [
|
|
2260
|
+
w(b(e(t)("tag.create")), 1)
|
|
2285
2261
|
]),
|
|
2286
2262
|
_: 1
|
|
2287
2263
|
}, 8, ["loading", "disabled"])
|
|
@@ -2289,38 +2265,38 @@ const Mt = { class: "wx-article-editor__head" }, Pt = { class: "wx-article-edito
|
|
|
2289
2265
|
_: 1
|
|
2290
2266
|
})
|
|
2291
2267
|
]),
|
|
2292
|
-
default:
|
|
2293
|
-
n(e(
|
|
2268
|
+
default: l(() => [
|
|
2269
|
+
n(e(ie), {
|
|
2294
2270
|
label: e(t)("tag.field-title"),
|
|
2295
2271
|
error: T.value.title?.[0],
|
|
2296
2272
|
required: ""
|
|
2297
2273
|
}, {
|
|
2298
|
-
default:
|
|
2299
|
-
|
|
2274
|
+
default: l(() => [
|
|
2275
|
+
j("div", {
|
|
2300
2276
|
ref_key: "field",
|
|
2301
|
-
ref:
|
|
2277
|
+
ref: c
|
|
2302
2278
|
}, [
|
|
2303
|
-
n(e(
|
|
2304
|
-
modelValue:
|
|
2305
|
-
"onUpdate:modelValue":
|
|
2279
|
+
n(e(Ae), {
|
|
2280
|
+
modelValue: s.value,
|
|
2281
|
+
"onUpdate:modelValue": W[0] || (W[0] = (S) => s.value = S),
|
|
2306
2282
|
"aria-label": e(t)("tag.field-title"),
|
|
2307
|
-
onKeyup:
|
|
2283
|
+
onKeyup: ze(o, ["enter"])
|
|
2308
2284
|
}, null, 8, ["modelValue", "aria-label"])
|
|
2309
2285
|
], 512)
|
|
2310
2286
|
]),
|
|
2311
2287
|
_: 1
|
|
2312
2288
|
}, 8, ["label", "error"]),
|
|
2313
|
-
n(e(
|
|
2289
|
+
n(e(ie), {
|
|
2314
2290
|
label: e(t)("tag.field-slug"),
|
|
2315
2291
|
error: T.value.slug?.[0],
|
|
2316
2292
|
help: e(t)("tag.field-slug-help")
|
|
2317
2293
|
}, {
|
|
2318
|
-
default:
|
|
2319
|
-
n(e(
|
|
2294
|
+
default: l(() => [
|
|
2295
|
+
n(e(Ae), {
|
|
2320
2296
|
modelValue: i.value,
|
|
2321
|
-
"onUpdate:modelValue":
|
|
2297
|
+
"onUpdate:modelValue": W[1] || (W[1] = (S) => i.value = S),
|
|
2322
2298
|
"aria-label": e(t)("tag.field-slug"),
|
|
2323
|
-
onKeyup:
|
|
2299
|
+
onKeyup: ze(o, ["enter"])
|
|
2324
2300
|
}, null, 8, ["modelValue", "aria-label"])
|
|
2325
2301
|
]),
|
|
2326
2302
|
_: 1
|
|
@@ -2329,63 +2305,144 @@ const Mt = { class: "wx-article-editor__head" }, Pt = { class: "wx-article-edito
|
|
|
2329
2305
|
_: 1
|
|
2330
2306
|
}, 8, ["open", "title"]));
|
|
2331
2307
|
}
|
|
2332
|
-
}),
|
|
2308
|
+
}), Ra = ["id"], Ua = /* @__PURE__ */ ee({
|
|
2309
|
+
__name: "TagRenameDialog",
|
|
2310
|
+
props: {
|
|
2311
|
+
name: {}
|
|
2312
|
+
},
|
|
2313
|
+
setup(f) {
|
|
2314
|
+
const m = f, { open: r, resolve: y, dismiss: u } = Ee();
|
|
2315
|
+
te();
|
|
2316
|
+
const a = Q("webx-blog"), t = Q("webx-admin"), s = ft(), i = z(m.name), x = De("field");
|
|
2317
|
+
Ne(async () => {
|
|
2318
|
+
await Ze();
|
|
2319
|
+
const c = x.value?.querySelector("input");
|
|
2320
|
+
c?.focus(), c?.select();
|
|
2321
|
+
});
|
|
2322
|
+
function T() {
|
|
2323
|
+
const c = i.value.trim();
|
|
2324
|
+
if (c === "" || c === m.name) {
|
|
2325
|
+
u();
|
|
2326
|
+
return;
|
|
2327
|
+
}
|
|
2328
|
+
y(c);
|
|
2329
|
+
}
|
|
2330
|
+
return (c, o) => (p(), C(e(Fe), {
|
|
2331
|
+
open: e(r),
|
|
2332
|
+
"onUpdate:open": o[2] || (o[2] = (_) => Ie(r) ? r.value = _ : null),
|
|
2333
|
+
title: e(a)("tag.rename"),
|
|
2334
|
+
width: 420
|
|
2335
|
+
}, {
|
|
2336
|
+
footer: l(() => [
|
|
2337
|
+
n(e(Le), { size: "sm" }, {
|
|
2338
|
+
default: l(() => [
|
|
2339
|
+
n(e(J), {
|
|
2340
|
+
variant: "outline",
|
|
2341
|
+
onClick: o[1] || (o[1] = (_) => e(u)())
|
|
2342
|
+
}, {
|
|
2343
|
+
default: l(() => [
|
|
2344
|
+
w(b(e(a)("tag.cancel")), 1)
|
|
2345
|
+
]),
|
|
2346
|
+
_: 1
|
|
2347
|
+
}),
|
|
2348
|
+
n(e(J), {
|
|
2349
|
+
type: "primary",
|
|
2350
|
+
"native-type": "submit",
|
|
2351
|
+
form: e(s),
|
|
2352
|
+
disabled: i.value.trim() === ""
|
|
2353
|
+
}, {
|
|
2354
|
+
default: l(() => [
|
|
2355
|
+
w(b(e(t)("editor.save")), 1)
|
|
2356
|
+
]),
|
|
2357
|
+
_: 1
|
|
2358
|
+
}, 8, ["form", "disabled"])
|
|
2359
|
+
]),
|
|
2360
|
+
_: 1
|
|
2361
|
+
})
|
|
2362
|
+
]),
|
|
2363
|
+
default: l(() => [
|
|
2364
|
+
j("form", {
|
|
2365
|
+
id: e(s),
|
|
2366
|
+
ref_key: "field",
|
|
2367
|
+
ref: x,
|
|
2368
|
+
onSubmit: at(T, ["prevent"])
|
|
2369
|
+
}, [
|
|
2370
|
+
n(e(ie), {
|
|
2371
|
+
label: e(a)("tag.field-title"),
|
|
2372
|
+
required: ""
|
|
2373
|
+
}, {
|
|
2374
|
+
default: l(() => [
|
|
2375
|
+
n(e(Ae), {
|
|
2376
|
+
modelValue: i.value,
|
|
2377
|
+
"onUpdate:modelValue": o[0] || (o[0] = (_) => i.value = _),
|
|
2378
|
+
"aria-label": e(a)("tag.field-title"),
|
|
2379
|
+
onKeydown: ze(at(T, ["prevent"]), ["enter"])
|
|
2380
|
+
}, null, 8, ["modelValue", "aria-label", "onKeydown"])
|
|
2381
|
+
]),
|
|
2382
|
+
_: 1
|
|
2383
|
+
}, 8, ["label"])
|
|
2384
|
+
], 40, Ra)
|
|
2385
|
+
]),
|
|
2386
|
+
_: 1
|
|
2387
|
+
}, 8, ["open", "title"]));
|
|
2388
|
+
}
|
|
2389
|
+
}), qa = { class: "wx-tag-merge" }, Ma = { class: "wx-tag-merge__chips" }, Na = { class: "wx-tag-merge__redirect" }, Ba = /* @__PURE__ */ ee({
|
|
2333
2390
|
__name: "TagMergeDialog",
|
|
2334
2391
|
props: {
|
|
2335
2392
|
tags: {}
|
|
2336
2393
|
},
|
|
2337
|
-
setup(
|
|
2338
|
-
const
|
|
2339
|
-
|
|
2340
|
-
const
|
|
2341
|
-
[...
|
|
2342
|
-
), T = z(!1),
|
|
2343
|
-
() =>
|
|
2344
|
-
),
|
|
2345
|
-
async function
|
|
2346
|
-
if (!(
|
|
2347
|
-
T.value = !0,
|
|
2394
|
+
setup(f) {
|
|
2395
|
+
const m = f, { open: r, resolve: y, dismiss: u } = Ee(), a = ne(), t = de(a);
|
|
2396
|
+
te();
|
|
2397
|
+
const s = Q("webx-blog"), i = ge(), x = z(
|
|
2398
|
+
[...m.tags].sort((U, R) => R.articles_count - U.articles_count)[0]?.id ?? 0
|
|
2399
|
+
), T = z(!1), c = z(!0), o = z(null), _ = v(
|
|
2400
|
+
() => m.tags.map((U) => ({ value: U.id, label: `${U.title} · ${U.articles_count}` }))
|
|
2401
|
+
), W = v(() => m.tags.find((U) => U.id === x.value) ?? null), S = v(() => m.tags.filter((U) => U.id !== x.value)), E = v(() => S.value.reduce((U, R) => U + R.articles_count, 0)), F = v(() => S.value.map((U) => U.path).filter(Boolean));
|
|
2402
|
+
async function $() {
|
|
2403
|
+
if (!(W.value === null || S.value.length === 0 || T.value)) {
|
|
2404
|
+
T.value = !0, o.value = null;
|
|
2348
2405
|
try {
|
|
2349
|
-
|
|
2406
|
+
y(
|
|
2350
2407
|
await t.mergeTags(
|
|
2351
|
-
|
|
2352
|
-
|
|
2353
|
-
|
|
2408
|
+
S.value.map((U) => U.id),
|
|
2409
|
+
x.value,
|
|
2410
|
+
c.value
|
|
2354
2411
|
)
|
|
2355
2412
|
);
|
|
2356
|
-
} catch (
|
|
2357
|
-
|
|
2413
|
+
} catch (U) {
|
|
2414
|
+
o.value = i(U);
|
|
2358
2415
|
} finally {
|
|
2359
2416
|
T.value = !1;
|
|
2360
2417
|
}
|
|
2361
2418
|
}
|
|
2362
2419
|
}
|
|
2363
|
-
return (
|
|
2364
|
-
open: e(
|
|
2365
|
-
"onUpdate:open":
|
|
2366
|
-
title: e(
|
|
2420
|
+
return (U, R) => (p(), C(e(Fe), {
|
|
2421
|
+
open: e(r),
|
|
2422
|
+
"onUpdate:open": R[3] || (R[3] = (M) => Ie(r) ? r.value = M : null),
|
|
2423
|
+
title: e(s)("tag.merge-title"),
|
|
2367
2424
|
width: 520
|
|
2368
2425
|
}, {
|
|
2369
|
-
footer:
|
|
2370
|
-
n(e(
|
|
2371
|
-
default:
|
|
2372
|
-
n(e(
|
|
2426
|
+
footer: l(() => [
|
|
2427
|
+
n(e(Le), { size: "sm" }, {
|
|
2428
|
+
default: l(() => [
|
|
2429
|
+
n(e(J), {
|
|
2373
2430
|
variant: "outline",
|
|
2374
|
-
onClick:
|
|
2431
|
+
onClick: R[2] || (R[2] = (M) => e(u)())
|
|
2375
2432
|
}, {
|
|
2376
|
-
default:
|
|
2377
|
-
|
|
2433
|
+
default: l(() => [
|
|
2434
|
+
w(b(e(s)("tag.cancel")), 1)
|
|
2378
2435
|
]),
|
|
2379
2436
|
_: 1
|
|
2380
2437
|
}),
|
|
2381
|
-
n(e(
|
|
2438
|
+
n(e(J), {
|
|
2382
2439
|
type: "primary",
|
|
2383
2440
|
loading: T.value,
|
|
2384
|
-
disabled:
|
|
2385
|
-
onClick:
|
|
2441
|
+
disabled: S.value.length === 0,
|
|
2442
|
+
onClick: $
|
|
2386
2443
|
}, {
|
|
2387
|
-
default:
|
|
2388
|
-
|
|
2444
|
+
default: l(() => [
|
|
2445
|
+
w(b(e(s)("tag.merge-confirm")), 1)
|
|
2389
2446
|
]),
|
|
2390
2447
|
_: 1
|
|
2391
2448
|
}, 8, ["loading", "disabled"])
|
|
@@ -2393,532 +2450,475 @@ const Mt = { class: "wx-article-editor__head" }, Pt = { class: "wx-article-edito
|
|
|
2393
2450
|
_: 1
|
|
2394
2451
|
})
|
|
2395
2452
|
]),
|
|
2396
|
-
default:
|
|
2397
|
-
|
|
2398
|
-
|
|
2399
|
-
(p(!0),
|
|
2400
|
-
key:
|
|
2453
|
+
default: l(() => [
|
|
2454
|
+
j("div", qa, [
|
|
2455
|
+
j("div", Ma, [
|
|
2456
|
+
(p(!0), Z(be, null, Be(S.value, (M) => (p(), C(e(oe), {
|
|
2457
|
+
key: M.id,
|
|
2401
2458
|
size: "sm",
|
|
2402
2459
|
round: ""
|
|
2403
2460
|
}, {
|
|
2404
|
-
default:
|
|
2405
|
-
|
|
2461
|
+
default: l(() => [
|
|
2462
|
+
w(b(M.title) + " · " + b(M.articles_count), 1)
|
|
2406
2463
|
]),
|
|
2407
2464
|
_: 2
|
|
2408
2465
|
}, 1024))), 128)),
|
|
2409
|
-
n(e(
|
|
2466
|
+
n(e(we), {
|
|
2410
2467
|
name: "arrow-right",
|
|
2411
2468
|
size: "sm"
|
|
2412
2469
|
}),
|
|
2413
|
-
|
|
2470
|
+
W.value ? (p(), C(e(oe), {
|
|
2414
2471
|
key: 0,
|
|
2415
2472
|
type: "primary",
|
|
2416
2473
|
size: "sm",
|
|
2417
2474
|
round: ""
|
|
2418
2475
|
}, {
|
|
2419
|
-
default:
|
|
2420
|
-
|
|
2476
|
+
default: l(() => [
|
|
2477
|
+
w(b(W.value.title) + " · " + b(W.value.articles_count), 1)
|
|
2421
2478
|
]),
|
|
2422
2479
|
_: 1
|
|
2423
|
-
})) :
|
|
2480
|
+
})) : H("", !0)
|
|
2424
2481
|
]),
|
|
2425
|
-
n(e(
|
|
2426
|
-
label: e(
|
|
2482
|
+
n(e(ie), {
|
|
2483
|
+
label: e(s)("tag.merge-keep")
|
|
2427
2484
|
}, {
|
|
2428
|
-
default:
|
|
2429
|
-
n(e(
|
|
2430
|
-
modelValue:
|
|
2431
|
-
"onUpdate:modelValue":
|
|
2432
|
-
options:
|
|
2433
|
-
"aria-label": e(
|
|
2485
|
+
default: l(() => [
|
|
2486
|
+
n(e(_e), {
|
|
2487
|
+
modelValue: x.value,
|
|
2488
|
+
"onUpdate:modelValue": R[0] || (R[0] = (M) => x.value = M),
|
|
2489
|
+
options: _.value,
|
|
2490
|
+
"aria-label": e(s)("tag.merge-keep")
|
|
2434
2491
|
}, null, 8, ["modelValue", "options", "aria-label"])
|
|
2435
2492
|
]),
|
|
2436
2493
|
_: 1
|
|
2437
2494
|
}, 8, ["label"]),
|
|
2438
|
-
|
|
2439
|
-
n(e(
|
|
2440
|
-
modelValue:
|
|
2441
|
-
"onUpdate:modelValue":
|
|
2442
|
-
label: e(
|
|
2495
|
+
j("div", Na, [
|
|
2496
|
+
n(e(Wt), {
|
|
2497
|
+
modelValue: c.value,
|
|
2498
|
+
"onUpdate:modelValue": R[1] || (R[1] = (M) => c.value = M),
|
|
2499
|
+
label: e(s)("tag.merge-redirect")
|
|
2443
2500
|
}, null, 8, ["modelValue", "label"]),
|
|
2444
2501
|
n(e(G), {
|
|
2445
2502
|
size: "sm",
|
|
2446
2503
|
tone: "muted"
|
|
2447
2504
|
}, {
|
|
2448
|
-
default:
|
|
2449
|
-
|
|
2505
|
+
default: l(() => [
|
|
2506
|
+
w(b(F.value.length === 0 ? e(s)("tag.merge-redirect-none") : e(s)("tag.merge-redirect-help", { addresses: F.value.join(", ") })), 1)
|
|
2450
2507
|
]),
|
|
2451
2508
|
_: 1
|
|
2452
2509
|
})
|
|
2453
2510
|
]),
|
|
2454
|
-
n(e(
|
|
2511
|
+
n(e(We), {
|
|
2455
2512
|
type: "warning",
|
|
2456
2513
|
variant: "soft",
|
|
2457
|
-
description: e(
|
|
2458
|
-
count:
|
|
2459
|
-
tag:
|
|
2460
|
-
merged:
|
|
2514
|
+
description: e(s)("tag.merge-warning", {
|
|
2515
|
+
count: E.value,
|
|
2516
|
+
tag: W.value?.title ?? "",
|
|
2517
|
+
merged: S.value.length
|
|
2461
2518
|
})
|
|
2462
2519
|
}, null, 8, ["description"]),
|
|
2463
|
-
|
|
2520
|
+
o.value ? (p(), C(e(We), {
|
|
2464
2521
|
key: 0,
|
|
2465
2522
|
type: "danger",
|
|
2466
2523
|
variant: "soft",
|
|
2467
|
-
description:
|
|
2468
|
-
}, null, 8, ["description"])) :
|
|
2524
|
+
description: o.value
|
|
2525
|
+
}, null, 8, ["description"])) : H("", !0)
|
|
2469
2526
|
])
|
|
2470
2527
|
]),
|
|
2471
2528
|
_: 1
|
|
2472
2529
|
}, 8, ["open", "title"]));
|
|
2473
2530
|
}
|
|
2474
|
-
}),
|
|
2531
|
+
}), Pa = /* @__PURE__ */ ve(Ba, [["__scopeId", "data-v-aa68b3a8"]]), Da = { class: "wx-tags" }, Ia = /* @__PURE__ */ ee({
|
|
2475
2532
|
__name: "TagsPage",
|
|
2476
2533
|
props: {
|
|
2477
2534
|
base: { default: "/blog" }
|
|
2478
2535
|
},
|
|
2479
|
-
setup(
|
|
2480
|
-
const
|
|
2481
|
-
|
|
2482
|
-
const t =
|
|
2483
|
-
() =>
|
|
2484
|
-
),
|
|
2485
|
-
get: () => typeof
|
|
2486
|
-
set: (
|
|
2487
|
-
|
|
2488
|
-
query: { ...
|
|
2536
|
+
setup(f) {
|
|
2537
|
+
const m = f, r = ne(), y = de(r), u = He(), a = Ke();
|
|
2538
|
+
te();
|
|
2539
|
+
const t = Q("webx-blog"), s = ge(), i = z(null), x = z(!0), T = z([]), c = z(!1), o = Ce(Ua), _ = Ce(za), W = Ce(Pa), S = v(() => r.can("blog.taxonomy.manage")), E = v(
|
|
2540
|
+
() => r.state.manifest?.modules.find((g) => g.id === "tags")?.title ?? t("module.tags")
|
|
2541
|
+
), F = v({
|
|
2542
|
+
get: () => typeof u.query.view == "string" ? u.query.view : "",
|
|
2543
|
+
set: (g) => {
|
|
2544
|
+
a.replace({
|
|
2545
|
+
query: { ...u.query, view: g === "" ? void 0 : String(g), page: void 0 }
|
|
2489
2546
|
});
|
|
2490
2547
|
}
|
|
2491
|
-
}),
|
|
2492
|
-
{ value: "", label: t("tag.view-all"), badge:
|
|
2493
|
-
{ value: "empty", label: t("tag.view-empty"), badge:
|
|
2494
|
-
{ value: "noindex", label: t("tag.view-noindex"), badge:
|
|
2495
|
-
]),
|
|
2496
|
-
{ key: "title", label: t("tag.column-title"), minWidth: 150 },
|
|
2548
|
+
}), $ = v(() => i.value?.filters ?? { total: 0, empty: 0, noindex: 0 }), U = v(() => [
|
|
2549
|
+
{ value: "", label: t("tag.view-all"), badge: $.value.total },
|
|
2550
|
+
{ value: "empty", label: t("tag.view-empty"), badge: $.value.empty },
|
|
2551
|
+
{ value: "noindex", label: t("tag.view-noindex"), badge: $.value.noindex }
|
|
2552
|
+
]), R = v(() => i.value?.data ?? []), M = v(() => R.value.filter((g) => T.value.includes(g.id))), A = v(() => [
|
|
2553
|
+
{ key: "title", label: t("tag.column-title"), minWidth: 150, sortable: !0 },
|
|
2497
2554
|
// The number is what the other columns and the narrowest the title may be add up to without
|
|
2498
2555
|
// this one: below it the address is what does not fit, and a fixed table does not shrink —
|
|
2499
2556
|
// it scrolls sideways and takes the ··· with it (CLAUDE.md §4). Measured, not guessed: at
|
|
2500
2557
|
// 375px the row is the word, the number and the menu, and nothing hangs off the edge.
|
|
2501
2558
|
{ key: "path", label: t("tag.column-address"), width: 180, hideBelow: 760 },
|
|
2502
|
-
{
|
|
2559
|
+
{
|
|
2560
|
+
key: "articles_count",
|
|
2561
|
+
label: t("tag.column-articles"),
|
|
2562
|
+
width: 80,
|
|
2563
|
+
align: "right",
|
|
2564
|
+
sortable: !0
|
|
2565
|
+
},
|
|
2503
2566
|
// Wide enough for the longest of the three states on one line, in every language: measured
|
|
2504
2567
|
// at 180px of text, and a cell keeps 32 of its own. Narrower, the ruled row wrapped and
|
|
2505
2568
|
// stood eighteen pixels taller than the ones around it.
|
|
2506
2569
|
{ key: "indexing", label: t("tag.column-indexing"), width: 230, hideBelow: 560 },
|
|
2507
|
-
{ key: "actions", label: "", width:
|
|
2570
|
+
{ key: "actions", label: "", width: st, align: "right" }
|
|
2508
2571
|
]);
|
|
2509
|
-
function
|
|
2572
|
+
function I(g) {
|
|
2510
2573
|
return {
|
|
2511
|
-
q:
|
|
2512
|
-
empty:
|
|
2513
|
-
noindex:
|
|
2574
|
+
q: g?.search ?? (typeof u.query.q == "string" ? u.query.q : ""),
|
|
2575
|
+
empty: F.value === "empty",
|
|
2576
|
+
noindex: F.value === "noindex",
|
|
2514
2577
|
// Only when it is not the default: most used first is what the list is, and a query
|
|
2515
2578
|
// string that repeats the default is a link that outlives a change of mind about it.
|
|
2516
|
-
sort:
|
|
2517
|
-
page:
|
|
2518
|
-
per_page:
|
|
2579
|
+
sort: P(g),
|
|
2580
|
+
page: g?.page ?? (Number(u.query.page ?? 1) || 1),
|
|
2581
|
+
per_page: g?.perPage
|
|
2519
2582
|
};
|
|
2520
2583
|
}
|
|
2521
|
-
async function
|
|
2522
|
-
|
|
2584
|
+
async function K(g) {
|
|
2585
|
+
x.value = !0;
|
|
2523
2586
|
try {
|
|
2524
|
-
i.value = await
|
|
2525
|
-
} catch (
|
|
2526
|
-
L.danger(
|
|
2587
|
+
i.value = await y.tagsPage(I(g));
|
|
2588
|
+
} catch (N) {
|
|
2589
|
+
L.danger(s(N));
|
|
2527
2590
|
} finally {
|
|
2528
|
-
|
|
2591
|
+
x.value = !1;
|
|
2529
2592
|
}
|
|
2530
2593
|
}
|
|
2531
|
-
function
|
|
2532
|
-
const
|
|
2533
|
-
|
|
2534
|
-
|
|
2535
|
-
|
|
2594
|
+
function P(g) {
|
|
2595
|
+
const N = g?.sort ?? q();
|
|
2596
|
+
if (!N) return;
|
|
2597
|
+
const B = N.key === "title" ? "name" : "articles", X = `${N.order === "desc" ? "-" : ""}${B}`;
|
|
2598
|
+
return X === "articles" ? void 0 : X;
|
|
2599
|
+
}
|
|
2600
|
+
function q() {
|
|
2601
|
+
const g = typeof u.query.sort == "string" ? u.query.sort : "";
|
|
2602
|
+
if (g === "") return null;
|
|
2603
|
+
const N = g.startsWith("-");
|
|
2604
|
+
return { key: (N ? g.slice(1) : g) === "name" ? "title" : "articles_count", order: N ? "desc" : "asc" };
|
|
2605
|
+
}
|
|
2606
|
+
function k(g) {
|
|
2607
|
+
const N = {
|
|
2608
|
+
...u.query,
|
|
2609
|
+
q: g.search === "" ? void 0 : g.search,
|
|
2610
|
+
sort: P(g),
|
|
2611
|
+
page: g.page === 1 ? void 0 : String(g.page)
|
|
2536
2612
|
};
|
|
2537
|
-
|
|
2538
|
-
}
|
|
2539
|
-
oe(R, () => {
|
|
2540
|
-
T.value = [], m();
|
|
2541
|
-
}), m();
|
|
2542
|
-
function j(o) {
|
|
2543
|
-
l.replace({
|
|
2544
|
-
query: { ...c.query, sort: o === "articles" ? void 0 : o, page: void 0 }
|
|
2545
|
-
}), m();
|
|
2546
|
-
}
|
|
2547
|
-
const de = b(() => c.query.sort === "name" ? "name" : "articles");
|
|
2548
|
-
async function Ve() {
|
|
2549
|
-
await C({}) && await m();
|
|
2550
|
-
}
|
|
2551
|
-
async function ve(o) {
|
|
2552
|
-
d.value = o.id, k.value = o.title, await Ke(), S.value?.querySelector("input")?.focus();
|
|
2553
|
-
}
|
|
2554
|
-
function J() {
|
|
2555
|
-
d.value = null, k.value = "";
|
|
2556
|
-
}
|
|
2557
|
-
async function we(o) {
|
|
2558
|
-
const s = k.value.trim();
|
|
2559
|
-
if (s === "" || s === o.title) {
|
|
2560
|
-
J();
|
|
2561
|
-
return;
|
|
2562
|
-
}
|
|
2563
|
-
J(), await Q(o, { title: s }, t("tag.renamed"));
|
|
2613
|
+
a.replace({ query: N }), K(g);
|
|
2564
2614
|
}
|
|
2565
|
-
|
|
2566
|
-
|
|
2615
|
+
ue(F, () => {
|
|
2616
|
+
T.value = [], K();
|
|
2617
|
+
}), K();
|
|
2618
|
+
async function le() {
|
|
2619
|
+
await _({}) && await K();
|
|
2620
|
+
}
|
|
2621
|
+
async function O(g) {
|
|
2622
|
+
const N = await o({ name: g.title });
|
|
2623
|
+
N && await xe(g, { title: N }, t("tag.renamed"));
|
|
2567
2624
|
}
|
|
2568
|
-
async function
|
|
2625
|
+
async function se(g, N) {
|
|
2626
|
+
await xe(g, { noindex: N }, t(N ? "tag.kept-out" : "tag.indexed"));
|
|
2627
|
+
}
|
|
2628
|
+
async function xe(g, N, B) {
|
|
2569
2629
|
try {
|
|
2570
|
-
const
|
|
2630
|
+
const X = await y.saveTag(g.id, N);
|
|
2571
2631
|
i.value && (i.value = {
|
|
2572
2632
|
...i.value,
|
|
2573
|
-
data: i.value.data.map((
|
|
2574
|
-
}), L.success(
|
|
2575
|
-
} catch (
|
|
2576
|
-
L.danger(
|
|
2633
|
+
data: i.value.data.map((ye) => ye.id === X.id ? X : ye)
|
|
2634
|
+
}), L.success(B);
|
|
2635
|
+
} catch (X) {
|
|
2636
|
+
L.danger(s(X));
|
|
2577
2637
|
}
|
|
2578
2638
|
}
|
|
2579
|
-
async function
|
|
2580
|
-
if (await
|
|
2581
|
-
title: t("tag.delete-title", { title:
|
|
2582
|
-
message:
|
|
2639
|
+
async function ce(g) {
|
|
2640
|
+
if (await me({
|
|
2641
|
+
title: t("tag.delete-title", { title: g.title }),
|
|
2642
|
+
message: g.articles_count > 0 ? t("tag.delete-text-used", { count: g.articles_count }) : t("tag.delete-text"),
|
|
2583
2643
|
confirmText: t("tag.delete"),
|
|
2584
2644
|
cancelText: t("tag.cancel"),
|
|
2585
2645
|
tone: "danger"
|
|
2586
2646
|
}))
|
|
2587
2647
|
try {
|
|
2588
|
-
await
|
|
2589
|
-
} catch (
|
|
2590
|
-
L.danger(
|
|
2648
|
+
await y.removeTag(g.id), L.success(t("tag.deleted")), T.value = T.value.filter((B) => B !== g.id), await K();
|
|
2649
|
+
} catch (B) {
|
|
2650
|
+
L.danger(s(B));
|
|
2591
2651
|
}
|
|
2592
2652
|
}
|
|
2593
|
-
|
|
2594
|
-
|
|
2595
|
-
|
|
2653
|
+
const he = v(() => [
|
|
2654
|
+
{
|
|
2655
|
+
key: "index",
|
|
2656
|
+
icon: "eye",
|
|
2657
|
+
label: t("tag.index"),
|
|
2658
|
+
disabled: c.value,
|
|
2659
|
+
run: () => {
|
|
2660
|
+
re("index");
|
|
2661
|
+
}
|
|
2662
|
+
},
|
|
2663
|
+
{
|
|
2664
|
+
key: "noindex",
|
|
2665
|
+
icon: "eye-off",
|
|
2666
|
+
label: t("tag.noindex"),
|
|
2667
|
+
disabled: c.value,
|
|
2668
|
+
run: () => {
|
|
2669
|
+
re("noindex");
|
|
2670
|
+
}
|
|
2671
|
+
},
|
|
2672
|
+
{
|
|
2673
|
+
key: "delete",
|
|
2674
|
+
icon: "trash",
|
|
2675
|
+
label: t("tag.delete"),
|
|
2676
|
+
danger: !0,
|
|
2677
|
+
disabled: c.value,
|
|
2678
|
+
run: () => {
|
|
2679
|
+
re("delete");
|
|
2680
|
+
}
|
|
2681
|
+
}
|
|
2682
|
+
]);
|
|
2683
|
+
function Te(g) {
|
|
2684
|
+
if (!S.value) return [];
|
|
2685
|
+
const N = [
|
|
2596
2686
|
{ key: "rename", icon: "edit", label: t("tag.rename"), run: () => {
|
|
2597
|
-
|
|
2687
|
+
O(g);
|
|
2598
2688
|
} }
|
|
2599
2689
|
];
|
|
2600
|
-
return
|
|
2690
|
+
return g.url && N.push({
|
|
2601
2691
|
key: "site",
|
|
2602
2692
|
icon: "external-link",
|
|
2603
2693
|
label: t("tag.open-on-site"),
|
|
2604
|
-
href:
|
|
2605
|
-
}),
|
|
2694
|
+
href: g.url
|
|
2695
|
+
}), N.push({
|
|
2606
2696
|
key: "articles",
|
|
2607
2697
|
icon: "list",
|
|
2608
2698
|
label: t("tag.show-articles"),
|
|
2609
2699
|
run: () => {
|
|
2610
|
-
|
|
2700
|
+
a.push({ path: `${m.base}/articles`, query: { tag: String(g.id) } });
|
|
2611
2701
|
}
|
|
2612
|
-
}),
|
|
2613
|
-
|
|
2702
|
+
}), N.push(
|
|
2703
|
+
g.noindex ? {
|
|
2614
2704
|
key: "index",
|
|
2615
2705
|
icon: "eye",
|
|
2616
2706
|
label: t("tag.index"),
|
|
2617
2707
|
run: () => {
|
|
2618
|
-
|
|
2708
|
+
se(g, !1);
|
|
2619
2709
|
}
|
|
2620
2710
|
} : {
|
|
2621
2711
|
key: "noindex",
|
|
2622
2712
|
icon: "eye-off",
|
|
2623
2713
|
label: t("tag.noindex"),
|
|
2624
2714
|
run: () => {
|
|
2625
|
-
|
|
2715
|
+
se(g, !0);
|
|
2626
2716
|
}
|
|
2627
2717
|
}
|
|
2628
|
-
),
|
|
2718
|
+
), N.push({
|
|
2629
2719
|
key: "delete",
|
|
2630
2720
|
icon: "trash",
|
|
2631
2721
|
label: t("tag.delete"),
|
|
2632
2722
|
danger: !0,
|
|
2633
2723
|
run: () => {
|
|
2634
|
-
|
|
2724
|
+
ce(g);
|
|
2635
2725
|
}
|
|
2636
|
-
}),
|
|
2637
|
-
}
|
|
2638
|
-
function
|
|
2639
|
-
return
|
|
2640
|
-
}
|
|
2641
|
-
async function
|
|
2642
|
-
if (
|
|
2643
|
-
const
|
|
2644
|
-
|
|
2645
|
-
}
|
|
2646
|
-
async function
|
|
2647
|
-
const
|
|
2648
|
-
if (!(
|
|
2649
|
-
if (
|
|
2650
|
-
const
|
|
2651
|
-
if (!await
|
|
2652
|
-
title: t("tag.delete-many-title", { count:
|
|
2653
|
-
message:
|
|
2726
|
+
}), N;
|
|
2727
|
+
}
|
|
2728
|
+
function ke(g) {
|
|
2729
|
+
return g === "noindex" ? "muted" : "success";
|
|
2730
|
+
}
|
|
2731
|
+
async function pe() {
|
|
2732
|
+
if (M.value.length < 2) return;
|
|
2733
|
+
const g = await W({ tags: M.value });
|
|
2734
|
+
g && (L.success(t("tag.merged", { tag: g.tag.title, count: g.articles_count })), T.value = [], await K());
|
|
2735
|
+
}
|
|
2736
|
+
async function re(g) {
|
|
2737
|
+
const N = M.value.map((B) => B.id);
|
|
2738
|
+
if (!(N.length === 0 || c.value)) {
|
|
2739
|
+
if (g === "delete") {
|
|
2740
|
+
const B = M.value.reduce((ye, d) => ye + d.articles_count, 0);
|
|
2741
|
+
if (!await me({
|
|
2742
|
+
title: t("tag.delete-many-title", { count: N.length }),
|
|
2743
|
+
message: B > 0 ? t("tag.delete-many-text-used", { count: B }) : t("tag.delete-many-text"),
|
|
2654
2744
|
confirmText: t("tag.delete"),
|
|
2655
2745
|
cancelText: t("tag.cancel"),
|
|
2656
2746
|
tone: "danger"
|
|
2657
2747
|
})) return;
|
|
2658
2748
|
}
|
|
2659
|
-
|
|
2749
|
+
c.value = !0;
|
|
2660
2750
|
try {
|
|
2661
|
-
const
|
|
2751
|
+
const B = await y.massTags(N, g);
|
|
2662
2752
|
L.success(
|
|
2663
|
-
|
|
2664
|
-
), T.value = [], await
|
|
2665
|
-
} catch (
|
|
2666
|
-
L.danger(
|
|
2753
|
+
g === "delete" ? t("tag.deleted-many", { count: B }) : g === "index" ? t("tag.indexed-many", { count: B }) : t("tag.kept-out-many", { count: B })
|
|
2754
|
+
), T.value = [], await K();
|
|
2755
|
+
} catch (B) {
|
|
2756
|
+
L.danger(s(B));
|
|
2667
2757
|
} finally {
|
|
2668
|
-
|
|
2758
|
+
c.value = !1;
|
|
2669
2759
|
}
|
|
2670
2760
|
}
|
|
2671
2761
|
}
|
|
2672
|
-
|
|
2673
|
-
|
|
2674
|
-
|
|
2675
|
-
|
|
2676
|
-
|
|
2677
|
-
|
|
2678
|
-
|
|
2679
|
-
|
|
2680
|
-
|
|
2762
|
+
const fe = v(
|
|
2763
|
+
() => S.value ? [{ key: "new", label: t("tag.new"), icon: "plus", primary: !0, run: () => {
|
|
2764
|
+
le();
|
|
2765
|
+
} }] : []
|
|
2766
|
+
);
|
|
2767
|
+
return (g, N) => (p(), Z("div", Da, [
|
|
2768
|
+
n(e(Qe), {
|
|
2769
|
+
view: F.value,
|
|
2770
|
+
"onUpdate:view": N[1] || (N[1] = (B) => F.value = B),
|
|
2771
|
+
title: E.value,
|
|
2772
|
+
views: U.value,
|
|
2773
|
+
actions: fe.value
|
|
2774
|
+
}, {
|
|
2775
|
+
default: l(() => [
|
|
2776
|
+
n(e(ot), {
|
|
2681
2777
|
selected: T.value,
|
|
2682
|
-
"onUpdate:selected":
|
|
2778
|
+
"onUpdate:selected": N[0] || (N[0] = (B) => T.value = B),
|
|
2683
2779
|
data: i.value,
|
|
2684
|
-
columns:
|
|
2780
|
+
columns: A.value,
|
|
2685
2781
|
"row-key": "id",
|
|
2686
2782
|
searchable: "",
|
|
2687
2783
|
hover: "",
|
|
2688
2784
|
flush: "",
|
|
2689
2785
|
layout: "fixed",
|
|
2690
|
-
loading:
|
|
2691
|
-
selectable:
|
|
2786
|
+
loading: x.value,
|
|
2787
|
+
selectable: S.value,
|
|
2692
2788
|
"cards-below": 0,
|
|
2693
2789
|
"search-placeholder": e(t)("tag.search"),
|
|
2694
|
-
"empty-text":
|
|
2695
|
-
"aria-label":
|
|
2696
|
-
onStateChange:
|
|
2790
|
+
"empty-text": R.value.length === 0 && !x.value ? e(t)("tag.empty") : void 0,
|
|
2791
|
+
"aria-label": E.value,
|
|
2792
|
+
onStateChange: k
|
|
2697
2793
|
}, {
|
|
2698
|
-
|
|
2699
|
-
|
|
2700
|
-
|
|
2701
|
-
|
|
2702
|
-
|
|
2703
|
-
|
|
2704
|
-
|
|
2705
|
-
}, {
|
|
2706
|
-
default: a(() => [
|
|
2707
|
-
g(f(e(t)(`tag.sort-${w}`)), 1)
|
|
2708
|
-
]),
|
|
2709
|
-
_: 2
|
|
2710
|
-
}, 1032, ["variant", "onClick"])), 64))
|
|
2711
|
-
])
|
|
2712
|
-
]),
|
|
2713
|
-
"cell-title": a(({ row: w }) => [
|
|
2714
|
-
d.value === w.id ? (p(), K("span", {
|
|
2715
|
-
key: 0,
|
|
2716
|
-
ref_key: "box",
|
|
2717
|
-
ref: S,
|
|
2718
|
-
class: "wx-tags__rename"
|
|
2719
|
-
}, [
|
|
2720
|
-
n(e($e), {
|
|
2721
|
-
modelValue: k.value,
|
|
2722
|
-
"onUpdate:modelValue": s[0] || (s[0] = (le) => k.value = le),
|
|
2723
|
-
size: "sm",
|
|
2724
|
-
"aria-label": e(t)("tag.rename"),
|
|
2725
|
-
onKeyup: [
|
|
2726
|
-
Ce((le) => we(w), ["enter"]),
|
|
2727
|
-
Ce(J, ["esc"])
|
|
2728
|
-
],
|
|
2729
|
-
onBlur: (le) => we(w)
|
|
2730
|
-
}, null, 8, ["modelValue", "aria-label", "onKeyup", "onBlur"])
|
|
2731
|
-
], 512)) : P.value ? (p(), K("button", {
|
|
2732
|
-
key: 1,
|
|
2733
|
-
type: "button",
|
|
2734
|
-
class: "wx-tags__name",
|
|
2735
|
-
title: e(t)("tag.rename"),
|
|
2736
|
-
onClick: (le) => ve(w)
|
|
2737
|
-
}, f(w.title), 9, Za)) : (p(), K("span", Qa, f(w.title), 1))
|
|
2794
|
+
"cell-title": l(({ row: B }) => [
|
|
2795
|
+
n(e(G), { truncate: "" }, {
|
|
2796
|
+
default: l(() => [
|
|
2797
|
+
w(b(B.title), 1)
|
|
2798
|
+
]),
|
|
2799
|
+
_: 2
|
|
2800
|
+
}, 1024)
|
|
2738
2801
|
]),
|
|
2739
|
-
"cell-path":
|
|
2802
|
+
"cell-path": l(({ row: B }) => [
|
|
2740
2803
|
n(e(G), {
|
|
2741
2804
|
size: "sm",
|
|
2742
2805
|
tone: "muted",
|
|
2743
2806
|
mono: "",
|
|
2744
2807
|
truncate: ""
|
|
2745
2808
|
}, {
|
|
2746
|
-
default:
|
|
2747
|
-
|
|
2809
|
+
default: l(() => [
|
|
2810
|
+
w(b(B.path ?? e(t)("tag.no-address")), 1)
|
|
2748
2811
|
]),
|
|
2749
2812
|
_: 2
|
|
2750
2813
|
}, 1024)
|
|
2751
2814
|
]),
|
|
2752
|
-
"cell-articles_count":
|
|
2815
|
+
"cell-articles_count": l(({ row: B }) => [
|
|
2753
2816
|
n(e(G), {
|
|
2754
|
-
tone:
|
|
2817
|
+
tone: B.articles_count === 0 ? "muted" : "default"
|
|
2755
2818
|
}, {
|
|
2756
|
-
default:
|
|
2757
|
-
|
|
2819
|
+
default: l(() => [
|
|
2820
|
+
w(b(B.articles_count), 1)
|
|
2758
2821
|
]),
|
|
2759
2822
|
_: 2
|
|
2760
2823
|
}, 1032, ["tone"])
|
|
2761
2824
|
]),
|
|
2762
|
-
"cell-indexing":
|
|
2763
|
-
|
|
2825
|
+
"cell-indexing": l(({ row: B }) => [
|
|
2826
|
+
B.indexing === "rule" ? (p(), C(e(et), {
|
|
2764
2827
|
key: 0,
|
|
2765
2828
|
content: e(t)("tag.indexing-rule-help")
|
|
2766
2829
|
}, {
|
|
2767
|
-
default:
|
|
2830
|
+
default: l(() => [
|
|
2768
2831
|
n(e(G), {
|
|
2769
2832
|
size: "sm",
|
|
2770
|
-
tone:
|
|
2833
|
+
tone: ke(B.indexing)
|
|
2771
2834
|
}, {
|
|
2772
|
-
default:
|
|
2773
|
-
|
|
2835
|
+
default: l(() => [
|
|
2836
|
+
w(b(e(t)("tag.indexing-rule")), 1)
|
|
2774
2837
|
]),
|
|
2775
2838
|
_: 1
|
|
2776
2839
|
}, 8, ["tone"])
|
|
2777
2840
|
]),
|
|
2778
2841
|
_: 2
|
|
2779
|
-
}, 1032, ["content"])) : (p(),
|
|
2842
|
+
}, 1032, ["content"])) : (p(), C(e(G), {
|
|
2780
2843
|
key: 1,
|
|
2781
2844
|
size: "sm",
|
|
2782
|
-
tone:
|
|
2845
|
+
tone: ke(B.indexing)
|
|
2783
2846
|
}, {
|
|
2784
|
-
default:
|
|
2785
|
-
|
|
2847
|
+
default: l(() => [
|
|
2848
|
+
w(b(e(t)(`tag.indexing-${B.indexing}`)), 1)
|
|
2786
2849
|
]),
|
|
2787
2850
|
_: 2
|
|
2788
2851
|
}, 1032, ["tone"]))
|
|
2789
2852
|
]),
|
|
2790
|
-
"cell-actions":
|
|
2791
|
-
n(e(
|
|
2792
|
-
actions:
|
|
2793
|
-
label:
|
|
2853
|
+
"cell-actions": l(({ row: B }) => [
|
|
2854
|
+
n(e(Re), {
|
|
2855
|
+
actions: Te(B),
|
|
2856
|
+
label: B.title
|
|
2794
2857
|
}, null, 8, ["actions", "label"])
|
|
2795
2858
|
]),
|
|
2796
2859
|
_: 1
|
|
2797
2860
|
}, 8, ["selected", "data", "columns", "loading", "selectable", "search-placeholder", "empty-text", "aria-label"])
|
|
2798
2861
|
]),
|
|
2799
|
-
_:
|
|
2800
|
-
}, [
|
|
2801
|
-
|
|
2802
|
-
name: "actions",
|
|
2803
|
-
fn: a(() => [
|
|
2804
|
-
n(e(F), {
|
|
2805
|
-
type: "primary",
|
|
2806
|
-
onClick: Ve
|
|
2807
|
-
}, {
|
|
2808
|
-
icon: a(() => [
|
|
2809
|
-
n(e(Y), { name: "plus" })
|
|
2810
|
-
]),
|
|
2811
|
-
default: a(() => [
|
|
2812
|
-
g(" " + f(e(t)("tag.new")), 1)
|
|
2813
|
-
]),
|
|
2814
|
-
_: 1
|
|
2815
|
-
})
|
|
2816
|
-
]),
|
|
2817
|
-
key: "0"
|
|
2818
|
-
} : void 0
|
|
2819
|
-
]), 1032, ["view", "title", "views"]),
|
|
2820
|
-
N.value.length > 0 ? (p(), V(e(ot), {
|
|
2862
|
+
_: 1
|
|
2863
|
+
}, 8, ["view", "title", "views", "actions"]),
|
|
2864
|
+
M.value.length > 0 ? (p(), C(e(rt), {
|
|
2821
2865
|
key: 0,
|
|
2822
2866
|
class: "wx-tags__bar",
|
|
2823
2867
|
sticky: ""
|
|
2824
2868
|
}, {
|
|
2825
|
-
|
|
2869
|
+
state: l(() => [
|
|
2826
2870
|
n(e(G), { weight: "medium" }, {
|
|
2827
|
-
default:
|
|
2828
|
-
|
|
2871
|
+
default: l(() => [
|
|
2872
|
+
w(b(e(t)("tag.selected", { count: M.value.length })), 1)
|
|
2829
2873
|
]),
|
|
2830
2874
|
_: 1
|
|
2831
|
-
})
|
|
2832
|
-
|
|
2833
|
-
|
|
2875
|
+
})
|
|
2876
|
+
]),
|
|
2877
|
+
default: l(() => [
|
|
2878
|
+
n(e(J), {
|
|
2834
2879
|
type: "primary",
|
|
2835
|
-
disabled:
|
|
2836
|
-
onClick:
|
|
2837
|
-
}, {
|
|
2838
|
-
icon: a(() => [
|
|
2839
|
-
n(e(Y), { name: "link" })
|
|
2840
|
-
]),
|
|
2841
|
-
default: a(() => [
|
|
2842
|
-
g(" " + f(e(t)("tag.merge")), 1)
|
|
2843
|
-
]),
|
|
2844
|
-
_: 1
|
|
2845
|
-
}, 8, ["disabled"]),
|
|
2846
|
-
n(e(F), {
|
|
2847
|
-
variant: "outline",
|
|
2848
|
-
disabled: h.value,
|
|
2849
|
-
onClick: s[3] || (s[3] = (w) => v("index"))
|
|
2850
|
-
}, {
|
|
2851
|
-
icon: a(() => [
|
|
2852
|
-
n(e(Y), { name: "eye" })
|
|
2853
|
-
]),
|
|
2854
|
-
default: a(() => [
|
|
2855
|
-
g(" " + f(e(t)("tag.index")), 1)
|
|
2856
|
-
]),
|
|
2857
|
-
_: 1
|
|
2858
|
-
}, 8, ["disabled"]),
|
|
2859
|
-
n(e(F), {
|
|
2860
|
-
variant: "outline",
|
|
2861
|
-
disabled: h.value,
|
|
2862
|
-
onClick: s[4] || (s[4] = (w) => v("noindex"))
|
|
2880
|
+
disabled: M.value.length < 2 || c.value,
|
|
2881
|
+
onClick: pe
|
|
2863
2882
|
}, {
|
|
2864
|
-
icon:
|
|
2865
|
-
n(e(
|
|
2883
|
+
icon: l(() => [
|
|
2884
|
+
n(e(we), { name: "link" })
|
|
2866
2885
|
]),
|
|
2867
|
-
default:
|
|
2868
|
-
|
|
2886
|
+
default: l(() => [
|
|
2887
|
+
w(" " + b(e(t)("tag.merge")), 1)
|
|
2869
2888
|
]),
|
|
2870
2889
|
_: 1
|
|
2871
2890
|
}, 8, ["disabled"]),
|
|
2872
|
-
n(e(
|
|
2873
|
-
|
|
2874
|
-
|
|
2875
|
-
|
|
2876
|
-
|
|
2877
|
-
}, {
|
|
2878
|
-
icon: a(() => [
|
|
2879
|
-
n(e(Y), { name: "trash" })
|
|
2880
|
-
]),
|
|
2881
|
-
default: a(() => [
|
|
2882
|
-
g(" " + f(e(t)("tag.delete")), 1)
|
|
2883
|
-
]),
|
|
2884
|
-
_: 1
|
|
2885
|
-
}, 8, ["disabled"]),
|
|
2886
|
-
n(e(F), {
|
|
2887
|
-
variant: "text",
|
|
2888
|
-
"aria-label": e(t)("tag.clear"),
|
|
2889
|
-
onClick: s[6] || (s[6] = (w) => T.value = [])
|
|
2890
|
-
}, {
|
|
2891
|
-
icon: a(() => [
|
|
2892
|
-
n(e(Y), { name: "close" })
|
|
2893
|
-
]),
|
|
2894
|
-
_: 1
|
|
2895
|
-
}, 8, ["aria-label"])
|
|
2891
|
+
n(e(Re), {
|
|
2892
|
+
size: "lg",
|
|
2893
|
+
actions: he.value,
|
|
2894
|
+
label: e(t)("tag.selected", { count: M.value.length })
|
|
2895
|
+
}, null, 8, ["actions", "label"])
|
|
2896
2896
|
]),
|
|
2897
2897
|
_: 1
|
|
2898
|
-
})) :
|
|
2898
|
+
})) : H("", !0)
|
|
2899
2899
|
]));
|
|
2900
2900
|
}
|
|
2901
|
-
}),
|
|
2902
|
-
function
|
|
2903
|
-
const
|
|
2901
|
+
}), Oa = /* @__PURE__ */ ve(Ia, [["__scopeId", "data-v-beb86d88"]]);
|
|
2902
|
+
function ja(f = {}) {
|
|
2903
|
+
const m = f.path ?? "/blog";
|
|
2904
2904
|
return [
|
|
2905
2905
|
{
|
|
2906
2906
|
id: "articles",
|
|
2907
|
-
path: `${
|
|
2907
|
+
path: `${m}/articles`,
|
|
2908
2908
|
routes: [
|
|
2909
2909
|
// The section's own path travels as a prop, so a panel that mounted the blog somewhere
|
|
2910
2910
|
// else still links between its screens correctly.
|
|
2911
2911
|
{
|
|
2912
|
-
path: `${
|
|
2912
|
+
path: `${m}/articles`,
|
|
2913
2913
|
name: "webx.blog.articles",
|
|
2914
|
-
component:
|
|
2915
|
-
props: { base:
|
|
2914
|
+
component: ha,
|
|
2915
|
+
props: { base: m }
|
|
2916
2916
|
},
|
|
2917
2917
|
{
|
|
2918
|
-
path: `${
|
|
2918
|
+
path: `${m}/articles/:id(\\d+)`,
|
|
2919
2919
|
name: "webx.blog.articles.edit",
|
|
2920
|
-
component:
|
|
2921
|
-
props: { base:
|
|
2920
|
+
component: Ot,
|
|
2921
|
+
props: { base: m }
|
|
2922
2922
|
}
|
|
2923
2923
|
],
|
|
2924
2924
|
/*
|
|
@@ -2933,34 +2933,34 @@ function nl(y = {}) {
|
|
|
2933
2933
|
*/
|
|
2934
2934
|
types: {
|
|
2935
2935
|
"wx-article-address": { component: Nt, kind: "display" },
|
|
2936
|
-
"wx-article-author": { component:
|
|
2937
|
-
"wx-article-rubrics": { component:
|
|
2938
|
-
"wx-article-tags": { component:
|
|
2939
|
-
"wx-article-related": { component:
|
|
2940
|
-
"wx-article-history": { component:
|
|
2936
|
+
"wx-article-author": { component: Bt, kind: "field" },
|
|
2937
|
+
"wx-article-rubrics": { component: aa, kind: "field" },
|
|
2938
|
+
"wx-article-tags": { component: oa, kind: "field" },
|
|
2939
|
+
"wx-article-related": { component: Xt, kind: "field" },
|
|
2940
|
+
"wx-article-history": { component: Kt, kind: "display" }
|
|
2941
2941
|
}
|
|
2942
2942
|
},
|
|
2943
2943
|
{
|
|
2944
2944
|
id: "rubrics",
|
|
2945
|
-
path: `${
|
|
2945
|
+
path: `${m}/rubrics`,
|
|
2946
2946
|
routes: [
|
|
2947
2947
|
{
|
|
2948
|
-
path: `${
|
|
2948
|
+
path: `${m}/rubrics`,
|
|
2949
2949
|
name: "webx.blog.rubrics",
|
|
2950
|
-
component:
|
|
2951
|
-
props: { base:
|
|
2950
|
+
component: Ca,
|
|
2951
|
+
props: { base: m }
|
|
2952
2952
|
}
|
|
2953
2953
|
]
|
|
2954
2954
|
},
|
|
2955
2955
|
{
|
|
2956
2956
|
id: "tags",
|
|
2957
|
-
path: `${
|
|
2957
|
+
path: `${m}/tags`,
|
|
2958
2958
|
routes: [
|
|
2959
2959
|
{
|
|
2960
|
-
path: `${
|
|
2960
|
+
path: `${m}/tags`,
|
|
2961
2961
|
name: "webx.blog.tags",
|
|
2962
|
-
component:
|
|
2963
|
-
props: { base:
|
|
2962
|
+
component: Oa,
|
|
2963
|
+
props: { base: m }
|
|
2964
2964
|
}
|
|
2965
2965
|
]
|
|
2966
2966
|
}
|
|
@@ -2968,24 +2968,24 @@ function nl(y = {}) {
|
|
|
2968
2968
|
}
|
|
2969
2969
|
export {
|
|
2970
2970
|
Nt as WxArticleAddress,
|
|
2971
|
-
|
|
2972
|
-
|
|
2973
|
-
|
|
2974
|
-
|
|
2975
|
-
|
|
2976
|
-
|
|
2977
|
-
|
|
2978
|
-
|
|
2979
|
-
|
|
2980
|
-
|
|
2981
|
-
|
|
2982
|
-
|
|
2983
|
-
|
|
2984
|
-
|
|
2985
|
-
|
|
2986
|
-
|
|
2987
|
-
|
|
2988
|
-
|
|
2989
|
-
|
|
2971
|
+
Bt as WxArticleAuthorField,
|
|
2972
|
+
ua as WxArticleCreateDialog,
|
|
2973
|
+
Ot as WxArticleEditorPage,
|
|
2974
|
+
Kt as WxArticleHistory,
|
|
2975
|
+
Xt as WxArticleRelated,
|
|
2976
|
+
aa as WxArticleRubrics,
|
|
2977
|
+
oa as WxArticleTags,
|
|
2978
|
+
ha as WxArticlesPage,
|
|
2979
|
+
Aa as WxRubricForm,
|
|
2980
|
+
Ca as WxRubricsPage,
|
|
2981
|
+
za as WxTagCreateDialog,
|
|
2982
|
+
Pa as WxTagMergeDialog,
|
|
2983
|
+
Oa as WxTagsPage,
|
|
2984
|
+
ut as articleEditorKey,
|
|
2985
|
+
ja as blog,
|
|
2986
|
+
Ut as blogMessages,
|
|
2987
|
+
de as createBlogApi,
|
|
2988
|
+
Rt as provideArticleEditor,
|
|
2989
|
+
Se as useArticleEditor
|
|
2990
2990
|
};
|
|
2991
2991
|
//# sourceMappingURL=index.js.map
|