@happeouikit/content-renderer 3.2.19 → 3.2.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs.js +1 -1
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.es.js +44 -31
- package/dist/index.es.js.map +1 -1
- package/package.json +2 -2
package/dist/index.es.js
CHANGED
|
@@ -5163,66 +5163,79 @@ const ni = ai(), ii = new RegExp(rt, "gi"), ui = new RegExp(
|
|
|
5163
5163
|
const N = () => {
|
|
5164
5164
|
if (!T.current || !t)
|
|
5165
5165
|
return;
|
|
5166
|
-
const
|
|
5167
|
-
|
|
5168
|
-
const { textContent:
|
|
5169
|
-
(
|
|
5170
|
-
(
|
|
5166
|
+
const d = T.current.querySelectorAll("h1, h2, h3, h4, h5, h6") || [];
|
|
5167
|
+
d.length > 0 && d.forEach((o) => {
|
|
5168
|
+
const { textContent: f = "" } = o;
|
|
5169
|
+
(f || "").length > 0 && (o.id = o.id || kt(
|
|
5170
|
+
(f || "").toLowerCase().replace(/\s/g, "-")
|
|
5171
5171
|
));
|
|
5172
|
-
}), q((
|
|
5172
|
+
}), q((o) => [...o, ...d]);
|
|
5173
5173
|
}, z = () => {
|
|
5174
5174
|
if (!T.current || !g)
|
|
5175
5175
|
return;
|
|
5176
|
-
const
|
|
5177
|
-
if (
|
|
5178
|
-
const
|
|
5179
|
-
|
|
5180
|
-
const { href:
|
|
5181
|
-
|
|
5176
|
+
const d = T.current.querySelectorAll("a") || [];
|
|
5177
|
+
if (d.length > 0) {
|
|
5178
|
+
const o = window.origin;
|
|
5179
|
+
d.forEach((f) => {
|
|
5180
|
+
const { href: c } = f;
|
|
5181
|
+
c.startsWith(o) ? delete f.target : f.target = "_blank";
|
|
5182
5182
|
});
|
|
5183
5183
|
}
|
|
5184
5184
|
}, H = () => {
|
|
5185
|
-
T.current && (T.current.querySelectorAll("a") || []).forEach((
|
|
5186
|
-
const { href:
|
|
5187
|
-
|
|
5185
|
+
T.current && (T.current.querySelectorAll("a") || []).forEach((d) => {
|
|
5186
|
+
const { href: o } = d;
|
|
5187
|
+
o.startsWith("mailto:") && (d.target = "_blank");
|
|
5188
5188
|
});
|
|
5189
5189
|
}, O = () => {
|
|
5190
5190
|
if (!T.current)
|
|
5191
5191
|
return;
|
|
5192
|
-
const
|
|
5192
|
+
const d = T.current.querySelectorAll(
|
|
5193
5193
|
yt
|
|
5194
5194
|
);
|
|
5195
|
-
|
|
5195
|
+
d.length > 0 && (_r.isDefined("highlightjs") || (fi(), _r([...Yn, ...Xn], "highlightjs")), _r.ready("highlightjs", () => {
|
|
5196
5196
|
window.hljs.configure({
|
|
5197
5197
|
languages: Jn,
|
|
5198
5198
|
useBr: !0
|
|
5199
|
-
}),
|
|
5200
|
-
const
|
|
5201
|
-
|
|
5202
|
-
}), q((
|
|
5199
|
+
}), d.forEach((o) => {
|
|
5200
|
+
const f = o.innerText, c = document.createElement(Zn), h = Qt(f);
|
|
5201
|
+
c.textContent = h, o.innerHTML = "", o.appendChild(c), window.hljs.highlightBlock(o);
|
|
5202
|
+
}), q((o) => [...o, ...d]);
|
|
5203
5203
|
}));
|
|
5204
5204
|
}, r = () => {
|
|
5205
|
-
D.length !== 0 && D.forEach(({ domainToReplace:
|
|
5205
|
+
D.length !== 0 && D.forEach(({ domainToReplace: d, domainToReplaceWith: o }) => {
|
|
5206
5206
|
if (!T.current)
|
|
5207
5207
|
return;
|
|
5208
|
-
const
|
|
5209
|
-
|
|
5208
|
+
const f = T.current.querySelectorAll("a") || [];
|
|
5209
|
+
f.length > 0 && f.forEach((c) => {
|
|
5210
5210
|
try {
|
|
5211
|
-
const { href:
|
|
5212
|
-
if (
|
|
5211
|
+
const { href: h } = c, A = new URL(h), { hostname: _ } = A;
|
|
5212
|
+
if (_ !== d || A.pathname === "/")
|
|
5213
5213
|
return;
|
|
5214
|
-
if (
|
|
5215
|
-
const
|
|
5216
|
-
|
|
5214
|
+
if (o === "") {
|
|
5215
|
+
const y = `${A.pathname}${A.search}${A.hash}`;
|
|
5216
|
+
c.href = y;
|
|
5217
5217
|
} else
|
|
5218
|
-
|
|
5218
|
+
c.href = h.replace(d, o);
|
|
5219
5219
|
} catch {
|
|
5220
5220
|
}
|
|
5221
5221
|
});
|
|
5222
5222
|
});
|
|
5223
|
+
}, n = () => {
|
|
5224
|
+
if (!T.current)
|
|
5225
|
+
return;
|
|
5226
|
+
T.current.querySelectorAll("iframe").forEach((o) => {
|
|
5227
|
+
var f, c;
|
|
5228
|
+
if (!((c = (f = o.allow) == null ? void 0 : f.includes) != null && c.call(f, "autoplay"))) {
|
|
5229
|
+
if (!o.allow) {
|
|
5230
|
+
o.allow = "autoplay";
|
|
5231
|
+
return;
|
|
5232
|
+
}
|
|
5233
|
+
o.allow = o.allow + " autoplay";
|
|
5234
|
+
}
|
|
5235
|
+
});
|
|
5223
5236
|
};
|
|
5224
5237
|
s && L(), requestAnimationFrame(() => {
|
|
5225
|
-
N(), z(), H(), O(), r();
|
|
5238
|
+
N(), z(), H(), O(), r(), n();
|
|
5226
5239
|
}), E.current = !0;
|
|
5227
5240
|
}, [
|
|
5228
5241
|
T,
|