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