@devgateway/dvz-ui-react 1.7.13 → 1.7.15
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const n=require("react/jsx-runtime"),
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const n=require("react/jsx-runtime"),p=require("react"),l=require("@devgateway/wp-react-lib"),f=require("semantic-ui-react"),P=require("react-intl"),x=(e,s)=>!e||!s||!e.includes("/wp/")||e.includes("/wp/"+s+"/")||e.includes("/wp/wp-content/uploads/")?e:e.replace(/href\s*=\s*(['"])(https?:\/\/[^'"]+)\1/ig,(i,a,t)=>{try{const r=new URL(t),u=r.pathname.indexOf("/wp/");if(u===-1)return i;const o=r.pathname.slice(u+3);return r.pathname=o.startsWith("/"+s)?o:"/"+s+o,`href=${a}${r.toString()}${a}`}catch{return i}}),I=e=>{const s=e.as?e.as:f.Container,i=["post","pageNumber","visibility","intl","as"],a={};return Object.keys(e).filter(t=>t).forEach(t=>{i.indexOf(t)==-1&&(a[t]=e[t])}),n.jsx(s,{...a,children:e.children})},_=e=>{const s=P.useIntl(),[i,a]=p.useState(!1);p.useEffect(()=>{e.onLoad&&e.onLoad()},[]);const{post:t,pageNumber:r,showTitle:u,showContent:o,showIntro:m,showDate:L,showLoading:b,as:N,locale:C,messages:y,preview:S}=e,d=C||s.locale;if(t){const c=t.content?t.content.rendered.split("<!--more-->"):[],v=c.length>1?c[0]:null,h=c.length>1?c[1]:c[0],w=h?h.split("<!--nextpage-->"):"";let g="";return r!=null&&w.length>0?g=w[r]:g=h,n.jsx(l.EmbeddedGateway,{parentUnique:e.parentUnique,messages:y,parent:S?t.parent:t.id,children:n.jsxs(I,{className:"entry-content",...e,children:[n.jsx("div",{}),L&&n.jsx(f.Container,{fluid:!0,className:"date",children:t.date.toLocaleString()}),u&&n.jsx("span",{id:t.slug,className:"title",dangerouslySetInnerHTML:{__html:t.title.rendered}},"title"),m&&n.jsx(f.Container,{fluid:!0,className:"excerpt",dangerouslySetInnerHTML:{__html:l.utils.removePatternBrackets(x(l.dvizTranslate(v,d),d))}},"intro"),o&&n.jsx(f.Container,{fluid:!0,className:"content ",dangerouslySetInnerHTML:{__html:l.utils.removePatternBrackets(x(l.dvizTranslate(g,d),d))}},"content")]})})}else return b?"Loading":!1},j=e=>n.jsx(p.Suspense,{children:n.jsx(_,{...e})});exports.FilteredPostContent=j;exports.default=j;
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { jsx as n, jsxs as P } from "react/jsx-runtime";
|
|
2
|
-
import
|
|
2
|
+
import m, { Suspense as v } from "react";
|
|
3
3
|
import { EmbeddedGateway as E, utils as g, dvizTranslate as w } from "@devgateway/wp-react-lib";
|
|
4
4
|
import { Container as u } from "semantic-ui-react";
|
|
5
5
|
import { useIntl as _ } from "react-intl";
|
|
6
|
-
const L = (e, r) => !e || !r ? e : e.replace(/href\s*=\s*(['"])(https?:\/\/[^'"]+)\1/ig, (a, o, t) => {
|
|
6
|
+
const L = (e, r) => !e || !r || !e.includes("/wp/") || e.includes("/wp/" + r + "/") || e.includes("/wp/wp-content/uploads/") ? e : e.replace(/href\s*=\s*(['"])(https?:\/\/[^'"]+)\1/ig, (a, o, t) => {
|
|
7
7
|
try {
|
|
8
|
-
const s = new URL(t),
|
|
9
|
-
if (
|
|
10
|
-
const
|
|
11
|
-
return s.pathname =
|
|
8
|
+
const s = new URL(t), l = s.pathname.indexOf("/wp/");
|
|
9
|
+
if (l === -1) return a;
|
|
10
|
+
const i = s.pathname.slice(l + 3);
|
|
11
|
+
return s.pathname = i.startsWith("/" + r) ? i : "/" + r + i, `href=${o}${s.toString()}${o}`;
|
|
12
12
|
} catch {
|
|
13
13
|
return a;
|
|
14
14
|
}
|
|
@@ -18,36 +18,36 @@ const L = (e, r) => !e || !r ? e : e.replace(/href\s*=\s*(['"])(https?:\/\/[^'"]
|
|
|
18
18
|
a.indexOf(t) == -1 && (o[t] = e[t]);
|
|
19
19
|
}), /* @__PURE__ */ n(r, { ...o, children: e.children });
|
|
20
20
|
}, j = (e) => {
|
|
21
|
-
const r = _(), [a, o] =
|
|
22
|
-
|
|
21
|
+
const r = _(), [a, o] = m.useState(!1);
|
|
22
|
+
m.useEffect(() => {
|
|
23
23
|
e.onLoad && e.onLoad();
|
|
24
24
|
}, []);
|
|
25
25
|
const {
|
|
26
26
|
post: t,
|
|
27
27
|
pageNumber: s,
|
|
28
|
-
showTitle:
|
|
29
|
-
showContent:
|
|
28
|
+
showTitle: l,
|
|
29
|
+
showContent: i,
|
|
30
30
|
showIntro: y,
|
|
31
31
|
showDate: b,
|
|
32
32
|
showLoading: x,
|
|
33
33
|
as: k,
|
|
34
|
-
locale:
|
|
35
|
-
messages:
|
|
34
|
+
locale: S,
|
|
35
|
+
messages: C,
|
|
36
36
|
preview: I
|
|
37
|
-
} = e, d =
|
|
37
|
+
} = e, d = S || r.locale;
|
|
38
38
|
if (t) {
|
|
39
|
-
const
|
|
40
|
-
let
|
|
41
|
-
return s != null &&
|
|
39
|
+
const c = t.content ? t.content.rendered.split("<!--more-->") : [], N = c.length > 1 ? c[0] : null, f = c.length > 1 ? c[1] : c[0], h = f ? f.split("<!--nextpage-->") : "";
|
|
40
|
+
let p = "";
|
|
41
|
+
return s != null && h.length > 0 ? p = h[s] : p = f, /* @__PURE__ */ n(
|
|
42
42
|
E,
|
|
43
43
|
{
|
|
44
44
|
parentUnique: e.parentUnique,
|
|
45
|
-
messages:
|
|
45
|
+
messages: C,
|
|
46
46
|
parent: I ? t.parent : t.id,
|
|
47
47
|
children: /* @__PURE__ */ P(T, { className: "entry-content", ...e, children: [
|
|
48
48
|
/* @__PURE__ */ n("div", {}),
|
|
49
49
|
b && /* @__PURE__ */ n(u, { fluid: !0, className: "date", children: t.date.toLocaleString() }),
|
|
50
|
-
|
|
50
|
+
l && /* @__PURE__ */ n(
|
|
51
51
|
"span",
|
|
52
52
|
{
|
|
53
53
|
id: t.slug,
|
|
@@ -65,12 +65,12 @@ const L = (e, r) => !e || !r ? e : e.replace(/href\s*=\s*(['"])(https?:\/\/[^'"]
|
|
|
65
65
|
},
|
|
66
66
|
"intro"
|
|
67
67
|
),
|
|
68
|
-
|
|
68
|
+
i && /* @__PURE__ */ n(
|
|
69
69
|
u,
|
|
70
70
|
{
|
|
71
71
|
fluid: !0,
|
|
72
72
|
className: "content ",
|
|
73
|
-
dangerouslySetInnerHTML: { __html: g.removePatternBrackets(L(w(
|
|
73
|
+
dangerouslySetInnerHTML: { __html: g.removePatternBrackets(L(w(p, d), d)) }
|
|
74
74
|
},
|
|
75
75
|
"content"
|
|
76
76
|
)
|
|
@@ -79,7 +79,7 @@ const L = (e, r) => !e || !r ? e : e.replace(/href\s*=\s*(['"])(https?:\/\/[^'"]
|
|
|
79
79
|
);
|
|
80
80
|
} else
|
|
81
81
|
return x ? "Loading" : !1;
|
|
82
|
-
}, B = (e) => /* @__PURE__ */ n(v, { children: /* @__PURE__ */ n(j, { ...e
|
|
82
|
+
}, B = (e) => /* @__PURE__ */ n(v, { children: /* @__PURE__ */ n(j, { ...e }) });
|
|
83
83
|
export {
|
|
84
84
|
B as FilteredPostContent,
|
|
85
85
|
B as default
|