@uniformdev/richtext
Advanced tools
Comparing version 19.185.1-alpha.8 to 19.186.1
@@ -23,3 +23,2 @@ "use strict"; | ||
__export(src_exports, { | ||
assetHtmlRenderer: () => assetHtmlRenderer, | ||
emptyRichTextValue: () => emptyRichTextValue, | ||
@@ -131,23 +130,2 @@ getLabelForElement: () => getLabelForElement, | ||
// src/nodes/asset.ts | ||
var ASSETS_SOURCE_UNIFORM = "uniform-assets"; | ||
var assetHtmlRenderer = ({ context }) => { | ||
var _a, _b; | ||
const node = context.currentNode; | ||
if (node.__asset === void 0) { | ||
return ""; | ||
} | ||
if (node.__asset.type !== "image" || node.__asset._source !== ASSETS_SOURCE_UNIFORM) { | ||
return ""; | ||
} | ||
const imgAttributes = /* @__PURE__ */ new Map(); | ||
imgAttributes.set("src", node.__asset.fields.url.value); | ||
if ((_a = node.__asset.fields.title) == null ? void 0 : _a.value) { | ||
imgAttributes.set("alt", node.__asset.fields.title.value); | ||
} | ||
const img = renderHtmlElement("img", imgAttributes); | ||
const figcaption = ((_b = node.__asset.fields.description) == null ? void 0 : _b.value) ? renderHtmlElement("figcaption", null, node.__asset.fields.description.value) : ""; | ||
return renderHtmlElement("figure", null, `${img}${figcaption}`); | ||
}; | ||
// src/nodes/heading.ts | ||
@@ -335,4 +313,3 @@ var headingHtmlRenderer = ({ context, renderChildren }) => { | ||
["tablecell", tablecellHtmlRenderer], | ||
["tablerow", tablerowHtmlRenderer], | ||
["asset", assetHtmlRenderer] | ||
["tablerow", tablerowHtmlRenderer] | ||
]); | ||
@@ -516,6 +493,2 @@ var resolveDefaultRenderer = (context) => { | ||
{ | ||
label: "Asset", | ||
type: "asset" | ||
}, | ||
{ | ||
label: "Dynamic Token", | ||
@@ -591,3 +564,2 @@ type: "variable" | ||
0 && (module.exports = { | ||
assetHtmlRenderer, | ||
emptyRichTextValue, | ||
@@ -594,0 +566,0 @@ getLabelForElement, |
@@ -1,2 +0,1 @@ | ||
import { AssetParamValueItem } from '@uniformdev/assets'; | ||
import { SerializedEditorState, SerializedParagraphNode } from 'lexical'; | ||
@@ -30,9 +29,4 @@ | ||
type RichTextBuiltInFormat = 'code' | 'bold' | 'italic' | 'underline' | 'strikethrough' | 'superscript' | 'subscript'; | ||
type RichTextBuiltInElement = 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6' | 'unorderedList' | 'orderedList' | 'link' | 'quote' | 'code' | 'variable' | 'table' | 'asset'; | ||
type RichTextBuiltInElement = 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6' | 'unorderedList' | 'orderedList' | 'link' | 'quote' | 'code' | 'variable' | 'table'; | ||
interface AssetNode extends RichTextNode { | ||
__asset?: NonNullable<AssetParamValueItem>; | ||
} | ||
declare const assetHtmlRenderer: NodeStringRenderer; | ||
interface HeadingNode extends RichTextNode { | ||
@@ -136,3 +130,2 @@ tag: 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6'; | ||
declare function isRichTextNodeType(node: unknown, type: 'link'): node is LinkNode; | ||
declare function isRichTextNodeType(node: unknown, type: 'asset'): node is AssetNode; | ||
declare function isRichTextNodeType(node: unknown, type: string): node is RichTextNode; | ||
@@ -214,2 +207,2 @@ declare function isRichTextValueConsideredEmpty(value: ParameterRichTextValue): boolean; | ||
export { type AssetNode, type HeadingNode, type LinkNode, type ListItemNode, type ListNode, type NodeStringRenderer, type NodeStringRendererProps, type ParagraphNode, type ParameterRichTextValue, type ResolveStringRenderer, type RichTextBuiltInElement, type RichTextBuiltInFormat, type RichTextNode, type RichTextNodeWithChildren, type StringRenderContext, type TableCellNode, type TableNode, type TableRowNode, type TextNode, assetHtmlRenderer, emptyRichTextValue, getLabelForElement, getLabelForFormat, getRichTextTagFromTableCellHeaderState, getRichTextTagsFromTextFormat, hasChildren, headingHtmlRenderer, isArrayWithLength, isPureDirection, isPureTextAlign, isRichTextNode, isRichTextNodeType, isRichTextValue, isRichTextValueConsideredEmpty, linkHtmlRenderer, linkParamValueToHref, listHtmlRenderer, listitemHtmlRenderer, paragraphHtmlRenderer, purifyText, renderChildrenToHtml, renderChildrenToText, renderHtmlElement, renderToHtml, renderToText, resolveDefaultRenderer$1 as resolveDefaultHtmlRenderer, resolveDefaultRenderer as resolveDefaultTextRenderer, richTextBuiltInElements, richTextBuiltInFormats, rootHtmlRenderer, tableHtmlRenderer, tablecellHtmlRenderer, tablerowHtmlRenderer, textHtmlRenderer, walkRichTextTree }; | ||
export { type HeadingNode, type LinkNode, type ListItemNode, type ListNode, type NodeStringRenderer, type NodeStringRendererProps, type ParagraphNode, type ParameterRichTextValue, type ResolveStringRenderer, type RichTextBuiltInElement, type RichTextBuiltInFormat, type RichTextNode, type RichTextNodeWithChildren, type StringRenderContext, type TableCellNode, type TableNode, type TableRowNode, type TextNode, emptyRichTextValue, getLabelForElement, getLabelForFormat, getRichTextTagFromTableCellHeaderState, getRichTextTagsFromTextFormat, hasChildren, headingHtmlRenderer, isArrayWithLength, isPureDirection, isPureTextAlign, isRichTextNode, isRichTextNodeType, isRichTextValue, isRichTextValueConsideredEmpty, linkHtmlRenderer, linkParamValueToHref, listHtmlRenderer, listitemHtmlRenderer, paragraphHtmlRenderer, purifyText, renderChildrenToHtml, renderChildrenToText, renderHtmlElement, renderToHtml, renderToText, resolveDefaultRenderer$1 as resolveDefaultHtmlRenderer, resolveDefaultRenderer as resolveDefaultTextRenderer, richTextBuiltInElements, richTextBuiltInFormats, rootHtmlRenderer, tableHtmlRenderer, tablecellHtmlRenderer, tablerowHtmlRenderer, textHtmlRenderer, walkRichTextTree }; |
@@ -69,23 +69,2 @@ // src/elements.ts | ||
// src/nodes/asset.ts | ||
var ASSETS_SOURCE_UNIFORM = "uniform-assets"; | ||
var assetHtmlRenderer = ({ context }) => { | ||
var _a, _b; | ||
const node = context.currentNode; | ||
if (node.__asset === void 0) { | ||
return ""; | ||
} | ||
if (node.__asset.type !== "image" || node.__asset._source !== ASSETS_SOURCE_UNIFORM) { | ||
return ""; | ||
} | ||
const imgAttributes = /* @__PURE__ */ new Map(); | ||
imgAttributes.set("src", node.__asset.fields.url.value); | ||
if ((_a = node.__asset.fields.title) == null ? void 0 : _a.value) { | ||
imgAttributes.set("alt", node.__asset.fields.title.value); | ||
} | ||
const img = renderHtmlElement("img", imgAttributes); | ||
const figcaption = ((_b = node.__asset.fields.description) == null ? void 0 : _b.value) ? renderHtmlElement("figcaption", null, node.__asset.fields.description.value) : ""; | ||
return renderHtmlElement("figure", null, `${img}${figcaption}`); | ||
}; | ||
// src/nodes/heading.ts | ||
@@ -273,4 +252,3 @@ var headingHtmlRenderer = ({ context, renderChildren }) => { | ||
["tablecell", tablecellHtmlRenderer], | ||
["tablerow", tablerowHtmlRenderer], | ||
["asset", assetHtmlRenderer] | ||
["tablerow", tablerowHtmlRenderer] | ||
]); | ||
@@ -454,6 +432,2 @@ var resolveDefaultRenderer = (context) => { | ||
{ | ||
label: "Asset", | ||
type: "asset" | ||
}, | ||
{ | ||
label: "Dynamic Token", | ||
@@ -528,3 +502,2 @@ type: "variable" | ||
export { | ||
assetHtmlRenderer, | ||
emptyRichTextValue, | ||
@@ -531,0 +504,0 @@ getLabelForElement, |
@@ -23,3 +23,2 @@ "use strict"; | ||
__export(src_exports, { | ||
assetHtmlRenderer: () => assetHtmlRenderer, | ||
emptyRichTextValue: () => emptyRichTextValue, | ||
@@ -131,23 +130,2 @@ getLabelForElement: () => getLabelForElement, | ||
// src/nodes/asset.ts | ||
var ASSETS_SOURCE_UNIFORM = "uniform-assets"; | ||
var assetHtmlRenderer = ({ context }) => { | ||
var _a, _b; | ||
const node = context.currentNode; | ||
if (node.__asset === void 0) { | ||
return ""; | ||
} | ||
if (node.__asset.type !== "image" || node.__asset._source !== ASSETS_SOURCE_UNIFORM) { | ||
return ""; | ||
} | ||
const imgAttributes = /* @__PURE__ */ new Map(); | ||
imgAttributes.set("src", node.__asset.fields.url.value); | ||
if ((_a = node.__asset.fields.title) == null ? void 0 : _a.value) { | ||
imgAttributes.set("alt", node.__asset.fields.title.value); | ||
} | ||
const img = renderHtmlElement("img", imgAttributes); | ||
const figcaption = ((_b = node.__asset.fields.description) == null ? void 0 : _b.value) ? renderHtmlElement("figcaption", null, node.__asset.fields.description.value) : ""; | ||
return renderHtmlElement("figure", null, `${img}${figcaption}`); | ||
}; | ||
// src/nodes/heading.ts | ||
@@ -335,4 +313,3 @@ var headingHtmlRenderer = ({ context, renderChildren }) => { | ||
["tablecell", tablecellHtmlRenderer], | ||
["tablerow", tablerowHtmlRenderer], | ||
["asset", assetHtmlRenderer] | ||
["tablerow", tablerowHtmlRenderer] | ||
]); | ||
@@ -516,6 +493,2 @@ var resolveDefaultRenderer = (context) => { | ||
{ | ||
label: "Asset", | ||
type: "asset" | ||
}, | ||
{ | ||
label: "Dynamic Token", | ||
@@ -591,3 +564,2 @@ type: "variable" | ||
0 && (module.exports = { | ||
assetHtmlRenderer, | ||
emptyRichTextValue, | ||
@@ -594,0 +566,0 @@ getLabelForElement, |
{ | ||
"name": "@uniformdev/richtext", | ||
"version": "19.185.1-alpha.8+53f7f96124", | ||
"version": "19.186.1", | ||
"description": "Common functionality and types for Uniform Rich Text parameters", | ||
@@ -48,3 +48,2 @@ "license": "SEE LICENSE IN LICENSE.txt", | ||
"@lexical/rich-text": "0.17.1", | ||
"@uniformdev/assets": "19.185.1-alpha.8+53f7f96124", | ||
"lexical": "0.17.1" | ||
@@ -58,3 +57,3 @@ }, | ||
}, | ||
"gitHead": "53f7f961242f3518b103e55337ada7ad91c18dd7" | ||
"gitHead": "12ca61d140d99b4f2de67428425076cecbc6577b" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
6
1
0
84086
2382