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