@roottale/cms-renderer-next 0.59.0 → 0.61.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 +28 -0
- package/README.md +5 -0
- package/dist/cms-public.css +2 -1
- package/dist/routes.js +4 -2
- package/dist/routes.js.map +1 -1
- package/dist/server.js +29 -20
- package/dist/server.js.map +1 -1
- package/package.json +5 -5
package/dist/server.js
CHANGED
|
@@ -883,6 +883,10 @@ import {
|
|
|
883
883
|
// src/server/tiptap-node-renderer.tsx
|
|
884
884
|
import { Fragment as Fragment4 } from "react";
|
|
885
885
|
import {
|
|
886
|
+
cmsLineHeight,
|
|
887
|
+
cmsParagraphSpacing,
|
|
888
|
+
cmsImageStyle,
|
|
889
|
+
cmsImageWidth,
|
|
886
890
|
bindingSrcValue,
|
|
887
891
|
bindingTextValue,
|
|
888
892
|
boundFieldValue,
|
|
@@ -937,6 +941,7 @@ function renderEmbedNode(node, key) {
|
|
|
937
941
|
|
|
938
942
|
// src/server/tiptap-inline-renderer.tsx
|
|
939
943
|
import {
|
|
944
|
+
cmsFontSize,
|
|
940
945
|
findInternalContentLinkTokens,
|
|
941
946
|
INTERNAL_CONTENT_LINK_CLASS,
|
|
942
947
|
INTERNAL_CONTENT_LINK_PENDING_ATTR,
|
|
@@ -995,10 +1000,12 @@ function applyMark(mark, child) {
|
|
|
995
1000
|
}
|
|
996
1001
|
case "textStyle": {
|
|
997
1002
|
const color = mark.attrs?.color;
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1003
|
+
const fontSize = cmsFontSize(mark.attrs?.fontSize);
|
|
1004
|
+
const style = {
|
|
1005
|
+
...typeof color === "string" && color ? { color } : {},
|
|
1006
|
+
...fontSize ? { fontSize } : {}
|
|
1007
|
+
};
|
|
1008
|
+
return Object.keys(style).length ? /* @__PURE__ */ jsx10("span", { style, children: child }) : /* @__PURE__ */ jsx10(Fragment3, { children: child });
|
|
1002
1009
|
}
|
|
1003
1010
|
case "link": {
|
|
1004
1011
|
const rawHref = mark.attrs?.href;
|
|
@@ -1066,13 +1073,14 @@ function boundContentText(node, fields) {
|
|
|
1066
1073
|
}
|
|
1067
1074
|
function alignStyle(node) {
|
|
1068
1075
|
const align = node.attrs?.textAlign;
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
+
const lineHeight = cmsLineHeight(node.attrs?.lineHeight);
|
|
1077
|
+
const marginBottom = cmsParagraphSpacing(node.attrs?.paragraphSpacing);
|
|
1078
|
+
const style = {
|
|
1079
|
+
...align === "left" || align === "center" || align === "right" || align === "justify" ? { textAlign: align } : {},
|
|
1080
|
+
...lineHeight !== null ? { lineHeight } : {},
|
|
1081
|
+
...marginBottom !== null ? { marginBottom } : {}
|
|
1082
|
+
};
|
|
1083
|
+
return Object.keys(style).length ? style : void 0;
|
|
1076
1084
|
}
|
|
1077
1085
|
function tableCellSpans(node) {
|
|
1078
1086
|
const colspan = Number(node.attrs?.colspan);
|
|
@@ -1135,7 +1143,9 @@ function renderTiptapNode(value, key, context) {
|
|
|
1135
1143
|
const title = typeof node.attrs?.title === "string" ? node.attrs.title : void 0;
|
|
1136
1144
|
const width = typeof node.attrs?.width === "number" && node.attrs.width > 0 ? node.attrs.width : void 0;
|
|
1137
1145
|
const height = typeof node.attrs?.height === "number" && node.attrs.height > 0 ? node.attrs.height : void 0;
|
|
1138
|
-
|
|
1146
|
+
const caption = typeof node.attrs?.caption === "string" ? node.attrs.caption : "";
|
|
1147
|
+
const layout = cmsImageStyle(node.attrs ?? {});
|
|
1148
|
+
const image = /* @__PURE__ */ jsx11(
|
|
1139
1149
|
"img",
|
|
1140
1150
|
{
|
|
1141
1151
|
src,
|
|
@@ -1143,10 +1153,15 @@ function renderTiptapNode(value, key, context) {
|
|
|
1143
1153
|
title,
|
|
1144
1154
|
width,
|
|
1145
1155
|
height,
|
|
1156
|
+
style: caption ? cmsImageWidth(node.attrs?.displayWidth) ? { width: "100%", maxWidth: "100%", height: "auto" } : void 0 : layout,
|
|
1146
1157
|
loading: "lazy"
|
|
1147
1158
|
},
|
|
1148
1159
|
key
|
|
1149
1160
|
);
|
|
1161
|
+
return caption ? /* @__PURE__ */ jsxs8("figure", { "data-cms-image": "", style: layout, children: [
|
|
1162
|
+
image,
|
|
1163
|
+
/* @__PURE__ */ jsx11("figcaption", { children: caption })
|
|
1164
|
+
] }, key) : image;
|
|
1150
1165
|
}
|
|
1151
1166
|
case "importedHtml": {
|
|
1152
1167
|
const rawHtml = node.attrs?.html;
|
|
@@ -1714,11 +1729,6 @@ function readEditorialReview(metaJson) {
|
|
|
1714
1729
|
}
|
|
1715
1730
|
return { reviewerName: value.reviewerName, reviewedAt: value.reviewedAt };
|
|
1716
1731
|
}
|
|
1717
|
-
function authorImageRadiusCss(radius) {
|
|
1718
|
-
if (radius === "circle") return "999px";
|
|
1719
|
-
if (radius === "rounded") return "0.875rem";
|
|
1720
|
-
return "0";
|
|
1721
|
-
}
|
|
1722
1732
|
async function lookupPost(input) {
|
|
1723
1733
|
if (input.previewToken) {
|
|
1724
1734
|
try {
|
|
@@ -1821,8 +1831,7 @@ async function RootTaleBlogPost(props) {
|
|
|
1821
1831
|
const authorImageUrl = post.authorImageUrl;
|
|
1822
1832
|
const authorImageAlt = `${authorName ?? ""} \uD504\uB85C\uD544 \uC0AC\uC9C4`.trim();
|
|
1823
1833
|
const authorImageStyle = {
|
|
1824
|
-
|
|
1825
|
-
objectPosition: `${display.authorProfileImagePositionX}% ${display.authorProfileImagePositionY}%`
|
|
1834
|
+
objectPosition: `${post.authorImagePositionX ?? display.authorProfileImagePositionX}% ${post.authorImagePositionY ?? display.authorProfileImagePositionY}%`
|
|
1826
1835
|
};
|
|
1827
1836
|
const showAuthorCard = display.showAuthorCard && Boolean(authorName);
|
|
1828
1837
|
const editorialReview = readEditorialReview(post.metaJson);
|
|
@@ -1911,6 +1920,7 @@ async function RootTaleBlogPost(props) {
|
|
|
1911
1920
|
}
|
|
1912
1921
|
),
|
|
1913
1922
|
renderPostPattern(footerPattern, POST_FOOTER_PATTERN_SLOT2, { apiKey, baseUrl }),
|
|
1923
|
+
footerPattern ? null : renderPostCta(blogSettings.postCta),
|
|
1914
1924
|
showAuthorCard && authorName ? /* @__PURE__ */ jsxs13("section", { className: "rt-cms-author-card", "aria-label": "\uC791\uC131\uC790", children: [
|
|
1915
1925
|
authorImageUrl ? /* @__PURE__ */ jsx18(
|
|
1916
1926
|
"img",
|
|
@@ -1932,7 +1942,6 @@ async function RootTaleBlogPost(props) {
|
|
|
1932
1942
|
editorPicked.length > 0 ? editorPicked : relatedCardsFromPosts(autoRelated, relatedHref),
|
|
1933
1943
|
relatedPostsTitle
|
|
1934
1944
|
),
|
|
1935
|
-
renderPostCta(blogSettings.postCta),
|
|
1936
1945
|
renderFaqJsonLd(post.bodyJson)
|
|
1937
1946
|
]
|
|
1938
1947
|
}
|