@roottale/cms-renderer-next 0.65.0 → 0.66.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/CHANGELOG.md +29 -0
- package/dist/chunk-22MB5YER.js +122 -0
- package/dist/chunk-22MB5YER.js.map +1 -0
- package/dist/cms-public.css +376 -228
- package/dist/fonts/LICENSE +94 -0
- package/dist/fonts/PretendardVariable.woff2 +0 -0
- package/dist/image-lightbox.d.ts +10 -0
- package/dist/image-lightbox.js +8 -0
- package/dist/image-lightbox.js.map +1 -0
- package/dist/routes.js +13 -15
- package/dist/routes.js.map +1 -1
- package/dist/server.js +16 -10
- package/dist/server.js.map +1 -1
- package/package.json +10 -5
package/dist/server.js
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import {
|
|
2
|
+
RootTaleImageLightbox
|
|
3
|
+
} from "./chunk-22MB5YER.js";
|
|
1
4
|
import {
|
|
2
5
|
collectCategories,
|
|
3
6
|
collectCategoriesWithCounts,
|
|
@@ -983,7 +986,7 @@ function isSafeHref(value) {
|
|
|
983
986
|
}
|
|
984
987
|
return /^(https?:|mailto:|tel:)/i.test(href);
|
|
985
988
|
}
|
|
986
|
-
function applyMark(mark, child) {
|
|
989
|
+
function applyMark(mark, child, headingText = false) {
|
|
987
990
|
switch (mark.type) {
|
|
988
991
|
case "bold":
|
|
989
992
|
return /* @__PURE__ */ jsx10("strong", { children: child });
|
|
@@ -1005,7 +1008,7 @@ function applyMark(mark, child) {
|
|
|
1005
1008
|
const fontSize = cmsFontSize(mark.attrs?.fontSize);
|
|
1006
1009
|
const style = {
|
|
1007
1010
|
...typeof color === "string" && color ? { color } : {},
|
|
1008
|
-
...fontSize ? { fontSize } : {}
|
|
1011
|
+
...fontSize ? { fontSize: headingText ? `var(--rt-cms-heading-size, ${fontSize})` : fontSize } : {}
|
|
1009
1012
|
};
|
|
1010
1013
|
return Object.keys(style).length ? /* @__PURE__ */ jsx10("span", { style, children: child }) : /* @__PURE__ */ jsx10(Fragment3, { children: child });
|
|
1011
1014
|
}
|
|
@@ -1045,7 +1048,7 @@ function renderInternalLinkText(text, resolve) {
|
|
|
1045
1048
|
if (cursor < text.length) parts.push(text.slice(cursor));
|
|
1046
1049
|
return /* @__PURE__ */ jsx10(Fragment3, { children: parts });
|
|
1047
1050
|
}
|
|
1048
|
-
function renderTextNode(node, key, internalLinks = null) {
|
|
1051
|
+
function renderTextNode(node, key, internalLinks = null, headingText = false) {
|
|
1049
1052
|
const text = node.text ?? "";
|
|
1050
1053
|
const marks = (node.marks ?? []).flatMap((value) => {
|
|
1051
1054
|
const mark = parseTiptapMark(value);
|
|
@@ -1058,7 +1061,7 @@ function renderTextNode(node, key, internalLinks = null) {
|
|
|
1058
1061
|
}
|
|
1059
1062
|
let element = typeof content === "string" ? content : /* @__PURE__ */ jsx10(Fragment3, { children: content });
|
|
1060
1063
|
for (const mark of marks) {
|
|
1061
|
-
element = applyMark(mark, element);
|
|
1064
|
+
element = applyMark(mark, element, headingText);
|
|
1062
1065
|
}
|
|
1063
1066
|
return /* @__PURE__ */ jsx10("span", { children: element }, key);
|
|
1064
1067
|
}
|
|
@@ -1096,7 +1099,7 @@ function renderTiptapNode(value, key, context) {
|
|
|
1096
1099
|
const node = parseTiptapNode(value);
|
|
1097
1100
|
if (!node) return null;
|
|
1098
1101
|
const children = node.content?.map(
|
|
1099
|
-
(child, index) => renderTiptapNode(child, index, context)
|
|
1102
|
+
(child, index) => renderTiptapNode(child, index, { ...context, headingText: node.type === "heading" })
|
|
1100
1103
|
);
|
|
1101
1104
|
switch (node.type) {
|
|
1102
1105
|
case "paragraph": {
|
|
@@ -1121,8 +1124,11 @@ function renderTiptapNode(value, key, context) {
|
|
|
1121
1124
|
}
|
|
1122
1125
|
case "bulletList":
|
|
1123
1126
|
return /* @__PURE__ */ jsx11("ul", { children }, key);
|
|
1124
|
-
case "orderedList":
|
|
1125
|
-
|
|
1127
|
+
case "orderedList": {
|
|
1128
|
+
const start = Number(node.attrs?.start);
|
|
1129
|
+
const validStart = Number.isSafeInteger(start) && start > 0 ? start : void 0;
|
|
1130
|
+
return /* @__PURE__ */ jsx11("ol", { start: validStart, children }, key);
|
|
1131
|
+
}
|
|
1126
1132
|
case "listItem":
|
|
1127
1133
|
return /* @__PURE__ */ jsx11("li", { children }, key);
|
|
1128
1134
|
case "blockquote":
|
|
@@ -1254,7 +1260,7 @@ function renderTiptapNode(value, key, context) {
|
|
|
1254
1260
|
return renderSection(node, key, context.section);
|
|
1255
1261
|
}
|
|
1256
1262
|
case "text":
|
|
1257
|
-
return renderTextNode(node, key, context.internalLinks ?? null);
|
|
1263
|
+
return renderTextNode(node, key, context.internalLinks ?? null, context.headingText);
|
|
1258
1264
|
default:
|
|
1259
1265
|
return children ? /* @__PURE__ */ jsx11("span", { children }, key) : null;
|
|
1260
1266
|
}
|
|
@@ -1483,7 +1489,7 @@ function BlogPostBody(props) {
|
|
|
1483
1489
|
source.html,
|
|
1484
1490
|
internalContentLinkResolverFrom2(internalLinks)
|
|
1485
1491
|
).html : source.kind === "html" ? source.html : "";
|
|
1486
|
-
const body = /* @__PURE__ */ jsx15("div", { "data-roottale-cms": "body", className: "rt-cms-body", children: source.kind === "html" ? (
|
|
1492
|
+
const body = /* @__PURE__ */ jsx15("div", { "data-roottale-cms": "body", className: "rt-cms-body", children: /* @__PURE__ */ jsx15(RootTaleImageLightbox, { children: source.kind === "html" ? (
|
|
1487
1493
|
// source.html 은 resolvePostBodySource 가 공용 sanitizeHtml 로 정제한 값이다
|
|
1488
1494
|
// (이 컴포넌트에서 한 번 더 정제하지 않는 이유 — sink 가 한 곳이어야 눈으로
|
|
1489
1495
|
// 추적 가능하고, 이중 정제는 안전을 더 만들지 않으면서 비용만 든다).
|
|
@@ -1497,7 +1503,7 @@ function BlogPostBody(props) {
|
|
|
1497
1503
|
baseUrl,
|
|
1498
1504
|
internalLinks
|
|
1499
1505
|
}
|
|
1500
|
-
) });
|
|
1506
|
+
) }) });
|
|
1501
1507
|
if (tocPosition === "sidebar" && tableOfContents) {
|
|
1502
1508
|
return /* @__PURE__ */ jsxs10("div", { className: "rt-cms-layout rt-cms-layout--toc-side", children: [
|
|
1503
1509
|
body,
|