@roottale/cms-core 0.60.0 → 0.61.1
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 +15 -0
- package/dist/index.cjs +67 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +20 -1
- package/dist/index.d.ts +20 -1
- package/dist/index.js +57 -0
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -576,4 +576,23 @@ declare function sitePatternPresentationAttributes(presentation: SitePatternPres
|
|
|
576
576
|
readonly cssVariables: Readonly<Record<string, string>>;
|
|
577
577
|
};
|
|
578
578
|
|
|
579
|
-
|
|
579
|
+
/** 편집기와 공개 렌더러가 공유하는 허용 서식. 기본값은 사이트 CSS를 따른다. */
|
|
580
|
+
declare const CMS_FONT_SIZES: readonly [14, 16, 18, 20, 24, 28, 32];
|
|
581
|
+
declare const CMS_LINE_HEIGHTS: readonly [1.2, 1.5, 1.8, 2, 2.4];
|
|
582
|
+
declare const CMS_PARAGRAPH_SPACINGS: readonly [0, 8, 16, 24, 32];
|
|
583
|
+
declare const CMS_IMAGE_WIDTHS: readonly [25, 50, 75, 100];
|
|
584
|
+
declare function cmsFontSize(value: unknown): string | null;
|
|
585
|
+
declare function cmsLineHeight(value: unknown): number | null;
|
|
586
|
+
declare function cmsParagraphSpacing(value: unknown): string | null;
|
|
587
|
+
declare function cmsImageWidth(value: unknown): string | null;
|
|
588
|
+
declare function cmsImageAlign(value: unknown): "left" | "center" | "right" | null;
|
|
589
|
+
declare function cmsImageStyle(attrs: Record<string, unknown>): {
|
|
590
|
+
display?: string | undefined;
|
|
591
|
+
marginLeft?: string | undefined;
|
|
592
|
+
marginRight?: string | undefined;
|
|
593
|
+
width?: string | undefined;
|
|
594
|
+
maxWidth?: string | undefined;
|
|
595
|
+
height?: string | undefined;
|
|
596
|
+
};
|
|
597
|
+
|
|
598
|
+
export { BLOCK_NAME_PATTERN, type BindingResolver, type Block, type BlockBinding, type BlockDefinition, type BlockRegistry, CMS_FONT_SIZES, CMS_IMAGE_WIDTHS, CMS_LINE_HEIGHTS, CMS_PARAGRAPH_SPACINGS, type CategoryTreeEntry, type CategoryTreePresentation, type CategoryTreeTerm, type ClientHydrationSpec, DEFAULT_SITE_PATTERN_PRESENTATION, EMPTY_SITE_PATTERN_PLACEMENTS, type EmbedProvider, FIELD_BINDING_SOURCE, FIELD_BINDING_SOURCE_ALIAS, type FaqEntry, IMAGE_ALT_MAX_LENGTH, INTERNAL_CONTENT_LINK_CLASS, INTERNAL_CONTENT_LINK_PENDING_ATTR, INTERNAL_CONTENT_LINK_PENDING_CLASS, INTERNAL_CONTENT_LINK_TOKEN_SOURCE, type InternalContentLinkResolver, type InternalContentLinkToken, LEGACY_BLOG_DETAIL_PATH, type NormalizedEmbed, PHASE_1_CORE_BLOCKS, PHASE_1_CSP, POST_FOOTER_SLOT, type PatternSlots, type Phase1CoreBlockName, type PreviewTokenPayload, type PublicPathContext, type PublicPathPost, type PublicPathPresentation, type RoutablePost, type RouteCollection, SITE_PATTERN_BUTTON_COLORS_MAX, SITE_PATTERN_KEY_PATTERN, SITE_PATTERN_PLACEMENTS_KEY, SITE_PATTERN_SLOTS, type SitePatternLayout, type SitePatternLinkStyle, type SitePatternPlacementRule, type SitePatternPlacements, type SitePatternPresentation, type SitePatternSlotKey, applyBlockBindings, bindingSrcValue, bindingTextValue, blockSchema, boundFieldValue, chainResolvers, cmsFontSize, cmsImageAlign, cmsImageStyle, cmsImageWidth, cmsLineHeight, cmsParagraphSpacing, createFieldBindingResolver, emptyPatternSlots, ensureImportedHtmlDocumentRoots, ensureStableIds, extractFaqEntries, faqPageJsonLd, findInternalContentLinkTokens, findSitePatternPlacementRule, htmlToPlainText, injectStableIdsTree, internalContentKeyFromPath, internalContentLinkResolverFrom, internalContentPathIndex, isAllowedEmbedSrc, isAllowedMapEmbedSrc, isInCollectionMode, isSitePatternSlotKey, isValidBlock, isValidSitePatternKey, issuePreviewToken, normalizeEmbed, normalizeHexColor, normalizeImageAlt, parseBlock, postsForCollection, postsInAnyCollection, postsNotInAnyCollection, readSitePatternPlacements, readSitePatternPresentation, referencedSitePatternKeys, renderInternalContentLinksInHtml, renderInternalContentLinksInText, resolveCategoryPath, resolveCategoryTreeChain, resolveCategoryTreeEntryPath, resolveCategoryTreeHubPaths, resolvePatternSlots, resolvePostCategorySlug, resolvePostCollection, resolvePostPath, resolvePostPublicPath, resolvePostUrl, sanitizeHtml, sanitizeImportedCss, sanitizeImportedHtml, scopeImportedCss, serializeBlock, setSitePatternPlacementRule, sitePatternButtonColor, sitePatternPresentationAttributes, validateCollections, verifyPreviewToken };
|
package/dist/index.d.ts
CHANGED
|
@@ -576,4 +576,23 @@ declare function sitePatternPresentationAttributes(presentation: SitePatternPres
|
|
|
576
576
|
readonly cssVariables: Readonly<Record<string, string>>;
|
|
577
577
|
};
|
|
578
578
|
|
|
579
|
-
|
|
579
|
+
/** 편집기와 공개 렌더러가 공유하는 허용 서식. 기본값은 사이트 CSS를 따른다. */
|
|
580
|
+
declare const CMS_FONT_SIZES: readonly [14, 16, 18, 20, 24, 28, 32];
|
|
581
|
+
declare const CMS_LINE_HEIGHTS: readonly [1.2, 1.5, 1.8, 2, 2.4];
|
|
582
|
+
declare const CMS_PARAGRAPH_SPACINGS: readonly [0, 8, 16, 24, 32];
|
|
583
|
+
declare const CMS_IMAGE_WIDTHS: readonly [25, 50, 75, 100];
|
|
584
|
+
declare function cmsFontSize(value: unknown): string | null;
|
|
585
|
+
declare function cmsLineHeight(value: unknown): number | null;
|
|
586
|
+
declare function cmsParagraphSpacing(value: unknown): string | null;
|
|
587
|
+
declare function cmsImageWidth(value: unknown): string | null;
|
|
588
|
+
declare function cmsImageAlign(value: unknown): "left" | "center" | "right" | null;
|
|
589
|
+
declare function cmsImageStyle(attrs: Record<string, unknown>): {
|
|
590
|
+
display?: string | undefined;
|
|
591
|
+
marginLeft?: string | undefined;
|
|
592
|
+
marginRight?: string | undefined;
|
|
593
|
+
width?: string | undefined;
|
|
594
|
+
maxWidth?: string | undefined;
|
|
595
|
+
height?: string | undefined;
|
|
596
|
+
};
|
|
597
|
+
|
|
598
|
+
export { BLOCK_NAME_PATTERN, type BindingResolver, type Block, type BlockBinding, type BlockDefinition, type BlockRegistry, CMS_FONT_SIZES, CMS_IMAGE_WIDTHS, CMS_LINE_HEIGHTS, CMS_PARAGRAPH_SPACINGS, type CategoryTreeEntry, type CategoryTreePresentation, type CategoryTreeTerm, type ClientHydrationSpec, DEFAULT_SITE_PATTERN_PRESENTATION, EMPTY_SITE_PATTERN_PLACEMENTS, type EmbedProvider, FIELD_BINDING_SOURCE, FIELD_BINDING_SOURCE_ALIAS, type FaqEntry, IMAGE_ALT_MAX_LENGTH, INTERNAL_CONTENT_LINK_CLASS, INTERNAL_CONTENT_LINK_PENDING_ATTR, INTERNAL_CONTENT_LINK_PENDING_CLASS, INTERNAL_CONTENT_LINK_TOKEN_SOURCE, type InternalContentLinkResolver, type InternalContentLinkToken, LEGACY_BLOG_DETAIL_PATH, type NormalizedEmbed, PHASE_1_CORE_BLOCKS, PHASE_1_CSP, POST_FOOTER_SLOT, type PatternSlots, type Phase1CoreBlockName, type PreviewTokenPayload, type PublicPathContext, type PublicPathPost, type PublicPathPresentation, type RoutablePost, type RouteCollection, SITE_PATTERN_BUTTON_COLORS_MAX, SITE_PATTERN_KEY_PATTERN, SITE_PATTERN_PLACEMENTS_KEY, SITE_PATTERN_SLOTS, type SitePatternLayout, type SitePatternLinkStyle, type SitePatternPlacementRule, type SitePatternPlacements, type SitePatternPresentation, type SitePatternSlotKey, applyBlockBindings, bindingSrcValue, bindingTextValue, blockSchema, boundFieldValue, chainResolvers, cmsFontSize, cmsImageAlign, cmsImageStyle, cmsImageWidth, cmsLineHeight, cmsParagraphSpacing, createFieldBindingResolver, emptyPatternSlots, ensureImportedHtmlDocumentRoots, ensureStableIds, extractFaqEntries, faqPageJsonLd, findInternalContentLinkTokens, findSitePatternPlacementRule, htmlToPlainText, injectStableIdsTree, internalContentKeyFromPath, internalContentLinkResolverFrom, internalContentPathIndex, isAllowedEmbedSrc, isAllowedMapEmbedSrc, isInCollectionMode, isSitePatternSlotKey, isValidBlock, isValidSitePatternKey, issuePreviewToken, normalizeEmbed, normalizeHexColor, normalizeImageAlt, parseBlock, postsForCollection, postsInAnyCollection, postsNotInAnyCollection, readSitePatternPlacements, readSitePatternPresentation, referencedSitePatternKeys, renderInternalContentLinksInHtml, renderInternalContentLinksInText, resolveCategoryPath, resolveCategoryTreeChain, resolveCategoryTreeEntryPath, resolveCategoryTreeHubPaths, resolvePatternSlots, resolvePostCategorySlug, resolvePostCollection, resolvePostPath, resolvePostPublicPath, resolvePostUrl, sanitizeHtml, sanitizeImportedCss, sanitizeImportedHtml, scopeImportedCss, serializeBlock, setSitePatternPlacementRule, sitePatternButtonColor, sitePatternPresentationAttributes, validateCollections, verifyPreviewToken };
|
package/dist/index.js
CHANGED
|
@@ -1326,6 +1326,16 @@ var SANITIZE_OPTIONS = {
|
|
|
1326
1326
|
"*": [ROOTTALE_CLASS_RE]
|
|
1327
1327
|
},
|
|
1328
1328
|
allowedStyles: {
|
|
1329
|
+
img: {
|
|
1330
|
+
display: [/^block$/i],
|
|
1331
|
+
"margin-left": [CSS_LENGTH_RE, /^auto$/i],
|
|
1332
|
+
"margin-right": [CSS_LENGTH_RE, /^auto$/i]
|
|
1333
|
+
},
|
|
1334
|
+
figure: {
|
|
1335
|
+
display: [/^block$/i],
|
|
1336
|
+
"margin-left": [CSS_LENGTH_RE, /^auto$/i],
|
|
1337
|
+
"margin-right": [CSS_LENGTH_RE, /^auto$/i]
|
|
1338
|
+
},
|
|
1329
1339
|
"*": {
|
|
1330
1340
|
"aspect-ratio": [ASPECT_RATIO_RE],
|
|
1331
1341
|
background: [HEX_COLOR_RE],
|
|
@@ -1553,8 +1563,49 @@ function sitePatternPresentationAttributes(presentation) {
|
|
|
1553
1563
|
cssVariables
|
|
1554
1564
|
};
|
|
1555
1565
|
}
|
|
1566
|
+
|
|
1567
|
+
// src/editor-formatting.ts
|
|
1568
|
+
var CMS_FONT_SIZES = [14, 16, 18, 20, 24, 28, 32];
|
|
1569
|
+
var CMS_LINE_HEIGHTS = [1.2, 1.5, 1.8, 2, 2.4];
|
|
1570
|
+
var CMS_PARAGRAPH_SPACINGS = [0, 8, 16, 24, 32];
|
|
1571
|
+
var CMS_IMAGE_WIDTHS = [25, 50, 75, 100];
|
|
1572
|
+
function cmsFontSize(value) {
|
|
1573
|
+
if (typeof value !== "string") return null;
|
|
1574
|
+
return CMS_FONT_SIZES.some((size) => value === `${size}px`) ? value : null;
|
|
1575
|
+
}
|
|
1576
|
+
function cmsLineHeight(value) {
|
|
1577
|
+
if (typeof value !== "number" && typeof value !== "string") return null;
|
|
1578
|
+
return CMS_LINE_HEIGHTS.find((size) => String(size) === String(value)) ?? null;
|
|
1579
|
+
}
|
|
1580
|
+
function cmsParagraphSpacing(value) {
|
|
1581
|
+
if (typeof value !== "string") return null;
|
|
1582
|
+
return CMS_PARAGRAPH_SPACINGS.some((size) => value === `${size}px`) ? value : null;
|
|
1583
|
+
}
|
|
1584
|
+
function cmsImageWidth(value) {
|
|
1585
|
+
if (typeof value !== "string") return null;
|
|
1586
|
+
return CMS_IMAGE_WIDTHS.some((size) => value === `${size}%`) ? value : null;
|
|
1587
|
+
}
|
|
1588
|
+
function cmsImageAlign(value) {
|
|
1589
|
+
return value === "left" || value === "center" || value === "right" ? value : null;
|
|
1590
|
+
}
|
|
1591
|
+
function cmsImageStyle(attrs) {
|
|
1592
|
+
const width = cmsImageWidth(attrs.displayWidth);
|
|
1593
|
+
const align = cmsImageAlign(attrs.imageAlign);
|
|
1594
|
+
return {
|
|
1595
|
+
...width ? { width, maxWidth: "100%", height: "auto" } : {},
|
|
1596
|
+
...align ? {
|
|
1597
|
+
display: "block",
|
|
1598
|
+
marginLeft: align === "left" ? "0" : "auto",
|
|
1599
|
+
marginRight: align === "right" ? "0" : "auto"
|
|
1600
|
+
} : {}
|
|
1601
|
+
};
|
|
1602
|
+
}
|
|
1556
1603
|
export {
|
|
1557
1604
|
BLOCK_NAME_PATTERN,
|
|
1605
|
+
CMS_FONT_SIZES,
|
|
1606
|
+
CMS_IMAGE_WIDTHS,
|
|
1607
|
+
CMS_LINE_HEIGHTS,
|
|
1608
|
+
CMS_PARAGRAPH_SPACINGS,
|
|
1558
1609
|
DEFAULT_SITE_PATTERN_PRESENTATION,
|
|
1559
1610
|
EMPTY_SITE_PATTERN_PLACEMENTS,
|
|
1560
1611
|
FIELD_BINDING_SOURCE,
|
|
@@ -1578,6 +1629,12 @@ export {
|
|
|
1578
1629
|
blockSchema,
|
|
1579
1630
|
boundFieldValue,
|
|
1580
1631
|
chainResolvers,
|
|
1632
|
+
cmsFontSize,
|
|
1633
|
+
cmsImageAlign,
|
|
1634
|
+
cmsImageStyle,
|
|
1635
|
+
cmsImageWidth,
|
|
1636
|
+
cmsLineHeight,
|
|
1637
|
+
cmsParagraphSpacing,
|
|
1581
1638
|
createFieldBindingResolver,
|
|
1582
1639
|
emptyPatternSlots,
|
|
1583
1640
|
ensureImportedHtmlDocumentRoots,
|